Skip to content

Commit

Permalink
dont try to render removed tile entities (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev authored Jul 16, 2024
1 parent 074ee92 commit b400fbf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ This work, "PolyPatcher", is adapted from ["Patcher"](https://sk1er.club/mods/pa
- Fix vanilla bug where enchantment glint takes up the whole slot
- Fix vanilla bug where items glitch out when using negative scale
- Fix vanilla bug where pumpkin overlay shows in spectator mode
- Fix vanilla bug where invalid tile entities try to render
- Fix vanilla sky lighting calculation
- Fix texture manager memory leak
- Fix compatability with LoliASM/CensoredASM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

@Mixin(value = TileEntityRendererDispatcher.class)
public class TileEntityRendererDispatcherMixin_BatchDraw {

//#if MC==10809
@Unique private boolean patcher$drawingBatch = false;

Expand All @@ -36,5 +35,4 @@ public class TileEntityRendererDispatcherMixin_BatchDraw {
return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer();
}
//#endif

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package club.sk1er.patcher.mixins.performance;

import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(TileEntityRendererDispatcher.class)
public class TileEntityRendererDispatcherMixin_RemoveInvalidEntities {
//#if MC==10809
@Inject(method = "getSpecialRenderer", at = @At("HEAD"), cancellable = true)
private <T extends TileEntity> void patcher$returnNullIfInvalid(TileEntity tileEntityIn, CallbackInfoReturnable<TileEntitySpecialRenderer<T>> cir) {
if (tileEntityIn == null || tileEntityIn.isInvalid()) {
cir.setReturnValue(null);
}
}
//#endif
}
1 change: 1 addition & 0 deletions src/main/resources/mixins.patcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
"performance.TextureManagerMixin_MemoryLeak",
"performance.TileEntityMobSpawnerRendererMixin_EntityCulling",
"performance.TileEntityRendererDispatcherMixin_BatchDraw",
"performance.TileEntityRendererDispatcherMixin_RemoveInvalidEntities",
"performance.VisGraphMixin_LimitScan",
"performance.WorldClientMixin_AnimationTick",
"performance.WorldMixin_Optimization",
Expand Down

0 comments on commit b400fbf

Please sign in to comment.