From 6a77d6a3f56f32fed2a16fccb0bd9ce97437ffaf Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:32:44 +0100 Subject: [PATCH] 25w05a --- gradle.properties | 2 +- .../PistonHeadRenderer_movableBEMixin.java | 8 ++-- .../java/carpet/script/api/Scoreboards.java | 37 +++++++++++++++++-- .../carpet/script/utils/ShapesRenderer.java | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c3082ea3d7..0f64a120a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w04a + minecraft_version=25w05a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java index 87df4e3485..3a8b0e14d0 100644 --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java @@ -10,6 +10,7 @@ import net.minecraft.client.renderer.blockentity.PistonHeadRenderer; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -27,8 +28,9 @@ private void onInitCM(BlockEntityRendererProvider.Context arguments, CallbackInf } @Inject(method = "render", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;renderBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/level/Level;ZI)V", ordinal = 3)) - private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float float_1, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int int_2, CallbackInfo ci) + target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;renderBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/level/Level;ZI)V", + ordinal = 3)) + private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float float_1, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int int_2, Vec3 cameraPos, CallbackInfo ci) //private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci) { if (!((PistonBlockEntityInterface) pistonBlockEntity_1).isRenderModeSet()) @@ -37,7 +39,7 @@ private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float @Inject(method = "render", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE) - private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, CallbackInfo ci) + private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci) { if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity()) { diff --git a/src/main/java/carpet/script/api/Scoreboards.java b/src/main/java/carpet/script/api/Scoreboards.java index cd282d7e88..3e758a70f1 100644 --- a/src/main/java/carpet/script/api/Scoreboards.java +++ b/src/main/java/carpet/script/api/Scoreboards.java @@ -35,6 +35,7 @@ import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Team; import net.minecraft.world.scores.criteria.ObjectiveCriteria; +import org.jetbrains.annotations.Nullable; public class Scoreboards { @@ -420,7 +421,7 @@ public static void apply(Expression expression) { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - Team.CollisionRule collisionRule = Team.CollisionRule.byName(settingVal.getString()); + Team.CollisionRule collisionRule = getCollisionRule(settingVal); if (collisionRule == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); @@ -452,7 +453,7 @@ public static void apply(Expression expression) { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - Team.Visibility deathMessageVisibility = Team.Visibility.byName(settingVal.getString()); + Team.Visibility deathMessageVisibility = getVisibility(settingVal); if (deathMessageVisibility == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); @@ -490,7 +491,7 @@ public static void apply(Expression expression) { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - Team.Visibility nametagVisibility = Team.Visibility.byName(settingVal.getString()); + Team.Visibility nametagVisibility = getVisibility(settingVal); if (nametagVisibility == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); @@ -697,5 +698,35 @@ public static void apply(Expression expression) } }); } + + @Nullable + private static Team.CollisionRule getCollisionRule(Value settingVal) + { + + final String string = settingVal.getString(); + for (Team.CollisionRule rule : Team.CollisionRule.values()) + { + if (rule.getSerializedName().equalsIgnoreCase(string)) + { + return rule; + } + } + return null; + } + + @Nullable + private static Team.Visibility getVisibility(Value settingVal) + { + + final String string = settingVal.getString(); + for (Team.Visibility rule : Team.Visibility.values()) + { + if (rule.getSerializedName().equalsIgnoreCase(string)) + { + return rule; + } + } + return null; + } } diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index a7c7a9eb64..54884f3719 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -435,7 +435,7 @@ public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, do if (blockEntityRenderer != null) { blockEntityRenderer.render(BlockEntity, partialTick, - matrices, immediate, light, OverlayTexture.NO_OVERLAY); + matrices, immediate, light, OverlayTexture.NO_OVERLAY, camera1.getPosition()); } }