From b1b3272d26c25767e9672a7981a924489f02bf9f Mon Sep 17 00:00:00 2001 From: Luke100000 Date: Mon, 31 Jul 2023 22:43:57 +0200 Subject: [PATCH 1/2] whoops --- common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java b/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java index 4d733adb49..eb10fac2ea 100644 --- a/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java +++ b/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java @@ -162,7 +162,7 @@ public SkinLibraryScreen(VillagerEditorScreen screen, VillagerEntityMCA villager public void renderBackground(MatrixStack matrices) { if (previousScreen instanceof DestinyScreen) { assert MinecraftClient.getInstance().world != null; - renderBackgroundTexture((int) MinecraftClient.getInstance().world.getTime()); + renderBackgroundTexture(matrices); } } From 8ef7cc3ee166e67d37a170d51fb06a31fe1d169f Mon Sep 17 00:00:00 2001 From: Luke100000 Date: Tue, 1 Aug 2023 10:21:55 +0200 Subject: [PATCH 2/2] fixed server crash --- changelog.md | 4 + .../java/net/mca/mixin/MixinPlayerEntity.java | 23 ------ .../mixin/client/MixinPlayerEntityClient.java | 40 ++++++++++ common/src/main/resources/mca.mixin.json | 77 ++++++++++--------- 4 files changed, 83 insertions(+), 61 deletions(-) create mode 100644 common/src/main/java/net/mca/mixin/client/MixinPlayerEntityClient.java diff --git a/changelog.md b/changelog.md index 591cef3bd1..96cacdcde7 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 d831dfcd48..4a4188ae10 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 + } }