From ad38e5744bb45c1dfcb70d95b1f473daec1d14a4 Mon Sep 17 00:00:00 2001 From: bconlon Date: Sat, 21 Dec 2024 10:55:10 -0800 Subject: [PATCH] feat: port fabric side --- .../ae1d30c191d4db2b7f214b6d362f276779fea27b | 4 +-- .../d201efe10f782834b959d1d9aa09d02766e262cc | 2 +- fabric/src/main/generated/pack.mcmeta | 2 +- .../event/listeners/WorldPreviewListener.java | 7 ++-- .../events/LivingEntityRenderEvents.java | 7 ++-- .../providers/CumulusLanguageProvider.java | 2 +- .../client/LivingEntityRendererMixin.java | 12 ++++--- .../mixins/client/PlayerRendererMixin.java | 36 ------------------- .../0f202e000d40347127b33b6edbbb29689b8cbf86 | 4 +-- .../222c7a37905a9e3eae8a1bd77013bedc2d6bd57a | 2 +- neoforge/src/generated/resources/pack.mcmeta | 2 +- 11 files changed, 24 insertions(+), 56 deletions(-) delete mode 100644 fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/PlayerRendererMixin.java diff --git a/fabric/src/main/generated/.cache/ae1d30c191d4db2b7f214b6d362f276779fea27b b/fabric/src/main/generated/.cache/ae1d30c191d4db2b7f214b6d362f276779fea27b index aeec703..e295912 100644 --- a/fabric/src/main/generated/.cache/ae1d30c191d4db2b7f214b6d362f276779fea27b +++ b/fabric/src/main/generated/.cache/ae1d30c191d4db2b7f214b6d362f276779fea27b @@ -1,2 +1,2 @@ -// 1.21.1 2024-12-01T16:57:54.430361 Cumulus/Pack Metadata -df2cdb8ffc69d6ccce673baf9fbb986751dd2ff1 pack.mcmeta +// 1.21.3 2024-12-21T10:50:42.9270876 Cumulus/Pack Metadata +911e45306939be3e6c4f3bd08e4fcc229a142b33 pack.mcmeta diff --git a/fabric/src/main/generated/.cache/d201efe10f782834b959d1d9aa09d02766e262cc b/fabric/src/main/generated/.cache/d201efe10f782834b959d1d9aa09d02766e262cc index d0ff881..a3b1954 100644 --- a/fabric/src/main/generated/.cache/d201efe10f782834b959d1d9aa09d02766e262cc +++ b/fabric/src/main/generated/.cache/d201efe10f782834b959d1d9aa09d02766e262cc @@ -1,2 +1,2 @@ -// 1.21.1 2024-12-01T16:57:54.4293215 Cumulus/Language (en_us) +// 1.21.3 2024-12-21T10:50:42.9260874 Cumulus/Language (en_us) b698ad6fb052eaa41b9335a7feb9bac53529c4db assets\cumulus_menus\lang\en_us.json diff --git a/fabric/src/main/generated/pack.mcmeta b/fabric/src/main/generated/pack.mcmeta index 44de18d..1c14c9a 100644 --- a/fabric/src/main/generated/pack.mcmeta +++ b/fabric/src/main/generated/pack.mcmeta @@ -3,6 +3,6 @@ "description": { "translate": "pack.cumulus_menus.mod.description" }, - "pack_format": 34 + "pack_format": 42 } } \ No newline at end of file diff --git a/fabric/src/main/java/com/aetherteam/cumulus/client/event/listeners/WorldPreviewListener.java b/fabric/src/main/java/com/aetherteam/cumulus/client/event/listeners/WorldPreviewListener.java index d2b9416..1c31126 100644 --- a/fabric/src/main/java/com/aetherteam/cumulus/client/event/listeners/WorldPreviewListener.java +++ b/fabric/src/main/java/com/aetherteam/cumulus/client/event/listeners/WorldPreviewListener.java @@ -10,6 +10,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.player.PlayerRenderer; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.world.entity.Entity; public class WorldPreviewListener { @@ -69,8 +70,8 @@ public static void onRenderPlayer(PlayerRenderer renderer, CancellableCallback c * @see WorldPreviewHooks#shouldHideEntity(Entity) * @see WorldPreviewHooks#adjustShadow(EntityRenderer, boolean) */ - public static void onRenderEntity(Entity entity, EntityRenderer renderer, CancellableCallback callback) { - boolean hide = WorldPreviewHooks.shouldHideEntity(entity); + public static void onRenderEntity(LivingEntityRenderState renderState, EntityRenderer renderer, float partialTick, CancellableCallback callback) { + boolean hide = WorldPreviewHooks.shouldHideEntity(renderer, renderState, partialTick); if (hide) { callback.setCanceled(true); } @@ -85,6 +86,6 @@ public static void initEvents() { WorldRenderEvents.LAST.register(context -> onRenderLevelLast()); ClientTickEvents.END_CLIENT_TICK.register(client -> WorldPreviewListener.onClientTick()); PlayerRenderEvents.BEFORE_RENDER.register((player, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback) -> WorldPreviewListener.onRenderPlayer(renderer, callback)); - LivingEntityRenderEvents.BEFORE_RENDER.register((livingEntity, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback) -> onRenderEntity(livingEntity, renderer, callback)); + LivingEntityRenderEvents.BEFORE_RENDER.register((entityRenderState, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback) -> onRenderEntity(entityRenderState, renderer, partialTick, callback)); } } diff --git a/fabric/src/main/java/com/aetherteam/cumulus/client/events/LivingEntityRenderEvents.java b/fabric/src/main/java/com/aetherteam/cumulus/client/events/LivingEntityRenderEvents.java index 4b1f070..ffb37a9 100644 --- a/fabric/src/main/java/com/aetherteam/cumulus/client/events/LivingEntityRenderEvents.java +++ b/fabric/src/main/java/com/aetherteam/cumulus/client/events/LivingEntityRenderEvents.java @@ -7,14 +7,15 @@ import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.world.entity.LivingEntity; public class LivingEntityRenderEvents { - public static final Event BEFORE_RENDER = EventFactory.createArrayBacked(PreMain.class, invokers -> (livingEntity, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback) -> { - for (var invoker : invokers) invoker.beforeRendering(livingEntity, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback); + public static final Event BEFORE_RENDER = EventFactory.createArrayBacked(PreMain.class, invokers -> (entityRenderState, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback) -> { + for (var invoker : invokers) invoker.beforeRendering(entityRenderState, renderer, partialTick, poseStack, multiBufferSource, packedLight, callback); }); public interface PreMain { - void beforeRendering(LivingEntity livingEntity, LivingEntityRenderer> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, CancellableCallback callback); + void beforeRendering(LivingEntityRenderState entityRenderState, LivingEntityRenderer> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, CancellableCallback callback); } } diff --git a/fabric/src/main/java/com/aetherteam/cumulus/data/providers/CumulusLanguageProvider.java b/fabric/src/main/java/com/aetherteam/cumulus/data/providers/CumulusLanguageProvider.java index 995e01a..8db113f 100644 --- a/fabric/src/main/java/com/aetherteam/cumulus/data/providers/CumulusLanguageProvider.java +++ b/fabric/src/main/java/com/aetherteam/cumulus/data/providers/CumulusLanguageProvider.java @@ -74,7 +74,7 @@ public void addItemStack(Supplier key, String name) { @Override public void add(ItemStack key, String name) { - builderInstance.add(key.getDescriptionId(), name); + builderInstance.add(key.getItem().getDescriptionId(), name); } @Override diff --git a/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/LivingEntityRendererMixin.java b/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/LivingEntityRendererMixin.java index dc139ca..78647ae 100644 --- a/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/LivingEntityRendererMixin.java +++ b/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/LivingEntityRendererMixin.java @@ -5,28 +5,30 @@ import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.world.entity.LivingEntity; import org.spongepowered.asm.mixin.Mixin; @Mixin(LivingEntityRenderer.class) -public abstract class LivingEntityRendererMixin> extends EntityRenderer { +public abstract class LivingEntityRendererMixin> extends EntityRenderer { protected LivingEntityRendererMixin(EntityRendererProvider.Context context) { super(context); } - @WrapMethod(method = "render(Lnet/minecraft/world/entity/LivingEntity;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V") - private void render(T entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, Operation original) { + @WrapMethod(method = "render(Lnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V") + private void render(S entityRenderState, PoseStack poseStack, MultiBufferSource buffer, int packedLight, Operation original) { var callback = new CancellableCallbackImpl(); - LivingEntityRenderEvents.BEFORE_RENDER.invoker().beforeRendering(entity, (LivingEntityRenderer) (Object) this, partialTicks, poseStack, buffer, packedLight, callback); + LivingEntityRenderEvents.BEFORE_RENDER.invoker().beforeRendering(entityRenderState, (LivingEntityRenderer) (Object) this, Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(true), poseStack, buffer, packedLight, callback); if (callback.isCanceled()) return; - original.call(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + original.call(entityRenderState, poseStack, buffer, packedLight); } } diff --git a/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/PlayerRendererMixin.java b/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/PlayerRendererMixin.java deleted file mode 100644 index 5051a25..0000000 --- a/fabric/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/PlayerRendererMixin.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.aetherteam.cumulus.mixin.mixins.client; - -import com.aetherteam.cumulus.client.events.PlayerRenderEvents; -import com.aetherteam.cumulus.events.CancellableCallbackImpl; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.model.PlayerModel; -import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.client.renderer.entity.player.PlayerRenderer; -import net.minecraft.world.entity.LivingEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -@Mixin(PlayerRenderer.class) -public abstract class PlayerRendererMixin extends LivingEntityRenderer> { - public PlayerRendererMixin(EntityRendererProvider.Context context, PlayerModel model, float shadowRadius) { - super(context, model, shadowRadius); - } - - @WrapOperation(method = "render(Lnet/minecraft/client/player/AbstractClientPlayer;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/LivingEntityRenderer;render(Lnet/minecraft/world/entity/LivingEntity;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V")) - private void render(PlayerRenderer instance, T entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, Operation original) { - var player = (AbstractClientPlayer) entity; - - var callback = new CancellableCallbackImpl(); - - PlayerRenderEvents.BEFORE_RENDER.invoker().beforeRendering(player, instance, partialTicks, poseStack, buffer, packedLight, callback); - - if (callback.isCanceled()) return; - - original.call(instance, entity, entityYaw, partialTicks, poseStack, buffer, packedLight); - } -} diff --git a/neoforge/src/generated/resources/.cache/0f202e000d40347127b33b6edbbb29689b8cbf86 b/neoforge/src/generated/resources/.cache/0f202e000d40347127b33b6edbbb29689b8cbf86 index 9885597..e050a19 100644 --- a/neoforge/src/generated/resources/.cache/0f202e000d40347127b33b6edbbb29689b8cbf86 +++ b/neoforge/src/generated/resources/.cache/0f202e000d40347127b33b6edbbb29689b8cbf86 @@ -1,2 +1,2 @@ -// 1.21.1 2024-10-25T14:43:36.3142406 Pack Metadata -df2cdb8ffc69d6ccce673baf9fbb986751dd2ff1 pack.mcmeta +// 1.21.3 2024-12-21T10:49:52.5635634 Pack Metadata +911e45306939be3e6c4f3bd08e4fcc229a142b33 pack.mcmeta diff --git a/neoforge/src/generated/resources/.cache/222c7a37905a9e3eae8a1bd77013bedc2d6bd57a b/neoforge/src/generated/resources/.cache/222c7a37905a9e3eae8a1bd77013bedc2d6bd57a index a3b8d1f..cc4e52f 100644 --- a/neoforge/src/generated/resources/.cache/222c7a37905a9e3eae8a1bd77013bedc2d6bd57a +++ b/neoforge/src/generated/resources/.cache/222c7a37905a9e3eae8a1bd77013bedc2d6bd57a @@ -1,2 +1,2 @@ -// 1.21.1 2024-12-01T16:58:54.0269104 Languages: en_us for mod: cumulus_menus +// 1.21.3 2024-12-21T10:49:52.5145659 Languages: en_us for mod: cumulus_menus b698ad6fb052eaa41b9335a7feb9bac53529c4db assets/cumulus_menus/lang/en_us.json diff --git a/neoforge/src/generated/resources/pack.mcmeta b/neoforge/src/generated/resources/pack.mcmeta index 44de18d..1c14c9a 100644 --- a/neoforge/src/generated/resources/pack.mcmeta +++ b/neoforge/src/generated/resources/pack.mcmeta @@ -3,6 +3,6 @@ "description": { "translate": "pack.cumulus_menus.mod.description" }, - "pack_format": 34 + "pack_format": 42 } } \ No newline at end of file