mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-09 22:06:09 +01:00
31 lines
854 B
Java
31 lines
854 B
Java
|
package com.jozufozu.flywheel.mixin;
|
||
|
|
||
|
import javax.annotation.Nullable;
|
||
|
|
||
|
import org.spongepowered.asm.mixin.Mixin;
|
||
|
import org.spongepowered.asm.mixin.Shadow;
|
||
|
import org.spongepowered.asm.mixin.injection.At;
|
||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||
|
|
||
|
import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher;
|
||
|
|
||
|
import net.minecraft.client.world.ClientWorld;
|
||
|
import net.minecraft.tileentity.TileEntity;
|
||
|
import net.minecraft.world.World;
|
||
|
|
||
|
@Mixin(TileEntity.class)
|
||
|
public class TileRemoveMixin {
|
||
|
|
||
|
@Shadow
|
||
|
@Nullable
|
||
|
protected World world;
|
||
|
|
||
|
@Inject(at = @At("TAIL"), method = "remove")
|
||
|
private void onRemove(CallbackInfo ci) {
|
||
|
if (world instanceof ClientWorld)
|
||
|
InstancedRenderDispatcher.getTiles(this.world)
|
||
|
.remove((TileEntity) (Object) this);
|
||
|
}
|
||
|
}
|