use of gregtech.api.capability.ICustomDataTile in project GregTech by GregTechCE.
the class CustomDataTileHandler method onChunkWatch.
@SubscribeEvent
public void onChunkWatch(ChunkWatchEvent.Watch event) {
ChunkPos chunkPos = event.getChunk();
EntityPlayerMP player = event.getPlayer();
Chunk chunk = player.world.getChunkFromChunkCoords(chunkPos.x, chunkPos.z);
for (TileEntity tileEntity : chunk.getTileEntityMap().values()) {
if (tileEntity instanceof ICustomDataTile) {
ICustomDataTile customDataTile = (ICustomDataTile) tileEntity;
customDataTile.onBeingWatched(player);
}
}
}
use of gregtech.api.capability.ICustomDataTile in project GregTech by GregTechCE.
the class CustomDataTileHandler method onClientTick.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
if (event.phase != Phase.END)
return;
World clientWorld = Minecraft.getMinecraft().world;
if (clientWorld == null)
return;
Iterator<BlockPos> keyIterator = pendingInitialSyncData.keySet().iterator();
while (keyIterator.hasNext()) {
BlockPos blockPos = keyIterator.next();
TileEntity tileEntity = clientWorld.getTileEntity(blockPos);
if (tileEntity instanceof ICustomDataTile) {
pendingInitialSyncData.get(blockPos).forEach(((ICustomDataTile) tileEntity)::handleDataPacket);
keyIterator.remove();
}
}
}
Aggregations