Skip to content

Commit

Permalink
Fix RenderChunkMixin, needs verification
Browse files Browse the repository at this point in the history
  • Loading branch information
ALongStringOfNumbers committed Dec 14, 2023
1 parent 26fedc5 commit 342ac19
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/java/gregtech/mixins/minecraft/RenderChunkMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
import gregtech.api.metatileentity.MetaTileEntityHolder;

import net.minecraft.client.renderer.chunk.RenderChunk;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import org.jetbrains.annotations.Nullable;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

// TODO, error in log
@Mixin(RenderChunk.class)
public class RenderChunkMixin {

@ModifyExpressionValue(method = "rebuildChunk",
at = @At(value = "INVOKE_ASSIGN",
@WrapOperation(method = "rebuildChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher;getRenderer(Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer;"))
public <T extends TileEntity> TileEntitySpecialRenderer<T> adjustMTERenderer(
TileEntitySpecialRenderer<T> originalRenderer,
@Nullable TileEntity tileEntityIn) {
public <T extends TileEntity> TileEntitySpecialRenderer<T> adjustMTERenderer(TileEntityRendererDispatcher original,
TileEntity tileentity,
Operation<TileEntitySpecialRenderer<T>> originalRenderer) {
// TODO, adjust when implementing second part of IGregTileEntity
if (tileEntityIn instanceof MetaTileEntityHolder && !((MetaTileEntityHolder) tileEntityIn).hasTESR()) {
if (tileentity instanceof MetaTileEntityHolder && !((MetaTileEntityHolder) tileentity).hasTESR()) {
return null;
}
return originalRenderer;
return originalRenderer.call(original, tileentity);
}
}

0 comments on commit 342ac19

Please sign in to comment.