Skip to content

Commit

Permalink
Fix 1.12 build errors 🙏
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Apr 16, 2024
1 parent 5bdf1d9 commit b51c4ca
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -34,5 +35,6 @@ public class TileEntityRendererDispatcherMixin_BatchDraw {
private boolean patcher$renderTileEntityAt(TileEntity instance) {
return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer();
}
//#endif

}

0 comments on commit b51c4ca

Please sign in to comment.