From beaa5bb990f7b7b3ac91379e3cfbebfbab8720da Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sat, 16 Nov 2024 14:58:36 +0100 Subject: [PATCH] Slight cleanups --- .../mixin/fixes/minecraft/block/MixinBedBlock.java | 4 ---- .../fixes/minecraft/entity/MixinClientPlayerEntity.java | 8 ++++---- .../minecraft/network/MixinRegistryEntryList_Named.java | 4 ++-- src/main/resources/viafabricplus.mixins.json | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java index 3a79f501..0e815ba8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java @@ -24,13 +24,9 @@ import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java index c368bbb5..da3f1eb3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java @@ -67,10 +67,6 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Shadow private int ticksSinceLastPositionPacketSent; - public MixinClientPlayerEntity(ClientWorld world, GameProfile profile) { - super(world, profile); - } - @Shadow @Final public ClientPlayNetworkHandler networkHandler; @@ -84,6 +80,10 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Shadow protected abstract void sendSneakingPacket(); + public MixinClientPlayerEntity(ClientWorld world, GameProfile profile) { + super(world, profile); + } + @WrapWithCondition(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSneakingPacket()V")) private boolean sendSneakingAfterSprinting(ClientPlayerEntity instance) { return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_2); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinRegistryEntryList_Named.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinRegistryEntryList_Named.java index e3473ed6..2cd303d6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinRegistryEntryList_Named.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinRegistryEntryList_Named.java @@ -42,7 +42,7 @@ public abstract class MixinRegistryEntryList_Named { abstract void setEntries(List entries); @Inject(method = "getEntries", at = @At("HEAD")) - public void preventNullableEntries(CallbackInfoReturnable>> cir) { + private void preventNullableEntries(CallbackInfoReturnable>> cir) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) { // Previoulsy didn't had unbounded entries if (this.entries == null) { @@ -52,7 +52,7 @@ public abstract class MixinRegistryEntryList_Named { } @Inject(method = "isBound", at = @At("HEAD"), cancellable = true) - public void alwaysBound(CallbackInfoReturnable cir) { + private void alwaysBound(CallbackInfoReturnable cir) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) { // Previously didn't exist cir.setReturnValue(true); diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index 43a71d2f..a282ff0f 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -155,6 +155,7 @@ "fixes.minecraft.network.MixinNetworkStateTransitionHandler", "fixes.minecraft.network.MixinNetworkStateTransitions", "fixes.minecraft.network.MixinPlayerListEntry", + "fixes.minecraft.network.MixinRegistryEntryList_Named", "fixes.minecraft.network.MixinRegistryEntryListCodec", "fixes.minecraft.network.MixinUpdatePlayerAbilitiesC2SPacket", "fixes.minecraft.screen.MixinAbstractCommandBlockScreen", @@ -215,8 +216,7 @@ "fixes.viaversion.MixinWorldPacketRewriter1_19", "viabedrock.MixinJoinPackets", "vialegacy.MixinExtensionProtocolMetadataStorage", - "vialegacy.MixinViaLegacyConfig", - "fixes.minecraft.network.MixinRegistryEntryList_Named" + "vialegacy.MixinViaLegacyConfig" ], "injectors": { "defaultRequire": 1