From b51c4cab4b05c86753eb6667d4328538fadf2ebe Mon Sep 17 00:00:00 2001 From: Mixces Date: Tue, 16 Apr 2024 17:24:00 -0500 Subject: [PATCH] Fix 1.12 build errors :pray: --- .../ItemLayerModelMixin_HeldItemLighting.java | 17 +++++++++++++++-- .../render/item/RenderItemMixin_CullFace.java | 14 +++++++++++++- ...EntityRendererDispatcherMixin_BatchDraw.java | 2 ++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/ItemLayerModelMixin_HeldItemLighting.java b/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/ItemLayerModelMixin_HeldItemLighting.java index a0786b73..4e2cdca4 100644 --- a/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/ItemLayerModelMixin_HeldItemLighting.java +++ b/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/ItemLayerModelMixin_HeldItemLighting.java @@ -1,12 +1,25 @@ package club.sk1er.patcher.mixins.bugfixes.forge; -import com.google.common.base.Optional; +import +//#if MC==10809 + com.google.common.base.Optional; +//#else +//$$ java.util.Optional; +//#endif + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; import net.minecraftforge.client.model.ItemLayerModel; -import net.minecraftforge.client.model.TRSRTransformation; + +//#if MC==10809 +import net.minecraftforge.client.model. +//#else +//$$ import net.minecraftforge.common.model. +//#endif + TRSRTransformation; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/club/sk1er/patcher/mixins/bugfixes/render/item/RenderItemMixin_CullFace.java b/src/main/java/club/sk1er/patcher/mixins/bugfixes/render/item/RenderItemMixin_CullFace.java index bb9e7219..ac1c821c 100644 --- a/src/main/java/club/sk1er/patcher/mixins/bugfixes/render/item/RenderItemMixin_CullFace.java +++ b/src/main/java/club/sk1er/patcher/mixins/bugfixes/render/item/RenderItemMixin_CullFace.java @@ -1,6 +1,11 @@ package club.sk1er.patcher.mixins.bugfixes.render.item; import net.minecraft.client.renderer.GlStateManager; + +//#if MC==11202 +//$$ import net.minecraft.client.renderer.GlStateManager.CullFace; +//#endif + import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.client.renderer.entity.RenderItem; @@ -12,15 +17,22 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +@SuppressWarnings("deprecation") @Mixin(RenderItem.class) public abstract class RenderItemMixin_CullFace { @Shadow protected abstract boolean isThereOneNegativeScale(ItemTransformVec3f itemTranformVec); + @Inject(method = "renderItemModelTransform", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V")) private void patcher$cullFace(ItemStack stack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, CallbackInfo ci) { if (isThereOneNegativeScale(model.getItemCameraTransforms().getTransform(cameraTransformType))) { - GlStateManager.cullFace(1028); + GlStateManager. + //#if MC==10809 + cullFace(1028); + //#else + //$$ cullFace(CullFace.FRONT); + //#endif } } diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java b/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java index 7ad453e7..214a15c1 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java @@ -13,6 +13,7 @@ @Mixin(value = TileEntityRendererDispatcher.class) public class TileEntityRendererDispatcherMixin_BatchDraw { + //#if MC==10809 @Unique private boolean patcher$drawingBatch = false; @Inject(method = "preDrawBatch", at = @At(value = "TAIL"), remap = false) @@ -34,5 +35,6 @@ public class TileEntityRendererDispatcherMixin_BatchDraw { private boolean patcher$renderTileEntityAt(TileEntity instance) { return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer(); } + //#endif }