/** * Updates the time and weather for the given player to those of the given world */ public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn) { WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder(); playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE)); playerIn.connection.sendPacket(new SPacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle"))); BlockPos blockpos = worldIn.getSpawnPoint(); playerIn.connection.sendPacket(new SPacketSpawnPosition(blockpos)); if (worldIn.isRaining()) { playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F)); playerIn.connection.sendPacket(new SPacketChangeGameState(7, worldIn.getRainStrength(1.0F))); playerIn.connection.sendPacket(new SPacketChangeGameState(8, worldIn.getThunderStrength(1.0F))); } }
/** * Updates the time and weather for the given player to those of the given world */ public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn) { WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder(); playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE)); playerIn.connection.sendPacket(new SPacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle"))); if (worldIn.isRaining()) { playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F)); playerIn.connection.sendPacket(new SPacketChangeGameState(7, worldIn.getRainStrength(1.0F))); playerIn.connection.sendPacket(new SPacketChangeGameState(8, worldIn.getThunderStrength(1.0F))); } }
public static void sendWorldBorder(EntityPlayer player) { if (Configs.enableSeparateWorldBorders && player.getEntityWorld().isRemote == false && (player instanceof EntityPlayerMP)) { JustEnoughDimensions.logInfo("WorldBorderUtils.sendWorldBorder(): Sending the border to player '{}'", player.getName()); ((EntityPlayerMP) player).connection.sendPacket( new SPacketWorldBorder(player.getEntityWorld().getWorldBorder(), SPacketWorldBorder.Action.INITIALIZE)); } }
private void sendPacketToPlayers(SPacketWorldBorder packet) { World world = DimensionManager.getWorld(this.dimension); if (world != null && world.isRemote == false) { for (EntityPlayerMP player : world.getPlayers(EntityPlayerMP.class, Predicates.alwaysTrue())) { player.connection.sendPacket(packet); } } }
public void handleWorldBorder(SPacketWorldBorder packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); packetIn.apply(this.clientWorldController.getWorldBorder()); }
@Override public void onSizeChanged(WorldBorder border, double newSize) { this.sendPacketToPlayers(new SPacketWorldBorder(border, SPacketWorldBorder.Action.SET_SIZE)); }
@Override public void onTransitionStarted(WorldBorder border, double oldSize, double newSize, long time) { this.sendPacketToPlayers(new SPacketWorldBorder(border, SPacketWorldBorder.Action.LERP_SIZE)); }
@Override public void onCenterChanged(WorldBorder border, double x, double z) { this.sendPacketToPlayers(new SPacketWorldBorder(border, SPacketWorldBorder.Action.SET_CENTER)); }
@Override public void onWarningTimeChanged(WorldBorder border, int newTime) { this.sendPacketToPlayers(new SPacketWorldBorder(border, SPacketWorldBorder.Action.SET_WARNING_TIME)); }
@Override public void onWarningDistanceChanged(WorldBorder border, int newDistance) { this.sendPacketToPlayers(new SPacketWorldBorder(border, SPacketWorldBorder.Action.SET_WARNING_BLOCKS)); }
void handleWorldBorder(SPacketWorldBorder packetIn);