From f7d9d0b2c939a1488e12cfa98cab399f5006653e Mon Sep 17 00:00:00 2001 From: ProfMobius Date: Sun, 11 May 2014 15:25:51 +0200 Subject: [PATCH] First start ! --- .../client/CommandClientShowRenderTick.java | 1 - .../commands/client/CommandClientStart.java | 1 - .../opis/commands/client/CommandOpis.java | 1 - .../server/CommandAmountEntities.java | 1 - .../commands/server/CommandChunkList.java | 1 - .../opis/commands/server/CommandHandler.java | 1 - .../opis/commands/server/CommandReset.java | 1 - .../opis/commands/server/CommandStart.java | 1 - .../server/CommandTimingEntities.java | 1 - .../server/CommandTimingTileEntities.java | 1 - .../data/holders/newtypes/DataPacket.java | 31 +- .../opis/data/managers/EntityManager.java | 6 +- .../opis/events/OpisServerTickHandler.java | 3 +- .../mcp/mobius/opis/events/PlayerTracker.java | 1 - src/main/java/mcp/mobius/opis/modOpis.java | 4 +- .../opis/network/OpisPacketHandler_OLD.java | 119 - .../mobius/opis/network/PacketManager.java | 18 +- .../opis/network/ServerMessageHandler.java | 8 +- .../network/packets/server/NetDataList.java | 2 +- .../network/packets/server/PacketChunks.java | 38 + .../PacketDataOverlayChunkEntities.java | 55 + .../network/packets/server/PacketTickets.java | 50 + .../packets/server/Packet_Chunks_OLD.java | 248 - .../Packet_DataOverlayChunkEntities_OLD.java | 58 - .../packets/server/Packet_Tickets_OLD.java | 50 - src/main/java/net/minecraft/world/World.java | 4442 +++++++++++++++++ .../world/gen/ChunkProviderServer.java | 383 ++ src/main/resources/mobius_at.cfg | 20 +- 28 files changed, 5019 insertions(+), 527 deletions(-) delete mode 100644 src/main/java/mcp/mobius/opis/network/OpisPacketHandler_OLD.java create mode 100644 src/main/java/mcp/mobius/opis/network/packets/server/PacketChunks.java create mode 100644 src/main/java/mcp/mobius/opis/network/packets/server/PacketDataOverlayChunkEntities.java create mode 100644 src/main/java/mcp/mobius/opis/network/packets/server/PacketTickets.java delete mode 100644 src/main/java/mcp/mobius/opis/network/packets/server/Packet_Chunks_OLD.java delete mode 100644 src/main/java/mcp/mobius/opis/network/packets/server/Packet_DataOverlayChunkEntities_OLD.java delete mode 100644 src/main/java/mcp/mobius/opis/network/packets/server/Packet_Tickets_OLD.java create mode 100644 src/main/java/net/minecraft/world/World.java create mode 100644 src/main/java/net/minecraft/world/gen/ChunkProviderServer.java diff --git a/src/main/java/mcp/mobius/opis/commands/client/CommandClientShowRenderTick.java b/src/main/java/mcp/mobius/opis/commands/client/CommandClientShowRenderTick.java index a67b759..44739b0 100644 --- a/src/main/java/mcp/mobius/opis/commands/client/CommandClientShowRenderTick.java +++ b/src/main/java/mcp/mobius/opis/commands/client/CommandClientShowRenderTick.java @@ -1,7 +1,6 @@ package mcp.mobius.opis.commands.client; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataCommand; diff --git a/src/main/java/mcp/mobius/opis/commands/client/CommandClientStart.java b/src/main/java/mcp/mobius/opis/commands/client/CommandClientStart.java index 2bafa46..9efaaf5 100644 --- a/src/main/java/mcp/mobius/opis/commands/client/CommandClientStart.java +++ b/src/main/java/mcp/mobius/opis/commands/client/CommandClientStart.java @@ -1,6 +1,5 @@ package mcp.mobius.opis.commands.client; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataCommand; diff --git a/src/main/java/mcp/mobius/opis/commands/client/CommandOpis.java b/src/main/java/mcp/mobius/opis/commands/client/CommandOpis.java index 01a993f..e2819a6 100644 --- a/src/main/java/mcp/mobius/opis/commands/client/CommandOpis.java +++ b/src/main/java/mcp/mobius/opis/commands/client/CommandOpis.java @@ -6,7 +6,6 @@ import javax.swing.JLabel; import mcp.mobius.opis.events.PlayerTracker; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.ServerMessageHandler; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataCommand; import net.minecraft.command.CommandBase; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandAmountEntities.java b/src/main/java/mcp/mobius/opis/commands/server/CommandAmountEntities.java index a7d2b49..51de1ca 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandAmountEntities.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandAmountEntities.java @@ -7,7 +7,6 @@ import mcp.mobius.opis.commands.IOpisCommand; import mcp.mobius.opis.data.holders.basetypes.AmountHolder; import mcp.mobius.opis.data.managers.EntityManager; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.enums.Message; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandChunkList.java b/src/main/java/mcp/mobius/opis/commands/server/CommandChunkList.java index 455e6db..41811dd 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandChunkList.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandChunkList.java @@ -6,7 +6,6 @@ import mcp.mobius.opis.commands.IOpisCommand; import mcp.mobius.opis.data.holders.stats.StatsChunk; import mcp.mobius.opis.data.managers.ChunkManager; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.enums.Message; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandHandler.java b/src/main/java/mcp/mobius/opis/commands/server/CommandHandler.java index 34e2f2a..a645a7d 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandHandler.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandHandler.java @@ -8,7 +8,6 @@ import mcp.mobius.opis.commands.IOpisCommand; import mcp.mobius.opis.data.holders.newtypes.DataHandler; import mcp.mobius.opis.data.managers.TickHandlerManager; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.enums.Message; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandReset.java b/src/main/java/mcp/mobius/opis/commands/server/CommandReset.java index e56fbbf..3441286 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandReset.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandReset.java @@ -8,7 +8,6 @@ import mcp.mobius.opis.data.managers.TickHandlerManager; import mcp.mobius.opis.data.managers.TileEntityManager; import mcp.mobius.opis.events.OpisServerTickHandler; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataCommand; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandStart.java b/src/main/java/mcp/mobius/opis/commands/server/CommandStart.java index 7cefb79..7dfe786 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandStart.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandStart.java @@ -10,7 +10,6 @@ import mcp.mobius.opis.data.managers.TickHandlerManager; import mcp.mobius.opis.data.managers.TileEntityManager; import mcp.mobius.opis.events.OpisServerTickHandler; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataValue; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandTimingEntities.java b/src/main/java/mcp/mobius/opis/commands/server/CommandTimingEntities.java index 22bff8f..b4541af 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandTimingEntities.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandTimingEntities.java @@ -8,7 +8,6 @@ import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk; import mcp.mobius.opis.data.holders.newtypes.DataEntity; import mcp.mobius.opis.data.managers.EntityManager; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.enums.Message; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandTimingTileEntities.java b/src/main/java/mcp/mobius/opis/commands/server/CommandTimingTileEntities.java index 448eec7..0dfeaa7 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandTimingTileEntities.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandTimingTileEntities.java @@ -6,7 +6,6 @@ import mcp.mobius.opis.commands.IOpisCommand; import mcp.mobius.opis.data.holders.newtypes.DataBlockTileEntity; import mcp.mobius.opis.data.managers.TileEntityManager; import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.enums.Message; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataPacket.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataPacket.java index 958257f..e558712 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataPacket.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataPacket.java @@ -4,6 +4,8 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import net.minecraft.network.Packet; + import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; @@ -20,27 +22,23 @@ public class DataPacket implements ISerializable{ } public DataPacket(int id){ - /* this.id = id; this.size = new DataByteSize(0); this.rate = new DataByteRate(0, 5); this.amount = new DataAmountRate(0, 5); - try { - this.type = ((Class)(Packet.packetIdToClassMap.lookup(this.id))).getSimpleName(); - } catch (Exception e) { + //try { + // this.type = ((Class)(Packet.packetIdToClassMap.lookup(this.id))).getSimpleName(); + //} catch (Exception e) { this.type = ""; - } - */ + //} } - /* public DataPacket fill(Packet packet){ - this.size.size += packet.getPacketSize() + 1; - this.rate.size += packet.getPacketSize() + 1; - this.amount.size += 1; + //this.size.size += packet.getPacketSize() + 1; + //this.rate.size += packet.getPacketSize() + 1; + //this.amount.size += 1; return this; } - */ public void startInterval(){ this.rate.reset(); @@ -57,17 +55,16 @@ public class DataPacket implements ISerializable{ public static DataPacket readFromStream(ByteArrayDataInput stream){ DataPacket retVal = new DataPacket(); - /* retVal.id = stream.readInt(); retVal.size = DataByteSize.readFromStream(stream); retVal.rate = DataByteRate.readFromStream(stream); retVal.amount = DataAmountRate.readFromStream(stream); - try { - retVal.type = ((Class)(Packet.packetIdToClassMap.lookup(retVal.id))).getSimpleName(); - } catch (Exception e) { + //try { + // retVal.type = ((Class)(Packet.packetIdToClassMap.lookup(retVal.id))).getSimpleName(); + //} catch (Exception e) { retVal.type = ""; - } - */ + //} + return retVal; } } diff --git a/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java b/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java index 2ce29ee..9e3470e 100644 --- a/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java +++ b/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java @@ -241,7 +241,7 @@ public enum EntityManager { else if (ent instanceof EntityPlayerMP && !filtered) return "[ Player ] " + ((EntityPlayerMP)ent).getDisplayName(); - String name = ent.getTranslatedEntityName(); + String name = ent.getCommandSenderName(); if (name.contains(".")){ String[] namelst = ent.getClass().getName().split("\\."); @@ -291,7 +291,9 @@ public enum EntityManager { } public ArrayList getAllPlayers(){ - List players = MinecraftServer.getServerConfigurationManager(MinecraftServer.getServer()).playerEntityList; + //List players = MinecraftServer.getServerConfigurationManager(MinecraftServer.getServer()).playerEntityList; + List players = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + ArrayList outList = new ArrayList(); for (Object p : players) diff --git a/src/main/java/mcp/mobius/opis/events/OpisServerTickHandler.java b/src/main/java/mcp/mobius/opis/events/OpisServerTickHandler.java index da32698..17f2d2e 100644 --- a/src/main/java/mcp/mobius/opis/events/OpisServerTickHandler.java +++ b/src/main/java/mcp/mobius/opis/events/OpisServerTickHandler.java @@ -35,7 +35,6 @@ import mcp.mobius.opis.data.profilers.ProfilerEvent; import mcp.mobius.opis.data.profilers.ProfilerPacket; import mcp.mobius.opis.data.profilers.ProfilerTick; import mcp.mobius.opis.gui.overlay.OverlayStatus; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.AccessLevel; import mcp.mobius.opis.network.enums.Message; @@ -151,7 +150,7 @@ public enum OpisServerTickHandler{ PacketManager.sendPacketToAllSwing(new NetDataValue(Message.STATUS_STOP, new SerialInt(modOpis.profilerMaxTicks))); for (EntityPlayerMP player : PlayerTracker.INSTANCE.playersSwing){ - OpisPacketHandler_OLD.sendFullUpdate(player); + PacketManager.sendFullUpdate(player); } diff --git a/src/main/java/mcp/mobius/opis/events/PlayerTracker.java b/src/main/java/mcp/mobius/opis/events/PlayerTracker.java index 62cdda3..864f19c 100644 --- a/src/main/java/mcp/mobius/opis/events/PlayerTracker.java +++ b/src/main/java/mcp/mobius/opis/events/PlayerTracker.java @@ -9,7 +9,6 @@ import mcp.mobius.opis.modOpis; import mcp.mobius.opis.data.holders.basetypes.SerialLong; import mcp.mobius.opis.data.managers.StringCache; import mcp.mobius.opis.gui.overlay.OverlayStatus; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.AccessLevel; import mcp.mobius.opis.network.enums.Message; diff --git a/src/main/java/mcp/mobius/opis/modOpis.java b/src/main/java/mcp/mobius/opis/modOpis.java index d8fd820..eb03408 100644 --- a/src/main/java/mcp/mobius/opis/modOpis.java +++ b/src/main/java/mcp/mobius/opis/modOpis.java @@ -48,7 +48,7 @@ import mcp.mobius.opis.events.OpisServerEventHandler; import mcp.mobius.opis.events.OpisServerTickHandler; import mcp.mobius.opis.events.PlayerTracker; import mcp.mobius.opis.helpers.ModIdentification; -import mcp.mobius.opis.network.OpisPacketHandler_OLD; +import mcp.mobius.opis.network.PacketManager; import mcp.mobius.opis.network.enums.AccessLevel; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.proxy.ProxyServer; @@ -131,6 +131,8 @@ public class modOpis { FMLCommonHandler.instance().bus().register(OpisServerTickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(PlayerTracker.INSTANCE); //Packet.addIdClassMapping(251, true, true, Packet251Extended.class); + + PacketManager.init(); } @EventHandler diff --git a/src/main/java/mcp/mobius/opis/network/OpisPacketHandler_OLD.java b/src/main/java/mcp/mobius/opis/network/OpisPacketHandler_OLD.java deleted file mode 100644 index e1202ed..0000000 --- a/src/main/java/mcp/mobius/opis/network/OpisPacketHandler_OLD.java +++ /dev/null @@ -1,119 +0,0 @@ -package mcp.mobius.opis.network; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.logging.Level; - -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; - -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table.Cell; - -import mapwriter.Mw; -import mcp.mobius.mobiuscore.profiler.ProfilerSection; -import mcp.mobius.opis.modOpis; -import mcp.mobius.opis.api.MessageHandlerRegistrar; -import mcp.mobius.opis.data.client.DataCache; -import mcp.mobius.opis.data.holders.ISerializable; -import mcp.mobius.opis.data.holders.basetypes.AmountHolder; -import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock; -import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk; -import mcp.mobius.opis.data.holders.basetypes.SerialDouble; -import mcp.mobius.opis.data.holders.basetypes.SerialInt; -import mcp.mobius.opis.data.holders.basetypes.SerialLong; -import mcp.mobius.opis.data.holders.basetypes.TicketData; -import mcp.mobius.opis.data.holders.newtypes.DataBlockTick; -import mcp.mobius.opis.data.holders.newtypes.DataBlockTileEntityPerClass; -import mcp.mobius.opis.data.holders.newtypes.DataEntity; -import mcp.mobius.opis.data.holders.newtypes.DataEntityPerClass; -import mcp.mobius.opis.data.holders.newtypes.DataEvent; -import mcp.mobius.opis.data.holders.newtypes.DataHandler; -import mcp.mobius.opis.data.holders.newtypes.DataNetworkTick; -import mcp.mobius.opis.data.holders.newtypes.DataBlockTileEntity; -import mcp.mobius.opis.data.holders.newtypes.DataTiming; -import mcp.mobius.opis.data.holders.stats.StatsChunk; -import mcp.mobius.opis.data.managers.ChunkManager; -import mcp.mobius.opis.data.managers.EntityManager; -import mcp.mobius.opis.data.managers.TickHandlerManager; -import mcp.mobius.opis.data.managers.TileEntityManager; -import mcp.mobius.opis.data.profilers.ProfilerEvent; -import mcp.mobius.opis.events.PlayerTracker; -import mcp.mobius.opis.gui.overlay.OverlayLoadedChunks; -import mcp.mobius.opis.gui.overlay.OverlayMeanTime; -import mcp.mobius.opis.gui.overlay.OverlayStatus; -import mcp.mobius.opis.gui.overlay.entperchunk.OverlayEntityPerChunk; -import mcp.mobius.opis.network.enums.AccessLevel; -import mcp.mobius.opis.network.enums.Message; -import mcp.mobius.opis.network.enums.Packets; -import mcp.mobius.opis.network.packets.server.Packet_Chunks_OLD; -import mcp.mobius.opis.network.packets.server.Packet_DataOverlayChunkEntities_OLD; -import mcp.mobius.opis.network.packets.server.Packet_Tickets_OLD; -import mcp.mobius.opis.swing.SwingUI; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.DimensionManager; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; - -public class OpisPacketHandler_OLD implements IPacketHandler { - - /* - @Override - public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, EntityPlayerMP player) { - if (packet.channel.equals("Opis") || packet.channel.equals("Opis_Chunk")) { - byte header = this.getHeader(packet); - - if (header == -1) return; - - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) - this.onPacketToClient(manager, packet, player, header); - } - } - */ - - void onPacketToClient(INetworkManager manager, Packet250CustomPayload packet, EntityPlayerMP player, Byte header) { - - if (header == Packets.TICKETS){ - Packet_Tickets_OLD castedPacket = new Packet_Tickets_OLD(packet); - OverlayLoadedChunks.instance().setupTable(castedPacket.tickets); - } - - else if (header == Packets.CHUNKS){ - Packet_Chunks_OLD castedPacket = Packet_Chunks_OLD.read(packet); - if (castedPacket != null) - Mw.instance.chunkManager.forceChunks(castedPacket.chunks); - } - - else if (header == Packets.DATA_OVERLAY_CHUNK_ENTITIES){ - Packet_DataOverlayChunkEntities_OLD castedPacket = new Packet_DataOverlayChunkEntities_OLD(packet); - OverlayEntityPerChunk.instance().overlayData = castedPacket.chunkStatus; - OverlayEntityPerChunk.instance().reduceData(); - OverlayEntityPerChunk.instance().setupChunkTable(); - } - } - - /* - public byte getHeader(Packet250CustomPayload packet){ - try{ - DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); - return inputStream.readByte(); - } catch (Exception e){ - return -1; - } - } - */ - - - - - - - -} diff --git a/src/main/java/mcp/mobius/opis/network/PacketManager.java b/src/main/java/mcp/mobius/opis/network/PacketManager.java index c558e17..39bd7a9 100644 --- a/src/main/java/mcp/mobius/opis/network/PacketManager.java +++ b/src/main/java/mcp/mobius/opis/network/PacketManager.java @@ -48,8 +48,12 @@ import mcp.mobius.opis.events.PlayerTracker; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.client.PacketReqChunks; import mcp.mobius.opis.network.packets.client.PacketReqData; +import mcp.mobius.opis.network.packets.server.NetDataCommand; import mcp.mobius.opis.network.packets.server.NetDataList; import mcp.mobius.opis.network.packets.server.NetDataValue; +import mcp.mobius.opis.network.packets.server.PacketChunks; +import mcp.mobius.opis.network.packets.server.PacketDataOverlayChunkEntities; +import mcp.mobius.opis.network.packets.server.PacketTickets; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -80,9 +84,13 @@ public class PacketManager extends FMLIndexedMessageToMessageCodec return; INSTANCE.addDiscriminator(0, PacketReqChunks.class); - INSTANCE.addDiscriminator(0, PacketReqData.class); - //INSTANCE.addDiscriminator(1, PacketShowToggle.class); - //INSTANCE.addDiscriminator(2, PacketKey.class); + INSTANCE.addDiscriminator(1, PacketReqData.class); + INSTANCE.addDiscriminator(2, NetDataCommand.class); + INSTANCE.addDiscriminator(3, NetDataList.class); + INSTANCE.addDiscriminator(4, NetDataValue.class); + INSTANCE.addDiscriminator(5, PacketChunks.class); + INSTANCE.addDiscriminator(6, PacketTickets.class); + INSTANCE.addDiscriminator(7, PacketDataOverlayChunkEntities.class); channels.putAll(NetworkRegistry.INSTANCE.newChannel("Opis", INSTANCE)); } @@ -163,8 +171,8 @@ public class PacketManager extends FMLIndexedMessageToMessageCodec public static void sendToAll(PacketBase packet) { - channels.get(SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); - channels.get(SERVER).writeAndFlush(packet); + channels.get(SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + channels.get(SERVER).writeAndFlush(packet); } public static Packet toMcPacket(PacketBase packet) diff --git a/src/main/java/mcp/mobius/opis/network/ServerMessageHandler.java b/src/main/java/mcp/mobius/opis/network/ServerMessageHandler.java index 86f7646..74166b4 100644 --- a/src/main/java/mcp/mobius/opis/network/ServerMessageHandler.java +++ b/src/main/java/mcp/mobius/opis/network/ServerMessageHandler.java @@ -41,8 +41,8 @@ import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataCommand; import mcp.mobius.opis.network.packets.server.NetDataList; import mcp.mobius.opis.network.packets.server.NetDataValue; -import mcp.mobius.opis.network.packets.server.Packet_DataOverlayChunkEntities_OLD; -import mcp.mobius.opis.network.packets.server.Packet_Tickets_OLD; +import mcp.mobius.opis.network.packets.server.PacketDataOverlayChunkEntities; +import mcp.mobius.opis.network.packets.server.PacketTickets; import mcp.mobius.opis.swing.SelectedTab; public class ServerMessageHandler { @@ -84,7 +84,7 @@ public class ServerMessageHandler { } else if (maintype == Message.LIST_CHUNK_TICKETS){ - PacketManager.sendToPlayer(new Packet_Tickets(ChunkManager.INSTANCE.getTickets()), player); + PacketManager.sendToPlayer(new PacketTickets(ChunkManager.INSTANCE.getTickets()), player); } else if (maintype == Message.LIST_TIMING_TILEENTS){ @@ -244,7 +244,7 @@ public class ServerMessageHandler { for (CoordinatesChunk chunk : entities.keySet()) perChunk.put(chunk, entities.get(chunk).size()); - PacketManager.sendToPlayer(Packet_DataOverlayChunkEntities_OLD.create(perChunk), player); + PacketManager.sendToPlayer(new PacketDataOverlayChunkEntities(perChunk), player); } } diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/NetDataList.java b/src/main/java/mcp/mobius/opis/network/packets/server/NetDataList.java index 2da35dc..2bd2dae 100644 --- a/src/main/java/mcp/mobius/opis/network/packets/server/NetDataList.java +++ b/src/main/java/mcp/mobius/opis/network/packets/server/NetDataList.java @@ -23,7 +23,7 @@ public class NetDataList extends PacketBase { public NetDataList(Message msg, List data) { this.msg = msg; - this.array = (ArrayList) data; + this.array = new ArrayList(data); } @Override diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/PacketChunks.java b/src/main/java/mcp/mobius/opis/network/packets/server/PacketChunks.java new file mode 100644 index 0000000..601eae0 --- /dev/null +++ b/src/main/java/mcp/mobius/opis/network/packets/server/PacketChunks.java @@ -0,0 +1,38 @@ +package mcp.mobius.opis.network.packets.server; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import mapwriter.Mw; +import mapwriter.region.MwChunk; +import mcp.mobius.opis.api.MessageHandlerRegistrar; +import mcp.mobius.opis.network.PacketBase; + +public class PacketChunks extends PacketBase{ + + public int dim; + public MwChunk[] chunks; + + @Override + public void encode(ByteArrayDataOutput output) { + // TODO Auto-generated method stub + + } + + @Override + public void decode(ByteArrayDataInput input) { + // TODO Auto-generated method stub + + } + + @SideOnly(Side.CLIENT) + public void actionClient(World world, EntityPlayer player){ + Mw.instance.chunkManager.forceChunks(this.chunks); + } + +} diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/PacketDataOverlayChunkEntities.java b/src/main/java/mcp/mobius/opis/network/packets/server/PacketDataOverlayChunkEntities.java new file mode 100644 index 0000000..0017a3b --- /dev/null +++ b/src/main/java/mcp/mobius/opis/network/packets/server/PacketDataOverlayChunkEntities.java @@ -0,0 +1,55 @@ +package mcp.mobius.opis.network.packets.server; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk; +import mcp.mobius.opis.gui.overlay.OverlayLoadedChunks; +import mcp.mobius.opis.gui.overlay.entperchunk.OverlayEntityPerChunk; +import mcp.mobius.opis.network.PacketBase; + +public class PacketDataOverlayChunkEntities extends PacketBase { + + public HashMap chunkStatus = new HashMap(); + + public PacketDataOverlayChunkEntities(){} + public PacketDataOverlayChunkEntities(HashMap chunks){ + this.chunkStatus = chunks; + } + + @Override + public void encode(ByteArrayDataOutput output) { + output.writeInt(chunkStatus.size()); + for (CoordinatesChunk chunk : chunkStatus.keySet()){ + chunk.writeToStream(output); + output.writeInt(chunkStatus.get(chunk)); + } + + } + + @Override + public void decode(ByteArrayDataInput input) { + int nchunks = input.readInt(); + + for (int i = 0; i <= nchunks; i++){ + CoordinatesChunk chunk = CoordinatesChunk.readFromStream(input); + this.chunkStatus.put(chunk, input.readInt()); + } + + } + + @SideOnly(Side.CLIENT) + public void actionClient(World world, EntityPlayer player){ + OverlayEntityPerChunk.instance().overlayData = this.chunkStatus; + OverlayEntityPerChunk.instance().reduceData(); + OverlayEntityPerChunk.instance().setupChunkTable(); + } + +} diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/PacketTickets.java b/src/main/java/mcp/mobius/opis/network/packets/server/PacketTickets.java new file mode 100644 index 0000000..2bba115 --- /dev/null +++ b/src/main/java/mcp/mobius/opis/network/packets/server/PacketTickets.java @@ -0,0 +1,50 @@ +package mcp.mobius.opis.network.packets.server; + +import java.util.HashSet; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import mcp.mobius.opis.api.MessageHandlerRegistrar; +import mcp.mobius.opis.data.holders.basetypes.TicketData; +import mcp.mobius.opis.gui.overlay.OverlayLoadedChunks; +import mcp.mobius.opis.network.PacketBase; + +public class PacketTickets extends PacketBase { + + public HashSet tickets = new HashSet(); + + public PacketTickets(){} + public PacketTickets(HashSet data){ + this.tickets = data; + } + + @Override + public void encode(ByteArrayDataOutput output) { + output.writeInt(tickets.size()); + for (TicketData ticket : tickets) + ticket.writeToStream(output); + + } + + @Override + public void decode(ByteArrayDataInput input) { + this.header = input.readByte(); + int ntickets = input.readInt(); + + for (int i = 0; i < ntickets; i++) + tickets.add(TicketData.readFromStream(input)); + + } + + @SideOnly(Side.CLIENT) + public void actionClient(World world, EntityPlayer player){ + OverlayLoadedChunks.instance().setupTable(this.tickets); + } + +} diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/Packet_Chunks_OLD.java b/src/main/java/mcp/mobius/opis/network/packets/server/Packet_Chunks_OLD.java deleted file mode 100644 index 6f6cedb..0000000 --- a/src/main/java/mcp/mobius/opis/network/packets/server/Packet_Chunks_OLD.java +++ /dev/null @@ -1,248 +0,0 @@ -package mcp.mobius.opis.network.packets.server; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.logging.Level; - - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import mapwriter.region.MwChunk; -import mcp.mobius.opis.modOpis; -import mcp.mobius.opis.network.PacketManager; -import mcp.mobius.opis.network.enums.Packets; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.NibbleArray; -import net.minecraft.world.chunk.storage.ExtendedBlockStorage; - -public class Packet_Chunks_OLD { - - public static int MAXPACKETSIZE = 30000; // This should be set to 32k but can be made lower for testing - - public byte header; - public int dim; - public MwChunk[] chunks; - - private static ByteArrayOutputStream bosPayload = new ByteArrayOutputStream(1); - private static DataOutputStream streamPayload = new DataOutputStream(bosPayload); - - @SideOnly(Side.CLIENT) - public static Packet_Chunks_OLD read(Packet250CustomPayload packet) { - DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); - Packet_Chunks_OLD retPacket = null; - - byte header; - int dataSize; - - try{ - header = inputStream.readByte(); - dataSize = inputStream.readInt(); - - if (dataSize == -1){ - retPacket = new Packet_Chunks_OLD(bosPayload.toByteArray()); - bosPayload.reset(); - } else { - byte[] buffer = new byte[dataSize]; - int readBytes = 0; - while ((readBytes = inputStream.read(buffer)) != -1){ - streamPayload.write(buffer); - } - } - - } catch (IOException e){} - - return retPacket; - } - - public static Packet250CustomPayload[] createPackets(String channel, byte header, byte[] data){ - Packet250CustomPayload[] packets = new Packet250CustomPayload[(data.length / MAXPACKETSIZE) + 2]; // Might require a small change to take round values into account - - ByteArrayInputStream bis = new ByteArrayInputStream(data); - DataInputStream dataStream = new DataInputStream(bis); - int packetIndex = 0; - int readBytes = 0; - - while(readBytes != -1){ - Packet250CustomPayload tmpPacket = new Packet250CustomPayload(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1); - DataOutputStream outputStream = new DataOutputStream(bos); - - try{ - - outputStream.writeByte(header); - byte[] buffer = new byte[MAXPACKETSIZE]; - readBytes = dataStream.read(buffer); - outputStream.writeInt(readBytes); - - if (readBytes != -1) - outputStream.write(buffer); - - } catch (IOException e){} - - tmpPacket.channel = channel; - tmpPacket.data = bos.toByteArray(); - tmpPacket.length = bos.size(); - - packets[packetIndex] = tmpPacket; - packetIndex += 1; - } - return packets; - } - - - - @SideOnly(Side.CLIENT) - public Packet_Chunks_OLD(byte[] data) { - DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(data)); - - try{ - this.header = inputStream.readByte(); - this.dim = inputStream.readInt(); - boolean hasNoSky = inputStream.readBoolean(); - - Packet56MapChunks chunkPacket = new Packet56MapChunks(); - chunkPacket.readPacketData(inputStream); - this.chunks = new MwChunk[chunkPacket.getNumberOfChunkInPacket()]; - for (int i = 0; i < chunkPacket.getNumberOfChunkInPacket(); i++){ - - MwChunk newChunk; - newChunk = this.unpackChunk(dim, chunkPacket.getChunkPosX(i), chunkPacket.getChunkPosZ(i), chunkPacket.getChunkCompressedData(i), chunkPacket.field_73590_a[i], chunkPacket.field_73588_b[i], true, hasNoSky); - this.chunks[i] = newChunk; - } - - } catch (IOException e){} - } - - public static void send(int dim, boolean hasNoSky, ArrayList chunks, EntityPlayerMP player){ - Packet250CustomPayload packet = create(dim, hasNoSky, chunks); - Packet250CustomPayload[] packets = createPackets("Opis_Chunk", Packets.CHUNKS, packet.data); - - for (Packet250CustomPayload p : packets){ - if (p != null) - PacketManager.sendToPlayer(p, player); - } - } - - private static Packet250CustomPayload create(int dim, boolean hasNoSky, ArrayList chunks){ - //Packet250CustomPayload packet = new Packet250CustomPayload(); - Packet250CustomPayload packet = new Packet250CustomPayload(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1); - DataOutputStream outputStream = new DataOutputStream(bos); - - Packet56MapChunks chunkPacket = new Packet56MapChunks(chunks); - - try{ - outputStream.writeByte(Packets.CHUNKS); - outputStream.writeInt(dim); - outputStream.writeBoolean(hasNoSky); - chunkPacket.writePacketData(outputStream); - }catch(IOException e){} - - packet.channel = "Opis_Chunk"; - packet.data = bos.toByteArray(); - packet.length = bos.size(); - - return packet; - } - - public MwChunk unpackChunk(int dim, int x, int z, byte[] compressedData, int chunkExistFlag, int chunkHasAddSectionFlag, boolean par4, boolean hasNoSky) - { - ExtendedBlockStorage[] storageArrays = new ExtendedBlockStorage[16]; - byte[] blockBiomeArray = new byte[256]; - - int k = 0; - - for (int l = 0; l < storageArrays.length; ++l){ - if ((chunkExistFlag & 1 << l) != 0){ - if (storageArrays[l] == null) - storageArrays[l] = new ExtendedBlockStorage(l << 4, hasNoSky); - - byte[] abyte1 = storageArrays[l].getBlockLSBArray(); - System.arraycopy(compressedData, k, abyte1, 0, abyte1.length); - k += abyte1.length; - } - else if (par4 && storageArrays[l] != null) - storageArrays[l] = null; - } - - NibbleArray nibblearray; - - for (int l = 0; l < storageArrays.length; ++l){ - if ((chunkExistFlag & 1 << l) != 0 && storageArrays[l] != null){ - nibblearray = storageArrays[l].getMetadataArray(); - System.arraycopy(compressedData, k, nibblearray.data, 0, nibblearray.data.length); - k += nibblearray.data.length; - } - } - - for (int l = 0; l < storageArrays.length; ++l){ - if ((chunkExistFlag & 1 << l) != 0 && storageArrays[l] != null){ - nibblearray = storageArrays[l].getBlocklightArray(); - System.arraycopy(compressedData, k, nibblearray.data, 0, nibblearray.data.length); - k += nibblearray.data.length; - } - } - - if (hasNoSky){ - for (int l = 0; l < storageArrays.length; ++l){ - if ((chunkExistFlag & 1 << l) != 0 && storageArrays[l] != null){ - nibblearray = storageArrays[l].getSkylightArray(); - System.arraycopy(compressedData, k, nibblearray.data, 0, nibblearray.data.length); - k += nibblearray.data.length; - } - } - } - - for (int l = 0; l < storageArrays.length; ++l){ - if ((chunkHasAddSectionFlag & 1 << l) != 0){ - if (storageArrays[l] == null) - k += 2048; - else{ - nibblearray = storageArrays[l].getBlockMSBArray(); - if (nibblearray == null) - nibblearray = storageArrays[l].createBlockMSBArray(); - - System.arraycopy(compressedData, k, nibblearray.data, 0, nibblearray.data.length); - k += nibblearray.data.length; - } - } - else if (par4 && storageArrays[l] != null && storageArrays[l].getBlockMSBArray() != null) - storageArrays[l].clearMSBArray(); - } - - if (par4){ - System.arraycopy(compressedData, k, blockBiomeArray, 0, blockBiomeArray.length); - int i1 = k + blockBiomeArray.length; - } - - for (int l = 0; l < storageArrays.length; ++l) - if (storageArrays[l] != null && (chunkExistFlag & 1 << l) != 0) - storageArrays[l].removeInvalidBlocks(); - - //int x, int z, int dimension, byte[][] msbArray, byte[][] lsbArray, byte[][] metaArray, byte[] biomeArray - - byte[][] msbArray = new byte[16][]; - byte[][] lsbArray = new byte[16][]; - byte[][] metaArray = new byte[16][]; - byte[][] lightingArray = new byte[16][]; - - if (storageArrays != null) { - for (ExtendedBlockStorage storage : storageArrays) { - if (storage != null) { - int y = (storage.getYLocation() >> 4) & 0xf; - lsbArray[y] = storage.getBlockLSBArray(); - msbArray[y] = (storage.getBlockMSBArray() != null) ? storage.getBlockMSBArray().data : null; - metaArray[y] = (storage.getMetadataArray() != null) ? storage.getMetadataArray().data : null; - lightingArray[y] = (storage.getBlocklightArray() != null) ? storage.getBlocklightArray().data : null; - } - } - } - - return new MwChunk(x, z, dim, msbArray, lsbArray, metaArray, lightingArray, blockBiomeArray); - } -} diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/Packet_DataOverlayChunkEntities_OLD.java b/src/main/java/mcp/mobius/opis/network/packets/server/Packet_DataOverlayChunkEntities_OLD.java deleted file mode 100644 index 9a066d9..0000000 --- a/src/main/java/mcp/mobius/opis/network/packets/server/Packet_DataOverlayChunkEntities_OLD.java +++ /dev/null @@ -1,58 +0,0 @@ -package mcp.mobius.opis.network.packets.server; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.HashMap; - -import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk; -import mcp.mobius.opis.network.enums.Packets; -import net.minecraft.world.ChunkCoordIntPair; - -public class Packet_DataOverlayChunkEntities_OLD { - - public byte header; - public HashMap chunkStatus = new HashMap(); - - public Packet_DataOverlayChunkEntities_OLD(Packet250CustomPayload packet) { - DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); - this.chunkStatus.clear(); - - try{ - this.header = inputStream.readByte(); - int nchunks = inputStream.readInt(); - - for (int i = 0; i <= nchunks; i++){ - CoordinatesChunk chunk = CoordinatesChunk.readFromStream(inputStream); - this.chunkStatus.put(chunk, inputStream.readInt()); - } - - - } catch (IOException e){} - } - - public static Packet250CustomPayload create(HashMap chunks){ - Packet250CustomPayload packet = new Packet250CustomPayload(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1); - DataOutputStream outputStream = new DataOutputStream(bos); - - try{ - outputStream.writeByte(Packets.DATA_OVERLAY_CHUNK_ENTITIES); - outputStream.writeInt(chunks.size()); - for (CoordinatesChunk chunk : chunks.keySet()){ - chunk.writeToStream(outputStream); - outputStream.writeInt(chunks.get(chunk)); - } - - }catch(IOException e){} - - packet.channel = "Opis"; - packet.data = bos.toByteArray(); - packet.length = bos.size(); - - return packet; - } - -} diff --git a/src/main/java/mcp/mobius/opis/network/packets/server/Packet_Tickets_OLD.java b/src/main/java/mcp/mobius/opis/network/packets/server/Packet_Tickets_OLD.java deleted file mode 100644 index 122aec9..0000000 --- a/src/main/java/mcp/mobius/opis/network/packets/server/Packet_Tickets_OLD.java +++ /dev/null @@ -1,50 +0,0 @@ -package mcp.mobius.opis.network.packets.server; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.HashSet; - -import mcp.mobius.opis.data.holders.basetypes.TicketData; -import mcp.mobius.opis.network.enums.Packets; - -public class Packet_Tickets_OLD { - - public byte header; - public HashSet tickets = new HashSet(); - - public Packet_Tickets_OLD(Packet250CustomPayload packet) { - DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); - - try{ - this.header = inputStream.readByte(); - int ntickets = inputStream.readInt(); - - for (int i = 0; i < ntickets; i++) - tickets.add(TicketData.readFromStream(inputStream)); - - } catch (IOException e){} - } - - public static Packet250CustomPayload create(HashSet data){ - Packet250CustomPayload packet = new Packet250CustomPayload(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1); - DataOutputStream outputStream = new DataOutputStream(bos); - - try{ - outputStream.writeByte(Packets.TICKETS); - outputStream.writeInt(data.size()); - for (TicketData ticket : data) - ticket.writeToStream(outputStream); - }catch(IOException e){} - - packet.channel = "Opis"; - packet.data = bos.toByteArray(); - packet.length = bos.size(); - - return packet; - } - -} diff --git a/src/main/java/net/minecraft/world/World.java b/src/main/java/net/minecraft/world/World.java new file mode 100644 index 0000000..bc22bd2 --- /dev/null +++ b/src/main/java/net/minecraft/world/World.java @@ -0,0 +1,4442 @@ +package net.minecraft.world; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.BlockSnow; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.material.Material; +import net.minecraft.command.IEntitySelector; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathFinder; +import net.minecraft.profiler.Profiler; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.Direction; +import net.minecraft.util.Facing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3Pool; +import net.minecraft.village.VillageCollection; +import net.minecraft.village.VillageSiege; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.MapStorage; +import net.minecraft.world.storage.WorldInfo; + +import cpw.mods.fml.common.FMLLog; + +import com.google.common.collect.ImmutableSetMultimap; + +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.WorldSpecificSaveHandler; +import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; +import net.minecraft.entity.EnumCreatureType; + +public abstract class World implements IBlockAccess +{ + /** + * Used in the getEntitiesWithinAABB functions to expand the search area for entities. + * Modders should change this variable to a higher value if it is less then the radius + * of one of there entities. + */ + public static double MAX_ENTITY_RADIUS = 2.0D; + + public final MapStorage perWorldStorage; + + /** + * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately + */ + public boolean scheduledUpdatesAreImmediate; + /** A list of all Entities in all currently-loaded chunks */ + public List loadedEntityList = new ArrayList(); + protected List unloadedEntityList = new ArrayList(); + /** A list of the loaded tile entities in the world */ + public List loadedTileEntityList = new ArrayList(); + private List addedTileEntityList = new ArrayList(); + private List field_147483_b = new ArrayList(); + /** Array list of players in the world. */ + public List playerEntities = new ArrayList(); + /** a list of all the lightning entities */ + public List weatherEffects = new ArrayList(); + private long cloudColour = 16777215L; + /** How much light is subtracted from full daylight */ + public int skylightSubtracted; + /** + * Contains the current Linear Congruential Generator seed for block updates. Used with an A value of 3 and a C + * value of 0x3c6ef35f, producing a highly planar series of values ill-suited for choosing random blocks in a + * 16x128x16 field. + */ + protected int updateLCG = (new Random()).nextInt(); + /** + * magic number used to generate fast random numbers for 3d distribution within a chunk + */ + protected final int DIST_HASH_MAGIC = 1013904223; + public float prevRainingStrength; + public float rainingStrength; + public float prevThunderingStrength; + public float thunderingStrength; + /** + * Set to 2 whenever a lightning bolt is generated in SSP. Decrements if > 0 in updateWeather(). Value appears to be + * unused. + */ + public int lastLightningBolt; + /** Option > Difficulty setting (0 - 3) */ + public EnumDifficulty difficultySetting; + /** RNG for World. */ + public Random rand = new Random(); + /** The WorldProvider instance that World uses. */ + public final WorldProvider provider; + protected List worldAccesses = new ArrayList(); + /** Handles chunk operations and caching */ + protected IChunkProvider chunkProvider; + protected final ISaveHandler saveHandler; + /** + * holds information about a world (size on disk, time, spawn point, seed, ...) + */ + protected WorldInfo worldInfo; + /** Boolean that is set to true when trying to find a spawn point */ + public boolean findingSpawnPoint; + public MapStorage mapStorage; + public VillageCollection villageCollectionObj; + protected final VillageSiege villageSiegeObj = new VillageSiege(this); + public final Profiler theProfiler; + /** The world-local pool of vectors */ + private final Vec3Pool vecPool = new Vec3Pool(300, 2000); + private final Calendar theCalendar = Calendar.getInstance(); + protected Scoreboard worldScoreboard = new Scoreboard(); + /** This is set to true for client worlds, and false for server worlds. */ + public boolean isRemote; + /** Positions to update */ + public Set activeChunkSet = new HashSet(); + /** number of ticks until the next random ambients play */ + private int ambientTickCountdown; + /** indicates if enemies are spawned or not */ + protected boolean spawnHostileMobs; + /** A flag indicating whether we should spawn peaceful mobs. */ + protected boolean spawnPeacefulMobs; + private ArrayList collidingBoundingBoxes; + private boolean field_147481_N; + /** + * is a temporary list of blocks and light values used when updating light levels. Holds up to 32x32x32 blocks (the + * maximum influence of a light source.) Every element is a packed bit value: 0000000000LLLLzzzzzzyyyyyyxxxxxx. The + * 4-bit L is a light level used when darkening blocks. 6-bit numbers x, y and z represent the block's offset from + * the original block, plus 32 (i.e. value of 31 would mean a -1 offset + */ + int[] lightUpdateBlockList; + private static final String __OBFID = "CL_00000140"; + + /** + * Gets the biome for a given set of x/z coordinates + */ + public BiomeGenBase getBiomeGenForCoords(final int par1, final int par2) + { + return provider.getBiomeGenForCoords(par1, par2); + } + + public BiomeGenBase getBiomeGenForCoordsBody(final int par1, final int par2) + { + if (this.blockExists(par1, 0, par2)) + { + Chunk chunk = this.getChunkFromBlockCoords(par1, par2); + + try + { + return chunk.getBiomeGenForWorldCoords(par1 & 15, par2 & 15, this.provider.worldChunkMgr); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting biome"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Coordinates of biome request"); + crashreportcategory.addCrashSectionCallable("Location", new Callable() + { + private static final String __OBFID = "CL_00000141"; + public String call() + { + return CrashReportCategory.getLocationInfo(par1, 0, par2); + } + }); + throw new ReportedException(crashreport); + } + } + else + { + return this.provider.worldChunkMgr.getBiomeGenAt(par1, par2); + } + } + + public WorldChunkManager getWorldChunkManager() + { + return this.provider.worldChunkMgr; + } + + @SideOnly(Side.CLIENT) + public World(ISaveHandler p_i45368_1_, String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_) + { + this.ambientTickCountdown = this.rand.nextInt(12000); + this.spawnHostileMobs = true; + this.spawnPeacefulMobs = true; + this.collidingBoundingBoxes = new ArrayList(); + this.lightUpdateBlockList = new int[32768]; + this.saveHandler = p_i45368_1_; + this.theProfiler = p_i45368_5_; + this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_); + this.provider = p_i45368_3_; + perWorldStorage = new MapStorage((ISaveHandler)null); + } + + // Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes + @SideOnly(Side.CLIENT) + protected void finishSetup() + { + VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); + this.mapStorage.setData("villages", this.villageCollectionObj); + } + else + { + this.villageCollectionObj = villagecollection; + this.villageCollectionObj.func_82566_a(this); + } + + // Guarantee the dimension ID was not reset by the provider + int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); + this.provider.dimensionId = providerDim; + this.chunkProvider = this.createChunkProvider(); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + } + + public World(ISaveHandler p_i45369_1_, String p_i45369_2_, WorldSettings p_i45369_3_, WorldProvider p_i45369_4_, Profiler p_i45369_5_) + { + this.ambientTickCountdown = this.rand.nextInt(12000); + this.spawnHostileMobs = true; + this.spawnPeacefulMobs = true; + this.collidingBoundingBoxes = new ArrayList(); + this.lightUpdateBlockList = new int[32768]; + this.saveHandler = p_i45369_1_; + this.theProfiler = p_i45369_5_; + this.mapStorage = getMapStorage(p_i45369_1_); + this.worldInfo = p_i45369_1_.loadWorldInfo(); + + if (p_i45369_4_ != null) + { + this.provider = p_i45369_4_; + } + else if (this.worldInfo != null && this.worldInfo.getVanillaDimension() != 0) + { + this.provider = WorldProvider.getProviderForDimension(this.worldInfo.getVanillaDimension()); + } + else + { + this.provider = WorldProvider.getProviderForDimension(0); + } + + if (this.worldInfo == null) + { + this.worldInfo = new WorldInfo(p_i45369_3_, p_i45369_2_); + } + else + { + this.worldInfo.setWorldName(p_i45369_2_); + } + + this.provider.registerWorld(this); + this.chunkProvider = this.createChunkProvider(); + + if (this instanceof WorldServer) + { + this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, p_i45369_1_)); + } + else + { + this.perWorldStorage = new MapStorage((ISaveHandler)null); + } + + if (!this.worldInfo.isInitialized()) + { + try + { + this.initialize(p_i45369_3_); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception initializing level"); + + try + { + this.addWorldInfoToCrashReport(crashreport); + } + catch (Throwable throwable) + { + ; + } + + throw new ReportedException(crashreport); + } + + this.worldInfo.setServerInitialized(true); + } + + VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, "villages"); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); + this.perWorldStorage.setData("villages", this.villageCollectionObj); + } + else + { + this.villageCollectionObj = villagecollection; + this.villageCollectionObj.func_82566_a(this); + } + + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + } + + private static MapStorage s_mapStorage; + private static ISaveHandler s_savehandler; + //Provides a solution for different worlds getting different copies of the same data, potentially rewriting the data or causing race conditions/stale data + //Buildcraft has suffered from the issue this fixes. If you load the same data from two different worlds they can get two different copies of the same object, thus the last saved gets final say. + private MapStorage getMapStorage(ISaveHandler savehandler) + { + if (s_savehandler != savehandler || s_mapStorage == null) + { + s_mapStorage = new MapStorage(savehandler); + s_savehandler = savehandler; + } + return s_mapStorage; + } + + /** + * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? + */ + protected abstract IChunkProvider createChunkProvider(); + + protected void initialize(WorldSettings par1WorldSettings) + { + this.worldInfo.setServerInitialized(true); + } + + /** + * Sets a new spawn location by finding an uncovered block at a random (x,z) location in the chunk. + */ + @SideOnly(Side.CLIENT) + public void setSpawnLocation() + { + this.setSpawnLocation(8, 64, 8); + } + + public Block getTopBlock(int p_147474_1_, int p_147474_2_) + { + int k; + + for (k = 63; !this.isAirBlock(p_147474_1_, k + 1, p_147474_2_); ++k) + { + ; + } + + return this.getBlock(p_147474_1_, k, p_147474_2_); + } + + public Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_) + { + if (p_147439_1_ >= -30000000 && p_147439_3_ >= -30000000 && p_147439_1_ < 30000000 && p_147439_3_ < 30000000 && p_147439_2_ >= 0 && p_147439_2_ < 256) + { + Chunk chunk = null; + + try + { + chunk = this.getChunkFromChunkCoords(p_147439_1_ >> 4, p_147439_3_ >> 4); + return chunk.getBlock(p_147439_1_ & 15, p_147439_2_, p_147439_3_ & 15); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception getting block type in world"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Requested block coordinates"); + crashreportcategory.addCrashSection("Found chunk", Boolean.valueOf(chunk == null)); + crashreportcategory.addCrashSection("Location", CrashReportCategory.getLocationInfo(p_147439_1_, p_147439_2_, p_147439_3_)); + throw new ReportedException(crashreport); + } + } + else + { + return Blocks.air; + } + } + + /** + * Returns true if the block at the specified coordinates is empty + */ + public boolean isAirBlock(int p_147437_1_, int p_147437_2_, int p_147437_3_) + { + Block block = this.getBlock(p_147437_1_, p_147437_2_, p_147437_3_); + return block.isAir(this, p_147437_1_, p_147437_2_, p_147437_3_); + } + + /** + * Returns whether a block exists at world coordinates x, y, z + */ + public boolean blockExists(int par1, int par2, int par3) + { + return par2 >= 0 && par2 < 256 ? this.chunkExists(par1 >> 4, par3 >> 4) : false; + } + + /** + * Checks if any of the chunks within distance (argument 4) blocks of the given block exist + */ + public boolean doChunksNearChunkExist(int par1, int par2, int par3, int par4) + { + return this.checkChunksExist(par1 - par4, par2 - par4, par3 - par4, par1 + par4, par2 + par4, par3 + par4); + } + + /** + * Checks between a min and max all the chunks inbetween actually exist. Args: minX, minY, minZ, maxX, maxY, maxZ + */ + public boolean checkChunksExist(int par1, int par2, int par3, int par4, int par5, int par6) + { + if (par5 >= 0 && par2 < 256) + { + par1 >>= 4; + par3 >>= 4; + par4 >>= 4; + par6 >>= 4; + + for (int k1 = par1; k1 <= par4; ++k1) + { + for (int l1 = par3; l1 <= par6; ++l1) + { + if (!this.chunkExists(k1, l1)) + { + return false; + } + } + } + + return true; + } + else + { + return false; + } + } + + /** + * Returns whether a chunk exists at chunk coordinates x, y + */ + protected boolean chunkExists(int par1, int par2) + { + return this.chunkProvider.chunkExists(par1, par2); + } + + /** + * Returns a chunk looked up by block coordinates. Args: x, z + */ + public Chunk getChunkFromBlockCoords(int par1, int par2) + { + return this.getChunkFromChunkCoords(par1 >> 4, par2 >> 4); + } + + /** + * Returns back a chunk looked up by chunk coordinates Args: x, y + */ + public Chunk getChunkFromChunkCoords(int par1, int par2) + { + return this.chunkProvider.provideChunk(par1, par2); + } + + /** + * Sets the block ID and metadata at a given location. Args: X, Y, Z, new block ID, new metadata, flags. Flag 1 will + * cause a block update. Flag 2 will send the change to clients (you almost always want this). Flag 4 prevents the + * block from being re-rendered, if this is a client world. Flags can be added together. + */ + public boolean setBlock(int p_147465_1_, int p_147465_2_, int p_147465_3_, Block p_147465_4_, int p_147465_5_, int p_147465_6_) + { + if (p_147465_1_ >= -30000000 && p_147465_3_ >= -30000000 && p_147465_1_ < 30000000 && p_147465_3_ < 30000000) + { + if (p_147465_2_ < 0) + { + return false; + } + else if (p_147465_2_ >= 256) + { + return false; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(p_147465_1_ >> 4, p_147465_3_ >> 4); + Block block1 = null; + + if ((p_147465_6_ & 1) != 0) + { + block1 = chunk.getBlock(p_147465_1_ & 15, p_147465_2_, p_147465_3_ & 15); + } + + boolean flag = chunk.func_150807_a(p_147465_1_ & 15, p_147465_2_, p_147465_3_ & 15, p_147465_4_, p_147465_5_); + this.theProfiler.startSection("checkLight"); + this.func_147451_t(p_147465_1_, p_147465_2_, p_147465_3_); + this.theProfiler.endSection(); + + if (flag) + { + if ((p_147465_6_ & 2) != 0 && (!this.isRemote || (p_147465_6_ & 4) == 0) && chunk.func_150802_k()) + { + this.markBlockForUpdate(p_147465_1_, p_147465_2_, p_147465_3_); + } + + if (!this.isRemote && (p_147465_6_ & 1) != 0) + { + this.notifyBlockChange(p_147465_1_, p_147465_2_, p_147465_3_, block1); + + if (p_147465_4_.hasComparatorInputOverride()) + { + this.func_147453_f(p_147465_1_, p_147465_2_, p_147465_3_, p_147465_4_); + } + } + } + + return flag; + } + } + else + { + return false; + } + } + + /** + * Returns the block metadata at coords x,y,z + */ + public int getBlockMetadata(int par1, int par2, int par3) + { + if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000) + { + if (par2 < 0) + { + return 0; + } + else if (par2 >= 256) + { + return 0; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + par1 &= 15; + par3 &= 15; + return chunk.getBlockMetadata(par1, par2, par3); + } + } + else + { + return 0; + } + } + + /** + * Sets the blocks metadata and if set will then notify blocks that this block changed, depending on the flag. Args: + * x, y, z, metadata, flag. See setBlock for flag description + */ + public boolean setBlockMetadataWithNotify(int par1, int par2, int par3, int par4, int par5) + { + if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000) + { + if (par2 < 0) + { + return false; + } + else if (par2 >= 256) + { + return false; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + int j1 = par1 & 15; + int k1 = par3 & 15; + boolean flag = chunk.setBlockMetadata(j1, par2, k1, par4); + + if (flag) + { + Block block = chunk.getBlock(j1, par2, k1); + + if ((par5 & 2) != 0 && (!this.isRemote || (par5 & 4) == 0) && chunk.func_150802_k()) + { + this.markBlockForUpdate(par1, par2, par3); + } + + if (!this.isRemote && (par5 & 1) != 0) + { + this.notifyBlockChange(par1, par2, par3, block); + + if (block.hasComparatorInputOverride()) + { + this.func_147453_f(par1, par2, par3, block); + } + } + } + + return flag; + } + } + else + { + return false; + } + } + + /** + * Sets a block to 0 and notifies relevant systems with the block change Args: x, y, z + */ + public boolean setBlockToAir(int p_147468_1_, int p_147468_2_, int p_147468_3_) + { + return this.setBlock(p_147468_1_, p_147468_2_, p_147468_3_, Blocks.air, 0, 3); + } + + public boolean func_147480_a(int p_147480_1_, int p_147480_2_, int p_147480_3_, boolean p_147480_4_) + { + Block block = this.getBlock(p_147480_1_, p_147480_2_, p_147480_3_); + + if (block.getMaterial() == Material.air) + { + return false; + } + else + { + int l = this.getBlockMetadata(p_147480_1_, p_147480_2_, p_147480_3_); + this.playAuxSFX(2001, p_147480_1_, p_147480_2_, p_147480_3_, Block.getIdFromBlock(block) + (l << 12)); + + if (p_147480_4_) + { + block.dropBlockAsItem(this, p_147480_1_, p_147480_2_, p_147480_3_, l, 0); + } + + return this.setBlock(p_147480_1_, p_147480_2_, p_147480_3_, Blocks.air, 0, 3); + } + } + + /** + * Sets a block by a coordinate + */ + public boolean setBlock(int p_147449_1_, int p_147449_2_, int p_147449_3_, Block p_147449_4_) + { + return this.setBlock(p_147449_1_, p_147449_2_, p_147449_3_, p_147449_4_, 0, 3); + } + + public void markBlockForUpdate(int p_147471_1_, int p_147471_2_, int p_147471_3_) + { + for (int l = 0; l < this.worldAccesses.size(); ++l) + { + ((IWorldAccess)this.worldAccesses.get(l)).markBlockForUpdate(p_147471_1_, p_147471_2_, p_147471_3_); + } + } + + /** + * The block type change and need to notify other systems Args: x, y, z, blockID + */ + public void notifyBlockChange(int p_147444_1_, int p_147444_2_, int p_147444_3_, Block p_147444_4_) + { + this.notifyBlocksOfNeighborChange(p_147444_1_, p_147444_2_, p_147444_3_, p_147444_4_); + } + + /** + * marks a vertical line of blocks as dirty + */ + public void markBlocksDirtyVertical(int par1, int par2, int par3, int par4) + { + int i1; + + if (par3 > par4) + { + i1 = par4; + par4 = par3; + par3 = i1; + } + + if (!this.provider.hasNoSky) + { + for (i1 = par3; i1 <= par4; ++i1) + { + this.updateLightByType(EnumSkyBlock.Sky, par1, i1, par2); + } + } + + this.markBlockRangeForRenderUpdate(par1, par3, par2, par1, par4, par2); + } + + public void markBlockRangeForRenderUpdate(int p_147458_1_, int p_147458_2_, int p_147458_3_, int p_147458_4_, int p_147458_5_, int p_147458_6_) + { + for (int k1 = 0; k1 < this.worldAccesses.size(); ++k1) + { + ((IWorldAccess)this.worldAccesses.get(k1)).markBlockRangeForRenderUpdate(p_147458_1_, p_147458_2_, p_147458_3_, p_147458_4_, p_147458_5_, p_147458_6_); + } + } + + public void notifyBlocksOfNeighborChange(int p_147459_1_, int p_147459_2_, int p_147459_3_, Block p_147459_4_) + { + this.notifyBlockOfNeighborChange(p_147459_1_ - 1, p_147459_2_, p_147459_3_, p_147459_4_); + this.notifyBlockOfNeighborChange(p_147459_1_ + 1, p_147459_2_, p_147459_3_, p_147459_4_); + this.notifyBlockOfNeighborChange(p_147459_1_, p_147459_2_ - 1, p_147459_3_, p_147459_4_); + this.notifyBlockOfNeighborChange(p_147459_1_, p_147459_2_ + 1, p_147459_3_, p_147459_4_); + this.notifyBlockOfNeighborChange(p_147459_1_, p_147459_2_, p_147459_3_ - 1, p_147459_4_); + this.notifyBlockOfNeighborChange(p_147459_1_, p_147459_2_, p_147459_3_ + 1, p_147459_4_); + } + + public void notifyBlocksOfNeighborChange(int p_147441_1_, int p_147441_2_, int p_147441_3_, Block p_147441_4_, int p_147441_5_) + { + if (p_147441_5_ != 4) + { + this.notifyBlockOfNeighborChange(p_147441_1_ - 1, p_147441_2_, p_147441_3_, p_147441_4_); + } + + if (p_147441_5_ != 5) + { + this.notifyBlockOfNeighborChange(p_147441_1_ + 1, p_147441_2_, p_147441_3_, p_147441_4_); + } + + if (p_147441_5_ != 0) + { + this.notifyBlockOfNeighborChange(p_147441_1_, p_147441_2_ - 1, p_147441_3_, p_147441_4_); + } + + if (p_147441_5_ != 1) + { + this.notifyBlockOfNeighborChange(p_147441_1_, p_147441_2_ + 1, p_147441_3_, p_147441_4_); + } + + if (p_147441_5_ != 2) + { + this.notifyBlockOfNeighborChange(p_147441_1_, p_147441_2_, p_147441_3_ - 1, p_147441_4_); + } + + if (p_147441_5_ != 3) + { + this.notifyBlockOfNeighborChange(p_147441_1_, p_147441_2_, p_147441_3_ + 1, p_147441_4_); + } + } + + /** + * Notifies a block that one of its neighbor change to the specified type Args: x, y, z, block + */ + public void notifyBlockOfNeighborChange(int p_147460_1_, int p_147460_2_, int p_147460_3_, final Block p_147460_4_) + { + if (!this.isRemote) + { + Block block = this.getBlock(p_147460_1_, p_147460_2_, p_147460_3_); + + try + { + block.onNeighborBlockChange(this, p_147460_1_, p_147460_2_, p_147460_3_, p_147460_4_); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception while updating neighbours"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being updated"); + int l; + + try + { + l = this.getBlockMetadata(p_147460_1_, p_147460_2_, p_147460_3_); + } + catch (Throwable throwable) + { + l = -1; + } + + crashreportcategory.addCrashSectionCallable("Source block type", new Callable() + { + private static final String __OBFID = "CL_00000142"; + public String call() + { + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(Block.getIdFromBlock(p_147460_4_)), p_147460_4_.getUnlocalizedName(), p_147460_4_.getClass().getCanonicalName()}); + } + catch (Throwable throwable2) + { + return "ID #" + Block.getIdFromBlock(p_147460_4_); + } + } + }); + CrashReportCategory.func_147153_a(crashreportcategory, p_147460_1_, p_147460_2_, p_147460_3_, block, l); + throw new ReportedException(crashreport); + } + } + } + + /** + * Returns true if the given block will receive a scheduled tick in this tick. Args: X, Y, Z, Block + */ + public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_) + { + return false; + } + + /** + * Checks if the specified block is able to see the sky + */ + public boolean canBlockSeeTheSky(int par1, int par2, int par3) + { + return this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4).canBlockSeeTheSky(par1 & 15, par2, par3 & 15); + } + + /** + * Does the same as getBlockLightValue_do but without checking if its not a normal block + */ + public int getFullBlockLightValue(int par1, int par2, int par3) + { + if (par2 < 0) + { + return 0; + } + else + { + if (par2 >= 256) + { + par2 = 255; + } + + return this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4).getBlockLightValue(par1 & 15, par2, par3 & 15, 0); + } + } + + /** + * Gets the light value of a block location + */ + public int getBlockLightValue(int par1, int par2, int par3) + { + return this.getBlockLightValue_do(par1, par2, par3, true); + } + + /** + * Gets the light value of a block location. This is the actual function that gets the value and has a bool flag + * that indicates if its a half step block to get the maximum light value of a direct neighboring block (left, + * right, forward, back, and up) + */ + public int getBlockLightValue_do(int par1, int par2, int par3, boolean par4) + { + if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000) + { + if (par4 && this.getBlock(par1, par2, par3).getUseNeighborBrightness()) + { + int l1 = this.getBlockLightValue_do(par1, par2 + 1, par3, false); + int l = this.getBlockLightValue_do(par1 + 1, par2, par3, false); + int i1 = this.getBlockLightValue_do(par1 - 1, par2, par3, false); + int j1 = this.getBlockLightValue_do(par1, par2, par3 + 1, false); + int k1 = this.getBlockLightValue_do(par1, par2, par3 - 1, false); + + if (l > l1) + { + l1 = l; + } + + if (i1 > l1) + { + l1 = i1; + } + + if (j1 > l1) + { + l1 = j1; + } + + if (k1 > l1) + { + l1 = k1; + } + + return l1; + } + else if (par2 < 0) + { + return 0; + } + else + { + if (par2 >= 256) + { + par2 = 255; + } + + Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + par1 &= 15; + par3 &= 15; + return chunk.getBlockLightValue(par1, par2, par3, this.skylightSubtracted); + } + } + else + { + return 15; + } + } + + /** + * Returns the y coordinate with a block in it at this x, z coordinate + */ + public int getHeightValue(int par1, int par2) + { + if (par1 >= -30000000 && par2 >= -30000000 && par1 < 30000000 && par2 < 30000000) + { + if (!this.chunkExists(par1 >> 4, par2 >> 4)) + { + return 0; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par2 >> 4); + return chunk.getHeightValue(par1 & 15, par2 & 15); + } + } + else + { + return 64; + } + } + + /** + * Gets the heightMapMinimum field of the given chunk, or 0 if the chunk is not loaded. Coords are in blocks. Args: + * X, Z + */ + public int getChunkHeightMapMinimum(int par1, int par2) + { + if (par1 >= -30000000 && par2 >= -30000000 && par1 < 30000000 && par2 < 30000000) + { + if (!this.chunkExists(par1 >> 4, par2 >> 4)) + { + return 0; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par2 >> 4); + return chunk.heightMapMinimum; + } + } + else + { + return 64; + } + } + + /** + * Brightness for SkyBlock.Sky is clear white and (through color computing it is assumed) DEPENDENT ON DAYTIME. + * Brightness for SkyBlock.Block is yellowish and independent. + */ + @SideOnly(Side.CLIENT) + public int getSkyBlockTypeBrightness(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) + { + if (this.provider.hasNoSky && par1EnumSkyBlock == EnumSkyBlock.Sky) + { + return 0; + } + else + { + if (par3 < 0) + { + par3 = 0; + } + + if (par3 >= 256) + { + return par1EnumSkyBlock.defaultLightValue; + } + else if (par2 >= -30000000 && par4 >= -30000000 && par2 < 30000000 && par4 < 30000000) + { + int l = par2 >> 4; + int i1 = par4 >> 4; + + if (!this.chunkExists(l, i1)) + { + return par1EnumSkyBlock.defaultLightValue; + } + else if (this.getBlock(par2, par3, par4).getUseNeighborBrightness()) + { + int j2 = this.getSavedLightValue(par1EnumSkyBlock, par2, par3 + 1, par4); + int j1 = this.getSavedLightValue(par1EnumSkyBlock, par2 + 1, par3, par4); + int k1 = this.getSavedLightValue(par1EnumSkyBlock, par2 - 1, par3, par4); + int l1 = this.getSavedLightValue(par1EnumSkyBlock, par2, par3, par4 + 1); + int i2 = this.getSavedLightValue(par1EnumSkyBlock, par2, par3, par4 - 1); + + if (j1 > j2) + { + j2 = j1; + } + + if (k1 > j2) + { + j2 = k1; + } + + if (l1 > j2) + { + j2 = l1; + } + + if (i2 > j2) + { + j2 = i2; + } + + return j2; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(l, i1); + return chunk.getSavedLightValue(par1EnumSkyBlock, par2 & 15, par3, par4 & 15); + } + } + else + { + return par1EnumSkyBlock.defaultLightValue; + } + } + } + + /** + * Returns saved light value without taking into account the time of day. Either looks in the sky light map or + * block light map based on the enumSkyBlock arg. + */ + public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) + { + if (par3 < 0) + { + par3 = 0; + } + + if (par3 >= 256) + { + par3 = 255; + } + + if (par2 >= -30000000 && par4 >= -30000000 && par2 < 30000000 && par4 < 30000000) + { + int l = par2 >> 4; + int i1 = par4 >> 4; + + if (!this.chunkExists(l, i1)) + { + return par1EnumSkyBlock.defaultLightValue; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(l, i1); + return chunk.getSavedLightValue(par1EnumSkyBlock, par2 & 15, par3, par4 & 15); + } + } + else + { + return par1EnumSkyBlock.defaultLightValue; + } + } + + /** + * Sets the light value either into the sky map or block map depending on if enumSkyBlock is set to sky or block. + * Args: enumSkyBlock, x, y, z, lightValue + */ + public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) + { + if (par2 >= -30000000 && par4 >= -30000000 && par2 < 30000000 && par4 < 30000000) + { + if (par3 >= 0) + { + if (par3 < 256) + { + if (this.chunkExists(par2 >> 4, par4 >> 4)) + { + Chunk chunk = this.getChunkFromChunkCoords(par2 >> 4, par4 >> 4); + chunk.setLightValue(par1EnumSkyBlock, par2 & 15, par3, par4 & 15, par5); + + for (int i1 = 0; i1 < this.worldAccesses.size(); ++i1) + { + ((IWorldAccess)this.worldAccesses.get(i1)).markBlockForRenderUpdate(par2, par3, par4); + } + } + } + } + } + } + + public void func_147479_m(int p_147479_1_, int p_147479_2_, int p_147479_3_) + { + for (int l = 0; l < this.worldAccesses.size(); ++l) + { + ((IWorldAccess)this.worldAccesses.get(l)).markBlockForRenderUpdate(p_147479_1_, p_147479_2_, p_147479_3_); + } + } + + /** + * Any Light rendered on a 1.8 Block goes through here + */ + @SideOnly(Side.CLIENT) + public int getLightBrightnessForSkyBlocks(int par1, int par2, int par3, int par4) + { + int i1 = this.getSkyBlockTypeBrightness(EnumSkyBlock.Sky, par1, par2, par3); + int j1 = this.getSkyBlockTypeBrightness(EnumSkyBlock.Block, par1, par2, par3); + + if (j1 < par4) + { + j1 = par4; + } + + return i1 << 20 | j1 << 4; + } + + /** + * Returns how bright the block is shown as which is the block's light value looked up in a lookup table (light + * values aren't linear for brightness). Args: x, y, z + */ + public float getLightBrightness(int par1, int par2, int par3) + { + return this.provider.lightBrightnessTable[this.getBlockLightValue(par1, par2, par3)]; + } + + /** + * Checks whether its daytime by seeing if the light subtracted from the skylight is less than 4 + */ + public boolean isDaytime() + { + return provider.isDaytime(); + } + + /** + * Performs a raycast against all blocks in the world except liquids. + */ + public MovingObjectPosition rayTraceBlocks(Vec3 par1Vec3, Vec3 par2Vec3) + { + return this.func_147447_a(par1Vec3, par2Vec3, false, false, false); + } + + /** + * Performs a raycast against all blocks in the world, and optionally liquids. + */ + public MovingObjectPosition rayTraceBlocks(Vec3 par1Vec3, Vec3 par2Vec3, boolean par3) + { + return this.func_147447_a(par1Vec3, par2Vec3, par3, false, false); + } + + public MovingObjectPosition func_147447_a(Vec3 p_147447_1_, Vec3 p_147447_2_, boolean p_147447_3_, boolean p_147447_4_, boolean p_147447_5_) + { + if (!Double.isNaN(p_147447_1_.xCoord) && !Double.isNaN(p_147447_1_.yCoord) && !Double.isNaN(p_147447_1_.zCoord)) + { + if (!Double.isNaN(p_147447_2_.xCoord) && !Double.isNaN(p_147447_2_.yCoord) && !Double.isNaN(p_147447_2_.zCoord)) + { + int i = MathHelper.floor_double(p_147447_2_.xCoord); + int j = MathHelper.floor_double(p_147447_2_.yCoord); + int k = MathHelper.floor_double(p_147447_2_.zCoord); + int l = MathHelper.floor_double(p_147447_1_.xCoord); + int i1 = MathHelper.floor_double(p_147447_1_.yCoord); + int j1 = MathHelper.floor_double(p_147447_1_.zCoord); + Block block = this.getBlock(l, i1, j1); + int k1 = this.getBlockMetadata(l, i1, j1); + + if ((!p_147447_4_ || block.getCollisionBoundingBoxFromPool(this, l, i1, j1) != null) && block.canCollideCheck(k1, p_147447_3_)) + { + MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, l, i1, j1, p_147447_1_, p_147447_2_); + + if (movingobjectposition != null) + { + return movingobjectposition; + } + } + + MovingObjectPosition movingobjectposition2 = null; + k1 = 200; + + while (k1-- >= 0) + { + if (Double.isNaN(p_147447_1_.xCoord) || Double.isNaN(p_147447_1_.yCoord) || Double.isNaN(p_147447_1_.zCoord)) + { + return null; + } + + if (l == i && i1 == j && j1 == k) + { + return p_147447_5_ ? movingobjectposition2 : null; + } + + boolean flag6 = true; + boolean flag3 = true; + boolean flag4 = true; + double d0 = 999.0D; + double d1 = 999.0D; + double d2 = 999.0D; + + if (i > l) + { + d0 = (double)l + 1.0D; + } + else if (i < l) + { + d0 = (double)l + 0.0D; + } + else + { + flag6 = false; + } + + if (j > i1) + { + d1 = (double)i1 + 1.0D; + } + else if (j < i1) + { + d1 = (double)i1 + 0.0D; + } + else + { + flag3 = false; + } + + if (k > j1) + { + d2 = (double)j1 + 1.0D; + } + else if (k < j1) + { + d2 = (double)j1 + 0.0D; + } + else + { + flag4 = false; + } + + double d3 = 999.0D; + double d4 = 999.0D; + double d5 = 999.0D; + double d6 = p_147447_2_.xCoord - p_147447_1_.xCoord; + double d7 = p_147447_2_.yCoord - p_147447_1_.yCoord; + double d8 = p_147447_2_.zCoord - p_147447_1_.zCoord; + + if (flag6) + { + d3 = (d0 - p_147447_1_.xCoord) / d6; + } + + if (flag3) + { + d4 = (d1 - p_147447_1_.yCoord) / d7; + } + + if (flag4) + { + d5 = (d2 - p_147447_1_.zCoord) / d8; + } + + boolean flag5 = false; + byte b0; + + if (d3 < d4 && d3 < d5) + { + if (i > l) + { + b0 = 4; + } + else + { + b0 = 5; + } + + p_147447_1_.xCoord = d0; + p_147447_1_.yCoord += d7 * d3; + p_147447_1_.zCoord += d8 * d3; + } + else if (d4 < d5) + { + if (j > i1) + { + b0 = 0; + } + else + { + b0 = 1; + } + + p_147447_1_.xCoord += d6 * d4; + p_147447_1_.yCoord = d1; + p_147447_1_.zCoord += d8 * d4; + } + else + { + if (k > j1) + { + b0 = 2; + } + else + { + b0 = 3; + } + + p_147447_1_.xCoord += d6 * d5; + p_147447_1_.yCoord += d7 * d5; + p_147447_1_.zCoord = d2; + } + + Vec3 vec32 = this.getWorldVec3Pool().getVecFromPool(p_147447_1_.xCoord, p_147447_1_.yCoord, p_147447_1_.zCoord); + l = (int)(vec32.xCoord = (double)MathHelper.floor_double(p_147447_1_.xCoord)); + + if (b0 == 5) + { + --l; + ++vec32.xCoord; + } + + i1 = (int)(vec32.yCoord = (double)MathHelper.floor_double(p_147447_1_.yCoord)); + + if (b0 == 1) + { + --i1; + ++vec32.yCoord; + } + + j1 = (int)(vec32.zCoord = (double)MathHelper.floor_double(p_147447_1_.zCoord)); + + if (b0 == 3) + { + --j1; + ++vec32.zCoord; + } + + Block block1 = this.getBlock(l, i1, j1); + int l1 = this.getBlockMetadata(l, i1, j1); + + if (!p_147447_4_ || block1.getCollisionBoundingBoxFromPool(this, l, i1, j1) != null) + { + if (block1.canCollideCheck(l1, p_147447_3_)) + { + MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(this, l, i1, j1, p_147447_1_, p_147447_2_); + + if (movingobjectposition1 != null) + { + return movingobjectposition1; + } + } + else + { + movingobjectposition2 = new MovingObjectPosition(l, i1, j1, b0, p_147447_1_, false); + } + } + } + + return p_147447_5_ ? movingobjectposition2 : null; + } + else + { + return null; + } + } + else + { + return null; + } + } + + /** + * Plays a sound at the entity's position. Args: entity, sound, volume (relative to 1.0), and frequency (or pitch, + * also relative to 1.0). + */ + public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4) + { + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(par1Entity, par2Str, par3, par4); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return; + } + par2Str = event.name; + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(par2Str, par1Entity.posX, par1Entity.posY - (double)par1Entity.yOffset, par1Entity.posZ, par3, par4); + } + } + + /** + * Plays sound to all near players except the player reference given + */ + public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, float par3, float par4) + { + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(par1EntityPlayer, par2Str, par3, par4); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return; + } + par2Str = event.name; + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(par1EntityPlayer, par2Str, par1EntityPlayer.posX, par1EntityPlayer.posY - (double)par1EntityPlayer.yOffset, par1EntityPlayer.posZ, par3, par4); + } + } + + /** + * Play a sound effect. Many many parameters for this function. Not sure what they do, but a classic call is : + * (double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, 'random.door_open', 1.0F, world.rand.nextFloat() * 0.1F + + * 0.9F with i,j,k position of the block. + */ + public void playSoundEffect(double par1, double par3, double par5, String par7Str, float par8, float par9) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(par7Str, par1, par3, par5, par8, par9); + } + } + + /** + * par8 is loudness, all pars passed to minecraftInstance.sndManager.playSound + */ + public void playSound(double par1, double par3, double par5, String par7Str, float par8, float par9, boolean par10) {} + + /** + * Plays a record at the specified coordinates of the specified name. Args: recordName, x, y, z + */ + public void playRecord(String par1Str, int par2, int par3, int par4) + { + for (int l = 0; l < this.worldAccesses.size(); ++l) + { + ((IWorldAccess)this.worldAccesses.get(l)).playRecord(par1Str, par2, par3, par4); + } + } + + /** + * Spawns a particle. Args particleName, x, y, z, velX, velY, velZ + */ + public void spawnParticle(String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).spawnParticle(par1Str, par2, par4, par6, par8, par10, par12); + } + } + + /** + * adds a lightning bolt to the list of lightning bolts in this world. + */ + public boolean addWeatherEffect(Entity par1Entity) + { + this.weatherEffects.add(par1Entity); + return true; + } + + /** + * Called to place all entities as part of a world + */ + public boolean spawnEntityInWorld(Entity par1Entity) + { + int i = MathHelper.floor_double(par1Entity.posX / 16.0D); + int j = MathHelper.floor_double(par1Entity.posZ / 16.0D); + boolean flag = par1Entity.forceSpawn; + + if (par1Entity instanceof EntityPlayer) + { + flag = true; + } + + if (!flag && !this.chunkExists(i, j)) + { + return false; + } + else + { + if (par1Entity instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)par1Entity; + this.playerEntities.add(entityplayer); + this.updateAllPlayersSleepingFlag(); + } + if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this)) && !flag) return false; + + this.getChunkFromChunkCoords(i, j).addEntity(par1Entity); + this.loadedEntityList.add(par1Entity); + this.onEntityAdded(par1Entity); + return true; + } + } + + public void onEntityAdded(Entity par1Entity) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(par1Entity); + } + } + + public void onEntityRemoved(Entity par1Entity) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(par1Entity); + } + } + + /** + * Schedule the entity for removal during the next tick. Marks the entity dead in anticipation. + */ + public void removeEntity(Entity par1Entity) + { + if (par1Entity.riddenByEntity != null) + { + par1Entity.riddenByEntity.mountEntity((Entity)null); + } + + if (par1Entity.ridingEntity != null) + { + par1Entity.mountEntity((Entity)null); + } + + par1Entity.setDead(); + + if (par1Entity instanceof EntityPlayer) + { + this.playerEntities.remove(par1Entity); + this.updateAllPlayersSleepingFlag(); + } + } + + /** + * Do NOT use this method to remove normal entities- use normal removeEntity + */ + public void removePlayerEntityDangerously(Entity par1Entity) + { + par1Entity.setDead(); + + if (par1Entity instanceof EntityPlayer) + { + this.playerEntities.remove(par1Entity); + this.updateAllPlayersSleepingFlag(); + } + + int i = par1Entity.chunkCoordX; + int j = par1Entity.chunkCoordZ; + + if (par1Entity.addedToChunk && this.chunkExists(i, j)) + { + this.getChunkFromChunkCoords(i, j).removeEntity(par1Entity); + } + + this.loadedEntityList.remove(par1Entity); + this.onEntityRemoved(par1Entity); + } + + /** + * Adds a IWorldAccess to the list of worldAccesses + */ + public void addWorldAccess(IWorldAccess par1IWorldAccess) + { + this.worldAccesses.add(par1IWorldAccess); + } + + /** + * Returns a list of bounding boxes that collide with aabb excluding the passed in entity's collision. Args: entity, + * aabb + */ + public List getCollidingBoundingBoxes(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB) + { + this.collidingBoundingBoxes.clear(); + int i = MathHelper.floor_double(par2AxisAlignedBB.minX); + int j = MathHelper.floor_double(par2AxisAlignedBB.maxX + 1.0D); + int k = MathHelper.floor_double(par2AxisAlignedBB.minY); + int l = MathHelper.floor_double(par2AxisAlignedBB.maxY + 1.0D); + int i1 = MathHelper.floor_double(par2AxisAlignedBB.minZ); + int j1 = MathHelper.floor_double(par2AxisAlignedBB.maxZ + 1.0D); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = i1; l1 < j1; ++l1) + { + if (this.blockExists(k1, 64, l1)) + { + for (int i2 = k - 1; i2 < l; ++i2) + { + Block block; + + if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) + { + block = this.getBlock(k1, i2, l1); + } + else + { + block = Blocks.stone; + } + + block.addCollisionBoxesToList(this, k1, i2, l1, par2AxisAlignedBB, this.collidingBoundingBoxes, par1Entity); + } + } + } + } + + double d0 = 0.25D; + List list = this.getEntitiesWithinAABBExcludingEntity(par1Entity, par2AxisAlignedBB.expand(d0, d0, d0)); + + for (int j2 = 0; j2 < list.size(); ++j2) + { + AxisAlignedBB axisalignedbb1 = ((Entity)list.get(j2)).getBoundingBox(); + + if (axisalignedbb1 != null && axisalignedbb1.intersectsWith(par2AxisAlignedBB)) + { + this.collidingBoundingBoxes.add(axisalignedbb1); + } + + axisalignedbb1 = par1Entity.getCollisionBox((Entity)list.get(j2)); + + if (axisalignedbb1 != null && axisalignedbb1.intersectsWith(par2AxisAlignedBB)) + { + this.collidingBoundingBoxes.add(axisalignedbb1); + } + } + + return this.collidingBoundingBoxes; + } + + public List func_147461_a(AxisAlignedBB p_147461_1_) + { + this.collidingBoundingBoxes.clear(); + int i = MathHelper.floor_double(p_147461_1_.minX); + int j = MathHelper.floor_double(p_147461_1_.maxX + 1.0D); + int k = MathHelper.floor_double(p_147461_1_.minY); + int l = MathHelper.floor_double(p_147461_1_.maxY + 1.0D); + int i1 = MathHelper.floor_double(p_147461_1_.minZ); + int j1 = MathHelper.floor_double(p_147461_1_.maxZ + 1.0D); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = i1; l1 < j1; ++l1) + { + if (this.blockExists(k1, 64, l1)) + { + for (int i2 = k - 1; i2 < l; ++i2) + { + Block block; + + if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) + { + block = this.getBlock(k1, i2, l1); + } + else + { + block = Blocks.bedrock; + } + + block.addCollisionBoxesToList(this, k1, i2, l1, p_147461_1_, this.collidingBoundingBoxes, (Entity)null); + } + } + } + } + + return this.collidingBoundingBoxes; + } + + /** + * Returns the amount of skylight subtracted for the current time + */ + public int calculateSkylightSubtracted(float par1) + { + float f1 = this.getCelestialAngle(par1); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + f2 = 1.0F - f2; + f2 = (float)((double)f2 * (1.0D - (double)(this.getRainStrength(par1) * 5.0F) / 16.0D)); + f2 = (float)((double)f2 * (1.0D - (double)(this.getWeightedThunderStrength(par1) * 5.0F) / 16.0D)); + f2 = 1.0F - f2; + return (int)(f2 * 11.0F); + } + + /** + * Removes a worldAccess from the worldAccesses object + */ + public void removeWorldAccess(IWorldAccess par1IWorldAccess) + { + this.worldAccesses.remove(par1IWorldAccess); + } + + /** + * Returns the sun brightness - checks time of day, rain and thunder + */ + @SideOnly(Side.CLIENT) + public float getSunBrightness(float par1) + { + float f1 = this.getCelestialAngle(par1); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + f2 = 1.0F - f2; + f2 = (float)((double)f2 * (1.0D - (double)(this.getRainStrength(par1) * 5.0F) / 16.0D)); + f2 = (float)((double)f2 * (1.0D - (double)(this.getWeightedThunderStrength(par1) * 5.0F) / 16.0D)); + return f2 * 0.8F + 0.2F; + } + + /** + * Calculates the color for the skybox + */ + @SideOnly(Side.CLIENT) + public Vec3 getSkyColor(Entity par1Entity, float par2) + { + return provider.getSkyColor(par1Entity, par2); + } + + @SideOnly(Side.CLIENT) + public Vec3 getSkyColorBody(Entity par1Entity, float par2) + { + float f1 = this.getCelestialAngle(par2); + float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + int i = MathHelper.floor_double(par1Entity.posX); + int j = MathHelper.floor_double(par1Entity.posY); + int k = MathHelper.floor_double(par1Entity.posZ); + int l = ForgeHooksClient.getSkyBlendColour(this, i, j, k); + float f4 = (float)(l >> 16 & 255) / 255.0F; + float f5 = (float)(l >> 8 & 255) / 255.0F; + float f6 = (float)(l & 255) / 255.0F; + f4 *= f2; + f5 *= f2; + f6 *= f2; + float f7 = this.getRainStrength(par2); + float f8; + float f9; + + if (f7 > 0.0F) + { + f8 = (f4 * 0.3F + f5 * 0.59F + f6 * 0.11F) * 0.6F; + f9 = 1.0F - f7 * 0.75F; + f4 = f4 * f9 + f8 * (1.0F - f9); + f5 = f5 * f9 + f8 * (1.0F - f9); + f6 = f6 * f9 + f8 * (1.0F - f9); + } + + f8 = this.getWeightedThunderStrength(par2); + + if (f8 > 0.0F) + { + f9 = (f4 * 0.3F + f5 * 0.59F + f6 * 0.11F) * 0.2F; + float f10 = 1.0F - f8 * 0.75F; + f4 = f4 * f10 + f9 * (1.0F - f10); + f5 = f5 * f10 + f9 * (1.0F - f10); + f6 = f6 * f10 + f9 * (1.0F - f10); + } + + if (this.lastLightningBolt > 0) + { + f9 = (float)this.lastLightningBolt - par2; + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + f9 *= 0.45F; + f4 = f4 * (1.0F - f9) + 0.8F * f9; + f5 = f5 * (1.0F - f9) + 0.8F * f9; + f6 = f6 * (1.0F - f9) + 1.0F * f9; + } + + return this.getWorldVec3Pool().getVecFromPool((double)f4, (double)f5, (double)f6); + } + + /** + * calls calculateCelestialAngle + */ + public float getCelestialAngle(float par1) + { + return this.provider.calculateCelestialAngle(this.worldInfo.getWorldTime(), par1); + } + + @SideOnly(Side.CLIENT) + public int getMoonPhase() + { + return this.provider.getMoonPhase(this.worldInfo.getWorldTime()); + } + + /** + * gets the current fullness of the moon expressed as a float between 1.0 and 0.0, in steps of .25 + */ + public float getCurrentMoonPhaseFactor() + { + return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; + } + + /** + * Return getCelestialAngle()*2*PI + */ + public float getCelestialAngleRadians(float par1) + { + float f1 = this.getCelestialAngle(par1); + return f1 * (float)Math.PI * 2.0F; + } + + @SideOnly(Side.CLIENT) + public Vec3 getCloudColour(float par1) + { + return provider.drawClouds(par1); + } + + @SideOnly(Side.CLIENT) + public Vec3 drawCloudsBody(float par1) + { + float f1 = this.getCelestialAngle(par1); + float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + float f3 = (float)(this.cloudColour >> 16 & 255L) / 255.0F; + float f4 = (float)(this.cloudColour >> 8 & 255L) / 255.0F; + float f5 = (float)(this.cloudColour & 255L) / 255.0F; + float f6 = this.getRainStrength(par1); + float f7; + float f8; + + if (f6 > 0.0F) + { + f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F; + f8 = 1.0F - f6 * 0.95F; + f3 = f3 * f8 + f7 * (1.0F - f8); + f4 = f4 * f8 + f7 * (1.0F - f8); + f5 = f5 * f8 + f7 * (1.0F - f8); + } + + f3 *= f2 * 0.9F + 0.1F; + f4 *= f2 * 0.9F + 0.1F; + f5 *= f2 * 0.85F + 0.15F; + f7 = this.getWeightedThunderStrength(par1); + + if (f7 > 0.0F) + { + f8 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F; + float f9 = 1.0F - f7 * 0.95F; + f3 = f3 * f9 + f8 * (1.0F - f9); + f4 = f4 * f9 + f8 * (1.0F - f9); + f5 = f5 * f9 + f8 * (1.0F - f9); + } + + return this.getWorldVec3Pool().getVecFromPool((double)f3, (double)f4, (double)f5); + } + + /** + * Returns vector(ish) with R/G/B for fog + */ + @SideOnly(Side.CLIENT) + public Vec3 getFogColor(float par1) + { + float f1 = this.getCelestialAngle(par1); + return this.provider.getFogColor(f1, par1); + } + + /** + * Gets the height to which rain/snow will fall. Calculates it if not already stored. + */ + public int getPrecipitationHeight(int par1, int par2) + { + return this.getChunkFromBlockCoords(par1, par2).getPrecipitationHeight(par1 & 15, par2 & 15); + } + + /** + * Finds the highest block on the x, z coordinate that is solid and returns its y coord. Args x, z + */ + public int getTopSolidOrLiquidBlock(int par1, int par2) + { + Chunk chunk = this.getChunkFromBlockCoords(par1, par2); + int x = par1; + int z = par2; + int k = chunk.getTopFilledSegment() + 15; + par1 &= 15; + + for (par2 &= 15; k > 0; --k) + { + Block block = chunk.getBlock(par1, k, par2); + + if (block.getMaterial().blocksMovement() && block.getMaterial() != Material.leaves && !block.isFoliage(this, x, k, z)) + { + return k + 1; + } + } + + return -1; + } + + /** + * How bright are stars in the sky + */ + @SideOnly(Side.CLIENT) + public float getStarBrightness(float par1) + { + return provider.getStarBrightness(par1); + } + + @SideOnly(Side.CLIENT) + public float getStarBrightnessBody(float par1) + { + float f1 = this.getCelestialAngle(par1); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + return f2 * f2 * 0.5F; + } + + /** + * Schedules a tick to a block with a delay (Most commonly the tick rate) + */ + public void scheduleBlockUpdate(int p_147464_1_, int p_147464_2_, int p_147464_3_, Block p_147464_4_, int p_147464_5_) {} + + public void scheduleBlockUpdateWithPriority(int p_147454_1_, int p_147454_2_, int p_147454_3_, Block p_147454_4_, int p_147454_5_, int p_147454_6_) {} + + public void func_147446_b(int p_147446_1_, int p_147446_2_, int p_147446_3_, Block p_147446_4_, int p_147446_5_, int p_147446_6_) {} + + /** + * Updates (and cleans up) entities and tile entities + */ + public void updateEntities() + { + this.theProfiler.startSection("entities"); + this.theProfiler.startSection("global"); + int i; + Entity entity; + CrashReport crashreport; + CrashReportCategory crashreportcategory; + + for (i = 0; i < this.weatherEffects.size(); ++i) + { + entity = (Entity)this.weatherEffects.get(i); + + try + { + ++entity.ticksExisted; + entity.onUpdate(); + } + catch (Throwable throwable2) + { + crashreport = CrashReport.makeCrashReport(throwable2, "Ticking entity"); + crashreportcategory = crashreport.makeCategory("Entity being ticked"); + + if (entity == null) + { + crashreportcategory.addCrashSection("Entity", "~~NULL~~"); + } + else + { + entity.addEntityCrashInfo(crashreportcategory); + } + + if (ForgeModContainer.removeErroringEntities) + { + FMLLog.severe(crashreport.getCompleteReport()); + removeEntity(entity); + } + else + { + throw new ReportedException(crashreport); + } + } + + if (entity.isDead) + { + this.weatherEffects.remove(i--); + } + } + + this.theProfiler.endStartSection("remove"); + this.loadedEntityList.removeAll(this.unloadedEntityList); + int j; + int l; + + for (i = 0; i < this.unloadedEntityList.size(); ++i) + { + entity = (Entity)this.unloadedEntityList.get(i); + j = entity.chunkCoordX; + l = entity.chunkCoordZ; + + if (entity.addedToChunk && this.chunkExists(j, l)) + { + this.getChunkFromChunkCoords(j, l).removeEntity(entity); + } + } + + for (i = 0; i < this.unloadedEntityList.size(); ++i) + { + this.onEntityRemoved((Entity)this.unloadedEntityList.get(i)); + } + + this.unloadedEntityList.clear(); + this.theProfiler.endStartSection("regular"); + + for (i = 0; i < this.loadedEntityList.size(); ++i) + { + entity = (Entity)this.loadedEntityList.get(i); + + if (entity.ridingEntity != null) + { + if (!entity.ridingEntity.isDead && entity.ridingEntity.riddenByEntity == entity) + { + continue; + } + + entity.ridingEntity.riddenByEntity = null; + entity.ridingEntity = null; + } + + this.theProfiler.startSection("tick"); + + if (!entity.isDead) + { + try + { + this.updateEntity(entity); + } + catch (Throwable throwable1) + { + crashreport = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + crashreportcategory = crashreport.makeCategory("Entity being ticked"); + entity.addEntityCrashInfo(crashreportcategory); + + if (ForgeModContainer.removeErroringEntities) + { + FMLLog.severe(crashreport.getCompleteReport()); + removeEntity(entity); + } + else + { + throw new ReportedException(crashreport); + } + } + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("remove"); + + if (entity.isDead) + { + j = entity.chunkCoordX; + l = entity.chunkCoordZ; + + if (entity.addedToChunk && this.chunkExists(j, l)) + { + this.getChunkFromChunkCoords(j, l).removeEntity(entity); + } + + this.loadedEntityList.remove(i--); + this.onEntityRemoved(entity); + } + + this.theProfiler.endSection(); + } + + this.theProfiler.endStartSection("blockEntities"); + this.field_147481_N = true; + Iterator iterator = this.loadedTileEntityList.iterator(); + + while (iterator.hasNext()) + { + TileEntity tileentity = (TileEntity)iterator.next(); + + if (!tileentity.isInvalid() && tileentity.hasWorldObj() && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord)) + { + try + { + tileentity.updateEntity(); + } + catch (Throwable throwable) + { + crashreport = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + crashreportcategory = crashreport.makeCategory("Block entity being ticked"); + tileentity.func_145828_a(crashreportcategory); + if (ForgeModContainer.removeErroringTileEntities) + { + FMLLog.severe(crashreport.getCompleteReport()); + tileentity.invalidate(); + setBlockToAir(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord); + } + else + { + throw new ReportedException(crashreport); + } + } + } + + if (tileentity.isInvalid()) + { + iterator.remove(); + + if (this.chunkExists(tileentity.xCoord >> 4, tileentity.zCoord >> 4)) + { + Chunk chunk = this.getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4); + + if (chunk != null) + { + chunk.removeInvalidTileEntity(tileentity.xCoord & 15, tileentity.yCoord, tileentity.zCoord & 15); + } + } + } + } + + if (!this.field_147483_b.isEmpty()) + { + for (Object tile : field_147483_b) + { + ((TileEntity)tile).onChunkUnload(); + } + this.loadedTileEntityList.removeAll(this.field_147483_b); + this.field_147483_b.clear(); + } + + this.field_147481_N = false; + + this.theProfiler.endStartSection("pendingBlockEntities"); + + if (!this.addedTileEntityList.isEmpty()) + { + for (int k = 0; k < this.addedTileEntityList.size(); ++k) + { + TileEntity tileentity1 = (TileEntity)this.addedTileEntityList.get(k); + + if (!tileentity1.isInvalid()) + { + if (!this.loadedTileEntityList.contains(tileentity1)) + { + this.loadedTileEntityList.add(tileentity1); + } + } + else + { + if (this.chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) + { + Chunk chunk1 = this.getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); + + if (chunk1 != null) + { + chunk1.removeInvalidTileEntity(tileentity1.xCoord & 15, tileentity1.yCoord, tileentity1.zCoord & 15); + } + } + } + } + + this.addedTileEntityList.clear(); + } + + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + public void func_147448_a(Collection p_147448_1_) + { + List dest = field_147481_N ? addedTileEntityList : loadedTileEntityList; + for(TileEntity entity : (Collection)p_147448_1_) + { + if(entity.canUpdate()) dest.add(entity); + } + } + + /** + * Will update the entity in the world if the chunk the entity is in is currently loaded. Args: entity + */ + public void updateEntity(Entity par1Entity) + { + this.updateEntityWithOptionalForce(par1Entity, true); + } + + /** + * Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update. + * Args: entity, forceUpdate + */ + public void updateEntityWithOptionalForce(Entity par1Entity, boolean par2) + { + int i = MathHelper.floor_double(par1Entity.posX); + int j = MathHelper.floor_double(par1Entity.posZ); + boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); + byte b0 = isForced ? (byte)0 : 32; + boolean canUpdate = !par2 || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0); + + if (!canUpdate) + { + EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(par1Entity); + MinecraftForge.EVENT_BUS.post(event); + canUpdate = event.canUpdate; + } + + if (canUpdate) + { + par1Entity.lastTickPosX = par1Entity.posX; + par1Entity.lastTickPosY = par1Entity.posY; + par1Entity.lastTickPosZ = par1Entity.posZ; + par1Entity.prevRotationYaw = par1Entity.rotationYaw; + par1Entity.prevRotationPitch = par1Entity.rotationPitch; + + if (par2 && par1Entity.addedToChunk) + { + ++par1Entity.ticksExisted; + + if (par1Entity.ridingEntity != null) + { + par1Entity.updateRidden(); + } + else + { + par1Entity.onUpdate(); + } + } + + this.theProfiler.startSection("chunkCheck"); + + if (Double.isNaN(par1Entity.posX) || Double.isInfinite(par1Entity.posX)) + { + par1Entity.posX = par1Entity.lastTickPosX; + } + + if (Double.isNaN(par1Entity.posY) || Double.isInfinite(par1Entity.posY)) + { + par1Entity.posY = par1Entity.lastTickPosY; + } + + if (Double.isNaN(par1Entity.posZ) || Double.isInfinite(par1Entity.posZ)) + { + par1Entity.posZ = par1Entity.lastTickPosZ; + } + + if (Double.isNaN((double)par1Entity.rotationPitch) || Double.isInfinite((double)par1Entity.rotationPitch)) + { + par1Entity.rotationPitch = par1Entity.prevRotationPitch; + } + + if (Double.isNaN((double)par1Entity.rotationYaw) || Double.isInfinite((double)par1Entity.rotationYaw)) + { + par1Entity.rotationYaw = par1Entity.prevRotationYaw; + } + + int k = MathHelper.floor_double(par1Entity.posX / 16.0D); + int l = MathHelper.floor_double(par1Entity.posY / 16.0D); + int i1 = MathHelper.floor_double(par1Entity.posZ / 16.0D); + + if (!par1Entity.addedToChunk || par1Entity.chunkCoordX != k || par1Entity.chunkCoordY != l || par1Entity.chunkCoordZ != i1) + { + if (par1Entity.addedToChunk && this.chunkExists(par1Entity.chunkCoordX, par1Entity.chunkCoordZ)) + { + this.getChunkFromChunkCoords(par1Entity.chunkCoordX, par1Entity.chunkCoordZ).removeEntityAtIndex(par1Entity, par1Entity.chunkCoordY); + } + + if (this.chunkExists(k, i1)) + { + par1Entity.addedToChunk = true; + this.getChunkFromChunkCoords(k, i1).addEntity(par1Entity); + } + else + { + par1Entity.addedToChunk = false; + } + } + + this.theProfiler.endSection(); + + if (par2 && par1Entity.addedToChunk && par1Entity.riddenByEntity != null) + { + if (!par1Entity.riddenByEntity.isDead && par1Entity.riddenByEntity.ridingEntity == par1Entity) + { + this.updateEntity(par1Entity.riddenByEntity); + } + else + { + par1Entity.riddenByEntity.ridingEntity = null; + par1Entity.riddenByEntity = null; + } + } + } + } + + /** + * Returns true if there are no solid, live entities in the specified AxisAlignedBB + */ + public boolean checkNoEntityCollision(AxisAlignedBB par1AxisAlignedBB) + { + return this.checkNoEntityCollision(par1AxisAlignedBB, (Entity)null); + } + + /** + * Returns true if there are no solid, live entities in the specified AxisAlignedBB, excluding the given entity + */ + public boolean checkNoEntityCollision(AxisAlignedBB par1AxisAlignedBB, Entity par2Entity) + { + List list = this.getEntitiesWithinAABBExcludingEntity((Entity)null, par1AxisAlignedBB); + + for (int i = 0; i < list.size(); ++i) + { + Entity entity1 = (Entity)list.get(i); + + if (!entity1.isDead && entity1.preventEntitySpawning && entity1 != par2Entity) + { + return false; + } + } + + return true; + } + + /** + * Returns true if there are any blocks in the region constrained by an AxisAlignedBB + */ + public boolean checkBlockCollision(AxisAlignedBB par1AxisAlignedBB) + { + int i = MathHelper.floor_double(par1AxisAlignedBB.minX); + int j = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D); + int k = MathHelper.floor_double(par1AxisAlignedBB.minY); + int l = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D); + int i1 = MathHelper.floor_double(par1AxisAlignedBB.minZ); + int j1 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D); + + if (par1AxisAlignedBB.minX < 0.0D) + { + --i; + } + + if (par1AxisAlignedBB.minY < 0.0D) + { + --k; + } + + if (par1AxisAlignedBB.minZ < 0.0D) + { + --i1; + } + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + Block block = this.getBlock(k1, l1, i2); + + if (block.getMaterial() != Material.air) + { + return true; + } + } + } + } + + return false; + } + + /** + * Returns if any of the blocks within the aabb are liquids. Args: aabb + */ + public boolean isAnyLiquid(AxisAlignedBB par1AxisAlignedBB) + { + int i = MathHelper.floor_double(par1AxisAlignedBB.minX); + int j = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D); + int k = MathHelper.floor_double(par1AxisAlignedBB.minY); + int l = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D); + int i1 = MathHelper.floor_double(par1AxisAlignedBB.minZ); + int j1 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D); + + if (par1AxisAlignedBB.minX < 0.0D) + { + --i; + } + + if (par1AxisAlignedBB.minY < 0.0D) + { + --k; + } + + if (par1AxisAlignedBB.minZ < 0.0D) + { + --i1; + } + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + Block block = this.getBlock(k1, l1, i2); + + if (block.getMaterial().isLiquid()) + { + return true; + } + } + } + } + + return false; + } + + public boolean func_147470_e(AxisAlignedBB p_147470_1_) + { + int i = MathHelper.floor_double(p_147470_1_.minX); + int j = MathHelper.floor_double(p_147470_1_.maxX + 1.0D); + int k = MathHelper.floor_double(p_147470_1_.minY); + int l = MathHelper.floor_double(p_147470_1_.maxY + 1.0D); + int i1 = MathHelper.floor_double(p_147470_1_.minZ); + int j1 = MathHelper.floor_double(p_147470_1_.maxZ + 1.0D); + + if (this.checkChunksExist(i, k, i1, j, l, j1)) + { + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + Block block = this.getBlock(k1, l1, i2); + + if (block == Blocks.fire || block == Blocks.flowing_lava || block == Blocks.lava) + { + return true; + } + else + { + if (block.isBurning(this, k1, l1, i2)) return true; + } + } + } + } + } + + return false; + } + + /** + * handles the acceleration of an object whilst in water. Not sure if it is used elsewhere. + */ + public boolean handleMaterialAcceleration(AxisAlignedBB par1AxisAlignedBB, Material par2Material, Entity par3Entity) + { + int i = MathHelper.floor_double(par1AxisAlignedBB.minX); + int j = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D); + int k = MathHelper.floor_double(par1AxisAlignedBB.minY); + int l = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D); + int i1 = MathHelper.floor_double(par1AxisAlignedBB.minZ); + int j1 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D); + + if (!this.checkChunksExist(i, k, i1, j, l, j1)) + { + return false; + } + else + { + boolean flag = false; + Vec3 vec3 = this.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + Block block = this.getBlock(k1, l1, i2); + + if (block.getMaterial() == par2Material) + { + double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(this.getBlockMetadata(k1, l1, i2))); + + if ((double)l >= d0) + { + flag = true; + block.velocityToAddToEntity(this, k1, l1, i2, par3Entity, vec3); + } + } + } + } + } + + if (vec3.lengthVector() > 0.0D && par3Entity.isPushedByWater()) + { + vec3 = vec3.normalize(); + double d1 = 0.014D; + par3Entity.motionX += vec3.xCoord * d1; + par3Entity.motionY += vec3.yCoord * d1; + par3Entity.motionZ += vec3.zCoord * d1; + } + + return flag; + } + } + + /** + * Returns true if the given bounding box contains the given material + */ + public boolean isMaterialInBB(AxisAlignedBB par1AxisAlignedBB, Material par2Material) + { + int i = MathHelper.floor_double(par1AxisAlignedBB.minX); + int j = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D); + int k = MathHelper.floor_double(par1AxisAlignedBB.minY); + int l = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D); + int i1 = MathHelper.floor_double(par1AxisAlignedBB.minZ); + int j1 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + if (this.getBlock(k1, l1, i2).getMaterial() == par2Material) + { + return true; + } + } + } + } + + return false; + } + + /** + * checks if the given AABB is in the material given. Used while swimming. + */ + public boolean isAABBInMaterial(AxisAlignedBB par1AxisAlignedBB, Material par2Material) + { + int i = MathHelper.floor_double(par1AxisAlignedBB.minX); + int j = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D); + int k = MathHelper.floor_double(par1AxisAlignedBB.minY); + int l = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D); + int i1 = MathHelper.floor_double(par1AxisAlignedBB.minZ); + int j1 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + Block block = this.getBlock(k1, l1, i2); + + if (block.getMaterial() == par2Material) + { + int j2 = this.getBlockMetadata(k1, l1, i2); + double d0 = (double)(l1 + 1); + + if (j2 < 8) + { + d0 = (double)(l1 + 1) - (double)j2 / 8.0D; + } + + if (d0 >= par1AxisAlignedBB.minY) + { + return true; + } + } + } + } + } + + return false; + } + + /** + * Creates an explosion. Args: entity, x, y, z, strength + */ + public Explosion createExplosion(Entity par1Entity, double par2, double par4, double par6, float par8, boolean par9) + { + return this.newExplosion(par1Entity, par2, par4, par6, par8, false, par9); + } + + /** + * returns a new explosion. Does initiation (at time of writing Explosion is not finished) + */ + public Explosion newExplosion(Entity par1Entity, double par2, double par4, double par6, float par8, boolean par9, boolean par10) + { + Explosion explosion = new Explosion(this, par1Entity, par2, par4, par6, par8); + explosion.isFlaming = par9; + explosion.isSmoking = par10; + explosion.doExplosionA(); + explosion.doExplosionB(true); + return explosion; + } + + /** + * Gets the percentage of real blocks within within a bounding box, along a specified vector. + */ + public float getBlockDensity(Vec3 par1Vec3, AxisAlignedBB par2AxisAlignedBB) + { + double d0 = 1.0D / ((par2AxisAlignedBB.maxX - par2AxisAlignedBB.minX) * 2.0D + 1.0D); + double d1 = 1.0D / ((par2AxisAlignedBB.maxY - par2AxisAlignedBB.minY) * 2.0D + 1.0D); + double d2 = 1.0D / ((par2AxisAlignedBB.maxZ - par2AxisAlignedBB.minZ) * 2.0D + 1.0D); + int i = 0; + int j = 0; + + for (float f = 0.0F; f <= 1.0F; f = (float)((double)f + d0)) + { + for (float f1 = 0.0F; f1 <= 1.0F; f1 = (float)((double)f1 + d1)) + { + for (float f2 = 0.0F; f2 <= 1.0F; f2 = (float)((double)f2 + d2)) + { + double d3 = par2AxisAlignedBB.minX + (par2AxisAlignedBB.maxX - par2AxisAlignedBB.minX) * (double)f; + double d4 = par2AxisAlignedBB.minY + (par2AxisAlignedBB.maxY - par2AxisAlignedBB.minY) * (double)f1; + double d5 = par2AxisAlignedBB.minZ + (par2AxisAlignedBB.maxZ - par2AxisAlignedBB.minZ) * (double)f2; + + if (this.rayTraceBlocks(this.getWorldVec3Pool().getVecFromPool(d3, d4, d5), par1Vec3) == null) + { + ++i; + } + + ++j; + } + } + } + + return (float)i / (float)j; + } + + /** + * If the block in the given direction of the given coordinate is fire, extinguish it. Args: Player, X,Y,Z, + * blockDirection + */ + public boolean extinguishFire(EntityPlayer par1EntityPlayer, int par2, int par3, int par4, int par5) + { + if (par5 == 0) + { + --par3; + } + + if (par5 == 1) + { + ++par3; + } + + if (par5 == 2) + { + --par4; + } + + if (par5 == 3) + { + ++par4; + } + + if (par5 == 4) + { + --par2; + } + + if (par5 == 5) + { + ++par2; + } + + if (this.getBlock(par2, par3, par4) == Blocks.fire) + { + this.playAuxSFXAtEntity(par1EntityPlayer, 1004, par2, par3, par4, 0); + this.setBlockToAir(par2, par3, par4); + return true; + } + else + { + return false; + } + } + + /** + * This string is 'All: (number of loaded entities)' Viewable by press ing F3 + */ + @SideOnly(Side.CLIENT) + public String getDebugLoadedEntities() + { + return "All: " + this.loadedEntityList.size(); + } + + /** + * Returns the name of the current chunk provider, by calling chunkprovider.makeString() + */ + @SideOnly(Side.CLIENT) + public String getProviderName() + { + return this.chunkProvider.makeString(); + } + + public TileEntity getTileEntity(int p_147438_1_, int p_147438_2_, int p_147438_3_) + { + if (p_147438_2_ >= 0 && p_147438_2_ < 256) + { + TileEntity tileentity = null; + int l; + TileEntity tileentity1; + + if (this.field_147481_N) + { + for (l = 0; l < this.addedTileEntityList.size(); ++l) + { + tileentity1 = (TileEntity)this.addedTileEntityList.get(l); + + if (!tileentity1.isInvalid() && tileentity1.xCoord == p_147438_1_ && tileentity1.yCoord == p_147438_2_ && tileentity1.zCoord == p_147438_3_) + { + tileentity = tileentity1; + break; + } + } + } + + if (tileentity == null) + { + Chunk chunk = this.getChunkFromChunkCoords(p_147438_1_ >> 4, p_147438_3_ >> 4); + + if (chunk != null) + { + tileentity = chunk.func_150806_e(p_147438_1_ & 15, p_147438_2_, p_147438_3_ & 15); + } + } + + if (tileentity == null) + { + for (l = 0; l < this.addedTileEntityList.size(); ++l) + { + tileentity1 = (TileEntity)this.addedTileEntityList.get(l); + + if (!tileentity1.isInvalid() && tileentity1.xCoord == p_147438_1_ && tileentity1.yCoord == p_147438_2_ && tileentity1.zCoord == p_147438_3_) + { + tileentity = tileentity1; + break; + } + } + } + + return tileentity; + } + else + { + return null; + } + } + + public void setTileEntity(int p_147455_1_, int p_147455_2_, int p_147455_3_, TileEntity p_147455_4_) + { + if (p_147455_4_ == null || p_147455_4_.isInvalid()) + { + return; + } + + if (p_147455_4_.canUpdate()) + { + if (this.field_147481_N) + { + Iterator iterator = this.addedTileEntityList.iterator(); + + while (iterator.hasNext()) + { + TileEntity tileentity1 = (TileEntity)iterator.next(); + + if (tileentity1.xCoord == p_147455_1_ && tileentity1.yCoord == p_147455_2_ && tileentity1.zCoord == p_147455_3_) + { + tileentity1.invalidate(); + iterator.remove(); + } + } + + this.addedTileEntityList.add(p_147455_4_); + } + else + { + this.loadedTileEntityList.add(p_147455_4_); + } + } + Chunk chunk = this.getChunkFromChunkCoords(p_147455_1_ >> 4, p_147455_3_ >> 4); + if (chunk != null) + { + chunk.func_150812_a(p_147455_1_ & 15, p_147455_2_, p_147455_3_ & 15, p_147455_4_); + } + //notify tile changes + func_147453_f(p_147455_1_, p_147455_2_, p_147455_3_, getBlock(p_147455_1_, p_147455_2_, p_147455_3_)); + } + + public void removeTileEntity(int p_147475_1_, int p_147475_2_, int p_147475_3_) + { + Chunk chunk = getChunkFromChunkCoords(p_147475_1_ >> 4, p_147475_3_ >> 4); + if (chunk != null) chunk.removeTileEntity(p_147475_1_ & 15, p_147475_2_, p_147475_3_ & 15); + func_147453_f(p_147475_1_, p_147475_2_, p_147475_3_, getBlock(p_147475_1_, p_147475_2_, p_147475_3_)); + } + + public void func_147457_a(TileEntity p_147457_1_) + { + this.field_147483_b.add(p_147457_1_); + } + + public boolean func_147469_q(int p_147469_1_, int p_147469_2_, int p_147469_3_) + { + AxisAlignedBB axisalignedbb = this.getBlock(p_147469_1_, p_147469_2_, p_147469_3_).getCollisionBoundingBoxFromPool(this, p_147469_1_, p_147469_2_, p_147469_3_); + return axisalignedbb != null && axisalignedbb.getAverageEdgeLength() >= 1.0D; + } + + /** + * Returns true if the block at the given coordinate has a solid (buildable) top surface. + */ + public static boolean doesBlockHaveSolidTopSurface(IBlockAccess p_147466_0_, int p_147466_1_, int p_147466_2_, int p_147466_3_) + { + Block block = p_147466_0_.getBlock(p_147466_1_, p_147466_2_, p_147466_3_); + return block.isSideSolid(p_147466_0_, p_147466_1_, p_147466_2_, p_147466_3_, ForgeDirection.UP); + } + + /** + * Checks if the block is a solid, normal cube. If the chunk does not exist, or is not loaded, it returns the + * boolean parameter + */ + public boolean isBlockNormalCubeDefault(int p_147445_1_, int p_147445_2_, int p_147445_3_, boolean p_147445_4_) + { + if (p_147445_1_ >= -30000000 && p_147445_3_ >= -30000000 && p_147445_1_ < 30000000 && p_147445_3_ < 30000000) + { + Chunk chunk = this.chunkProvider.provideChunk(p_147445_1_ >> 4, p_147445_3_ >> 4); + + if (chunk != null && !chunk.isEmpty()) + { + Block block = this.getBlock(p_147445_1_, p_147445_2_, p_147445_3_); + return block.isNormalCube(this, p_147445_1_, p_147445_2_, p_147445_3_); + } + else + { + return p_147445_4_; + } + } + else + { + return p_147445_4_; + } + } + + /** + * Called on construction of the World class to setup the initial skylight values + */ + public void calculateInitialSkylight() + { + int i = this.calculateSkylightSubtracted(1.0F); + + if (i != this.skylightSubtracted) + { + this.skylightSubtracted = i; + } + } + + /** + * Set which types of mobs are allowed to spawn (peaceful vs hostile). + */ + public void setAllowedSpawnTypes(boolean par1, boolean par2) + { + provider.setAllowedSpawnTypes(par1, par2); + } + + /** + * Runs a single tick for the world + */ + public void tick() + { + this.updateWeather(); + } + + /** + * Called from World constructor to set rainingStrength and thunderingStrength + */ + private void calculateInitialWeather() + { + provider.calculateInitialWeather(); + } + + public void calculateInitialWeatherBody() + { + if (this.worldInfo.isRaining()) + { + this.rainingStrength = 1.0F; + + if (this.worldInfo.isThundering()) + { + this.thunderingStrength = 1.0F; + } + } + } + + /** + * Updates all weather states. + */ + protected void updateWeather() + { + provider.updateWeather(); + } + + public void updateWeatherBody() + { + if (!this.provider.hasNoSky) + { + if (!this.isRemote) + { + int i = this.worldInfo.getThunderTime(); + + if (i <= 0) + { + if (this.worldInfo.isThundering()) + { + this.worldInfo.setThunderTime(this.rand.nextInt(12000) + 3600); + } + else + { + this.worldInfo.setThunderTime(this.rand.nextInt(168000) + 12000); + } + } + else + { + --i; + this.worldInfo.setThunderTime(i); + + if (i <= 0) + { + this.worldInfo.setThundering(!this.worldInfo.isThundering()); + } + } + + this.prevThunderingStrength = this.thunderingStrength; + + if (this.worldInfo.isThundering()) + { + this.thunderingStrength = (float)((double)this.thunderingStrength + 0.01D); + } + else + { + this.thunderingStrength = (float)((double)this.thunderingStrength - 0.01D); + } + + this.thunderingStrength = MathHelper.clamp_float(this.thunderingStrength, 0.0F, 1.0F); + int j = this.worldInfo.getRainTime(); + + if (j <= 0) + { + if (this.worldInfo.isRaining()) + { + this.worldInfo.setRainTime(this.rand.nextInt(12000) + 12000); + } + else + { + this.worldInfo.setRainTime(this.rand.nextInt(168000) + 12000); + } + } + else + { + --j; + this.worldInfo.setRainTime(j); + + if (j <= 0) + { + this.worldInfo.setRaining(!this.worldInfo.isRaining()); + } + } + + this.prevRainingStrength = this.rainingStrength; + + if (this.worldInfo.isRaining()) + { + this.rainingStrength = (float)((double)this.rainingStrength + 0.01D); + } + else + { + this.rainingStrength = (float)((double)this.rainingStrength - 0.01D); + } + + this.rainingStrength = MathHelper.clamp_float(this.rainingStrength, 0.0F, 1.0F); + } + } + } + + protected void setActivePlayerChunksAndCheckLight() + { + this.activeChunkSet.clear(); + this.theProfiler.startSection("buildList"); + this.activeChunkSet.addAll(getPersistentChunks().keySet()); + int i; + EntityPlayer entityplayer; + int j; + int k; + + for (i = 0; i < this.playerEntities.size(); ++i) + { + entityplayer = (EntityPlayer)this.playerEntities.get(i); + j = MathHelper.floor_double(entityplayer.posX / 16.0D); + k = MathHelper.floor_double(entityplayer.posZ / 16.0D); + byte b0 = 7; + + for (int l = -b0; l <= b0; ++l) + { + for (int i1 = -b0; i1 <= b0; ++i1) + { + this.activeChunkSet.add(new ChunkCoordIntPair(l + j, i1 + k)); + } + } + } + + this.theProfiler.endSection(); + + if (this.ambientTickCountdown > 0) + { + --this.ambientTickCountdown; + } + + this.theProfiler.startSection("playerCheckLight"); + + if (!this.playerEntities.isEmpty()) + { + i = this.rand.nextInt(this.playerEntities.size()); + entityplayer = (EntityPlayer)this.playerEntities.get(i); + j = MathHelper.floor_double(entityplayer.posX) + this.rand.nextInt(11) - 5; + k = MathHelper.floor_double(entityplayer.posY) + this.rand.nextInt(11) - 5; + int j1 = MathHelper.floor_double(entityplayer.posZ) + this.rand.nextInt(11) - 5; + this.func_147451_t(j, k, j1); + } + + this.theProfiler.endSection(); + } + + protected void func_147467_a(int p_147467_1_, int p_147467_2_, Chunk p_147467_3_) + { + this.theProfiler.endStartSection("moodSound"); + + if (this.ambientTickCountdown == 0 && !this.isRemote) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int k = this.updateLCG >> 2; + int l = k & 15; + int i1 = k >> 8 & 15; + int j1 = k >> 16 & 255; + Block block = p_147467_3_.getBlock(l, j1, i1); + l += p_147467_1_; + i1 += p_147467_2_; + + if (block.getMaterial() == Material.air && this.getFullBlockLightValue(l, j1, i1) <= this.rand.nextInt(8) && this.getSavedLightValue(EnumSkyBlock.Sky, l, j1, i1) <= 0) + { + EntityPlayer entityplayer = this.getClosestPlayer((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D); + + if (entityplayer != null && entityplayer.getDistanceSq((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D) > 4.0D) + { + this.playSoundEffect((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.rand.nextFloat() * 0.2F); + this.ambientTickCountdown = this.rand.nextInt(12000) + 6000; + } + } + } + + this.theProfiler.endStartSection("checkLight"); + p_147467_3_.enqueueRelightChecks(); + } + + protected void func_147456_g() + { + this.setActivePlayerChunksAndCheckLight(); + } + + /** + * checks to see if a given block is both water and is cold enough to freeze + */ + public boolean isBlockFreezable(int par1, int par2, int par3) + { + return this.canBlockFreeze(par1, par2, par3, false); + } + + /** + * checks to see if a given block is both water and has at least one immediately adjacent non-water block + */ + public boolean isBlockFreezableNaturally(int par1, int par2, int par3) + { + return this.canBlockFreeze(par1, par2, par3, true); + } + + /** + * checks to see if a given block is both water, and cold enough to freeze - if the par4 boolean is set, this will + * only return true if there is a non-water block immediately adjacent to the specified block + */ + public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4) + { + return provider.canBlockFreeze(par1, par2, par3, par4); + } + + public boolean canBlockFreezeBody(int par1, int par2, int par3, boolean par4) + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); + float f = biomegenbase.getFloatTemperature(par1, par2, par3); + + if (f > 0.15F) + { + return false; + } + else + { + if (par2 >= 0 && par2 < 256 && this.getSavedLightValue(EnumSkyBlock.Block, par1, par2, par3) < 10) + { + Block block = this.getBlock(par1, par2, par3); + + if ((block == Blocks.water || block == Blocks.flowing_water) && this.getBlockMetadata(par1, par2, par3) == 0) + { + if (!par4) + { + return true; + } + + boolean flag1 = true; + + if (flag1 && this.getBlock(par1 - 1, par2, par3).getMaterial() != Material.water) + { + flag1 = false; + } + + if (flag1 && this.getBlock(par1 + 1, par2, par3).getMaterial() != Material.water) + { + flag1 = false; + } + + if (flag1 && this.getBlock(par1, par2, par3 - 1).getMaterial() != Material.water) + { + flag1 = false; + } + + if (flag1 && this.getBlock(par1, par2, par3 + 1).getMaterial() != Material.water) + { + flag1 = false; + } + + if (!flag1) + { + return true; + } + } + } + + return false; + } + } + + public boolean func_147478_e(int p_147478_1_, int p_147478_2_, int p_147478_3_, boolean p_147478_4_) + { + return provider.canSnowAt(p_147478_1_, p_147478_2_, p_147478_3_, p_147478_4_); + } + + public boolean canSnowAtBody(int p_147478_1_, int p_147478_2_, int p_147478_3_, boolean p_147478_4_) + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(p_147478_1_, p_147478_3_); + float f = biomegenbase.getFloatTemperature(p_147478_1_, p_147478_2_, p_147478_3_); + + if (f > 0.15F) + { + return false; + } + else if (!p_147478_4_) + { + return true; + } + else + { + if (p_147478_2_ >= 0 && p_147478_2_ < 256 && this.getSavedLightValue(EnumSkyBlock.Block, p_147478_1_, p_147478_2_, p_147478_3_) < 10) + { + Block block = this.getBlock(p_147478_1_, p_147478_2_, p_147478_3_); + + if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, p_147478_1_, p_147478_2_, p_147478_3_)) + { + return true; + } + } + + return false; + } + } + + public boolean func_147451_t(int p_147451_1_, int p_147451_2_, int p_147451_3_) + { + boolean flag = false; + + if (!this.provider.hasNoSky) + { + flag |= this.updateLightByType(EnumSkyBlock.Sky, p_147451_1_, p_147451_2_, p_147451_3_); + } + + flag |= this.updateLightByType(EnumSkyBlock.Block, p_147451_1_, p_147451_2_, p_147451_3_); + return flag; + } + + private int computeLightValue(int par1, int par2, int par3, EnumSkyBlock par4EnumSkyBlock) + { + if (par4EnumSkyBlock == EnumSkyBlock.Sky && this.canBlockSeeTheSky(par1, par2, par3)) + { + return 15; + } + else + { + Block block = this.getBlock(par1, par2, par3); + int blockLight = block.getLightValue(this, par1, par2, par3); + int l = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : blockLight; + int i1 = block.getLightOpacity(this, par1, par2, par3); + + if (i1 >= 15 && blockLight > 0) + { + i1 = 1; + } + + if (i1 < 1) + { + i1 = 1; + } + + if (i1 >= 15) + { + return 0; + } + else if (l >= 14) + { + return l; + } + else + { + for (int j1 = 0; j1 < 6; ++j1) + { + int k1 = par1 + Facing.offsetsXForSide[j1]; + int l1 = par2 + Facing.offsetsYForSide[j1]; + int i2 = par3 + Facing.offsetsZForSide[j1]; + int j2 = this.getSavedLightValue(par4EnumSkyBlock, k1, l1, i2) - i1; + + if (j2 > l) + { + l = j2; + } + + if (l >= 14) + { + return l; + } + } + + return l; + } + } + } + + public boolean updateLightByType(EnumSkyBlock p_147463_1_, int p_147463_2_, int p_147463_3_, int p_147463_4_) + { + if (!this.doChunksNearChunkExist(p_147463_2_, p_147463_3_, p_147463_4_, 17)) + { + return false; + } + else + { + int l = 0; + int i1 = 0; + this.theProfiler.startSection("getBrightness"); + int j1 = this.getSavedLightValue(p_147463_1_, p_147463_2_, p_147463_3_, p_147463_4_); + int k1 = this.computeLightValue(p_147463_2_, p_147463_3_, p_147463_4_, p_147463_1_); + int l1; + int i2; + int j2; + int k2; + int l2; + int i3; + int j3; + int k3; + int l3; + + if (k1 > j1) + { + this.lightUpdateBlockList[i1++] = 133152; + } + else if (k1 < j1) + { + this.lightUpdateBlockList[i1++] = 133152 | j1 << 18; + + while (l < i1) + { + l1 = this.lightUpdateBlockList[l++]; + i2 = (l1 & 63) - 32 + p_147463_2_; + j2 = (l1 >> 6 & 63) - 32 + p_147463_3_; + k2 = (l1 >> 12 & 63) - 32 + p_147463_4_; + l2 = l1 >> 18 & 15; + i3 = this.getSavedLightValue(p_147463_1_, i2, j2, k2); + + if (i3 == l2) + { + this.setLightValue(p_147463_1_, i2, j2, k2, 0); + + if (l2 > 0) + { + j3 = MathHelper.abs_int(i2 - p_147463_2_); + k3 = MathHelper.abs_int(j2 - p_147463_3_); + l3 = MathHelper.abs_int(k2 - p_147463_4_); + + if (j3 + k3 + l3 < 17) + { + for (int i4 = 0; i4 < 6; ++i4) + { + int j4 = i2 + Facing.offsetsXForSide[i4]; + int k4 = j2 + Facing.offsetsYForSide[i4]; + int l4 = k2 + Facing.offsetsZForSide[i4]; + int i5 = Math.max(1, this.getBlock(j4, k4, l4).getLightOpacity(this, j4, k4, l4)); + i3 = this.getSavedLightValue(p_147463_1_, j4, k4, l4); + + if (i3 == l2 - i5 && i1 < this.lightUpdateBlockList.length) + { + this.lightUpdateBlockList[i1++] = j4 - p_147463_2_ + 32 | k4 - p_147463_3_ + 32 << 6 | l4 - p_147463_4_ + 32 << 12 | l2 - i5 << 18; + } + } + } + } + } + } + + l = 0; + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("checkedPosition < toCheckCount"); + + while (l < i1) + { + l1 = this.lightUpdateBlockList[l++]; + i2 = (l1 & 63) - 32 + p_147463_2_; + j2 = (l1 >> 6 & 63) - 32 + p_147463_3_; + k2 = (l1 >> 12 & 63) - 32 + p_147463_4_; + l2 = this.getSavedLightValue(p_147463_1_, i2, j2, k2); + i3 = this.computeLightValue(i2, j2, k2, p_147463_1_); + + if (i3 != l2) + { + this.setLightValue(p_147463_1_, i2, j2, k2, i3); + + if (i3 > l2) + { + j3 = Math.abs(i2 - p_147463_2_); + k3 = Math.abs(j2 - p_147463_3_); + l3 = Math.abs(k2 - p_147463_4_); + boolean flag = i1 < this.lightUpdateBlockList.length - 6; + + if (j3 + k3 + l3 < 17 && flag) + { + if (this.getSavedLightValue(p_147463_1_, i2 - 1, j2, k2) < i3) + { + this.lightUpdateBlockList[i1++] = i2 - 1 - p_147463_2_ + 32 + (j2 - p_147463_3_ + 32 << 6) + (k2 - p_147463_4_ + 32 << 12); + } + + if (this.getSavedLightValue(p_147463_1_, i2 + 1, j2, k2) < i3) + { + this.lightUpdateBlockList[i1++] = i2 + 1 - p_147463_2_ + 32 + (j2 - p_147463_3_ + 32 << 6) + (k2 - p_147463_4_ + 32 << 12); + } + + if (this.getSavedLightValue(p_147463_1_, i2, j2 - 1, k2) < i3) + { + this.lightUpdateBlockList[i1++] = i2 - p_147463_2_ + 32 + (j2 - 1 - p_147463_3_ + 32 << 6) + (k2 - p_147463_4_ + 32 << 12); + } + + if (this.getSavedLightValue(p_147463_1_, i2, j2 + 1, k2) < i3) + { + this.lightUpdateBlockList[i1++] = i2 - p_147463_2_ + 32 + (j2 + 1 - p_147463_3_ + 32 << 6) + (k2 - p_147463_4_ + 32 << 12); + } + + if (this.getSavedLightValue(p_147463_1_, i2, j2, k2 - 1) < i3) + { + this.lightUpdateBlockList[i1++] = i2 - p_147463_2_ + 32 + (j2 - p_147463_3_ + 32 << 6) + (k2 - 1 - p_147463_4_ + 32 << 12); + } + + if (this.getSavedLightValue(p_147463_1_, i2, j2, k2 + 1) < i3) + { + this.lightUpdateBlockList[i1++] = i2 - p_147463_2_ + 32 + (j2 - p_147463_3_ + 32 << 6) + (k2 + 1 - p_147463_4_ + 32 << 12); + } + } + } + } + } + + this.theProfiler.endSection(); + return true; + } + } + + /** + * Runs through the list of updates to run and ticks them + */ + public boolean tickUpdates(boolean par1) + { + return false; + } + + public List getPendingBlockUpdates(Chunk par1Chunk, boolean par2) + { + return null; + } + + /** + * Will get all entities within the specified AABB excluding the one passed into it. Args: entityToExclude, aabb + */ + public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB) + { + return this.getEntitiesWithinAABBExcludingEntity(par1Entity, par2AxisAlignedBB, (IEntitySelector)null); + } + + public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) + { + ArrayList arraylist = new ArrayList(); + int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D); + int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D); + int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D); + int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + + for (int i1 = i; i1 <= j; ++i1) + { + for (int j1 = k; j1 <= l; ++j1) + { + if (this.chunkExists(i1, j1)) + { + this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(par1Entity, par2AxisAlignedBB, arraylist, par3IEntitySelector); + } + } + } + + return arraylist; + } + + /** + * Returns all entities of the specified class type which intersect with the AABB. Args: entityClass, aabb + */ + public List getEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB) + { + return this.selectEntitiesWithinAABB(par1Class, par2AxisAlignedBB, (IEntitySelector)null); + } + + public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) + { + int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D); + int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D); + int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D); + int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + ArrayList arraylist = new ArrayList(); + + for (int i1 = i; i1 <= j; ++i1) + { + for (int j1 = k; j1 <= l; ++j1) + { + if (this.chunkExists(i1, j1)) + { + this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(par1Class, par2AxisAlignedBB, arraylist, par3IEntitySelector); + } + } + } + + return arraylist; + } + + public Entity findNearestEntityWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, Entity par3Entity) + { + List list = this.getEntitiesWithinAABB(par1Class, par2AxisAlignedBB); + Entity entity1 = null; + double d0 = Double.MAX_VALUE; + + for (int i = 0; i < list.size(); ++i) + { + Entity entity2 = (Entity)list.get(i); + + if (entity2 != par3Entity) + { + double d1 = par3Entity.getDistanceSqToEntity(entity2); + + if (d1 <= d0) + { + entity1 = entity2; + d0 = d1; + } + } + } + + return entity1; + } + + /** + * Returns the Entity with the given ID, or null if it doesn't exist in this World. + */ + public abstract Entity getEntityByID(int var1); + + /** + * Accessor for world Loaded Entity List + */ + @SideOnly(Side.CLIENT) + public List getLoadedEntityList() + { + return this.loadedEntityList; + } + + /** + * Args: X, Y, Z, tile entity Marks the chunk the tile entity is in as modified. This is essential as chunks that + * are not marked as modified may be rolled back when exiting the game. + */ + public void markTileEntityChunkModified(int p_147476_1_, int p_147476_2_, int p_147476_3_, TileEntity p_147476_4_) + { + if (this.blockExists(p_147476_1_, p_147476_2_, p_147476_3_)) + { + this.getChunkFromBlockCoords(p_147476_1_, p_147476_3_).setChunkModified(); + } + } + + /** + * Counts how many entities of an entity class exist in the world. Args: entityClass + */ + public int countEntities(Class par1Class) + { + int i = 0; + + for (int j = 0; j < this.loadedEntityList.size(); ++j) + { + Entity entity = (Entity)this.loadedEntityList.get(j); + + if ((!(entity instanceof EntityLiving) || !((EntityLiving)entity).isNoDespawnRequired()) && par1Class.isAssignableFrom(entity.getClass())) + { + ++i; + } + } + + return i; + } + + /** + * adds entities to the loaded entities list, and loads thier skins. + */ + public void addLoadedEntities(List par1List) + { + for (int i = 0; i < par1List.size(); ++i) + { + Entity entity = (Entity)par1List.get(i); + if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this))) + { + loadedEntityList.add(entity); + this.onEntityAdded(entity); + } + } + } + + /** + * Adds a list of entities to be unloaded on the next pass of World.updateEntities() + */ + public void unloadEntities(List par1List) + { + this.unloadedEntityList.addAll(par1List); + } + + /** + * Returns true if the given Entity can be placed on the given side of the given block position. + */ + public boolean canPlaceEntityOnSide(Block p_147472_1_, int p_147472_2_, int p_147472_3_, int p_147472_4_, boolean p_147472_5_, int p_147472_6_, Entity p_147472_7_, ItemStack p_147472_8_) + { + Block block1 = this.getBlock(p_147472_2_, p_147472_3_, p_147472_4_); + AxisAlignedBB axisalignedbb = p_147472_5_ ? null : p_147472_1_.getCollisionBoundingBoxFromPool(this, p_147472_2_, p_147472_3_, p_147472_4_); + return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_147472_7_) ? false : (block1.getMaterial() == Material.circuits && p_147472_1_ == Blocks.anvil ? true : block1.isReplaceable(this, p_147472_2_, p_147472_3_, p_147472_4_) && p_147472_1_.canReplace(this, p_147472_2_, p_147472_3_, p_147472_4_, p_147472_6_, p_147472_8_)); + } + + public PathEntity getPathEntityToEntity(Entity par1Entity, Entity par2Entity, float par3, boolean par4, boolean par5, boolean par6, boolean par7) + { + this.theProfiler.startSection("pathfind"); + int i = MathHelper.floor_double(par1Entity.posX); + int j = MathHelper.floor_double(par1Entity.posY + 1.0D); + int k = MathHelper.floor_double(par1Entity.posZ); + int l = (int)(par3 + 16.0F); + int i1 = i - l; + int j1 = j - l; + int k1 = k - l; + int l1 = i + l; + int i2 = j + l; + int j2 = k + l; + ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2, 0); + PathEntity pathentity = (new PathFinder(chunkcache, par4, par5, par6, par7)).createEntityPathTo(par1Entity, par2Entity, par3); + this.theProfiler.endSection(); + return pathentity; + } + + public PathEntity getEntityPathToXYZ(Entity par1Entity, int par2, int par3, int par4, float par5, boolean par6, boolean par7, boolean par8, boolean par9) + { + this.theProfiler.startSection("pathfind"); + int l = MathHelper.floor_double(par1Entity.posX); + int i1 = MathHelper.floor_double(par1Entity.posY); + int j1 = MathHelper.floor_double(par1Entity.posZ); + int k1 = (int)(par5 + 8.0F); + int l1 = l - k1; + int i2 = i1 - k1; + int j2 = j1 - k1; + int k2 = l + k1; + int l2 = i1 + k1; + int i3 = j1 + k1; + ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3, 0); + PathEntity pathentity = (new PathFinder(chunkcache, par6, par7, par8, par9)).createEntityPathTo(par1Entity, par2, par3, par4, par5); + this.theProfiler.endSection(); + return pathentity; + } + + /** + * Is this block powering in the specified direction Args: x, y, z, direction + */ + public int isBlockProvidingPowerTo(int par1, int par2, int par3, int par4) + { + return this.getBlock(par1, par2, par3).isProvidingStrongPower(this, par1, par2, par3, par4); + } + + /** + * Returns the highest redstone signal strength powering the given block. Args: X, Y, Z. + */ + public int getBlockPowerInput(int par1, int par2, int par3) + { + byte b0 = 0; + int l = Math.max(b0, this.isBlockProvidingPowerTo(par1, par2 - 1, par3, 0)); + + if (l >= 15) + { + return l; + } + else + { + l = Math.max(l, this.isBlockProvidingPowerTo(par1, par2 + 1, par3, 1)); + + if (l >= 15) + { + return l; + } + else + { + l = Math.max(l, this.isBlockProvidingPowerTo(par1, par2, par3 - 1, 2)); + + if (l >= 15) + { + return l; + } + else + { + l = Math.max(l, this.isBlockProvidingPowerTo(par1, par2, par3 + 1, 3)); + + if (l >= 15) + { + return l; + } + else + { + l = Math.max(l, this.isBlockProvidingPowerTo(par1 - 1, par2, par3, 4)); + + if (l >= 15) + { + return l; + } + else + { + l = Math.max(l, this.isBlockProvidingPowerTo(par1 + 1, par2, par3, 5)); + return l >= 15 ? l : l; + } + } + } + } + } + } + + /** + * Returns the indirect signal strength being outputted by the given block in the *opposite* of the given direction. + * Args: X, Y, Z, direction + */ + public boolean getIndirectPowerOutput(int par1, int par2, int par3, int par4) + { + return this.getIndirectPowerLevelTo(par1, par2, par3, par4) > 0; + } + + /** + * Gets the power level from a certain block face. Args: x, y, z, direction + */ + public int getIndirectPowerLevelTo(int par1, int par2, int par3, int par4) + { + Block block = this.getBlock(par1, par2, par3); + return block.shouldCheckWeakPower(this, par1, par2, par3, par4) ? this.getBlockPowerInput(par1, par2, par3) : block.isProvidingWeakPower(this, par1, par2, par3, par4); + } + + /** + * Used to see if one of the blocks next to you or your block is getting power from a neighboring block. Used by + * items like TNT or Doors so they don't have redstone going straight into them. Args: x, y, z + */ + public boolean isBlockIndirectlyGettingPowered(int par1, int par2, int par3) + { + return this.getIndirectPowerLevelTo(par1, par2 - 1, par3, 0) > 0 ? true : (this.getIndirectPowerLevelTo(par1, par2 + 1, par3, 1) > 0 ? true : (this.getIndirectPowerLevelTo(par1, par2, par3 - 1, 2) > 0 ? true : (this.getIndirectPowerLevelTo(par1, par2, par3 + 1, 3) > 0 ? true : (this.getIndirectPowerLevelTo(par1 - 1, par2, par3, 4) > 0 ? true : this.getIndirectPowerLevelTo(par1 + 1, par2, par3, 5) > 0)))); + } + + public int getStrongestIndirectPower(int par1, int par2, int par3) + { + int l = 0; + + for (int i1 = 0; i1 < 6; ++i1) + { + int j1 = this.getIndirectPowerLevelTo(par1 + Facing.offsetsXForSide[i1], par2 + Facing.offsetsYForSide[i1], par3 + Facing.offsetsZForSide[i1], i1); + + if (j1 >= 15) + { + return 15; + } + + if (j1 > l) + { + l = j1; + } + } + + return l; + } + + /** + * Gets the closest player to the entity within the specified distance (if distance is less than 0 then ignored). + * Args: entity, dist + */ + public EntityPlayer getClosestPlayerToEntity(Entity par1Entity, double par2) + { + return this.getClosestPlayer(par1Entity.posX, par1Entity.posY, par1Entity.posZ, par2); + } + + /** + * Gets the closest player to the point within the specified distance (distance can be set to less than 0 to not + * limit the distance). Args: x, y, z, dist + */ + public EntityPlayer getClosestPlayer(double par1, double par3, double par5, double par7) + { + double d4 = -1.0D; + EntityPlayer entityplayer = null; + + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); + double d5 = entityplayer1.getDistanceSq(par1, par3, par5); + + if ((par7 < 0.0D || d5 < par7 * par7) && (d4 == -1.0D || d5 < d4)) + { + d4 = d5; + entityplayer = entityplayer1; + } + } + + return entityplayer; + } + + /** + * Returns the closest vulnerable player to this entity within the given radius, or null if none is found + */ + public EntityPlayer getClosestVulnerablePlayerToEntity(Entity par1Entity, double par2) + { + return this.getClosestVulnerablePlayer(par1Entity.posX, par1Entity.posY, par1Entity.posZ, par2); + } + + /** + * Returns the closest vulnerable player within the given radius, or null if none is found. + */ + public EntityPlayer getClosestVulnerablePlayer(double par1, double par3, double par5, double par7) + { + double d4 = -1.0D; + EntityPlayer entityplayer = null; + + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); + + if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive()) + { + double d5 = entityplayer1.getDistanceSq(par1, par3, par5); + double d6 = par7; + + if (entityplayer1.isSneaking()) + { + d6 = par7 * 0.800000011920929D; + } + + if (entityplayer1.isInvisible()) + { + float f = entityplayer1.getArmorVisibility(); + + if (f < 0.1F) + { + f = 0.1F; + } + + d6 *= (double)(0.7F * f); + } + + if ((par7 < 0.0D || d5 < d6 * d6) && (d4 == -1.0D || d5 < d4)) + { + d4 = d5; + entityplayer = entityplayer1; + } + } + } + + return entityplayer; + } + + /** + * Find a player by name in this world. + */ + public EntityPlayer getPlayerEntityByName(String par1Str) + { + for (int i = 0; i < this.playerEntities.size(); ++i) + { + if (par1Str.equals(((EntityPlayer)this.playerEntities.get(i)).getCommandSenderName())) + { + return (EntityPlayer)this.playerEntities.get(i); + } + } + + return null; + } + + /** + * If on MP, sends a quitting packet. + */ + @SideOnly(Side.CLIENT) + public void sendQuittingDisconnectingPacket() {} + + /** + * Checks whether the session lock file was modified by another process + */ + public void checkSessionLock() throws MinecraftException + { + this.saveHandler.checkSessionLock(); + } + + @SideOnly(Side.CLIENT) + public void func_82738_a(long par1) + { + this.worldInfo.incrementTotalWorldTime(par1); + } + + /** + * Retrieve the world seed from level.dat + */ + public long getSeed() + { + return provider.getSeed(); + } + + public long getTotalWorldTime() + { + return this.worldInfo.getWorldTotalTime(); + } + + public long getWorldTime() + { + return provider.getWorldTime(); + } + + /** + * Sets the world time. + */ + public void setWorldTime(long par1) + { + provider.setWorldTime(par1); + } + + /** + * Returns the coordinates of the spawn point + */ + public ChunkCoordinates getSpawnPoint() + { + return provider.getSpawnPoint(); + } + + public void setSpawnLocation(int par1, int par2, int par3) + { + provider.setSpawnPoint(par1, par2, par3); + } + + /** + * spwans an entity and loads surrounding chunks + */ + @SideOnly(Side.CLIENT) + public void joinEntityInSurroundings(Entity par1Entity) + { + int i = MathHelper.floor_double(par1Entity.posX / 16.0D); + int j = MathHelper.floor_double(par1Entity.posZ / 16.0D); + byte b0 = 2; + + for (int k = i - b0; k <= i + b0; ++k) + { + for (int l = j - b0; l <= j + b0; ++l) + { + this.getChunkFromChunkCoords(k, l); + } + } + + if (!this.loadedEntityList.contains(par1Entity)) + { + if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this))) + { + this.loadedEntityList.add(par1Entity); + } + } + } + + /** + * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. + */ + public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) + { + return provider.canMineBlock(par1EntityPlayer, par2, par3, par4); + } + + public boolean canMineBlockBody(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) + { + return true; + } + + /** + * sends a Packet 38 (Entity Status) to all tracked players of that entity + */ + public void setEntityState(Entity par1Entity, byte par2) {} + + /** + * gets the IChunkProvider this world uses. + */ + public IChunkProvider getChunkProvider() + { + return this.chunkProvider; + } + + /** + * Adds a block event with the given Args to the blockEventCache. During the next tick(), the block specified will + * have its onBlockEvent handler called with the given parameters. Args: X,Y,Z, Block, EventID, EventParameter + */ + public void addBlockEvent(int p_147452_1_, int p_147452_2_, int p_147452_3_, Block p_147452_4_, int p_147452_5_, int p_147452_6_) + { + p_147452_4_.onBlockEventReceived(this, p_147452_1_, p_147452_2_, p_147452_3_, p_147452_5_, p_147452_6_); + } + + /** + * Returns this world's current save handler + */ + public ISaveHandler getSaveHandler() + { + return this.saveHandler; + } + + /** + * Gets the World's WorldInfo instance + */ + public WorldInfo getWorldInfo() + { + return this.worldInfo; + } + + /** + * Gets the GameRules instance. + */ + public GameRules getGameRules() + { + return this.worldInfo.getGameRulesInstance(); + } + + /** + * Updates the flag that indicates whether or not all players in the world are sleeping. + */ + public void updateAllPlayersSleepingFlag() {} + + public float getWeightedThunderStrength(float par1) + { + return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * par1) * this.getRainStrength(par1); + } + + /** + * Sets the strength of the thunder. + */ + @SideOnly(Side.CLIENT) + public void setThunderStrength(float p_147442_1_) + { + this.prevThunderingStrength = p_147442_1_; + this.thunderingStrength = p_147442_1_; + } + + /** + * Not sure about this actually. Reverting this one myself. + */ + public float getRainStrength(float par1) + { + return this.prevRainingStrength + (this.rainingStrength - this.prevRainingStrength) * par1; + } + + /** + * Sets the strength of the rain. + */ + @SideOnly(Side.CLIENT) + public void setRainStrength(float par1) + { + this.prevRainingStrength = par1; + this.rainingStrength = par1; + } + + /** + * Returns true if the current thunder strength (weighted with the rain strength) is greater than 0.9 + */ + public boolean isThundering() + { + return (double)this.getWeightedThunderStrength(1.0F) > 0.9D; + } + + /** + * Returns true if the current rain strength is greater than 0.2 + */ + public boolean isRaining() + { + return (double)this.getRainStrength(1.0F) > 0.2D; + } + + public boolean canLightningStrikeAt(int par1, int par2, int par3) + { + if (!this.isRaining()) + { + return false; + } + else if (!this.canBlockSeeTheSky(par1, par2, par3)) + { + return false; + } + else if (this.getPrecipitationHeight(par1, par3) > par2) + { + return false; + } + else + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); + return biomegenbase.getEnableSnow() ? false : (this.func_147478_e(par1, par2, par3, false) ? false : biomegenbase.canSpawnLightningBolt()); + } + } + + /** + * Checks to see if the biome rainfall values for a given x,y,z coordinate set are extremely high + */ + public boolean isBlockHighHumidity(int par1, int par2, int par3) + { + return provider.isBlockHighHumidity(par1, par2, par3); + } + + /** + * Assigns the given String id to the given MapDataBase using the MapStorage, removing any existing ones of the same + * id. + */ + public void setItemData(String par1Str, WorldSavedData par2WorldSavedData) + { + this.mapStorage.setData(par1Str, par2WorldSavedData); + } + + /** + * Loads an existing MapDataBase corresponding to the given String id from disk using the MapStorage, instantiating + * the given Class, or returns null if none such file exists. args: Class to instantiate, String dataid + */ + public WorldSavedData loadItemData(Class par1Class, String par2Str) + { + return this.mapStorage.loadData(par1Class, par2Str); + } + + /** + * Returns an unique new data id from the MapStorage for the given prefix and saves the idCounts map to the + * 'idcounts' file. + */ + public int getUniqueDataId(String par1Str) + { + return this.mapStorage.getUniqueDataId(par1Str); + } + + public void playBroadcastSound(int par1, int par2, int par3, int par4, int par5) + { + for (int j1 = 0; j1 < this.worldAccesses.size(); ++j1) + { + ((IWorldAccess)this.worldAccesses.get(j1)).broadcastSound(par1, par2, par3, par4, par5); + } + } + + /** + * See description for func_72706_a. + */ + public void playAuxSFX(int par1, int par2, int par3, int par4, int par5) + { + this.playAuxSFXAtEntity((EntityPlayer)null, par1, par2, par3, par4, par5); + } + + /** + * See description for playAuxSFX. + */ + public void playAuxSFXAtEntity(EntityPlayer par1EntityPlayer, int par2, int par3, int par4, int par5, int par6) + { + try + { + for (int j1 = 0; j1 < this.worldAccesses.size(); ++j1) + { + ((IWorldAccess)this.worldAccesses.get(j1)).playAuxSFX(par1EntityPlayer, par2, par3, par4, par5, par6); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Playing level event"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Level event being played"); + crashreportcategory.addCrashSection("Block coordinates", CrashReportCategory.getLocationInfo(par3, par4, par5)); + crashreportcategory.addCrashSection("Event source", par1EntityPlayer); + crashreportcategory.addCrashSection("Event type", Integer.valueOf(par2)); + crashreportcategory.addCrashSection("Event data", Integer.valueOf(par6)); + throw new ReportedException(crashreport); + } + } + + /** + * Returns current world height. + */ + public int getHeight() + { + return provider.getHeight(); + } + + /** + * Returns current world height. + */ + public int getActualHeight() + { + return provider.getActualHeight(); + } + + /** + * puts the World Random seed to a specific state dependant on the inputs + */ + public Random setRandomSeed(int par1, int par2, int par3) + { + long l = (long)par1 * 341873128712L + (long)par2 * 132897987541L + this.getWorldInfo().getSeed() + (long)par3; + this.rand.setSeed(l); + return this.rand; + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(String p_147440_1_, int p_147440_2_, int p_147440_3_, int p_147440_4_) + { + return this.getChunkProvider().func_147416_a(this, p_147440_1_, p_147440_2_, p_147440_3_, p_147440_4_); + } + + /** + * set by !chunk.getAreLevelsEmpty + */ + @SideOnly(Side.CLIENT) + public boolean extendedLevelsInChunkCache() + { + return false; + } + + /** + * Returns horizon height for use in rendering the sky. + */ + @SideOnly(Side.CLIENT) + public double getHorizon() + { + return provider.getHorizon(); + } + + /** + * Adds some basic stats of the world to the given crash report. + */ + public CrashReportCategory addWorldInfoToCrashReport(CrashReport par1CrashReport) + { + CrashReportCategory crashreportcategory = par1CrashReport.makeCategoryDepth("Affected level", 1); + crashreportcategory.addCrashSection("Level name", this.worldInfo == null ? "????" : this.worldInfo.getWorldName()); + crashreportcategory.addCrashSectionCallable("All players", new Callable() + { + private static final String __OBFID = "CL_00000143"; + public String call() + { + return World.this.playerEntities.size() + " total; " + World.this.playerEntities.toString(); + } + }); + crashreportcategory.addCrashSectionCallable("Chunk stats", new Callable() + { + private static final String __OBFID = "CL_00000144"; + public String call() + { + return World.this.chunkProvider.makeString(); + } + }); + + try + { + this.worldInfo.addToCrashReport(crashreportcategory); + } + catch (Throwable throwable) + { + crashreportcategory.addCrashSectionThrowable("Level Data Unobtainable", throwable); + } + + return crashreportcategory; + } + + /** + * Starts (or continues) destroying a block with given ID at the given coordinates for the given partially destroyed + * value + */ + public void destroyBlockInWorldPartially(int p_147443_1_, int p_147443_2_, int p_147443_3_, int p_147443_4_, int p_147443_5_) + { + for (int j1 = 0; j1 < this.worldAccesses.size(); ++j1) + { + IWorldAccess iworldaccess = (IWorldAccess)this.worldAccesses.get(j1); + iworldaccess.destroyBlockPartially(p_147443_1_, p_147443_2_, p_147443_3_, p_147443_4_, p_147443_5_); + } + } + + /** + * Return the Vec3Pool object for this world. + */ + public Vec3Pool getWorldVec3Pool() + { + return this.vecPool; + } + + /** + * returns a calendar object containing the current date + */ + public Calendar getCurrentDate() + { + if (this.getTotalWorldTime() % 600L == 0L) + { + this.theCalendar.setTimeInMillis(MinecraftServer.getSystemTimeMillis()); + } + + return this.theCalendar; + } + + @SideOnly(Side.CLIENT) + public void makeFireworks(double par1, double par3, double par5, double par7, double par9, double par11, NBTTagCompound par13NBTTagCompound) {} + + public Scoreboard getScoreboard() + { + return this.worldScoreboard; + } + + public void func_147453_f(int p_147453_1_, int p_147453_2_, int p_147453_3_, Block p_147453_4_) + { + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + int i1 = p_147453_1_ + dir.offsetX; + int y = p_147453_2_ + dir.offsetY; + int j1 = p_147453_3_ + dir.offsetZ; + Block block1 = this.getBlock(i1, y, j1); + + block1.onNeighborChange(this, i1, y, j1, p_147453_1_, p_147453_2_, p_147453_3_); + if (block1.isNormalCube(this, i1, p_147453_2_, j1)) + { + i1 += dir.offsetX; + y += dir.offsetY; + j1 += dir.offsetZ; + Block block2 = this.getBlock(i1, y, j1); + + if (block2.getWeakChanges(this, i1, y, j1)) + { + block2.onNeighborChange(this, i1, y, j1, p_147453_1_, p_147453_2_, p_147453_3_); + } + } + } + } + + public float func_147462_b(double p_147462_1_, double p_147462_3_, double p_147462_5_) + { + return this.func_147473_B(MathHelper.floor_double(p_147462_1_), MathHelper.floor_double(p_147462_3_), MathHelper.floor_double(p_147462_5_)); + } + + public float func_147473_B(int p_147473_1_, int p_147473_2_, int p_147473_3_) + { + float f = 0.0F; + boolean flag = this.difficultySetting == EnumDifficulty.HARD; + + if (this.blockExists(p_147473_1_, p_147473_2_, p_147473_3_)) + { + float f1 = this.getCurrentMoonPhaseFactor(); + f += MathHelper.clamp_float((float)this.getChunkFromBlockCoords(p_147473_1_, p_147473_3_).inhabitedTime / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F); + f += f1 * 0.25F; + } + + if (this.difficultySetting == EnumDifficulty.EASY || this.difficultySetting == EnumDifficulty.PEACEFUL) + { + f *= (float)this.difficultySetting.getDifficultyId() / 2.0F; + } + + return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); + } + + public void func_147450_X() + { + Iterator iterator = this.worldAccesses.iterator(); + + while (iterator.hasNext()) + { + IWorldAccess iworldaccess = (IWorldAccess)iterator.next(); + iworldaccess.onStaticEntitiesChanged(); + } + } + + + /* ======================================== FORGE START =====================================*/ + /** + * Adds a single TileEntity to the world. + * @param entity The TileEntity to be added. + */ + public void addTileEntity(TileEntity entity) + { + List dest = field_147481_N ? addedTileEntityList : loadedTileEntityList; + if(entity.canUpdate()) + { + dest.add(entity); + } + } + + /** + * Determine if the given block is considered solid on the + * specified side. Used by placement logic. + * + * @param x Block X Position + * @param y Block Y Position + * @param z Block Z Position + * @param side The Side in question + * @return True if the side is solid + */ + public boolean isSideSolid(int x, int y, int z, ForgeDirection side) + { + return isSideSolid(x, y, z, side, false); + } + + /** + * Determine if the given block is considered solid on the + * specified side. Used by placement logic. + * + * @param x Block X Position + * @param y Block Y Position + * @param z Block Z Position + * @param side The Side in question + * @param _default The default to return if the block doesn't exist. + * @return True if the side is solid + */ + @Override + public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) + { + if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) + { + return _default; + } + + Chunk chunk = this.chunkProvider.provideChunk(x >> 4, z >> 4); + if (chunk == null || chunk.isEmpty()) + { + return _default; + } + return getBlock(x, y, z).isSideSolid(this, x, y, z, side); + } + + /** + * Get the persistent chunks for this world + * + * @return + */ + public ImmutableSetMultimap getPersistentChunks() + { + return ForgeChunkManager.getPersistentChunksFor(this); + } + + /** + * Readded as it was removed, very useful helper function + * + * @param x X position + * @param y Y Position + * @param z Z Position + * @return The blocks light opacity + */ + public int getBlockLightOpacity(int x, int y, int z) + { + if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) + { + return 0; + } + + if (y < 0 || y >= 256) + { + return 0; + } + + /** + * Returns back a chunk looked up by chunk coordinates Args: x, y + */ + return getChunkFromChunkCoords(x >> 4, z >> 4).func_150808_b(x & 15, y, z & 15); + } + + /** + * Returns a count of entities that classify themselves as the specified creature type. + */ + public int countEntities(EnumCreatureType type, boolean forSpawnCount) + { + int count = 0; + for (int x = 0; x < loadedEntityList.size(); x++) + { + if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) + { + count++; + } + } + return count; + } +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/world/gen/ChunkProviderServer.java b/src/main/java/net/minecraft/world/gen/ChunkProviderServer.java new file mode 100644 index 0000000..3736c1d --- /dev/null +++ b/src/main/java/net/minecraft/world/gen/ChunkProviderServer.java @@ -0,0 +1,383 @@ +package net.minecraft.world.gen; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.LongHashMap; +import net.minecraft.util.ReportedException; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.EmptyChunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.ForgeChunkManager; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ChunkProviderServer implements IChunkProvider +{ + private static final Logger logger = LogManager.getLogger(); + /** + * used by unload100OldestChunks to iterate the loadedChunkHashMap for unload (underlying assumption, first in, + * first out) + */ + public Set chunksToUnload = new HashSet(); + public Chunk defaultEmptyChunk; + public IChunkProvider currentChunkProvider; + public IChunkLoader currentChunkLoader; + /** + * if this is false, the defaultEmptyChunk will be returned by the provider + */ + public boolean loadChunkOnProvideRequest = true; + public LongHashMap loadedChunkHashMap = new LongHashMap(); + public List loadedChunks = new ArrayList(); + public WorldServer worldObj; + public static final String __OBFID = "CL_00001436"; + + public ChunkProviderServer(WorldServer par1WorldServer, IChunkLoader par2IChunkLoader, IChunkProvider par3IChunkProvider) + { + this.defaultEmptyChunk = new EmptyChunk(par1WorldServer, 0, 0); + this.worldObj = par1WorldServer; + this.currentChunkLoader = par2IChunkLoader; + this.currentChunkProvider = par3IChunkProvider; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return this.loadedChunkHashMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); + } + + /** + * marks chunk for unload by "unload100OldestChunks" if there is no spawn point, or if the center of the chunk is + * outside 200 blocks (x or z) of the spawn + */ + public void unloadChunksIfNotNearSpawn(int par1, int par2) + { + if (this.worldObj.provider.canRespawnHere() && DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)) + { + ChunkCoordinates chunkcoordinates = this.worldObj.getSpawnPoint(); + int k = par1 * 16 + 8 - chunkcoordinates.posX; + int l = par2 * 16 + 8 - chunkcoordinates.posZ; + short short1 = 128; + + if (k < -short1 || k > short1 || l < -short1 || l > short1) + { + this.chunksToUnload.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par1, par2))); + } + } + else + { + this.chunksToUnload.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par1, par2))); + } + } + + /** + * marks all chunks for unload, ignoring those near the spawn + */ + public void unloadAllChunks() + { + Iterator iterator = this.loadedChunks.iterator(); + + while (iterator.hasNext()) + { + Chunk chunk = (Chunk)iterator.next(); + this.unloadChunksIfNotNearSpawn(chunk.xPosition, chunk.zPosition); + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); + this.chunksToUnload.remove(Long.valueOf(k)); + Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(k); + + if (chunk == null) + { + chunk = ForgeChunkManager.fetchDormantChunk(k, this.worldObj); + if (chunk == null) + { + chunk = this.safeLoadChunk(par1, par2); + } + + if (chunk == null) + { + if (this.currentChunkProvider == null) + { + chunk = this.defaultEmptyChunk; + } + else + { + try + { + chunk = this.currentChunkProvider.provideChunk(par1, par2); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated"); + crashreportcategory.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(par1), Integer.valueOf(par2)})); + crashreportcategory.addCrashSection("Position hash", Long.valueOf(k)); + crashreportcategory.addCrashSection("Generator", this.currentChunkProvider.makeString()); + throw new ReportedException(crashreport); + } + } + } + + this.loadedChunkHashMap.add(k, chunk); + this.loadedChunks.add(chunk); + chunk.onChunkLoad(); + chunk.populateChunk(this, this, par1, par2); + } + + return chunk; + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); + return chunk == null ? (!this.worldObj.findingSpawnPoint && !this.loadChunkOnProvideRequest ? this.defaultEmptyChunk : this.loadChunk(par1, par2)) : chunk; + } + + /** + * used by loadChunk, but catches any exceptions if the load fails. + */ + private Chunk safeLoadChunk(int par1, int par2) + { + if (this.currentChunkLoader == null) + { + return null; + } + else + { + try + { + Chunk chunk = this.currentChunkLoader.loadChunk(this.worldObj, par1, par2); + + if (chunk != null) + { + chunk.lastSaveTime = this.worldObj.getTotalWorldTime(); + + if (this.currentChunkProvider != null) + { + this.currentChunkProvider.recreateStructures(par1, par2); + } + } + + return chunk; + } + catch (Exception exception) + { + logger.error("Couldn\'t load chunk", exception); + return null; + } + } + } + + /** + * used by saveChunks, but catches any exceptions if the save fails. + */ + private void safeSaveExtraChunkData(Chunk par1Chunk) + { + if (this.currentChunkLoader != null) + { + try + { + this.currentChunkLoader.saveExtraChunkData(this.worldObj, par1Chunk); + } + catch (Exception exception) + { + logger.error("Couldn\'t save entities", exception); + } + } + } + + /** + * used by saveChunks, but catches any exceptions if the save fails. + */ + private void safeSaveChunk(Chunk par1Chunk) + { + if (this.currentChunkLoader != null) + { + try + { + par1Chunk.lastSaveTime = this.worldObj.getTotalWorldTime(); + this.currentChunkLoader.saveChunk(this.worldObj, par1Chunk); + } + catch (IOException ioexception) + { + logger.error("Couldn\'t save chunk", ioexception); + } + catch (MinecraftException minecraftexception) + { + logger.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", minecraftexception); + } + } + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + { + Chunk chunk = this.provideChunk(par2, par3); + + if (!chunk.isTerrainPopulated) + { + chunk.func_150809_p(); + + if (this.currentChunkProvider != null) + { + this.currentChunkProvider.populate(par1IChunkProvider, par2, par3); + GameRegistry.generateWorld(par2, par3, worldObj, currentChunkProvider, par1IChunkProvider); + chunk.setChunkModified(); + } + } + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + int i = 0; + + for (int j = 0; j < this.loadedChunks.size(); ++j) + { + Chunk chunk = (Chunk)this.loadedChunks.get(j); + + if (par1) + { + this.safeSaveExtraChunkData(chunk); + } + + if (chunk.needsSaving(par1)) + { + this.safeSaveChunk(chunk); + chunk.isModified = false; + ++i; + + if (i == 24 && !par1) + { + return false; + } + } + } + + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + if (this.currentChunkLoader != null) + { + this.currentChunkLoader.saveExtraData(); + } + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + if (!this.worldObj.levelSaving) + { + for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) + { + this.chunksToUnload.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); + } + + for (int i = 0; i < 100; ++i) + { + if (!this.chunksToUnload.isEmpty()) + { + Long olong = (Long)this.chunksToUnload.iterator().next(); + Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(olong.longValue()); + chunk.onChunkUnload(); + this.safeSaveChunk(chunk); + this.safeSaveExtraChunkData(chunk); + this.chunksToUnload.remove(olong); + this.loadedChunkHashMap.remove(olong.longValue()); + this.loadedChunks.remove(chunk); + ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); + if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)){ + DimensionManager.unloadWorld(this.worldObj.provider.dimensionId); + return currentChunkProvider.unloadQueuedChunks(); + } + } + } + + if (this.currentChunkLoader != null) + { + this.currentChunkLoader.chunkTick(); + } + } + + return this.currentChunkProvider.unloadQueuedChunks(); + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return !this.worldObj.levelSaving; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "ServerChunkCache: " + this.loadedChunkHashMap.getNumHashElements() + " Drop: " + this.chunksToUnload.size(); + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + return this.currentChunkProvider.getPossibleCreatures(par1EnumCreatureType, par2, par3, par4); + } + + public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) + { + return this.currentChunkProvider.func_147416_a(p_147416_1_, p_147416_2_, p_147416_3_, p_147416_4_, p_147416_5_); + } + + public int getLoadedChunkCount() + { + return this.loadedChunkHashMap.getNumHashElements(); + } + + public void recreateStructures(int par1, int par2) {} +} \ No newline at end of file diff --git a/src/main/resources/mobius_at.cfg b/src/main/resources/mobius_at.cfg index a9a17fd..664cd27 100644 --- a/src/main/resources/mobius_at.cfg +++ b/src/main/resources/mobius_at.cfg @@ -1,10 +1,12 @@ public cpw.mods.fml.common.SingleIntervalHandler.wrapped -public jr.g #FD:ChunkProviderServer/field_73245_g #loadedChunks -public jr.b #chunksToUnload -public jr.f #loadedChunkHashMap -public jr.b(Ladr;)V -public jr.a(Ladr;)V -public jr.h #worldObj -public jr.d #currentChunkProvider -public jr.e #currentChunkLoader -public jr.c #defaultEmptyChunk \ No newline at end of file +public mi.a +public mi.b +public mi.c +public mi.d +public mi.e +public mi.f +public mi.g +public mi.h +public mi.i +public mi.b(Laoj;)V +public mi.a(Laoj;)V \ No newline at end of file