Slight cleanups

This commit is contained in:
FlorianMichael 2024-11-16 14:58:36 +01:00
parent b7975b6544
commit beaa5bb990
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 8 additions and 12 deletions
src/main
java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft
resources

View File

@ -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;

View File

@ -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);

View File

@ -42,7 +42,7 @@ public abstract class MixinRegistryEntryList_Named {
abstract void setEntries(List<RegistryEntry> entries);
@Inject(method = "getEntries", at = @At("HEAD"))
public void preventNullableEntries(CallbackInfoReturnable<List<RegistryEntry<?>>> cir) {
private void preventNullableEntries(CallbackInfoReturnable<List<RegistryEntry<?>>> 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<Boolean> cir) {
private void alwaysBound(CallbackInfoReturnable<Boolean> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
// Previously didn't exist
cir.setReturnValue(true);

View File

@ -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