@SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { EntityPlayer player = event.player; World world = player.world; int atlasID = player.getUniqueID().hashCode(); AtlasData data = AntiqueAtlasMod.atlasData.getAtlasData(atlasID, world); // On the player join send the map from the server to the client: if (!data.isEmpty()) { data.syncOnPlayer(atlasID, player); } // Same thing with the local markers: MarkersData markers = AntiqueAtlasMod.markersData.getMarkersData(atlasID, world); if (!markers.isEmpty()) { markers.syncOnPlayer(atlasID, player); } }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isEquipped) { AtlasData data = AntiqueAtlasMod.atlasData.getAtlasData(stack, world); if (data == null || !(entity instanceof EntityPlayer)) return; // On the first run send the map from the server to the client: EntityPlayer player = (EntityPlayer) entity; if (!world.isRemote && !data.isSyncedOnPlayer(player) && !data.isEmpty()) { data.syncOnPlayer(stack.getItemDamage(), player); } // Same thing with the local markers: MarkersData markers = AntiqueAtlasMod.markersData.getMarkersData(stack, world); if (!world.isRemote && !markers.isSyncedOnPlayer(player) && !markers.isEmpty()) { markers.syncOnPlayer(stack.getItemDamage(), player); } // Updating map around player ArrayList<TileInfo> newTiles = data.updateMapAroundPlayer(player); if (!world.isRemote) { if (newTiles.size() > 0) { DimensionUpdatePacket packet = new DimensionUpdatePacket(stack.getItemDamage(), player.dimension); for (TileInfo t : newTiles) { packet.addTile(t.x, t.z, t.biome); } PacketDispatcher.sendToAll(packet); } } }