diff --git a/build.gradle b/build.gradle index 87b85ed..fc78f1f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.11-SNAPSHOT' } repositories { @@ -9,13 +9,14 @@ repositories { dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modCompile "net.fabricmc:fabric-loader:${project.loader_version}" - modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modCompile "org.json:json:20200518" - modCompile "org.xerial:sqlite-jdbc:3.32.3.2" + + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + modImplementation "org.json:json:20211205" + modImplementation "org.xerial:sqlite-jdbc:3.36.0.3" modImplementation "com.google.code.findbugs:jsr305:3.0.2" - include "org.json:json:20200518" - include "org.xerial:sqlite-jdbc:3.32.3.2" + include "org.json:json:20211205" + include "org.xerial:sqlite-jdbc:3.36.0.3" } jar { diff --git a/gradle.properties b/gradle.properties index bca36d6..668e25e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ org.gradle.jvmargs=-Xmx1G -minecraft_version=1.16.3 -yarn_mappings=1.16.3+build.47 -loader_version=0.10.3+build.211 +minecraft_version=1.18.1 +yarn_mappings=1.18.1+build.22 +loader_version=0.12.12 mod_version=1.2.0 -maven_group=party.2a03.mc +maven_group=party._2a03.mc archives_base_name=minecraft-tweaks-2a03 -fabric_version=0.24.1+build.412-1.16 +fabric_version=0.46.2+1.18 diff --git a/src/main/java/party/_2a03/mc/command/FlyCommand.java b/src/main/java/party/_2a03/mc/command/FlyCommand.java index d0b4e37..5293165 100644 --- a/src/main/java/party/_2a03/mc/command/FlyCommand.java +++ b/src/main/java/party/_2a03/mc/command/FlyCommand.java @@ -11,10 +11,10 @@ public class FlyCommand { public static void register(CommandDispatcher dispatcher) { dispatcher.register(CommandManager.literal("fly").executes(ctx -> { ServerCommandSource source = ctx.getSource(); - if (Config.getBool("disableFlyCommand")) { + //if (Config.getBool("disableFlyCommand")) { source.sendFeedback(new LiteralText("The /fly command is disabled"), true); return 0; - } + /*} ServerPlayerEntity sender = source.getPlayer(); boolean flight = sender.abilities.allowFlying; sender.abilities.allowFlying = !flight; @@ -25,7 +25,7 @@ public class FlyCommand { sender.abilities.flying = false; } sender.sendAbilitiesUpdate(); - return 1; + return 1;*/ })); } } diff --git a/src/main/java/party/_2a03/mc/command/HeadCommand.java b/src/main/java/party/_2a03/mc/command/HeadCommand.java index 959fa89..b156d6c 100644 --- a/src/main/java/party/_2a03/mc/command/HeadCommand.java +++ b/src/main/java/party/_2a03/mc/command/HeadCommand.java @@ -6,7 +6,7 @@ import net.minecraft.block.Blocks; import net.minecraft.entity.ItemEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtCompound; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; @@ -23,9 +23,9 @@ public class HeadCommand { private static int giveHead(ServerCommandSource source, ServerPlayerEntity sender, String skullowner) { ItemStack itemstack = new ItemStack(Blocks.PLAYER_HEAD.asItem()); - CompoundTag compoundtag = new CompoundTag(); - compoundtag.putString("SkullOwner", skullowner); - itemstack.setTag(compoundtag); + NbtCompound nbt = new NbtCompound(); + nbt.putString("SkullOwner", skullowner); + itemstack.setNbt(nbt); ItemEntity itementity = sender.dropItem(itemstack, false); itementity.resetPickupDelay(); itementity.setOwner(sender.getUuid()); diff --git a/src/main/java/party/_2a03/mc/command/HomeCommand.java b/src/main/java/party/_2a03/mc/command/HomeCommand.java index 5cf41d0..3a84def 100644 --- a/src/main/java/party/_2a03/mc/command/HomeCommand.java +++ b/src/main/java/party/_2a03/mc/command/HomeCommand.java @@ -34,9 +34,9 @@ public class HomeCommand { double x = sender.getX(); double y = sender.getY(); double z = sender.getZ(); - float yaw = sender.yaw; - float pitch = sender.pitch; - RegistryKey registrykey = sender.getServerWorld().getRegistryKey(); + float yaw = sender.getYaw(); + float pitch = sender.getPitch(); + RegistryKey registrykey = sender.getWorld().getRegistryKey(); PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey); playerdata.setHome(location); source.sendFeedback(new LiteralText("Your home has been updated"), true); @@ -52,9 +52,9 @@ public class HomeCommand { double x = sender.getX(); double y = sender.getY(); double z = sender.getZ(); - float yaw = sender.yaw; - float pitch = sender.pitch; - RegistryKey registrykey = sender.getServerWorld().getRegistryKey(); + float yaw = sender.getYaw(); + float pitch = sender.getPitch(); + RegistryKey registrykey = sender.getWorld().getRegistryKey(); PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey); playerdata.setHome(location); source.sendFeedback(new LiteralText("User's home has been updated (" + StringArgumentType.getString(ctx, "UUID") + ")"), true); diff --git a/src/main/java/party/_2a03/mc/command/SpawnCommand.java b/src/main/java/party/_2a03/mc/command/SpawnCommand.java index 0b1884f..4d845f3 100644 --- a/src/main/java/party/_2a03/mc/command/SpawnCommand.java +++ b/src/main/java/party/_2a03/mc/command/SpawnCommand.java @@ -37,9 +37,9 @@ public class SpawnCommand { double x = sender.getX(); double y = sender.getY(); double z = sender.getZ(); - float yaw = sender.yaw; - float pitch = sender.pitch; - RegistryKey registrykey = sender.getServerWorld().getRegistryKey(); + float yaw = sender.getYaw(); + float pitch = sender.getPitch(); + RegistryKey registrykey = sender.getWorld().getRegistryKey(); PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey); Config.setData("spawn", location.getJSON()); source.sendFeedback(new LiteralText("Spawn has been set"), true); diff --git a/src/main/java/party/_2a03/mc/mixin/MixinGameModeCommand.java b/src/main/java/party/_2a03/mc/mixin/MixinGameModeCommand.java index 378d114..6b51fcd 100644 --- a/src/main/java/party/_2a03/mc/mixin/MixinGameModeCommand.java +++ b/src/main/java/party/_2a03/mc/mixin/MixinGameModeCommand.java @@ -1,5 +1,7 @@ package party._2a03.mc.mixin; +import java.util.Collection; +import com.mojang.brigadier.context.CommandContext; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.GameModeCommand; import net.minecraft.server.network.ServerPlayerEntity; @@ -8,14 +10,14 @@ import net.minecraft.world.GameMode; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(GameModeCommand.class) public class MixinGameModeCommand { - @Inject(method = "setGameMode", at = @At("HEAD")) - private static void OnSetGameMode(ServerCommandSource source, ServerPlayerEntity player, GameMode gameMode, CallbackInfo ci) { + @Inject(method = "execute", at = @At("HEAD")) + private static void OnExecute(CommandContext context, Collection targets, GameMode gameMode, CallbackInfoReturnable cir) { if (gameMode == GameMode.CREATIVE) { - source.sendFeedback(new LiteralText(" Creative mode? What are you, a cheater?"), false); + context.getSource().sendFeedback(new LiteralText(" Creative mode? What are you, a cheater?"), false); } return; } diff --git a/src/main/java/party/_2a03/mc/mixin/MixinServerPlayerEntity.java b/src/main/java/party/_2a03/mc/mixin/MixinServerPlayerEntity.java index 289b0e2..d6f5e81 100644 --- a/src/main/java/party/_2a03/mc/mixin/MixinServerPlayerEntity.java +++ b/src/main/java/party/_2a03/mc/mixin/MixinServerPlayerEntity.java @@ -31,11 +31,11 @@ public abstract class MixinServerPlayerEntity extends PlayerEntity { } } - @Inject(method = "setGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;sendAbilitiesUpdate()V")) + /*@Inject(method = "setGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;sendAbilitiesUpdate()V")) public void disableFlightIfSafe(GameMode gameMode, CallbackInfo ci) { if (gameMode != GameMode.CREATIVE && gameMode != GameMode.SPECTATOR) { this.abilities.allowFlying = false; this.abilities.flying = false; } - } + }*/ } diff --git a/src/main/java/party/_2a03/mc/mixin/MixinTntEntity.java b/src/main/java/party/_2a03/mc/mixin/MixinTntEntity.java index 9723018..d84c32f 100644 --- a/src/main/java/party/_2a03/mc/mixin/MixinTntEntity.java +++ b/src/main/java/party/_2a03/mc/mixin/MixinTntEntity.java @@ -13,13 +13,9 @@ import party._2a03.mc.util.Config; @Mixin(TntEntity.class) public abstract class MixinTntEntity extends Entity { - @Shadow - private int fuseTimer; - public MixinTntEntity(EntityType entityType, World world) { super(entityType, world); - this.fuseTimer = 80; - this.inanimate = true; + this.intersectionChecked = true; } @Inject(method = "explode", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/party/_2a03/mc/util/PlayerPosition.java b/src/main/java/party/_2a03/mc/util/PlayerPosition.java index 82b9fc0..965988d 100644 --- a/src/main/java/party/_2a03/mc/util/PlayerPosition.java +++ b/src/main/java/party/_2a03/mc/util/PlayerPosition.java @@ -24,7 +24,7 @@ public class PlayerPosition { this.z = data.getDouble(2); this.yaw = data.getNumber(3).floatValue(); this.pitch = data.getNumber(4).floatValue(); - this.registrykey = RegistryKey.of(Registry.DIMENSION, new Identifier(registry_string)); + this.registrykey = RegistryKey.of(Registry.DIMENSION_KEY, new Identifier(registry_string)); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c71afdd..07c6f49 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -2,17 +2,17 @@ "schemaVersion": 1, "id": "minecraft-tweaks-2a03", "version": "1.2.0", - "name": "2a03.party Tweaks", - "description": "Simple modifications for the 2a03.party Minecraft server.", + "name": "minecraft-tweaks-2a03", + "description": "Simple modifications for mc.2a03.party.", "authors": [ "flewkey" ], "contact": { "homepage": "https://flewkey.com/", - "sources": "https://github.com/flewkey/minecraft-tweaks-2a03" + "sources": "https://git.sdf.org/flewkey/minecraft-tweaks-2a03" }, "license": "MIT", - "icon": "assets/2a03-minecraft-tweaks/icon.png", + "icon": "assets/minecraft-tweaks-2a03/icon.png", "environment": "*", "entrypoints": { "main": [ @@ -23,8 +23,8 @@ "minecraft-tweaks-2a03.mixins.json" ], "depends": { - "fabricloader": ">=0.8.2", + "fabricloader": ">=0.12.12", "fabric": "*", - "minecraft": "1.16.x" + "minecraft": "1.18.1" } } diff --git a/src/main/resources/minecraft-tweaks-2a03.mixins.json b/src/main/resources/minecraft-tweaks-2a03.mixins.json index f026041..e63dc04 100644 --- a/src/main/resources/minecraft-tweaks-2a03.mixins.json +++ b/src/main/resources/minecraft-tweaks-2a03.mixins.json @@ -1,7 +1,7 @@ { "required": true, "package": "party._2a03.mc.mixin", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_17", "server": [ "MixinGameMode", "MixinGameModeCommand",