Update to 1.21.8
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.11-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.21
|
minecraft_version=1.21.8
|
||||||
yarn_mappings=1.21+build.8
|
yarn_mappings=1.21.8+build.1
|
||||||
loader_version=0.15.11
|
loader_version=0.17.2
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.1
|
mod_version = 1.2
|
||||||
maven_group = com.kasetoatz
|
maven_group = com.kasetoatz
|
||||||
archives_base_name = noexplosiongrief
|
archives_base_name = noexplosiongrief
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.100.6+1.21
|
fabric_version=0.133.4+1.21.8
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1 +1 @@
|
|||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.kasetoatz.noexplosiongrief;
|
package com.kasetoatz.noexplosiongrief;
|
||||||
|
|
||||||
import com.kasetoatz.noexplosiongrief.config.Config;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
|
||||||
public class NoExplosionGrief implements ModInitializer {
|
import static com.kasetoatz.noexplosiongrief.config.Config.load;
|
||||||
|
|
||||||
|
public class NoExplosionGrief implements ModInitializer
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize()
|
||||||
Config.load();
|
{
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,44 +3,45 @@ package com.kasetoatz.noexplosiongrief.config;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.util.crash.CrashException;
|
import net.minecraft.util.crash.CrashException;
|
||||||
import net.minecraft.util.crash.CrashReport;
|
import net.minecraft.util.crash.CrashReport;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public class Config {
|
public class Config
|
||||||
public static boolean blockCreeper = true;
|
{
|
||||||
public static boolean blockGhast = true;
|
public static boolean BLOCK_CREEPER = true;
|
||||||
public static boolean blockWither = true;
|
public static boolean BLOCK_GHAST = true;
|
||||||
|
public static boolean BLOCK_WITHER = true;
|
||||||
|
|
||||||
private static final File config = new File(MinecraftClient.getInstance().runDirectory, "config/noexplosiongrief.json");
|
private static final Path FILE = FabricLoader.getInstance().getConfigDir().resolve("noexplosiongrief.json");
|
||||||
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
|
||||||
public static void load()
|
public static void load()
|
||||||
{
|
{
|
||||||
if (!config.exists())
|
if (!Files.exists(FILE))
|
||||||
{
|
{
|
||||||
save();
|
save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try (FileReader reader = new FileReader(config))
|
try
|
||||||
{
|
{
|
||||||
JsonObject json = gson.fromJson(reader, JsonObject.class);
|
String json = Files.readString(FILE);
|
||||||
if (json.has("blockCreeper"))
|
JsonObject data = GSON.fromJson(json, JsonObject.class);
|
||||||
|
if (data.has("block-creeper"))
|
||||||
{
|
{
|
||||||
blockCreeper = json.get("blockCreeper").getAsBoolean();
|
BLOCK_CREEPER = data.get("block-creeper").getAsBoolean();
|
||||||
}
|
}
|
||||||
if (json.has("blockGhast"))
|
if (data.has("block-ghast"))
|
||||||
{
|
{
|
||||||
blockGhast = json.get("blockGhast").getAsBoolean();
|
BLOCK_GHAST = data.get("block-ghast").getAsBoolean();
|
||||||
}
|
}
|
||||||
if (json.has("blockWither"))
|
if (data.has("block-wither"))
|
||||||
{
|
{
|
||||||
blockWither = json.get("blockWither").getAsBoolean();
|
BLOCK_WITHER = data.get("block-wither").getAsBoolean();
|
||||||
}
|
}
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
@@ -52,13 +53,13 @@ public class Config {
|
|||||||
|
|
||||||
public static void save()
|
public static void save()
|
||||||
{
|
{
|
||||||
JsonObject json = new JsonObject();
|
try
|
||||||
json.addProperty("blockCreeper", blockCreeper);
|
|
||||||
json.addProperty("blockGhast", blockGhast);
|
|
||||||
json.addProperty("blockWither", blockWither);
|
|
||||||
try (FileWriter writer = new FileWriter(config))
|
|
||||||
{
|
{
|
||||||
gson.toJson(json, writer);
|
JsonObject data = new JsonObject();
|
||||||
|
data.addProperty("block-creeper", BLOCK_CREEPER);
|
||||||
|
data.addProperty("block-ghast", BLOCK_GHAST);
|
||||||
|
data.addProperty("block-wither", BLOCK_WITHER);
|
||||||
|
Files.writeString(FILE, GSON.toJson(data));
|
||||||
}
|
}
|
||||||
catch (IOException exc)
|
catch (IOException exc)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package com.kasetoatz.noexplosiongrief.mixin;
|
|||||||
import com.kasetoatz.noexplosiongrief.config.Config;
|
import com.kasetoatz.noexplosiongrief.config.Config;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.boss.WitherEntity;
|
|
||||||
import net.minecraft.entity.mob.CreeperEntity;
|
import net.minecraft.entity.mob.CreeperEntity;
|
||||||
import net.minecraft.entity.mob.GhastEntity;
|
|
||||||
import net.minecraft.entity.projectile.FireballEntity;
|
import net.minecraft.entity.projectile.FireballEntity;
|
||||||
import net.minecraft.entity.projectile.WitherSkullEntity;
|
import net.minecraft.entity.projectile.WitherSkullEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -16,14 +14,18 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import static com.kasetoatz.noexplosiongrief.config.Config.BLOCK_CREEPER;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
public abstract class EntityMixin {
|
public abstract class EntityMixin
|
||||||
@Inject(method="canExplosionDestroyBlock", at = @At("HEAD"), cancellable = true)
|
{
|
||||||
public void onExplosion(Explosion explosion, BlockView world, BlockPos pos, BlockState state, float explosionPower, CallbackInfoReturnable<Boolean> cir) {
|
@Inject(method="canExplosionDestroyBlock", at=@At("HEAD"), cancellable=true)
|
||||||
|
public void onExplosion(Explosion explosion, BlockView world, BlockPos pos, BlockState state, float explosionPower, CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
Entity entity = (Entity)(Object)this;
|
Entity entity = (Entity)(Object)this;
|
||||||
if ((entity instanceof CreeperEntity && Config.blockCreeper) || ((entity instanceof FireballEntity && ((FireballEntity)entity).getOwner() instanceof GhastEntity) && Config.blockGhast) || ((entity instanceof WitherSkullEntity && ((WitherSkullEntity)entity).getOwner() instanceof WitherEntity) && Config.blockWither))
|
if ((entity instanceof CreeperEntity && BLOCK_CREEPER) || (entity instanceof FireballEntity && Config.BLOCK_GHAST) || (entity instanceof WitherSkullEntity && Config.BLOCK_WITHER))
|
||||||
{
|
{
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"repo": "https://github.com/KaseToatz1337/NoExplosionGrief"
|
"repo": "https://github.com/KaseToatz1337/NoExplosionGrief"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"environment": "*",
|
"environment": "server",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"com.kasetoatz.noexplosiongrief.NoExplosionGrief"
|
"com.kasetoatz.noexplosiongrief.NoExplosionGrief"
|
||||||
|
|||||||
Reference in New Issue
Block a user