net.minecraft.network.play.server.SPacketChunkData Java Examples
The following examples show how to use
net.minecraft.network.play.server.SPacketChunkData.
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 |
@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: ChunkLogger.java From ForgeHax with MIT License | 6 votes |
void addChunk(SPacketChunkData packet) { if (chunks != null) { chunkLock.lock(); try { ChunkData temp = new ChunkData(packet); ChunkData data = chunks.stream().filter(temp::equals).findAny().orElse(null); if (data != null) { data.update(packet); chunks.remove(data); chunks.add(data); // remove and re-add to bring forward in the queue } else { chunks.add(temp); } } finally { chunkLock.unlock(); } } }
Example #3
Source File: NoChunkModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void onReceivePacket(EventReceivePacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof SPacketChunkData) { event.setCanceled(true); } } }
Example #4
Source File: NewChunksModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@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 #5
Source File: StorageAlertModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@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 #6
Source File: MixinNetHandlerPlayClient.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
@Inject(method = "handleChunkData", at = @At("RETURN")) private void onChunkData(SPacketChunkData packetIn, CallbackInfo ci) { if (Configs.Visuals.ENABLE_RENDERING.getBooleanValue() && Configs.Visuals.ENABLE_SCHEMATIC_RENDERING.getBooleanValue()) { SchematicWorldRenderingNotifier.markSchematicChunksForRenderUpdate(new ChunkPos(packetIn.getChunkX(), packetIn.getChunkZ())); } }
Example #7
Source File: ScoreboardListenerService.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onPacketIn(PacketEvent.Incoming.Pre event) { if (ignore && timer.isStarted() && timer.hasTimeElapsed(wait.get())) { ignore = false; } if (!ignore && event.getPacket() instanceof SPacketCustomPayload) { ignore = true; timer.start(); } else if (ignore && event.getPacket() instanceof SPacketChunkData) { ignore = false; timer.reset(); } }
Example #8
Source File: ChunkLogger.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onPacketInbound(PacketEvent.Incoming.Pre event) { if (event.getPacket() instanceof SPacketChunkData) { SPacketChunkData packet = event.getPacket(); addChunk(packet); } }
Example #9
Source File: ChunkLogger.java From ForgeHax with MIT License | 5 votes |
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); }
Example #10
Source File: ChunkLogger.java From ForgeHax with MIT License | 5 votes |
void update(SPacketChunkData packet) { updatedIsFullChunk = packet.isFullChunk(); if (!updatedIsFullChunk) { isNewByFullChunk = true; } previousTimeArrived = timeArrived; timeArrived = System.currentTimeMillis(); if (getTimeDifference() != -1 && getTimeDifference() <= flag_timing.get()) { isNewByTiming = true; } previousBlockCount = blockCount; }
Example #11
Source File: PhysicsObject.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
public void preloadNewPlayers() { Set<EntityPlayerMP> newWatchers = getPlayersThatJustWatched(); for (Chunk[] chunkArray : claimedChunkCache.getCacheArray()) { for (Chunk chunk : chunkArray) { SPacketChunkData data = new SPacketChunkData(chunk, 65535); for (EntityPlayerMP player : newWatchers) { player.connection.sendPacket(data); ((WorldServer) world()).getEntityTracker() .sendLeashedEntitiesInChunk(player, chunk); } } } }
Example #12
Source File: NetHandlerPlayClientPatch.java From seppuku with GNU General Public License v3.0 | 4 votes |
public static void handleChunkDataHook(SPacketChunkData chunkData) { if (chunkData != null) { final EventChunk event = new EventChunk(EventChunk.ChunkType.LOAD, Minecraft.getMinecraft().world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ())); Seppuku.INSTANCE.getEventManager().dispatchEvent(event); } }
Example #13
Source File: RegenChunkCommand.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] params) { EntityPlayerMP player; try { player = getCommandSenderAsPlayer(sender); } catch (PlayerNotFoundException e) { return; } if(!player.isCreative()) return; WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.getDimension()); if(player.getEntityWorld().provider.getDimension() == 0 && params.length == 1) { int radius = Integer.parseInt(params[0]); for(int i = -radius; i <= radius; i++) { for(int k = -radius; k <= radius; k++) { int x = (((int)player.posX+i*16) >> 4); int z = (((int)player.posZ+k*16) >> 4); ChunkProviderServer cps = world.getChunkProvider(); Chunk c = cps.chunkGenerator.provideChunk(x, z); Chunk old = world.getChunkProvider().provideChunk(x, z); old.setStorageArrays(c.getBlockStorageArray()); c.setTerrainPopulated(false); c.onChunkLoad(); c.setChunkModified(); c.checkLight(); cps.chunkGenerator.populate(c.xPosition, c.zPosition); net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(c.xPosition, c.zPosition, world, cps.chunkGenerator, world.getChunkProvider()); c.setChunkModified(); player.connection.sendPacket(new SPacketChunkData(cps.provideChunk(x, z), 0xffffffff)); } } /*for(int i = -radius; i <= radius; i++) { for(int k = -radius; k <= radius; k++) { int x = (((int)player.posX+i*16) >> 4); int z = (((int)player.posZ+k*16) >> 4); ChunkProviderServer cps = world.getChunkProvider(); Chunk c = cps.chunkGenerator.provideChunk(x, z); Chunk old = world.getChunkProvider().provideChunk(x, z); old.populateChunk(cps, cps.chunkGenerator); if (c.isTerrainPopulated()) { if (cps.chunkGenerator.generateStructures(c, c.xPosition, c.zPosition)) { c.setChunkModified(); } } else { c.checkLight(); cps.chunkGenerator.populate(c.xPosition, c.zPosition); net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(c.xPosition, c.zPosition, world, cps.chunkGenerator, world.getChunkProvider()); c.setChunkModified(); } player.connection.sendPacket(new SPacketChunkData(cps.provideChunk(x, z), 0xffffffff)); } }*/ } else if(player.getEntityWorld().provider.getDimension() == 0 && params.length == 2 && params[1].equalsIgnoreCase("hex")) { execute(server, sender, new String[] {params[0]}); IslandMap map = Core.getMapForWorld(world, player.getPosition()); HexGenRegistry.generate(Core.getMapForWorld(world, player.getPosition()), map.getClosestCenter(player.getPosition()), world); } }