mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-17 02:55:10 +00:00
Initial Commit
This commit is contained in:
1 parent
397135f687
commit
0f32dd8620
82 files changed
+10693
No files matched your search
@@ -0,0 +1,85 @@
|
||||
package codechicken.lib.world;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
|
||||
public abstract class ChunkExtension
|
||||
{
|
||||
public final Chunk chunk;
|
||||
public final ChunkCoordIntPair coord;
|
||||
public final WorldExtension world;
|
||||
public HashSet<EntityPlayerMP> watchedPlayers;
|
||||
|
||||
public ChunkExtension(Chunk chunk, WorldExtension world)
|
||||
{
|
||||
this.chunk = chunk;
|
||||
coord = chunk.getChunkCoordIntPair();
|
||||
this.world = world;
|
||||
watchedPlayers = new HashSet<EntityPlayerMP>();
|
||||
}
|
||||
|
||||
public void loadData(NBTTagCompound tag)
|
||||
{
|
||||
}
|
||||
|
||||
public void saveData(NBTTagCompound tag)
|
||||
{
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
}
|
||||
|
||||
public void unload()
|
||||
{
|
||||
}
|
||||
|
||||
public final void sendPacketToPlayers(Packet packet)
|
||||
{
|
||||
for(EntityPlayerMP player : watchedPlayers)
|
||||
player.playerNetServerHandler.sendPacketToPlayer(packet);
|
||||
}
|
||||
|
||||
public final void watchPlayer(EntityPlayerMP player)
|
||||
{
|
||||
watchedPlayers.add(player);
|
||||
onWatchPlayer(player);
|
||||
}
|
||||
|
||||
public void onWatchPlayer(EntityPlayerMP player)
|
||||
{
|
||||
}
|
||||
|
||||
public final void unwatchPlayer(EntityPlayerMP player)
|
||||
{
|
||||
watchedPlayers.remove(player);
|
||||
onUnWatchPlayer(player);
|
||||
}
|
||||
|
||||
public void onUnWatchPlayer(EntityPlayerMP player)
|
||||
{
|
||||
}
|
||||
|
||||
public void sendUpdatePackets()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return coord.chunkXPos ^ coord.chunkZPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return (o instanceof ChunkExtension && ((ChunkExtension)o).coord.equals(coord)) ||
|
||||
(o instanceof ChunkCoordIntPair && coord.equals(o)) ||
|
||||
(o instanceof Long && (Long)o == (((long)coord.chunkXPos)<<32 | coord.chunkZPos));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user