2021-06-16 21:57:52 +02:00
|
|
|
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
|
2021-07-15 20:51:57 +02:00
|
|
|
protected World level;
|
2021-06-16 21:57:52 +02:00
|
|
|
|
2021-07-15 20:51:57 +02:00
|
|
|
@Inject(at = @At("TAIL"), method = "setRemoved")
|
2021-06-16 21:57:52 +02:00
|
|
|
private void onRemove(CallbackInfo ci) {
|
2021-07-15 20:51:57 +02:00
|
|
|
if (level instanceof ClientWorld) InstancedRenderDispatcher.getTiles(this.level)
|
2021-06-30 21:43:54 +02:00
|
|
|
.remove((TileEntity) (Object) this);
|
2021-06-16 21:57:52 +02:00
|
|
|
}
|
|
|
|
}
|