Java Code Examples for net.minecraft.network.play.server.SPacketChunkData#getChunkZ()

The following examples show how to use net.minecraft.network.play.server.SPacketChunkData#getChunkZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlimeChunksModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Listener
public void receivePacket(EventReceivePacket event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        if (event.getPacket() instanceof SPacketChunkData) {
            final SPacketChunkData packet = (SPacketChunkData) event.getPacket();
            final SlimeChunk chunk = new SlimeChunk(packet.getChunkX() * 16, packet.getChunkZ() * 16);

            final ServerData serverData = Minecraft.getMinecraft().getCurrentServerData();
            if (serverData != null) {
                final WorldManager.WorldData worldData = Seppuku.INSTANCE.getWorldManager().find(serverData.serverIP);
                if (worldData != null) {
                    if (!this.slimeChunkList.contains(chunk) && this.isSlimeChunk(worldData.getSeed(), packet.getChunkX(), packet.getChunkZ())) {
                        this.slimeChunkList.add(chunk);
                    }
                }
            }
        }
    }
}
 
Example 2
Source File: NewChunksModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void receivePacket(EventReceivePacket event) {
    if(event.getStage() == EventStageable.EventStage.PRE) {
        if(event.getPacket() instanceof SPacketChunkData) {
            final SPacketChunkData packet = (SPacketChunkData) event.getPacket();
            if(!packet.isFullChunk()) {
                final ChunkData chunk = new ChunkData(packet.getChunkX() * 16, packet.getChunkZ() * 16);

                if(!this.chunkDataList.contains(chunk)) {
                    this.chunkDataList.add(chunk);
                }
            }
        }
    }
}
 
Example 3
Source File: StorageAlertModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void recievePacket(EventReceivePacket event) {
    if (event.getStage() == EventStageable.EventStage.POST) {
        if (event.getPacket() instanceof SPacketChunkData) {
            final SPacketChunkData packet = (SPacketChunkData) event.getPacket();

            final Minecraft mc = Minecraft.getMinecraft();

            int count = 0;

            for(NBTTagCompound tag : packet.getTileEntityTags()) {
                final String id = tag.getString("id");

                if(
                        (this.chests.getValue() && (id.equals("minecraft:chest") || id.equals("minecraft:trapped_chest"))) ||
                        (this.echests.getValue() && id.equals("minecraft:ender_chest")) ||
                        (this.shulkers.getValue() && id.equals("minecraft:shulker_box")) ||
                        (this.hoppers.getValue() && id.equals("minecraft:hopper")) ||
                        (this.droppers.getValue() && id.equals("minecraft:dropper")) ||
                        (this.dispensers.getValue() && id.equals("minecraft:dispenser")) ||
                        (this.stands.getValue() && id.equals("minecraft:brewing_stand"))
                ) {
                    count++;
                }
            }

            if(count > 0) {
                final String message = count + " storage blocks located at X: " + packet.getChunkX() * 16 + " Z: " + packet.getChunkZ() * 16;
                if (this.mode.getValue() == Mode.CHAT || this.mode.getValue() == Mode.BOTH) {
                    Seppuku.INSTANCE.logChat(message);
                }
                if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) {
                    Seppuku.INSTANCE.getNotificationManager().addNotification("", message);
                }
            }

        }
    }
}
 
Example 4
Source File: ChunkLogger.java    From ForgeHax with MIT License 5 votes vote down vote up
ChunkData(SPacketChunkData packet) {
  pos = new ChunkPos(packet.getChunkX(), packet.getChunkZ());
  bbox =
      new AxisAlignedBB(pos.getXStart(), 0, pos.getZStart(), pos.getXEnd(), 255, pos.getZEnd());
  isFullChunk = packet.isFullChunk();
  update(packet);
}