Use TileChunkUnload state. Fixes Fixes
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.common.SpongeImplHooks;
import org.spongepowered.common.command.SpongeCommandFactory;
+import org.spongepowered.common.event.tracking.PhaseContext;
import org.spongepowered.common.item.inventory.util.InventoryUtil;
import org.spongepowered.common.item.inventory.util.ItemStackUtil;
import org.spongepowered.common.event.tracking.PhaseTracker;
@@ -276,8 +277,12 @@ public static boolean shouldRefresh(TileEntity tile, net.minecraft.world.World w
*/
@Overwrite
public static void onTileChunkUnload(TileEntity te) {
+ try (final PhaseContext<?> o = BlockPhase.State.TILE_CHUNK_UNLOAD.createPhaseContext()
+ .source(te)
+ .buildAndSwitch()) {
te.onChunkUnload();
}
+ }
// World
