use of net.minecraft.network.play.server.SPacketUnloadChunk in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysicsObject method destroy.
public void destroy() {
wrapper.setDead();
ArrayList<EntityPlayerMP> watchersCopy = (ArrayList<EntityPlayerMP>) watchingPlayers.clone();
for (EntityPlayerMP wachingPlayer : watchersCopy) {
for (int x = ownedChunks.minX; x <= ownedChunks.maxX; x++) {
for (int z = ownedChunks.minZ; z <= ownedChunks.maxZ; z++) {
SPacketUnloadChunk unloadPacket = new SPacketUnloadChunk(x, z);
((EntityPlayerMP) wachingPlayer).connection.sendPacket(unloadPacket);
}
}
// NOTICE: This method isnt being called to avoid the watchingPlayers.remove(player) call, which is a waste of CPU time
// onPlayerUntracking(wachingPlayer);
}
watchingPlayers.clear();
ValkyrienWarfareMod.chunkManager.removeRegistedChunksForShip(wrapper);
ValkyrienWarfareMod.chunkManager.removeShipPosition(wrapper);
ValkyrienWarfareMod.chunkManager.removeShipNameRegistry(wrapper);
ValkyrienWarfareMod.physicsManager.onShipUnload(wrapper);
}
use of net.minecraft.network.play.server.SPacketUnloadChunk in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysicsObject method onPlayerUntracking.
/**
* TODO: Make this further get the player to stop all further tracking of thos physObject
*
* @param EntityPlayer
* that stopped tracking
*/
public void onPlayerUntracking(EntityPlayer untracking) {
watchingPlayers.remove(untracking);
for (int x = ownedChunks.minX; x <= ownedChunks.maxX; x++) {
for (int z = ownedChunks.minZ; z <= ownedChunks.maxZ; z++) {
SPacketUnloadChunk unloadPacket = new SPacketUnloadChunk(x, z);
((EntityPlayerMP) untracking).connection.sendPacket(unloadPacket);
}
}
}
Aggregations