diff --git a/changelog.md b/changelog.md index b2b9c67827..189fd4cf96 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +# 7.5.5 + +* Fixed server crash + # 7.5.4 * Removed size requirements of blueprint buildings diff --git a/common/src/main/java/net/mca/mixin/MixinPlayerEntity.java b/common/src/main/java/net/mca/mixin/MixinPlayerEntity.java index c606e3cde6..faab716da8 100644 --- a/common/src/main/java/net/mca/mixin/MixinPlayerEntity.java +++ b/common/src/main/java/net/mca/mixin/MixinPlayerEntity.java @@ -1,11 +1,7 @@ package net.mca.mixin; -import net.mca.Config; -import net.mca.MCAClient; import net.mca.item.BabyItem; import net.mca.server.world.data.VillageManager; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityPose; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; @@ -39,23 +35,4 @@ private void onDropItem(ItemStack stack, boolean throwRandomly, boolean retainOw info.setReturnValue(null); } } - - @Inject(method = "getActiveEyeHeight(Lnet/minecraft/entity/EntityPose;Lnet/minecraft/entity/EntityDimensions;)F", at = @At("HEAD"), cancellable = true) - public void mca$getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions, CallbackInfoReturnable cir) { - if (Config.getInstance().adjustPlayerEyesToHeight) { - MCAClient.getPlayerData(getUuid()).ifPresent(data -> { - switch (pose) { - case SWIMMING, FALL_FLYING, SPIN_ATTACK -> { - cir.setReturnValue(0.4f * data.getRawScaleFactor()); - } - case CROUCHING -> { - cir.setReturnValue(1.27f * data.getRawScaleFactor()); - } - default -> { - cir.setReturnValue(1.62f * data.getRawScaleFactor()); - } - } - }); - } - } } diff --git a/common/src/main/java/net/mca/mixin/client/MixinPlayerEntityClient.java b/common/src/main/java/net/mca/mixin/client/MixinPlayerEntityClient.java new file mode 100644 index 0000000000..83c3084e41 --- /dev/null +++ b/common/src/main/java/net/mca/mixin/client/MixinPlayerEntityClient.java @@ -0,0 +1,40 @@ +package net.mca.mixin.client; + +import net.mca.Config; +import net.mca.MCAClient; +import net.minecraft.entity.EntityDimensions; +import net.minecraft.entity.EntityPose; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.World; +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.CallbackInfoReturnable; + +@Mixin(PlayerEntity.class) +abstract class MixinPlayerEntityClient extends LivingEntity { + protected MixinPlayerEntityClient(EntityType entityType, World world) { + super(entityType, world); + } + + @Inject(method = "getActiveEyeHeight(Lnet/minecraft/entity/EntityPose;Lnet/minecraft/entity/EntityDimensions;)F", at = @At("HEAD"), cancellable = true) + public void mca$getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions, CallbackInfoReturnable cir) { + if (Config.getInstance().adjustPlayerEyesToHeight) { + MCAClient.getPlayerData(getUuid()).ifPresent(data -> { + switch (pose) { + case SWIMMING, FALL_FLYING, SPIN_ATTACK -> { + cir.setReturnValue(0.4f * data.getRawScaleFactor()); + } + case CROUCHING -> { + cir.setReturnValue(1.27f * data.getRawScaleFactor()); + } + default -> { + cir.setReturnValue(1.62f * data.getRawScaleFactor()); + } + } + }); + } + } +} diff --git a/common/src/main/resources/mca.mixin.json b/common/src/main/resources/mca.mixin.json index 3662697af9..7b3177f817 100644 --- a/common/src/main/resources/mca.mixin.json +++ b/common/src/main/resources/mca.mixin.json @@ -1,40 +1,41 @@ { - "required": true, - "minVersion": "0.7", - "package": "net.mca.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [ - "MixinAbstractFurnaceBlockEntity", - "MixinActivity", - "MixinCriteria", - "MixinDefaultParticleType", - "MixinEntityType", - "MixinGoatEntity", - "MixinHorseBaseEntity", - "MixinMemoryModuleType", - "MixinMilkBucketItem", - "MixinPlayerEntity", - "MixinPlayerInventory", - "MixinProtoChunk", - "MixinSensorType", - "MixinServerPlayNetworkHandler", - "MixinServerWorld", - "MixinTranslatableText", - "MixinVillagerEntity", - "MixinVillagerEntityInvoker", - "MixinVillagerProfession", - "MixinZombieVillagerEntity" - ], - "client": [ - "client.MixinArmorFeatureRenderer", - "client.MixinGameRenderer", - "client.MixinHeldItemFeatureRenderer", - "client.MixinMessageHandler", - "client.MixinLivingEntityRenderer", - "client.MixinPlayerEntityRenderer", - "client.MixinTranslationStorage" - ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "minVersion": "0.7", + "package": "net.mca.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "MixinAbstractFurnaceBlockEntity", + "MixinActivity", + "MixinCriteria", + "MixinDefaultParticleType", + "MixinEntityType", + "MixinGoatEntity", + "MixinHorseBaseEntity", + "MixinMemoryModuleType", + "MixinMilkBucketItem", + "MixinPlayerEntity", + "MixinPlayerInventory", + "MixinProtoChunk", + "MixinSensorType", + "MixinServerPlayNetworkHandler", + "MixinServerWorld", + "MixinTranslatableText", + "MixinVillagerEntity", + "MixinVillagerEntityInvoker", + "MixinVillagerProfession", + "MixinZombieVillagerEntity" + ], + "client": [ + "client.MixinArmorFeatureRenderer", + "client.MixinGameRenderer", + "client.MixinHeldItemFeatureRenderer", + "client.MixinLivingEntityRenderer", + "client.MixinMessageHandler", + "client.MixinPlayerEntityRenderer", + "client.MixinTranslationStorage", + "client.MixinPlayerEntityClient" + ], + "injectors": { + "defaultRequire": 1 + } }