diff --git a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java index 14ccd98..09582f9 100644 --- a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java +++ b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java @@ -1,4 +1,5 @@ package StevenDimDoors.mod_pocketDim; + import java.util.EnumSet; import java.util.Random; @@ -11,177 +12,179 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; import cpw.mods.fml.relauncher.Side; + public class CommonTickHandler implements ITickHandler { - Random rand= new Random(); - public int tickCount=0; - public int tickCount2=0; - - - - - - + private Random rand = new Random(); + public int tickCount=0; + public int tickCount2=0; + private static DDProperties properties = null; + + public CommonTickHandler() + { + if (properties == null) + properties = DDProperties.instance(); + } - @Override - public void tickStart(EnumSet type, Object... tickData) - { - if (type.equals(EnumSet.of(TickType.SERVER))) - { - onTickInGame(); - } - } + @Override + public void tickStart(EnumSet type, Object... tickData) + { + if (type.equals(EnumSet.of(TickType.SERVER))) + { + onTickInGame(); + } + } - @Override - public void tickEnd(EnumSet type, Object... tickData) - { - if (type.equals(EnumSet.of(TickType.SERVER))) - { - } - } + @Override + public void tickEnd(EnumSet type, Object... tickData) + { + if (type.equals(EnumSet.of(TickType.SERVER))) + { + } + } - public EnumSet ticks() - { - return EnumSet.of(TickType.SERVER); - } + public EnumSet ticks() + { + return EnumSet.of(TickType.SERVER); + } - public String getLabel() - { - return null; - } + public String getLabel() + { + return null; + } - //replaces rifts in game that have been destroyed/have blocks placed over them. - private void onTickInGame() - { - - try - { - - if(tickCount>100) - { - tickCount=0; - int i=0; - - - while (i<15&&FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER) - { - i++; - LinkData link; - - //actually gets the random rift based on the size of the list - link = (LinkData) dimHelper.instance.getRandomLinkData(true); + //replaces rifts in game that have been destroyed/have blocks placed over them. + private void onTickInGame() + { - - - if(link!=null) - { - - if(dimHelper.getWorld(link.locDimID)!=null) - { - World world=dimHelper.getWorld(link.locDimID); - - int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord); - - if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesnt replace a door or something - { - if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID)==null) - { - } - else - { - dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID); - TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true; - } - } - } - } - } - } - - - } - catch (Exception e) - { - tickCount++; - System.out.println("something on tick went wrong"); - } - tickCount++; - - //this section regulates decay in Limbo- it records any blocks placed by the player and later progresss them through the decay cycle - if(tickCount2>10&&dimHelper.blocksToDecay!=null) - { - tickCount2=0; - if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(mod_pocketDim.limboDimID)!=null) - { - - - if(dimHelper.blocksToDecay.size()>rand.nextInt(400)) - { - int index = rand.nextInt(dimHelper.blocksToDecay.size()); - Point3D point = (Point3D) dimHelper.blocksToDecay.get(index); + try + { - int blockID = dimHelper.getWorld(mod_pocketDim.limboDimID).getBlockId(point.getX(), point.getY(), point.getZ()); - int idToSet=Block.stone.blockID; - - if(blockID==0||blockID==mod_pocketDim.blockLimboID) - { - dimHelper.blocksToDecay.remove(index); - } - else - { - if(Block.blocksList[idToSet] instanceof BlockContainer) - { - idToSet=-1; - dimHelper.blocksToDecay.remove(index); - } - - - - if(blockID==Block.cobblestone.blockID) - { - idToSet=Block.gravel.blockID; - } - if(blockID==Block.stone.blockID) - { - idToSet=Block.cobblestone.blockID; + if(tickCount>100) + { + tickCount=0; + int i=0; - } - if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(mod_pocketDim.limboDimID).isAirBlock(point.getX(), point.getY()-1, point.getZ())) - { - idToSet=mod_pocketDim.blockLimboID; - dimHelper.getWorld(mod_pocketDim.limboDimID).scheduleBlockUpdate(point.getX(), point.getY(), point.getZ(),10, idToSet); - - } - else if(blockID==Block.gravel.blockID) - { - dimHelper.blocksToDecay.remove(index); - idToSet=-1; - } - - if(idToSet!=-1) - { - - dimHelper.getWorld(mod_pocketDim.limboDimID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet); + while (i<15&&FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER) + { + i++; + LinkData link; + + //actually gets the random rift based on the size of the list + link = (LinkData) dimHelper.instance.getRandomLinkData(true); + + + + if(link!=null) + { + + if(dimHelper.getWorld(link.locDimID)!=null) + { + World world=dimHelper.getWorld(link.locDimID); + + int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord); + + if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesn't replace a door or something + { + if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID)==null) + { + } + else + { + dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID); + TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true; + } + } + } + } + } + } + + + } + catch (Exception e) + { + tickCount++; + System.out.println("something on tick went wrong"); + } + tickCount++; + + //this section regulates decay in Limbo- it records any blocks placed by the player and later progresss them through the decay cycle + if(tickCount2>10&&dimHelper.blocksToDecay!=null) + { + tickCount2=0; + if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(properties.LimboDimensionID)!=null) + { + + + if(dimHelper.blocksToDecay.size()>rand.nextInt(400)) + { + int index = rand.nextInt(dimHelper.blocksToDecay.size()); + Point3D point = (Point3D) dimHelper.blocksToDecay.get(index); + + int blockID = dimHelper.getWorld(properties.LimboDimensionID).getBlockId(point.getX(), point.getY(), point.getZ()); + int idToSet=Block.stone.blockID; + + if(blockID==0||blockID==properties.LimboBlockID) + { + dimHelper.blocksToDecay.remove(index); + } + else + { + if(Block.blocksList[idToSet] instanceof BlockContainer) + { + idToSet=-1; + dimHelper.blocksToDecay.remove(index); + } + + + + if(blockID==Block.cobblestone.blockID) + { + idToSet=Block.gravel.blockID; + } + if(blockID==Block.stone.blockID) + { + idToSet=Block.cobblestone.blockID; + + } + if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(properties.LimboDimensionID).isAirBlock(point.getX(), point.getY()-1, point.getZ())) + { + idToSet=properties.LimboBlockID; + dimHelper.getWorld(properties.LimboDimensionID).scheduleBlockUpdate(point.getX(), point.getY(), point.getZ(),10, idToSet); + + } + else if(blockID==Block.gravel.blockID) + { + dimHelper.blocksToDecay.remove(index); + idToSet=-1; + + } + + if(idToSet!=-1) + { + + dimHelper.getWorld(properties.LimboDimensionID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet); + + } + } + } + } + } + + tickCount2++; + + if(mod_pocketDim.teleTimer>0) + { + mod_pocketDim.teleTimer--; + } + + + + + + + } - } - } - } - } - } - - tickCount2++; - - if(mod_pocketDim.teleTimer>0) - { - mod_pocketDim.teleTimer--; - } - - - - - - - } - } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java index df659bc..6de4ad7 100644 --- a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java +++ b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java @@ -16,15 +16,19 @@ import cpw.mods.fml.common.network.Player; public class ConnectionHandler implements IConnectionHandler { private static boolean connected = false; - + private static DDProperties properties = null; + //sends a packet to clients containing all the information about the dims and links. Lots of packets, actually. @Override public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) { + if (properties == null) + properties = DDProperties.instance(); + Collection set = new ArrayList(); set.addAll(dimHelper.dimList.keySet()); PacketHandler.onClientJoinPacket(manager, dimHelper.dimList); - PacketHandler.onDimCreatedPacket(new DimData(mod_pocketDim.limboDimID, false, 0, 0, 0, 0, 0)); + PacketHandler.onDimCreatedPacket(new DimData(properties.LimboDimensionID, false, 0, 0, 0, 0, 0)); return null; } diff --git a/StevenDimDoors/mod_pocketDim/DDProperties.java b/StevenDimDoors/mod_pocketDim/DDProperties.java new file mode 100644 index 0000000..87dad0d --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/DDProperties.java @@ -0,0 +1,204 @@ +package StevenDimDoors.mod_pocketDim; + +import java.io.File; + +import net.minecraftforge.common.Configuration; + +public class DDProperties +{ + /** + * Block IDs + */ + + public final int UnstableDoorID; + public final int DimensionalDoorID; + public final int WarpDoorID; + public final int TransTrapdoorID; + public final int TransientDoorID; + public final int FabricBlockID; + public final int RiftBlockID; + + /** + * World Generation Block IDs + */ + + public final int LimboBlockID; + public final int PermaFabricBlockID; + + /** + * Item IDs + */ + + public final int RiftBladeItemID; + public final int RiftSignatureItemID; + public final int RiftRemoverItemID; + public final int StableFabricItemID; + public final int StabilizedRiftSignatureItemID; + public final int DimensionalDoorItemID; + public final int UnstableDoorItemID; + public final int WarpDoorItemID; + + /** + * Other IDs + */ + + public final int LimboBiomeID; + public final int PocketBiomeID; + public final int LimboDimensionID; + public final int LimboProviderID; + public final int PocketProviderID; + public final int DoorRenderEntityID; + public final int MonolithEntityID; + + /** + * Crafting Flags + */ + + public final boolean CraftingDimensionaDoorAllowed; + public final boolean CraftingWarpDoorAllowed; + public final boolean CraftingRiftSignatureAllowed; + public final boolean CraftingRiftRemoverAllowed; + public final boolean CraftingUnstableDoorAllowed; + public final boolean CraftingRiftBladeAllowed; + public final boolean CraftingTransTrapdoorAllowed; + public final boolean CraftingStabilizedRiftSignatureAllowed; + public final boolean CraftingStableFabricAllowed; + + /** + * Other Flags + */ + + public final boolean WorldRiftGenerationEnabled; + public final boolean RiftSpreadEnabled; + public final boolean RiftGriefingEnabled; + public final boolean RiftsSpawnEndermenEnabled; + public final boolean LimboEnabled; + public final boolean HardcoreLimboEnabled; + public final boolean LimboReturnsInventoryEnabled; + public final boolean DoorRenderingEnabled; + public final boolean TNFREAKINGT_Enabled; + + /** + * Other + */ + + public final int NonTntWeight; + public final int RiftSpreadModifier; + public final int LimboReturnRange; + public final String CustomSchematicDirectory; + + //Singleton instance + private static DDProperties instance = null; + //Path for custom dungeons within configuration directory + private final String CUSTOM_SCHEMATIC_SUBDIRECTORY = "/DimDoors_Custom_schematics"; + //Names of categories + private final String CATEGORY_CRAFTING = "crafting"; + private final String CATEGORY_ENTITY = "entity"; + private final String CATEGORY_DIMENSION = "dimension"; + private final String CATEGORY_PROVIDER = "provider"; + private final String CATEGORY_BIOME = "biome"; + + private DDProperties(File configFile) + { + //Load the configuration. This must be done in the constructor, even though I'd rather have a separate + //function, because "blank final" variables must be initialized within the constructor. + + CustomSchematicDirectory = configFile.getParent() + CUSTOM_SCHEMATIC_SUBDIRECTORY; + Configuration config = new Configuration(configFile); + config.load(); + + CraftingDimensionaDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Dimesional Door", true).getBoolean(true); + CraftingWarpDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Warp Door", true).getBoolean(true); + CraftingUnstableDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crating Unstable Door", true).getBoolean(true); + CraftingTransTrapdoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Transdimensional Trapdoor", true).getBoolean(true); + CraftingRiftSignatureAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Signature", true).getBoolean(true); + CraftingRiftRemoverAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Remover", true).getBoolean(true); + CraftingStabilizedRiftSignatureAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Stabilized Rift Signature", true).getBoolean(true); + CraftingRiftBladeAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Blade", true).getBoolean(true); + CraftingStableFabricAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Stable Fabric", true).getBoolean(true); + + RiftGriefingEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift Griefing", true, + "Sets whether rifts destroy blocks around them or not").getBoolean(true); + RiftSpreadEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift Spread", true, + "Sets whether rifts create more rifts when they are near other rifts").getBoolean(true); + RiftsSpawnEndermenEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Endermen Spawning from Rifts", true, + "Sets whether groups of connected rifts will spawn Endermen").getBoolean(true); + + LimboEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Limbo", true, + "Sets whether the Limbo dimension is activated").getBoolean(true); + LimboReturnsInventoryEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Limbo Returns Inventory", true, + "Sets whether players keep their inventories upon dying and respawning in Limbo").getBoolean(true); + HardcoreLimboEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Hardcore Limbo", false, + "Sets whether players that die in Limbo will respawn there").getBoolean(false); + LimboReturnRange = config.get(Configuration.CATEGORY_GENERAL, "Limbo Return Range", 500, + "Sets the farthest distance that Limbo can send you upon returning to the Overworld").getInt(); + DoorRenderingEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Door Rendering", true).getBoolean(true); + + TNFREAKINGT_Enabled = config.get(Configuration.CATEGORY_GENERAL, "EXPLOSIONS!!???!!!?!?!!", false).getBoolean(false); + NonTntWeight = config.get(Configuration.CATEGORY_GENERAL, "HOWMUCHTNT", 25, + "Weighs the chance that a block will not be TNT. Must be greater than or equal to 0. " + + "EXPLOSIONS must be set to true for this to have any effect.").getInt(); + + DoorRenderEntityID=config.get(CATEGORY_ENTITY, "Door Render Entity ID", 89).getInt(); + MonolithEntityID = config.get(CATEGORY_ENTITY, "Monolith Entity ID", 125).getInt(); + + DimensionalDoorID = config.getBlock("Dimensional Door Block ID", 1970).getInt(); + TransTrapdoorID = config.getBlock("Transdimensional Trapdoor Block ID", 1971).getInt(); + FabricBlockID =config.getBlock("Fabric Of Reality Block ID", 1973).getInt(); + WarpDoorID = config.getBlock("Warp Door Block ID", 1975).getInt(); + RiftBlockID = config.getBlock("Rift Block ID", 1977).getInt(); + UnstableDoorID = config.getBlock("Unstable Door Block ID", 1978).getInt(); + TransientDoorID = config.getBlock("Transient Door Block ID", 1979).getInt(); + + WarpDoorItemID = config.getItem("Warp Door Item ID", 5670).getInt(); + RiftRemoverItemID = config.getItem("Rift Remover Item ID", 5671).getInt(); + StableFabricItemID = config.getItem("Stable Fabric Item ID", 5672).getInt(); + UnstableDoorItemID = config.getItem("Unstable Door Item ID", 5673).getInt(); + DimensionalDoorItemID = config.getItem("Dimensional Door Item ID", 5674).getInt(); + RiftSignatureItemID = config.getItem("Rift Signature Item ID", 5675).getInt(); + RiftBladeItemID = config.getItem("Rift Blade Item ID", 5676).getInt(); + StabilizedRiftSignatureItemID = config.getItem("Stabilized Rift Signature Item ID", 5677).getInt(); + + LimboBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256", "Limbo Block ID", 217, + "Blocks used for the terrain in Limbo").getInt(); + PermaFabricBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256", + "Perma Fabric Block ID", 220, "Blocks used for enclosing pocket dimensions").getInt(); + + LimboDimensionID = config.get(CATEGORY_DIMENSION, "Limbo Dimension ID", -23).getInt(); + PocketProviderID = config.get(CATEGORY_PROVIDER, "Pocket Provider ID", 24).getInt(); + LimboProviderID = config.get(CATEGORY_PROVIDER, "Limbo Provider ID", 13).getInt(); + + WorldRiftGenerationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift World Generation", true, + "Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true); + + RiftSpreadModifier = config.get(Configuration.CATEGORY_GENERAL, "Rift Spread Modifier", 3, + "Sets the number of times a rift can spread. 0 prevents rifts from spreading at all. " + + "A value greater than 5 is not recommended as the growth is exponential.").getInt(); + + LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt(); + PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt(); + + config.save(); + } + + public static DDProperties create(File configFile) + { + if (instance == null) + instance = new DDProperties(configFile); + else + throw new IllegalStateException("Cannot create DDProperties twice"); + + return instance; + } + + public static DDProperties instance() + { + if (instance == null) + { + //This is to prevent some frustrating bugs that could arise when classes + //are loaded in the wrong order. Trust me, I had to squash a few... + throw new IllegalStateException("Instance of DDProperties requested before properties have been loaded"); + } + return instance; + } +} \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/DimData.java b/StevenDimDoors/mod_pocketDim/DimData.java index 8998e83..3726054 100644 --- a/StevenDimDoors/mod_pocketDim/DimData.java +++ b/StevenDimDoors/mod_pocketDim/DimData.java @@ -33,6 +33,8 @@ public class DimData implements Serializable static final long serialVersionUID = 454342L; + private static DDProperties properties = null; + public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData) { this.dimID=dimID; @@ -40,17 +42,14 @@ public class DimData implements Serializable this.isPocket=isPocket; this.exitDimLink= exitLinkData; - + + if (properties == null) + properties = DDProperties.instance(); } public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ) { - this.dimID=dimID; - this.depth=depth; - this.isPocket=isPocket; - - this.exitDimLink= new LinkData(exitLinkDimID, exitX, exitY, exitZ); - + this(dimID, isPocket, depth, new LinkData(exitLinkDimID, exitX, exitY, exitZ)); } public LinkData findNearestRift(World world, int range, int x, int y, int z) @@ -67,7 +66,7 @@ public class DimData implements Serializable { while (k dimList) + int id=data.readByte(); + + + + + + if(id==regsiterDimPacketID) { - - Collection dimIDs= dimList.keySet(); - Collection dimDataSet= dimList.values(); - Collection packetsToSend = new HashSet(); - - - for(DimData data : dimDataSet) + + + int dimId = data.readInt(); + // System.out.println("regsitered dim ID" + dimId); + try { - - manager.addToSendQueue(PacketHandler.onDimCreatedPacket(data)); - - Collection >> linkList = data.linksInThisDim.values(); - - for(HashMap map : linkList ) - { - - Collection > linkList2 = map.values(); - - for(HashMap map2 : linkList2) - { - Collection linkList3 = map2.values(); - - for(LinkData link : linkList3) - { - - packetsToSend.add(( PacketHandler.onLinkCreatedPacket(link))); + DimData dimDataToAdd = new DimData(dimId, data.readBoolean(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt()); - - } + if(!dimHelper.dimList.containsKey(dimId)) + { + dimHelper.dimList.put(dimId, dimDataToAdd); + } + if(dimDataToAdd.isPocket) + { + if (properties == null) + properties = DDProperties.instance(); + + dimHelper.registerDimension(dimId, properties.PocketProviderID); + //System.out.println("regsitered dim ID" + dimId); + } - - - } - - } - - - - - } - for (Packet250CustomPayload packet : packetsToSend) + catch (Exception e) { - manager.addToSendQueue(packet); + // e.printStackTrace(); + if(dimId!=0) + { + // System.out.println(String.valueOf(dimId)+"dimID already registered"); + } } - - } - - - public static Packet250CustomPayload onLinkCreatedPacket(LinkData link) - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream dataOut = new DataOutputStream(bos); - - try - { - - dataOut.writeByte(PacketHandler.registerLinkPacketID); - dataOut.writeInt(link.locDimID); - dataOut.writeInt(link.destDimID); - dataOut.writeInt(link.locXCoord); - dataOut.writeInt(link.locYCoord); - dataOut.writeInt(link.locZCoord); - dataOut.writeInt(link.destXCoord); - dataOut.writeInt(link.destYCoord); - dataOut.writeInt(link.destZCoord); - dataOut.writeBoolean(link.isLocPocket); - - dataOut.writeInt(link.linkOrientation); - dataOut.writeBoolean(link.hasGennedDoor); - - - } - - - - catch (IOException e) - { - e.printStackTrace(); - } - - Packet250CustomPayload packet= new Packet250CustomPayload(); - packet.channel="DimDoorPackets"; - packet.data = bos.toByteArray(); - packet.length = bos.size();; - PacketDispatcher.sendPacketToAllPlayers(packet); - return packet; - } - - - public static Packet250CustomPayload linkKeyPacket(LinkData link, int key) - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream dataOut = new DataOutputStream(bos); - - try - { - - dataOut.writeByte(PacketHandler.linkKeyPacketID); - - dataOut.writeInt(link.destDimID); - dataOut.writeInt(link.destXCoord); - dataOut.writeInt(link.destYCoord); - dataOut.writeInt(link.destZCoord); - dataOut.writeInt(key); - - - } - - - - catch (IOException e) - { - e.printStackTrace(); - } - - Packet250CustomPayload packet= new Packet250CustomPayload(); - packet.channel="DimDoorPackets"; - packet.data = bos.toByteArray(); - packet.length = bos.size();; - PacketDispatcher.sendPacketToAllPlayers(packet); - return packet; + } - - - public static void onLinkRemovedPacket(LinkData link) - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream dataOut = new DataOutputStream(bos); - - - try - { - - dataOut.writeByte(PacketHandler.removeLinkPacketID); - dataOut.writeInt(link.locDimID); - dataOut.writeInt(link.destDimID); - dataOut.writeInt(link.locXCoord); - dataOut.writeInt(link.locYCoord); - dataOut.writeInt(link.locZCoord); - dataOut.writeInt(link.destXCoord); - dataOut.writeInt(link.destYCoord); - dataOut.writeInt(link.destZCoord); - dataOut.writeBoolean(link.isLocPocket); - - - - } - - - - catch (IOException e) - { - e.printStackTrace(); - } - - Packet250CustomPayload packet= new Packet250CustomPayload(); - packet.channel="DimDoorPackets"; - packet.data = bos.toByteArray(); - packet.length = bos.size();; - PacketDispatcher.sendPacketToAllPlayers(packet); - } - - - public static Packet250CustomPayload onDimCreatedPacket(DimData data) + + if(id==registerLinkPacketID) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream dataOut = new DataOutputStream(bos); - - - try - { - - dataOut.writeByte(PacketHandler.regsiterDimPacketID); - dataOut.writeInt(data.dimID); - dataOut.writeBoolean(data.isPocket); - dataOut.writeInt(data.depth); - dataOut.writeInt(data.exitDimLink.destDimID); - dataOut.writeInt(data.exitDimLink.destXCoord); - dataOut.writeInt(data.exitDimLink.destYCoord); - dataOut.writeInt(data.exitDimLink.destZCoord); - - - - } - - - - catch (IOException e) - { - e.printStackTrace(); - } - - Packet250CustomPayload packet= new Packet250CustomPayload(); - packet.channel="DimDoorPackets"; - packet.data = bos.toByteArray(); - packet.length = bos.size(); - - PacketDispatcher.sendPacketToAllPlayers(packet); - return packet; - - + int dimId = data.readInt(); + try + { + DimData dimDataToAddLink= dimHelper.dimList.get(dimId); + + LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt()); + linkToAdd.hasGennedDoor=data.readBoolean(); + + dimHelper.instance.createLink(linkToAdd); + + } + catch (Exception e) + { + e.printStackTrace(); + System.out.println("Tried to update client link data & failed!"); + } + + } - /** + if(id==removeLinkPacketID) + { + + + + + int dimId = data.readInt(); + try + { + DimData dimDataToRemoveFrom= dimHelper.dimList.get(dimId); + + LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt()); + dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord); + + } + catch (Exception e) + { + //e.printStackTrace(); + System.out.println("Tried to update client link data & failed!"); + } + + + } + if(id==this.linkKeyPacketID) + { + LinkData link = new LinkData(data.readInt(), data.readInt(), data.readInt(), data.readInt()); + dimHelper.instance.interDimLinkList.put(data.readInt(), link); + } + + + + + + } + + public static void onClientJoinPacket(INetworkManager manager, HashMap dimList) + { + + Collection dimIDs= dimList.keySet(); + Collection dimDataSet= dimList.values(); + Collection packetsToSend = new HashSet(); + + + + for(DimData data : dimDataSet) + { + + manager.addToSendQueue(PacketHandler.onDimCreatedPacket(data)); + + Collection >> linkList = data.linksInThisDim.values(); + + for(HashMap map : linkList ) + { + + Collection > linkList2 = map.values(); + + for(HashMap map2 : linkList2) + { + Collection linkList3 = map2.values(); + + for(LinkData link : linkList3) + { + + packetsToSend.add(( PacketHandler.onLinkCreatedPacket(link))); + + + } + + + + } + + } + + + + + + } + for (Packet250CustomPayload packet : packetsToSend) + { + manager.addToSendQueue(packet); + } + + } + + + public static Packet250CustomPayload onLinkCreatedPacket(LinkData link) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream dataOut = new DataOutputStream(bos); + + try + { + + dataOut.writeByte(PacketHandler.registerLinkPacketID); + dataOut.writeInt(link.locDimID); + dataOut.writeInt(link.destDimID); + dataOut.writeInt(link.locXCoord); + dataOut.writeInt(link.locYCoord); + dataOut.writeInt(link.locZCoord); + dataOut.writeInt(link.destXCoord); + dataOut.writeInt(link.destYCoord); + dataOut.writeInt(link.destZCoord); + dataOut.writeBoolean(link.isLocPocket); + + dataOut.writeInt(link.linkOrientation); + dataOut.writeBoolean(link.hasGennedDoor); + + + } + + + + catch (IOException e) + { + e.printStackTrace(); + } + + Packet250CustomPayload packet= new Packet250CustomPayload(); + packet.channel="DimDoorPackets"; + packet.data = bos.toByteArray(); + packet.length = bos.size();; + PacketDispatcher.sendPacketToAllPlayers(packet); + return packet; + } + + + public static Packet250CustomPayload linkKeyPacket(LinkData link, int key) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream dataOut = new DataOutputStream(bos); + + try + { + + dataOut.writeByte(PacketHandler.linkKeyPacketID); + + dataOut.writeInt(link.destDimID); + dataOut.writeInt(link.destXCoord); + dataOut.writeInt(link.destYCoord); + dataOut.writeInt(link.destZCoord); + dataOut.writeInt(key); + + + + } + + + + catch (IOException e) + { + e.printStackTrace(); + } + + Packet250CustomPayload packet= new Packet250CustomPayload(); + packet.channel="DimDoorPackets"; + packet.data = bos.toByteArray(); + packet.length = bos.size();; + PacketDispatcher.sendPacketToAllPlayers(packet); + return packet; + } + + + public static void onLinkRemovedPacket(LinkData link) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream dataOut = new DataOutputStream(bos); + + + try + { + + dataOut.writeByte(PacketHandler.removeLinkPacketID); + dataOut.writeInt(link.locDimID); + dataOut.writeInt(link.destDimID); + dataOut.writeInt(link.locXCoord); + dataOut.writeInt(link.locYCoord); + dataOut.writeInt(link.locZCoord); + dataOut.writeInt(link.destXCoord); + dataOut.writeInt(link.destYCoord); + dataOut.writeInt(link.destZCoord); + dataOut.writeBoolean(link.isLocPocket); + + + + } + + + + catch (IOException e) + { + e.printStackTrace(); + } + + Packet250CustomPayload packet= new Packet250CustomPayload(); + packet.channel="DimDoorPackets"; + packet.data = bos.toByteArray(); + packet.length = bos.size();; + PacketDispatcher.sendPacketToAllPlayers(packet); + } + + + public static Packet250CustomPayload onDimCreatedPacket(DimData data) + { + + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream dataOut = new DataOutputStream(bos); + + + try + { + + dataOut.writeByte(PacketHandler.regsiterDimPacketID); + dataOut.writeInt(data.dimID); + dataOut.writeBoolean(data.isPocket); + + dataOut.writeInt(data.depth); + dataOut.writeInt(data.exitDimLink.destDimID); + dataOut.writeInt(data.exitDimLink.destXCoord); + dataOut.writeInt(data.exitDimLink.destYCoord); + dataOut.writeInt(data.exitDimLink.destZCoord); + + + + + } + + + + catch (IOException e) + { + e.printStackTrace(); + } + + Packet250CustomPayload packet= new Packet250CustomPayload(); + packet.channel="DimDoorPackets"; + packet.data = bos.toByteArray(); + packet.length = bos.size(); + + PacketDispatcher.sendPacketToAllPlayers(packet); + return packet; + + + } + /** private void handleObjectPacket(Packet250CustomPayload packet, Player player) { ObjectInputStream data = new ObjectInputStream; @@ -375,50 +374,50 @@ public class PacketHandler implements IPacketHandler System.out.println(id); if(id==dimPacketID) { - - - - - + + + + + try { DimData dimData = data.read - + dimHelper.dimList.put(key, value) - + } catch (Exception e) { e.printStackTrace(); } - - + + } } - **/ - public static void sendDimObject(DimData dim) + **/ + public static void sendDimObject(DimData dim) + { + try { - try - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream dataOut = new ObjectOutputStream(bos); - dataOut.writeObject(dim); - - Packet250CustomPayload packet= new Packet250CustomPayload(); - packet.channel="DimDoorPackets"; - packet.data = bos.toByteArray(); - packet.length = bos.size();; - PacketDispatcher.sendPacketToAllPlayers(packet); - } - catch (IOException e) - - - { - e.printStackTrace(); - } + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream dataOut = new ObjectOutputStream(bos); + dataOut.writeObject(dim); + + Packet250CustomPayload packet= new Packet250CustomPayload(); + packet.channel="DimDoorPackets"; + packet.data = bos.toByteArray(); + packet.length = bos.size();; + PacketDispatcher.sendPacketToAllPlayers(packet); + } + catch (IOException e) + + + { + e.printStackTrace(); } - - + } + + } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/PlayerRespawnTracker.java b/StevenDimDoors/mod_pocketDim/PlayerRespawnTracker.java index 48e7018..706334f 100644 --- a/StevenDimDoors/mod_pocketDim/PlayerRespawnTracker.java +++ b/StevenDimDoors/mod_pocketDim/PlayerRespawnTracker.java @@ -12,7 +12,13 @@ import cpw.mods.fml.common.IPlayerTracker; public class PlayerRespawnTracker implements IPlayerTracker { + public PlayerRespawnTracker() + { + if (properties == null) + properties = DDProperties.instance(); + } + private static DDProperties properties = null; @Override public void onPlayerLogin(EntityPlayer player) { @@ -35,10 +41,10 @@ public class PlayerRespawnTracker implements IPlayerTracker @Override public void onPlayerRespawn(EntityPlayer player) { - if(player.worldObj.provider.dimensionId==mod_pocketDim.limboDimID) + if(player.worldObj.provider.dimensionId==properties.LimboDimensionID) { - if(!player.worldObj.isRemote&&mod_pocketDim.returnInventory) + if(!player.worldObj.isRemote && properties.LimboReturnsInventoryEnabled) { if(player.username!=null) diff --git a/StevenDimDoors/mod_pocketDim/RiftGenerator.java b/StevenDimDoors/mod_pocketDim/RiftGenerator.java index 2282a5f..d4a6483 100644 --- a/StevenDimDoors/mod_pocketDim/RiftGenerator.java +++ b/StevenDimDoors/mod_pocketDim/RiftGenerator.java @@ -12,94 +12,100 @@ import cpw.mods.fml.common.IWorldGenerator; public class RiftGenerator implements IWorldGenerator { - private int minableBlockId; - private int numberOfBlocks; - int cycles=40; - boolean shouldSave = false; - int count = 0; - int i; - int k; - int j; - Random rand = new Random(); - boolean shouldGenHere=true; - LinkData link; - - - DimData dimData; + private int minableBlockId; + private int numberOfBlocks; + int cycles=40; + boolean shouldSave = false; + int count = 0; + int i; + int k; + int j; + Random rand = new Random(); + boolean shouldGenHere=true; + LinkData link; + DimData dimData; - @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) - { - //Long ntime = System.nanoTime(); - shouldGenHere=true; - - if(world.provider.getDimensionName()=="PocketDim"||!mod_pocketDim.riftsInWorldGen ||world.isRemote) - { - - this.shouldGenHere=false; - - - } - - - if(this.shouldGenHere) - { - - - if(random.nextInt(3500)==0) - { - i=chunkX*16-random.nextInt(16); - k=chunkZ*16-random.nextInt(16); - - j= world.getHeightValue(i, k); - - if(j>20&&world.getBlockId(i, j, k)==0) - { - // System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"Large gen"); - - link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4)); - link = dimHelper.instance.createPocket(link,true, true); - this.shouldSave=true; - - - // SchematicLoader loader = new SchematicLoader(); - // loader.init(link); - // loader.generateSchematic(link); - - - count=0; - while(random.nextInt(4)!=1) - { - i=chunkX*16-random.nextInt(16); - k=chunkZ*16-random.nextInt(16); - - j= world.getHeightValue(i, k); - - if(world.isAirBlock(i, j+1, k)) - { - - - - link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord); - + private static DDProperties properties = null; + + public RiftGenerator() + { + if (properties == null) + properties = DDProperties.instance(); + } - + @Override + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) + { + //Long ntime = System.nanoTime(); + shouldGenHere=true; - - - - } - - } - - } - } - /** + if (world.provider.getDimensionName()=="PocketDim"|| !properties.WorldRiftGenerationEnabled || world.isRemote) + { + + this.shouldGenHere=false; + + + } + + + if(this.shouldGenHere) + { + + + if(random.nextInt(3500)==0) + { + i=chunkX*16-random.nextInt(16); + k=chunkZ*16-random.nextInt(16); + + j= world.getHeightValue(i, k); + + if(j>20&&world.getBlockId(i, j, k)==0) + { + // System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"Large gen"); + + link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4)); + link = dimHelper.instance.createPocket(link,true, true); + this.shouldSave=true; + + + // SchematicLoader loader = new SchematicLoader(); + // loader.init(link); + // loader.generateSchematic(link); + + + count=0; + while(random.nextInt(4)!=1) + { + i=chunkX*16-random.nextInt(16); + k=chunkZ*16-random.nextInt(16); + + j= world.getHeightValue(i, k); + + if(world.isAirBlock(i, j+1, k)) + { + + + + link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord); + + + + + + + + } + + } + + } + } + /** if(random.nextInt(540)==0) { i=chunkX*16-random.nextInt(16); k=chunkZ*16-random.nextInt(16); - + j= world.getHeightValue(i, k); if(j>20&&world.getBlockId(i, j, k)==0) { @@ -108,149 +114,149 @@ public class RiftGenerator implements IWorldGenerator link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4)); link = dimHelper.instance.createPocket(link,true, true); this.shouldSave=true; - - + + // SchematicLoader loader = new SchematicLoader(); // loader.init(link); // loader.generateSchematic(link); count=0; - - + + while(random.nextInt(3)!=1) { i=chunkX*16-random.nextInt(16); k=chunkZ*16-random.nextInt(16); - + j= world.getHeightValue(i, k); - + if(world.isAirBlock(i, j+1, k)) { - - - + + + link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord); - - - + + + } - + } - + } } - **/ - - } - - if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote&&mod_pocketDim.riftsInWorldGen) - { - // System.out.println("tryingToGen"); - int blockID=Block.stoneBrick.blockID; - if(world.provider.dimensionId==mod_pocketDim.limboDimID) - { - blockID= mod_pocketDim.blockLimboID; - } - i=chunkX*16-random.nextInt(16); - k=chunkZ*16-random.nextInt(16); - - j= world.getHeightValue(i, k); - if(j>20&&world.getBlockId(i, j, k)==0) - { - //System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"small gen"); + **/ - count=0; - - - if(world.isAirBlock(i, j+1, k)) - { - - - - - if(world.isBlockOpaqueCube(i, j-2, k)||world.isBlockOpaqueCube(i, j-1, k)) - { - link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4)); - link =dimHelper.instance.createPocket(link,true, true); - - for(int xc=-3;xc<4;xc++) - { - for(int zc=-3;zc<4;zc++) - { - for(int yc=0;yc<200;yc++) - { - if(yc==0&&world.isBlockOpaqueCube(i+xc, j-2,k +zc)) - { - - if(Math.abs(xc)+Math.abs(zc)20&&world.getBlockId(i, j, k)==0) + { + //System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"small gen"); - } + count=0; - } - } - - ItemRiftBlade.placeDoorBlock(world, i, j+1, k, 0, mod_pocketDim.transientDoor); - { + if(world.isAirBlock(i, j+1, k)) + { + + + + + if(world.isBlockOpaqueCube(i, j-2, k)||world.isBlockOpaqueCube(i, j-1, k)) + { + link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4)); + link =dimHelper.instance.createPocket(link,true, true); + + for(int xc=-3;xc<4;xc++) + { + for(int zc=-3;zc<4;zc++) + { + for(int yc=0;yc<200;yc++) + { + if(yc==0&&world.isBlockOpaqueCube(i+xc, j-2,k +zc)) + { + + if(Math.abs(xc)+Math.abs(zc) sideLinks = new ArrayList(); - public ArrayList exitLinks = new ArrayList(); - - public HashMap>> rotationMap = new HashMap>>(); - - public int transMeta; - - public int cX; - public int cZ; - public int cY; - + public NBTTagList entities; + public NBTTagList tileEntities; - - public boolean didRead=false; - public String schematic; - - public SchematicLoader() - { - - - - } - - - public void init(LinkData link) - { - String filePath = dimHelper.dimList.get(link.destDimID).dungeonGenerator.schematicPath; - - this.schematic=filePath; - try - { - - InputStream input; - String fname= schematic ; - - if(!(new File(fname).exists())) - { - + private Random rand = new Random(); - input = this.getClass().getResourceAsStream(fname); - } - else - { - System.out.println(new File(fname).exists()); - input = new FileInputStream(fname); - } - //FileInputStream fileinputstream = new FileInputStream(file); - NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(input); - - width = nbtdata.getShort("Width"); - height = nbtdata.getShort("Height"); - length = nbtdata.getShort("Length"); - - blockId = nbtdata.getByteArray("Blocks"); - blockData = nbtdata.getByteArray("Data"); - - blocks=new short[blockId.length]; - - addId = nbtdata.getByteArray("AddBlocks"); - - tileEntities = nbtdata.getTagList("TileEntities"); - tileEntityList = new NBTTagCompound[width*height*length]; - - for(int count = 0; count> 1) >= addId.length) - { - blocks[index] = (short) (blockId[index] & 0xFF); - } - else - { - if ((index & 1) == 0) - { - blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); - } - else - { - blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); - } - } - } - - - - } - catch (Exception e) - { - this.didRead=false; - System.out.println("Error- could not find file "+schematic); - e.printStackTrace(); - - } - - this.generateSchematic(link, 0, 0, 0); - - } - public int transformMetadata(int metadata, int orientation, int blockID) - { - if(mod_pocketDim.dungeonHelper.metadataFlipList.contains(blockID)) - { - - - - - - switch (orientation) - { - case 0: - - if(Block.blocksList[blockID] instanceof BlockStairs) - { - - switch (metadata) - { - case 0: - metadata = 2; - break; - case 1: - metadata = 3; - break; - case 2: - metadata = 1; - break; - case 3: - metadata = 0; - break; - case 7: - metadata = 4; - break; - case 6: - metadata = 5; - break; - case 5: - metadata = 7; - break; - case 4: - metadata = 6; - break; - - } - } - - else if(blockID== Block.chest.blockID||blockID== Block.chestTrapped.blockID||blockID== Block.ladder.blockID) - { - switch (metadata) - { - - case 2: - metadata = 5; - break; - case 3: - metadata = 4; - break; - case 4: - metadata = 2; - break; - case 5: - metadata = 3; - break; - - + public Point3D incomingLink= new Point3D(0,0,0); - } + public ArrayList sideLinks = new ArrayList(); + public ArrayList exitLinks = new ArrayList(); - } - else if(blockID==Block.vine.blockID) - { - switch (metadata) - { - - case 1: - metadata = 2; - break; - case 2: - metadata = 4; - break; - case 4: - metadata = 8; - break; - case 8: - metadata = 1; - break; - - + public HashMap>> rotationMap = new HashMap>>(); - } + public int transMeta; - } - - - - - else if(blockID== Block.lever.blockID||blockID== Block.stoneButton.blockID||blockID== Block.woodenButton.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) - { - switch (metadata) - { - case 12: - metadata = 9; - break; - case 11: - metadata = 10; - break; - case 10: - metadata = 12; - break; - case 9: - metadata = 11; - break; - case 2: - metadata = 4; - break; - case 3: - metadata = 2; - break; - case 1: - metadata = 3; - break; - case 4: - metadata = 1; - - break; + public int cX; + public int cZ; + public int cY; - } + public boolean didRead = false; + public String schematic; - } - - else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonStickyBase.blockID||blockID==Block.dispenser.blockID||blockID==Block.dropper.blockID) - { - switch (metadata) - { - case 4: - metadata = 2; - break; - case 5: - metadata = 3; - break; - case 13: - metadata = 11; - break; - case 12: - metadata = 10; - break; - case 3: - metadata = 4; - break; - case 2: - metadata = 5; - break; - case 11: - metadata = 12; - break; - case 10: - metadata = 13; - break; - - - } - - - - } - - else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) - { - - - switch (metadata) - { - case 0: - metadata = 1; - break; - case 1: - metadata = 2; - break; - case 2: - metadata = 3; - break; - case 3: - metadata = 0; - break; - case 4: - metadata = 5; - break; - case 5: - metadata = 6; - break; - case 6: - metadata = 7; - break; - case 7: - metadata = 4; - break; - case 8: - metadata = 9; - break; - case 9: - metadata = 10; - break; - case 10: - metadata = 11; - break; - case 11: - metadata = 8; - break; - case 12: - metadata = 13; - break; - case 13: - metadata = 14; - break; - case 14: - metadata = 15; - break; - case 15: - metadata = 12; - break; - - - } - - - - } - - - - - - break; - case 1: + private DDProperties properties = DDProperties.instance(); + + public SchematicLoader() { } - - if(Block.blocksList[blockID] instanceof BlockStairs) - { - - switch (metadata) - { - case 0: - metadata = 1; - break; - case 1: - metadata = 0; - break; - case 2: - metadata = 3; - break; - case 3: - metadata = 2; - break; - case 7: - metadata = 6; - break; - case 6: - metadata = 7; - break; - case 5: - metadata = 4; - break; - case 4: - metadata = 5; - break; - - } - } - - else if(blockID== Block.chest.blockID||blockID== Block.chestTrapped.blockID||blockID==Block.ladder.blockID) - { - switch (metadata) - { - - case 2: - metadata = 3; - break; - case 3: - metadata = 2; - break; - case 4: - metadata = 5; - break; - case 5: - metadata = 4; - break; - - + public void init(LinkData link) + { + String filePath = dimHelper.dimList.get(link.destDimID).dungeonGenerator.schematicPath; - } - - } - - else if(blockID==Block.vine.blockID) - { - switch (metadata) - { - - case 1: - metadata = 4; - break; - case 2: - metadata = 8; - break; - case 4: - metadata = 1; - break; - case 8: - metadata = 2; - break; - } - } - - - - - else if(blockID== Block.lever.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) - { - switch (metadata) - { - case 12: - metadata = 11; - break; - case 11: - metadata = 12; - break; - case 10: - metadata = 9; - break; - case 9: - metadata = 10; - break; - case 2: - metadata = 1; - break; - case 3: - metadata = 4; - break; - case 1: - metadata = 2; - break; - case 4: - metadata = 3; - - break; - - } - - } - - else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonStickyBase.blockID||blockID==Block.dispenser.blockID||blockID==Block.dropper.blockID) - { - switch (metadata) - { - case 4: - metadata = 5; - break; - case 5: - metadata = 4; - break; - case 13: - metadata = 12; - break; - case 12: - metadata = 13; - break; - case 3: - metadata = 2; - break; - case 2: - metadata = 3; - break; - case 11: - metadata = 10; - break; - case 10: - metadata = 11; - break; - - } - - - - } - - else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) - { - switch (metadata) - { - case 0: - metadata = 2; - break; - case 1: - metadata = 3; - break; - case 2: - metadata = 0; - break; - case 3: - metadata = 1; - break; - case 4: - metadata = 6; - break; - case 5: - metadata = 7; - break; - case 6: - metadata = 4; - break; - case 7: - metadata = 5; - break; - case 8: - metadata = 10; - break; - case 9: - metadata = 11; - break; - case 10: - metadata = 8; - break; - case 11: - metadata = 9; - break; - case 12: - metadata = 14; - break; - case 13: - metadata = 15; - break; - case 14: - metadata = 12; - break; - case 15: - metadata = 13; - break; - - - } - - - - } - - break; - case 2: - - if(Block.blocksList[blockID] instanceof BlockStairs) - { - - switch (metadata) - { - case 2: - metadata = 0; - break; - case 3: - metadata = 1; - break; - case 1: - metadata = 2; - break; - case 0: - metadata = 3; - break; - case 4: - metadata = 7; - break; - case 5: - metadata = 6; - break; - case 7: - metadata = 5; - break; - case 6: - metadata = 4; - break; - - } - } - - else if(blockID== Block.chest.blockID||blockID== Block.chestTrapped.blockID||blockID==Block.ladder.blockID) - { - switch (metadata) - { - - case 2: - metadata = 4; - break; - case 3: - metadata = 5; - break; - case 4: - metadata = 3; - break; - case 5: - metadata = 2; - break; - - - - } - - } - - else if(blockID==Block.vine.blockID) - { - switch (metadata) - { - - case 1: - metadata = 8; - break; - case 2: - metadata = 1; - break; - case 4: - metadata = 2; - break; - case 8: - metadata = 4; - break; - } - } - - - - - else if(blockID== Block.lever.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) - { - switch (metadata) - { - case 9: - metadata = 12; - break; - case 10: - metadata = 11; - break; - case 12: - metadata = 10; - break; - case 11: - metadata = 9; - break; - case 4: - metadata = 2; - break; - case 2: - metadata = 3; - break; - case 3: - metadata = 1; - break; - case 1: - metadata = 4; - - break; - - } - - } - - else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonStickyBase.blockID||blockID==Block.dispenser.blockID||blockID==Block.dropper.blockID) - { - switch (metadata) - { - case 2: - metadata = 4; - break; - case 3: - metadata = 5; - break; - case 11: - metadata = 13; - break; - case 10: - metadata = 12; - break; - case 4: - metadata = 3; - break; - case 5: - metadata = 2; - break; - case 12: - metadata = 11; - break; - case 13: - metadata = 10; - break; - - - } - - - - } - - else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) - { - switch (metadata) - { - case 1: - metadata = 0; - break; - case 2: - metadata = 1; - break; - case 3: - metadata = 2; - break; - case 0: - metadata = 3; - break; - case 5: - metadata = 4; - break; - case 6: - metadata = 5; - break; - case 7: - metadata = 6; - break; - case 4: - metadata = 7; - break; - case 9: - metadata = 8; - break; - case 10: - metadata = 9; - break; - case 11: - metadata = 10; - break; - case 8: - metadata = 11; - break; - case 13: - metadata = 12; - break; - case 14: - metadata = 13; - break; - case 15: - metadata = 14; - break; - case 12: - metadata = 15; - break; - - - } - - - - } - - - - - - - break; - case 3: - /** - * this is the default case- never need to change anything here - * - */ - - - - - break; - - } - - - } - return metadata; - } - - public void generateSchematic(LinkData link, int xOffset, int yOffset, int zOffset) + this.schematic=filePath; + try { - - World world; - Chunk chunk; - dimHelper.dimList.get(link.destDimID).hasBeenFilled=this.didRead; - SchematicLoader loader=this; - - int i = link.destXCoord; - int j = link.destYCoord-1; - int k = link.destZCoord; - - - - - - - if(dimHelper.getWorld(link.destDimID)==null) - { - dimHelper.initDimension(link.destDimID); - } - world=dimHelper.getWorld(link.destDimID); - - int x; - int y; - int z; - - - int xCooe=0; - int yCooe=0; - int zCooe=0; - - - - - - - - - for ( x = 0; x < loader.width; ++x) - { - for ( y = 0; y < loader.height; ++y) - { - for ( z = 0; z < loader.length; ++z) - { - if(link.linkOrientation==0) - { - zCooe=x-20; - yCooe=y-6; - xCooe=-z+35; - - } - if(link.linkOrientation==1) - { - xCooe=-x+20; - yCooe=y-6; - zCooe=-z+35; - } - if(link.linkOrientation==2) - { - zCooe=-x+20; - yCooe=y-6; - xCooe=+z-35; - } - if(link.linkOrientation==3) - { - xCooe=x-20; - yCooe=y-6; - zCooe=z-35; - } - - int index = y * width * length + z * width + x; - - int blockToReplace=loader.blocks[index]; - int blockMetaData=loader.blockData[index]; - NBTTagList tileEntity = loader.tileEntities; - //int size = tileEntity.tagCount(); - - - if(blockToReplace==Block.doorIron.blockID) - { - this.sideLinks.add(new Point3D(i+xCooe, j+yCooe, k+zCooe)); - } - if(blockToReplace==Block.doorWood.blockID) - { - this.exitLinks.add(new Point3D(i+xCooe, j+yCooe, k+zCooe)); - } - - if(Block.blocksList[blockToReplace]==null&&blockToReplace!=0||blockToReplace>158) - { - blockToReplace=mod_pocketDim.blockDimWall.blockID; - } - - if(blockToReplace>0) - { - - this.transMeta=this.transformMetadata(blockMetaData, link.linkOrientation, blockToReplace); - if(blockToReplace==Block.doorIron.blockID) - { - setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,mod_pocketDim.dimDoorID, transMeta ); - } - else - if(blockToReplace==Block.doorWood.blockID) - { - setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,mod_pocketDim.ExitDoorID, transMeta ); - } - else - { - - setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,blockToReplace, transMeta ); - } - - if(Block.blocksList[blockToReplace] instanceof BlockContainer) - { - TileEntity tile = world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe); - NBTTagCompound tag = this.tileEntityList[index]; - if(tag!=null) - { - tile.readFromNBT(tag); - } - - - - /** + InputStream input; + String fname= schematic ; + + if(!(new File(fname).exists())) + { + + + input = this.getClass().getResourceAsStream(fname); + } + else + { + System.out.println(new File(fname).exists()); + input = new FileInputStream(fname); + } + //FileInputStream fileinputstream = new FileInputStream(file); + NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(input); + + width = nbtdata.getShort("Width"); + height = nbtdata.getShort("Height"); + length = nbtdata.getShort("Length"); + + blockId = nbtdata.getByteArray("Blocks"); + blockData = nbtdata.getByteArray("Data"); + + blocks=new short[blockId.length]; + + addId = nbtdata.getByteArray("AddBlocks"); + + tileEntities = nbtdata.getTagList("TileEntities"); + tileEntityList = new NBTTagCompound[width*height*length]; + + for(int count = 0; count> 1) >= addId.length) + { + blocks[index] = (short) (blockId[index] & 0xFF); + } + else + { + if ((index & 1) == 0) + { + blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); + } + else + { + blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); + } + } + } + + + + } + catch (Exception e) + { + this.didRead=false; + System.out.println("Error- could not find file "+schematic); + e.printStackTrace(); + + } + + this.generateSchematic(link, 0, 0, 0); + + } + public int transformMetadata(int metadata, int orientation, int blockID) + { + if(mod_pocketDim.dungeonHelper.metadataFlipList.contains(blockID)) + { + + + + + + switch (orientation) + { + case 0: + + if(Block.blocksList[blockID] instanceof BlockStairs) + { + + switch (metadata) + { + case 0: + metadata = 2; + break; + case 1: + metadata = 3; + break; + case 2: + metadata = 1; + break; + case 3: + metadata = 0; + break; + case 7: + metadata = 4; + break; + case 6: + metadata = 5; + break; + case 5: + metadata = 7; + break; + case 4: + metadata = 6; + break; + + } + } + + else if(blockID== Block.chest.blockID||blockID== Block.chestTrapped.blockID||blockID== Block.ladder.blockID) + { + switch (metadata) + { + + case 2: + metadata = 5; + break; + case 3: + metadata = 4; + break; + case 4: + metadata = 2; + break; + case 5: + metadata = 3; + break; + + + + } + + } + else if(blockID==Block.vine.blockID) + { + switch (metadata) + { + + case 1: + metadata = 2; + break; + case 2: + metadata = 4; + break; + case 4: + metadata = 8; + break; + case 8: + metadata = 1; + break; + + + + } + + } + + + + + else if(blockID== Block.lever.blockID||blockID== Block.stoneButton.blockID||blockID== Block.woodenButton.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) + { + switch (metadata) + { + case 12: + metadata = 9; + break; + case 11: + metadata = 10; + break; + case 10: + metadata = 12; + break; + case 9: + metadata = 11; + break; + case 2: + metadata = 4; + break; + case 3: + metadata = 2; + break; + case 1: + metadata = 3; + break; + case 4: + metadata = 1; + + break; + + } + + } + + else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonStickyBase.blockID||blockID==Block.dispenser.blockID||blockID==Block.dropper.blockID) + { + switch (metadata) + { + case 4: + metadata = 2; + break; + case 5: + metadata = 3; + break; + case 13: + metadata = 11; + break; + case 12: + metadata = 10; + break; + case 3: + metadata = 4; + break; + case 2: + metadata = 5; + break; + case 11: + metadata = 12; + break; + case 10: + metadata = 13; + break; + + + } + + + + } + + else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) + { + + + switch (metadata) + { + case 0: + metadata = 1; + break; + case 1: + metadata = 2; + break; + case 2: + metadata = 3; + break; + case 3: + metadata = 0; + break; + case 4: + metadata = 5; + break; + case 5: + metadata = 6; + break; + case 6: + metadata = 7; + break; + case 7: + metadata = 4; + break; + case 8: + metadata = 9; + break; + case 9: + metadata = 10; + break; + case 10: + metadata = 11; + break; + case 11: + metadata = 8; + break; + case 12: + metadata = 13; + break; + case 13: + metadata = 14; + break; + case 14: + metadata = 15; + break; + case 15: + metadata = 12; + break; + + + } + + + + } + + + + + + break; + case 1: + + + if(Block.blocksList[blockID] instanceof BlockStairs) + { + + switch (metadata) + { + case 0: + metadata = 1; + break; + case 1: + metadata = 0; + break; + case 2: + metadata = 3; + break; + case 3: + metadata = 2; + break; + case 7: + metadata = 6; + break; + case 6: + metadata = 7; + break; + case 5: + metadata = 4; + break; + case 4: + metadata = 5; + break; + + } + } + + else if(blockID== Block.chest.blockID||blockID== Block.chestTrapped.blockID||blockID==Block.ladder.blockID) + { + switch (metadata) + { + + case 2: + metadata = 3; + break; + case 3: + metadata = 2; + break; + case 4: + metadata = 5; + break; + case 5: + metadata = 4; + break; + + + + } + + } + + else if(blockID==Block.vine.blockID) + { + switch (metadata) + { + + case 1: + metadata = 4; + break; + case 2: + metadata = 8; + break; + case 4: + metadata = 1; + break; + case 8: + metadata = 2; + break; + } + } + + + + + else if(blockID== Block.lever.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) + { + switch (metadata) + { + case 12: + metadata = 11; + break; + case 11: + metadata = 12; + break; + case 10: + metadata = 9; + break; + case 9: + metadata = 10; + break; + case 2: + metadata = 1; + break; + case 3: + metadata = 4; + break; + case 1: + metadata = 2; + break; + case 4: + metadata = 3; + + break; + + } + + } + + else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonStickyBase.blockID||blockID==Block.dispenser.blockID||blockID==Block.dropper.blockID) + { + switch (metadata) + { + case 4: + metadata = 5; + break; + case 5: + metadata = 4; + break; + case 13: + metadata = 12; + break; + case 12: + metadata = 13; + break; + case 3: + metadata = 2; + break; + case 2: + metadata = 3; + break; + case 11: + metadata = 10; + break; + case 10: + metadata = 11; + break; + + } + + + + } + + else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) + { + switch (metadata) + { + case 0: + metadata = 2; + break; + case 1: + metadata = 3; + break; + case 2: + metadata = 0; + break; + case 3: + metadata = 1; + break; + case 4: + metadata = 6; + break; + case 5: + metadata = 7; + break; + case 6: + metadata = 4; + break; + case 7: + metadata = 5; + break; + case 8: + metadata = 10; + break; + case 9: + metadata = 11; + break; + case 10: + metadata = 8; + break; + case 11: + metadata = 9; + break; + case 12: + metadata = 14; + break; + case 13: + metadata = 15; + break; + case 14: + metadata = 12; + break; + case 15: + metadata = 13; + break; + + + } + + + + } + + break; + case 2: + + if(Block.blocksList[blockID] instanceof BlockStairs) + { + + switch (metadata) + { + case 2: + metadata = 0; + break; + case 3: + metadata = 1; + break; + case 1: + metadata = 2; + break; + case 0: + metadata = 3; + break; + case 4: + metadata = 7; + break; + case 5: + metadata = 6; + break; + case 7: + metadata = 5; + break; + case 6: + metadata = 4; + break; + + } + } + + else if(blockID== Block.chest.blockID||blockID== Block.chestTrapped.blockID||blockID==Block.ladder.blockID) + { + switch (metadata) + { + + case 2: + metadata = 4; + break; + case 3: + metadata = 5; + break; + case 4: + metadata = 3; + break; + case 5: + metadata = 2; + break; + + + + } + + } + + else if(blockID==Block.vine.blockID) + { + switch (metadata) + { + + case 1: + metadata = 8; + break; + case 2: + metadata = 1; + break; + case 4: + metadata = 2; + break; + case 8: + metadata = 4; + break; + } + } + + + + + else if(blockID== Block.lever.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) + { + switch (metadata) + { + case 9: + metadata = 12; + break; + case 10: + metadata = 11; + break; + case 12: + metadata = 10; + break; + case 11: + metadata = 9; + break; + case 4: + metadata = 2; + break; + case 2: + metadata = 3; + break; + case 3: + metadata = 1; + break; + case 1: + metadata = 4; + + break; + + } + + } + + else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonStickyBase.blockID||blockID==Block.dispenser.blockID||blockID==Block.dropper.blockID) + { + switch (metadata) + { + case 2: + metadata = 4; + break; + case 3: + metadata = 5; + break; + case 11: + metadata = 13; + break; + case 10: + metadata = 12; + break; + case 4: + metadata = 3; + break; + case 5: + metadata = 2; + break; + case 12: + metadata = 11; + break; + case 13: + metadata = 10; + break; + + + } + + + + } + + else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) + { + switch (metadata) + { + case 1: + metadata = 0; + break; + case 2: + metadata = 1; + break; + case 3: + metadata = 2; + break; + case 0: + metadata = 3; + break; + case 5: + metadata = 4; + break; + case 6: + metadata = 5; + break; + case 7: + metadata = 6; + break; + case 4: + metadata = 7; + break; + case 9: + metadata = 8; + break; + case 10: + metadata = 9; + break; + case 11: + metadata = 10; + break; + case 8: + metadata = 11; + break; + case 13: + metadata = 12; + break; + case 14: + metadata = 13; + break; + case 15: + metadata = 14; + break; + case 12: + metadata = 15; + break; + + + } + + + + } + + + + + + + break; + case 3: + /** + * this is the default case- never need to change anything here + * + */ + + + + + break; + + } + + + } + return metadata; + } + + public void generateSchematic(LinkData link, int xOffset, int yOffset, int zOffset) + { + + World world; + Chunk chunk; + dimHelper.dimList.get(link.destDimID).hasBeenFilled=this.didRead; + SchematicLoader loader=this; + + int i = link.destXCoord; + int j = link.destYCoord-1; + int k = link.destZCoord; + + + + + + + if(dimHelper.getWorld(link.destDimID)==null) + { + dimHelper.initDimension(link.destDimID); + } + world=dimHelper.getWorld(link.destDimID); + + int x; + int y; + int z; + + + int xCooe=0; + int yCooe=0; + int zCooe=0; + + + + + + + + + for ( x = 0; x < loader.width; ++x) + { + for ( y = 0; y < loader.height; ++y) + { + for ( z = 0; z < loader.length; ++z) + { + if(link.linkOrientation==0) + { + zCooe=x-20; + yCooe=y-6; + xCooe=-z+35; + + } + if(link.linkOrientation==1) + { + xCooe=-x+20; + yCooe=y-6; + zCooe=-z+35; + } + if(link.linkOrientation==2) + { + zCooe=-x+20; + yCooe=y-6; + xCooe=+z-35; + } + if(link.linkOrientation==3) + { + xCooe=x-20; + yCooe=y-6; + zCooe=z-35; + } + + int index = y * width * length + z * width + x; + + int blockToReplace=loader.blocks[index]; + int blockMetaData=loader.blockData[index]; + NBTTagList tileEntity = loader.tileEntities; + //int size = tileEntity.tagCount(); + + + if(blockToReplace==Block.doorIron.blockID) + { + this.sideLinks.add(new Point3D(i+xCooe, j+yCooe, k+zCooe)); + } + if(blockToReplace==Block.doorWood.blockID) + { + this.exitLinks.add(new Point3D(i+xCooe, j+yCooe, k+zCooe)); + } + + if(Block.blocksList[blockToReplace]==null&&blockToReplace!=0||blockToReplace>158) + { + blockToReplace=mod_pocketDim.blockDimWall.blockID; + } + + if(blockToReplace>0) + { + + this.transMeta=this.transformMetadata(blockMetaData, link.linkOrientation, blockToReplace); + + if(blockToReplace==Block.doorIron.blockID) + { + setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,properties.DimensionalDoorID, transMeta ); + } + else + if(blockToReplace==Block.doorWood.blockID) + { + setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,properties.WarpDoorID, transMeta ); + } + else + { + + setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,blockToReplace, transMeta ); + } + + if(Block.blocksList[blockToReplace] instanceof BlockContainer) + { + TileEntity tile = world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe); + NBTTagCompound tag = this.tileEntityList[index]; + if(tag!=null) + { + tile.readFromNBT(tag); + } + + + + /** // System.out.println("found container"); Random rand= new Random(); if(world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe) instanceof TileEntityChest) { TileEntityChest chest = (TileEntityChest) world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe); - + ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); if(rand.nextBoolean()) { @@ -998,199 +992,195 @@ public class SchematicLoader } WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand),(TileEntityChest)world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe) , info.getCount(rand)); - + } if(world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe) instanceof TileEntityDispenser) { TileEntityDispenser dispenser = (TileEntityDispenser) world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe); dispenser.addItem(new ItemStack(Item.arrow, 64)); - + } - **/ - - } - } - } - } - - - } - - - - LinkData outgoingLink = dimHelper.instance.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); - - + **/ - - - - - for(Point3D point : this.sideLinks) - { - if(world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.dimDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.dimDoorID) - { - - int depth = dimHelper.instance.getDimDepth(link.locDimID); - int xNoise = 0; - int zNoise =0; - switch(world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ())) - { - case 0: - xNoise = (int)rand.nextInt(depth+1*200)+depth*50; - zNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; - - break; - case 1: - xNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; - zNoise = (int) rand.nextInt(depth+1*200)+depth*50; - - break; - case 2: - xNoise = - (rand.nextInt(depth+1*200)+depth*50); - zNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; - - break; - case 3: - xNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; - zNoise = -(rand.nextInt(depth+1*200)+depth*50); - - break; - + } } - - - - - - - - LinkData sideLink = new LinkData(link.destDimID,0,point.getX(), point.getY(), point.getZ(),xNoise+point.getX(), point.getY()+1, zNoise+point.getZ(),true,world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ())); - dimHelper.instance.createPocket(sideLink, true, true); - - - - - - } - } - for(Point3D point : this.exitLinks) - { - try - { - - if(world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())==Block.sandStone.blockID) - { - - LinkData randomLink=dimHelper.instance.getRandomLinkData(false); - - LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), 0, point.getZ(),true,world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ())); - - if(sideLink.destDimID==mod_pocketDim.limboDimID) - { - sideLink.destDimID=0; - } - else if((rand.nextBoolean()&&randomLink!=null)) - { - sideLink.destDimID=randomLink.locDimID; - // System.out.println("randomLink"); - } - - - - sideLink.destYCoord=yCoordHelper.getFirstUncovered(sideLink.destDimID, point.getX(),10,point.getZ()); - - if(sideLink.destYCoord<5) - { - sideLink.destYCoord=70; - } - - sideLink.linkOrientation=world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ()); - dimHelper.instance.createLink(sideLink); - dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation)); - - if(world.getBlockId(point.getX(), point.getY()-3, point.getZ())==mod_pocketDim.blockDimWallID) - { - setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(),Block.stoneBrick.blockID,0); - - } - else - { - setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(),world.getBlockId(point.getX(), point.getY()-3, point.getZ()),world.getBlockMetadata(point.getX(), point.getY()-3, point.getZ())); - - } - } - else if ((world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())!=Block.sandStone.blockID)) - { - this.incomingLink = point; - } - } - - - catch(Exception E) - { - E.printStackTrace(); } - - - - } - - - if(!this.incomingLink.equals(new Point3D(0,0,0))) - { - outgoingLink.locXCoord=this.incomingLink.getX(); - outgoingLink.locYCoord=this.incomingLink.getY(); - outgoingLink.locZCoord=this.incomingLink.getZ(); - outgoingLink.linkOrientation=world.getBlockMetadata(incomingLink.getX(), incomingLink.getY()-1, incomingLink.getZ()); - dimHelper.instance.createLink(outgoingLink); + } - link.destXCoord=this.incomingLink.getX(); - link.destYCoord=this.incomingLink.getY(); - link.destZCoord=this.incomingLink.getZ(); - dimHelper.instance.createLink(link); - - } } - - public void setBlockDirectly(World world, int x, int y, int z,int id, int metadata) - { - if(Block.blocksList[id]==null) - { - return; - } - Chunk chunk; - this.cX=x >>4; - this.cZ=z >>4; - this.cY=y >>4; - int chunkX=(x % 16)< 0 ? ((x) % 16)+16 : ((x) % 16); - int chunkY=y; - int chunkZ=((z) % 16)< 0 ? ((z) % 16)+16 : ((z) % 16); - - - // this.chunk=new EmptyChunk(world,cX, cZ); + + LinkData outgoingLink = dimHelper.instance.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); + + + + + + + + for(Point3D point : this.sideLinks) + { + if(world.getBlockId(point.getX(), point.getY(), point.getZ())==properties.DimensionalDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==properties.DimensionalDoorID) + { + + int depth = dimHelper.instance.getDimDepth(link.locDimID); + int xNoise = 0; + int zNoise =0; + switch(world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ())) + { + case 0: + xNoise = (int)rand.nextInt(depth+1*200)+depth*50; + zNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; + + break; + case 1: + xNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; + zNoise = (int) rand.nextInt(depth+1*200)+depth*50; + + break; + case 2: + xNoise = - (rand.nextInt(depth+1*200)+depth*50); + zNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; + + break; + case 3: + xNoise = (int)rand.nextInt(depth+1*20)-(10)*depth; + zNoise = -(rand.nextInt(depth+1*200)+depth*50); + + break; + + } + + + + + + + + LinkData sideLink = new LinkData(link.destDimID,0,point.getX(), point.getY(), point.getZ(),xNoise+point.getX(), point.getY()+1, zNoise+point.getZ(),true,world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ())); + dimHelper.instance.createPocket(sideLink, true, true); + + + + + + } + } + for(Point3D point : this.exitLinks) + { try { - chunk=world.getChunkFromChunkCoords(cX, cZ); - if (chunk.getBlockStorageArray()[cY] == null) - { - chunk.getBlockStorageArray()[cY] = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky); - } - - - chunk.getBlockStorageArray()[cY].setExtBlockID(chunkX, (y) & 15, chunkZ, id); - chunk.getBlockStorageArray()[cY].setExtBlockMetadata(chunkX, (y) & 15, chunkZ, metadata); + + if(world.getBlockId(point.getX(), point.getY(), point.getZ())==properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())==Block.sandStone.blockID) + { + + LinkData randomLink=dimHelper.instance.getRandomLinkData(false); + + LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), 0, point.getZ(),true,world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ())); + + if(sideLink.destDimID==properties.LimboDimensionID) + { + sideLink.destDimID=0; + } + else if((rand.nextBoolean()&&randomLink!=null)) + { + sideLink.destDimID=randomLink.locDimID; + // System.out.println("randomLink"); + } + + + + sideLink.destYCoord=yCoordHelper.getFirstUncovered(sideLink.destDimID, point.getX(),10,point.getZ()); + + if(sideLink.destYCoord<5) + { + sideLink.destYCoord=70; + } + + sideLink.linkOrientation=world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ()); + dimHelper.instance.createLink(sideLink); + dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation)); + + if(world.getBlockId(point.getX(), point.getY()-3, point.getZ()) == properties.FabricBlockID) + { + setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(),Block.stoneBrick.blockID,0); + + } + else + { + setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(),world.getBlockId(point.getX(), point.getY()-3, point.getZ()),world.getBlockMetadata(point.getX(), point.getY()-3, point.getZ())); + + } + } + else if ((world.getBlockId(point.getX(), point.getY(), point.getZ()) == properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())!=Block.sandStone.blockID)) + { + this.incomingLink = point; + } } - catch(Exception e) + + + catch(Exception E) { - e.printStackTrace(); + E.printStackTrace(); } - + + + } - - + + + if(!this.incomingLink.equals(new Point3D(0,0,0))) + { + outgoingLink.locXCoord=this.incomingLink.getX(); + outgoingLink.locYCoord=this.incomingLink.getY(); + outgoingLink.locZCoord=this.incomingLink.getZ(); + outgoingLink.linkOrientation=world.getBlockMetadata(incomingLink.getX(), incomingLink.getY()-1, incomingLink.getZ()); + dimHelper.instance.createLink(outgoingLink); + + link.destXCoord=this.incomingLink.getX(); + link.destYCoord=this.incomingLink.getY(); + link.destZCoord=this.incomingLink.getZ(); + dimHelper.instance.createLink(link); + + } + + } + + + public void setBlockDirectly(World world, int x, int y, int z,int id, int metadata) + { + if(Block.blocksList[id]==null) + { + return; + } + Chunk chunk; + this.cX = x >> 4; + this.cZ = z >> 4; + this.cY=y >>4; + + int chunkX=(x % 16)< 0 ? ((x) % 16)+16 : ((x) % 16); + int chunkZ=((z) % 16)< 0 ? ((z) % 16)+16 : ((z) % 16); + + + // this.chunk=new EmptyChunk(world,cX, cZ); + try + { + chunk=world.getChunkFromChunkCoords(cX, cZ); + if (chunk.getBlockStorageArray()[cY] == null) + { + chunk.getBlockStorageArray()[cY] = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky); + } + + + chunk.getBlockStorageArray()[cY].setExtBlockID(chunkX, (y) & 15, chunkZ, id); + chunk.getBlockStorageArray()[cY].setExtBlockMetadata(chunkX, (y) & 15, chunkZ, metadata); + } + catch(Exception e) + { + e.printStackTrace(); + } + } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java b/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java index 4c003b1..fff2079 100644 --- a/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java +++ b/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java @@ -7,9 +7,9 @@ import cpw.mods.fml.common.network.Player; public class ServerPacketHandler implements IPacketHandler { - @Override - public void onPacketData(INetworkManager manager, - Packet250CustomPayload packet, Player player) - { - } + @Override + public void onPacketData(INetworkManager manager, + Packet250CustomPayload packet, Player player) + { + } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/TransientDoor.java b/StevenDimDoors/mod_pocketDim/TransientDoor.java index bc99b2b..d52f679 100644 --- a/StevenDimDoors/mod_pocketDim/TransientDoor.java +++ b/StevenDimDoors/mod_pocketDim/TransientDoor.java @@ -32,10 +32,13 @@ public class TransientDoor extends ExitDoor { super(par1, Material.grass); // this.blockIndexInTexture = 18; - + if (properties == null) + properties = DDProperties.instance(); } + private static DDProperties properties = null; + public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top"); @@ -90,7 +93,7 @@ public class TransientDoor extends ExitDoor { dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); par1World.setBlock(par2, par3-1, par4, 0); - par1World.setBlock(par2, par3, par4, mod_pocketDim.blockRiftID); + par1World.setBlock(par2, par3, par4, properties.RiftBlockID); } } @@ -104,7 +107,7 @@ public class TransientDoor extends ExitDoor { dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); par1World.setBlock(par2, par3, par4, 0); - par1World.setBlock(par2, par3+1, par4, mod_pocketDim.blockRiftID); + par1World.setBlock(par2, par3+1, par4, properties.RiftBlockID); } } diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java index bd19550..2309e8e 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -16,83 +17,79 @@ import net.minecraft.world.World; public class BlockDimWallPerm extends Block { + private static DDProperties properties = null; public BlockDimWallPerm(int i, int j, Material par2Material) { - super(i, Material.ground); - setTickRandomly(true); - // this.setCreativeTab(CreativeTabs.tabBlock); - - - - - + super(i, Material.ground); + setTickRandomly(true); + // this.setCreativeTab(CreativeTabs.tabBlock); + if (properties == null) + properties = DDProperties.instance(); } public void registerIcons(IconRegister par1IconRegister) - { - this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2().replace("perm", "")); - } - public int quantityDropped(Random par1Random) - { - - - return 0; - - } - public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} - - /** - * Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0 - */ - public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) - { - if(!par1World.isRemote&&par1World.provider.dimensionId==mod_pocketDim.limboDimID) - { - Random rand = new Random(); - - LinkData link=dimHelper.instance.getRandomLinkData(false); - if(link==null) - { - link =new LinkData(0,0,0,0); - } - + { + this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2().replace("perm", "")); + } - if(dimHelper.getWorld(0)==null) - { - dimHelper.initDimension(0); - } - - - if(dimHelper.getWorld(0)!=null&&par5Entity instanceof EntityPlayer) - { - - - int x = (link.destXCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2); - int z = (link.destZCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2); - - x=x+(x>> 4); //make sure I am in the middle of a chunk, andnot on a boundry, so it doesnt load the chunk next to me - z=z+(z>> 4); + public int quantityDropped(Random par1Random) + { + return 0; + } + + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} - - - int y = yCoordHelper.getFirstUncovered(0, x, 63, z); - - //this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk - dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0), - EntityPlayer.class.cast(par5Entity)); + /** + * Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0 + */ + public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if(!par1World.isRemote&&par1World.provider.dimensionId==properties.LimboDimensionID) + { + Random rand = new Random(); - - EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z ); + LinkData link=dimHelper.instance.getRandomLinkData(false); + if(link==null) + { + link =new LinkData(0,0,0,0); + } - //makes sure they can breath when they teleport - dimHelper.getWorld(0).setBlock(x, y, z, 0); - int i=x; - int j=y-1; - int k=z; - - - for(int xc=-3;xc<4;xc++) + + if(dimHelper.getWorld(0)==null) + { + dimHelper.initDimension(0); + } + + + if(dimHelper.getWorld(0)!=null&&par5Entity instanceof EntityPlayer) + { + + + int x = (link.destXCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2); + int z = (link.destZCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2); + + //make sure I am in the middle of a chunk, and not on a boundary, so it doesn't load the chunk next to me + x = x + (x >> 4); + z = z + (z >> 4); + + int y = yCoordHelper.getFirstUncovered(0, x, 63, z); + + //this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk + dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0), + EntityPlayer.class.cast(par5Entity)); + + + EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z ); + + //makes sure they can breath when they teleport + dimHelper.getWorld(0).setBlock(x, y, z, 0); + int i=x; + int j=y-1; + int k=z; + + + for(int xc=-3;xc<4;xc++) { for(int zc=-3;zc<4;zc++) { @@ -100,15 +97,15 @@ public class BlockDimWallPerm extends Block { if(yc==0) { - + if(Math.abs(xc)+Math.abs(zc)0) - { - if(rand.nextInt(tile.xOffset)==0) - { - xGrowth =xGrowth+.15F*tile.xOffset; - - } - } - else if(tile.xOffset<0) - { - if(rand.nextInt(-tile.xOffset)==0) - { - xGrowthn =xGrowthn-.15F*-tile.xOffset; - - } - } - - if(tile.yOffset>0) - { - if(rand.nextInt(tile.yOffset)==0) - { - yGrowth =yGrowth+.15F*tile.yOffset; - - } - } - else if(tile.yOffset<0) - { - if(rand.nextInt(-tile.yOffset)==0) - { - yGrowthn =yGrowthn-.15F*-tile.yOffset; - - } - } - - if(tile.zOffset>0) - { - if(rand.nextInt(tile.zOffset)==0) - { - zGrowth =zGrowth+.15F*tile.zOffset; - - } - } - else if(tile.zOffset<0) - { - if(rand.nextInt(-tile.zOffset)==0) - { - zGrowthn =zGrowthn-.15F*-tile.zOffset; - - } - } - - - xChange=(float) ((xGrowth+xGrowthn)+rand.nextGaussian()*.05F); - yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F); - zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F); - - offset= (float) ((0.2F/(1+Math.abs(xChange)+Math.abs(yChange)+Math.abs(zChange)))); - Xoffset= (float) ((0.25F/(1+Math.abs(xChange)))); - - Yoffset= (float) ((0.25F/(1+Math.abs(yChange)))); - Zoffset= (float) ((0.25F/(1+Math.abs(zChange)))); - - - - - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5+xChange+Xoffset*rand.nextGaussian(), par3+.5+yChange+Yoffset*rand.nextGaussian() , par4+.5+zChange+Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer)); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5-xChange-Xoffset*rand.nextGaussian(), par3+.5-yChange-Yoffset*rand.nextGaussian() , par4+.5-zChange-Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer)); + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} - if(rand.nextBoolean()) - { - //renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles. - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer)); - } - if(tile.shouldClose) - { - //renders an opposite color effect if it is being closed by the rift remover - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer)); - - } - - } - - } - public int idPicked(World par1World, int par2, int par3, int par4) - { - return 0; - } - - public int idDropped(int par1, Random par2Random, int par3) - { - return 0; - } + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag + */ + public boolean canCollideCheck(int par1, boolean par2) + { + + return par2; + } + + /** + * Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the + * adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side + */ + public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + //this doesnt do anything yet. + public int getRenderType() + { + if(mod_pocketDim.isPlayerWearingGoogles) + { + return 0; + } + + return 8; + } + + @SideOnly(Side.CLIENT) + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + //function that regulates how many blocks it eats/ how fast it eates them. + public void updateTick(World world, int x, int y, int z, Random random) + { + if(!world.isRemote&&dimHelper.instance.getLinkDataFromCoords(x, y, z, world.provider.dimensionId)!=null && properties.RiftGriefingEnabled) + { + TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z); + if(rift.isNearRift) + { + + int range=4; + + float distance=range+range/4; + int i=-range; + int j=-range; + int k=-range; + boolean flag=true; + while (i0) + { + if(rand.nextInt(tile.xOffset)==0) + { + xGrowth =xGrowth+.15F*tile.xOffset; + + } + } + else if(tile.xOffset<0) + { + if(rand.nextInt(-tile.xOffset)==0) + { + xGrowthn =xGrowthn-.15F*-tile.xOffset; + + } + } + + if(tile.yOffset>0) + { + if(rand.nextInt(tile.yOffset)==0) + { + yGrowth =yGrowth+.15F*tile.yOffset; + + } + } + else if(tile.yOffset<0) + { + if(rand.nextInt(-tile.yOffset)==0) + { + yGrowthn =yGrowthn-.15F*-tile.yOffset; + + } + } + + if(tile.zOffset>0) + { + if(rand.nextInt(tile.zOffset)==0) + { + zGrowth =zGrowth+.15F*tile.zOffset; + + } + } + else if(tile.zOffset<0) + { + if(rand.nextInt(-tile.zOffset)==0) + { + zGrowthn =zGrowthn-.15F*-tile.zOffset; + + } + } + + + xChange=(float) ((xGrowth+xGrowthn)+rand.nextGaussian()*.05F); + yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F); + zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F); + + offset= (float) ((0.2F/(1+Math.abs(xChange)+Math.abs(yChange)+Math.abs(zChange)))); + Xoffset= (float) ((0.25F/(1+Math.abs(xChange)))); + + Yoffset= (float) ((0.25F/(1+Math.abs(yChange)))); + Zoffset= (float) ((0.25F/(1+Math.abs(zChange)))); + + + + + FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5+xChange+Xoffset*rand.nextGaussian(), par3+.5+yChange+Yoffset*rand.nextGaussian() , par4+.5+zChange+Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer)); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5-xChange-Xoffset*rand.nextGaussian(), par3+.5-yChange-Yoffset*rand.nextGaussian() , par4+.5-zChange-Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer)); + + + if(rand.nextBoolean()) + { + //renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles. + FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer)); + } + if(tile.shouldClose) + { + //renders an opposite color effect if it is being closed by the rift remover + FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer)); + + } + + } + + } + public int idPicked(World par1World, int par2, int par3, int par4) + { + return 0; + } + + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } @Override public TileEntity createNewTileEntity(World var1) - + { // TODO Auto-generated method stub return new TileEntityRift(); } - - - + + + } diff --git a/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java b/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java index 611b357..0806ae4 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -28,12 +29,13 @@ import cpw.mods.fml.relauncher.SideOnly; public class ChaosDoor extends dimDoor { private Icon blockIconBottom; + private static DDProperties properties = null; + public ChaosDoor(int par1, Material material) { super(par1, Material.iron); - // this.blockIndexInTexture = 18; - - + if (properties == null) + properties = DDProperties.instance(); } public void registerIcons(IconRegister par1IconRegister) @@ -74,7 +76,7 @@ public class ChaosDoor extends dimDoor if(newDim) { - LinkData link = new LinkData(par1World.provider.dimensionId, mod_pocketDim.limboDimID, par2, par3, par4, par2, par3+500, par4, false,0); + LinkData link = new LinkData(par1World.provider.dimensionId, properties.LimboDimensionID, par2, par3, par4, par2, par3+500, par4, false,0); link.linkOrientation= par1World.getBlockMetadata(par2, par3-1, par4); dimHelper.instance.createLink(link); // System.out.println(link.linkOrientation); @@ -101,9 +103,8 @@ public class ChaosDoor extends dimDoor int var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); int num = par1World.getBlockMetadata(par2, par3-1, par4); - if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.chaosDoorID) + if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==properties.UnstableDoorID) { - this.onPoweredBlockChange(par1World, par2, par3, par4, false); boolean foundRandomDest=false; @@ -122,7 +123,7 @@ public class ChaosDoor extends dimDoor if(link!=null) { - if(!link.isLocPocket&&link.linkOrientation!=-10&&link.destDimID!=mod_pocketDim.limboDimID) + if(!link.isLocPocket&&link.linkOrientation!=-10&&link.destDimID!=properties.LimboDimensionID) { foundRandomDest=true; @@ -132,7 +133,7 @@ public class ChaosDoor extends dimDoor { if(dimHelper.getWorld(link.locDimID).isAirBlock(link.locXCoord,link.locYCoord,link.locZCoord)) { - dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord,link.locYCoord,link.locZCoord, mod_pocketDim.blockRiftID); + dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord,link.locYCoord,link.locZCoord, properties.RiftBlockID); } } } diff --git a/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java b/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java index 82ffb50..ae4533c 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -34,9 +35,11 @@ public class dimDoor extends BlockContainer super(par1, Material.iron); // this.blockIndexInTexture = 18; - + if (properties == null) + properties = DDProperties.instance(); } + private static DDProperties properties = null; public void registerIcons(IconRegister par1IconRegister) @@ -56,19 +59,19 @@ public class dimDoor extends BlockContainer if(dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World)!=null) { LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); - par1World.setBlock(par2, par3, par4, mod_pocketDim.blockRiftID); + par1World.setBlock(par2, par3, par4, properties.RiftBlockID); } if(dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World)!=null) { LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World); - par1World.setBlock(par2, par3-1, par4, mod_pocketDim.blockRiftID); + par1World.setBlock(par2, par3-1, par4, properties.RiftBlockID); } if(dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World)!=null) { LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World); - par1World.setBlock(par2, par3+1, par4, mod_pocketDim.blockRiftID); + par1World.setBlock(par2, par3+1, par4, properties.RiftBlockID); } @@ -546,7 +549,7 @@ public class dimDoor extends BlockContainer { if (!par1World.isRemote) { - this.dropBlockAsItem(par1World, par2, par3, par4, mod_pocketDim.dimDoorID, 0); + this.dropBlockAsItem(par1World, par2, par3, par4, properties.DimensionalDoorID, 0); } } else diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java index 0eeca5f..11f444d 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import cpw.mods.fml.common.FMLCommonHandler; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -14,14 +15,19 @@ import net.minecraft.world.World; public class CommandDeleteRifts extends CommandBase { + public CommandDeleteRifts() + { + if (properties == null) + properties = DDProperties.instance(); + } + + private static DDProperties properties = null; + public String getCommandName()//the name of our command { return "dimdoors-cleanupRifts"; } - - - @Override public void processCommand(ICommandSender var1, String[] var2) @@ -79,7 +85,7 @@ public class CommandDeleteRifts extends CommandBase } targetWorld = dimHelper.getWorld(targetDim); - if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==mod_pocketDim.blockRiftID) + if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==properties.RiftBlockID) { dim.removeLinkAtCoords(link); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java index f992d99..d2977ef 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDim.commands; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DungeonGenerator; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; @@ -10,14 +11,19 @@ import net.minecraft.entity.player.EntityPlayer; public class CommandEndDungeonCreation extends CommandBase { + private static DDProperties properties = null; + + public CommandEndDungeonCreation() + { + if (properties == null) + properties = DDProperties.instance(); + } + public String getCommandName()//the name of our command { return "dimdoors-endDungeonCreation"; } - - - @Override public void processCommand(ICommandSender var1, String[] var2) @@ -53,8 +59,8 @@ public class CommandEndDungeonCreation extends CommandBase } else if(!player.worldObj.isRemote) { - DungeonGenerator newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic"); - player.sendChatToPlayer("created dungeon schematic in " +mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic"); + DungeonGenerator newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, properties.CustomSchematicDirectory + "/" + var2[0] + ".schematic"); + player.sendChatToPlayer("created dungeon schematic in " + properties.CustomSchematicDirectory +"/"+var2[0]+".schematic"); mod_pocketDim.dungeonHelper.customDungeons.add(newDungeon); if(mod_pocketDim.dungeonHelper.customDungeonStatus.containsKey(player.worldObj.provider.dimensionId)&&!player.worldObj.isRemote) diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java index 9ac8e1b..011bd6c 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import cpw.mods.fml.common.FMLCommonHandler; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -18,6 +19,14 @@ import net.minecraft.world.World; public class CommandStartDungeonCreation extends CommandBase { + public CommandStartDungeonCreation() + { + if (properties == null) + properties = DDProperties.instance(); + } + + private static DDProperties properties = null; + public String getCommandName()//the name of our command { return "dimdoors-startDungeonCreation"; @@ -40,7 +49,7 @@ public class CommandStartDungeonCreation extends CommandBase link = dimHelper.instance.createPocket(link,true, false); - itemDimDoor.placeDoorBlock(player.worldObj, x, y, z, 3, Block.blocksList[mod_pocketDim.ExitDoorID]); + itemDimDoor.placeDoorBlock(player.worldObj, x, y, z, 3, Block.blocksList[properties.WarpDoorID]); // dimHelper.instance.teleportToPocket(player.worldObj, link, player); diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 0bee3e0..51dc5e6 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -13,6 +13,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DungeonGenerator; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -37,9 +38,12 @@ public class DungeonHelper public DungeonHelper() { - + if (properties == null) + properties = DDProperties.instance(); } + private static DDProperties properties = null; + private Random rand = new Random(); public HashMap customDungeonStatus = new HashMap(); @@ -361,27 +365,27 @@ public class DungeonHelper for(int count=0;count<50;count++) { - if(world.getBlockId(xMin, yI, zI)!=mod_pocketDim.blockDimWallPermID) + if(world.getBlockId(xMin, yI, zI)!=properties.PermaFabricBlockID) { xMin--; } - if(world.getBlockId(xI, yMin, zI)!=mod_pocketDim.blockDimWallPermID) + if(world.getBlockId(xI, yMin, zI)!=properties.PermaFabricBlockID) { yMin--; } - if(world.getBlockId(xI, yI, zMin)!=mod_pocketDim.blockDimWallPermID) + if(world.getBlockId(xI, yI, zMin)!=properties.PermaFabricBlockID) { zMin--; } - if(world.getBlockId(xMax, yI, zI)!=mod_pocketDim.blockDimWallPermID) + if(world.getBlockId(xMax, yI, zI)!=properties.PermaFabricBlockID) { xMax++; } - if(world.getBlockId(xI, yMax, zI)!=mod_pocketDim.blockDimWallPermID) + if(world.getBlockId(xI, yMax, zI)!=properties.PermaFabricBlockID) { yMax++; } - if(world.getBlockId(xI, yI, zMax)!=mod_pocketDim.blockDimWallPermID) + if(world.getBlockId(xI, yI, zMax)!=properties.PermaFabricBlockID) { zMax++; } @@ -409,11 +413,11 @@ public class DungeonHelper int blockID = world.getBlockId(x+xMin, y+yMin, z+zMin); int meta= world.getBlockMetadata(x+xMin, y+yMin, z+zMin); - if(blockID==mod_pocketDim.dimDoorID) + if(blockID==properties.DimensionalDoorID) { blockID=Block.doorIron.blockID; } - if(blockID==mod_pocketDim.ExitDoorID) + if(blockID==properties.WarpDoorID) { blockID=Block.doorWood.blockID; diff --git a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java index c3ac18d..8aed210 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java @@ -10,12 +10,30 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Random; import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.packet.Packet41EntityEffect; +import net.minecraft.network.packet.Packet43Experience; +import net.minecraft.network.packet.Packet9Respawn; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; +import net.minecraftforge.common.DimensionManager; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.ObjectSaveInputStream; @@ -24,32 +42,7 @@ import StevenDimDoors.mod_pocketDim.TileEntityRift; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.world.LimboProvider; import StevenDimDoors.mod_pocketDim.world.pocketProvider; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.packet.Packet10Flying; -import net.minecraft.network.packet.Packet39AttachEntity; -import net.minecraft.network.packet.Packet41EntityEffect; -import net.minecraft.network.packet.Packet43Experience; -import net.minecraft.network.packet.Packet9Respawn; -import net.minecraft.potion.PotionEffect; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.Teleporter; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.storage.ExtendedBlockStorage; -import net.minecraftforge.common.DimensionManager; import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -80,20 +73,20 @@ public class dimHelper extends DimensionManager public static dimHelper instance = new dimHelper(); /** - * HashMap for temporary storage of Link Singnature damage hash values. See itemLinkSignature for more details + * HashMap for temporary storage of Link Signature damage hash values. See itemLinkSignature for more details * @Return */ public HashMap interDimLinkList= new HashMap(); /** * ArrayList containing all link data not sorted for easy random access, used for random doors and for recreating rifts if they have a block placed over them. - * See the common tick manager and the Chaos door for details on useage + * See the common tick manager and the Chaos door for details on usage * @Return */ //public ArrayList linksForRendering =new ArrayList(); Random rand= new Random(); - //Stupid function I use because I dont understand bitwise operations yet. Used in door orientation + //Stupid function I use because I don't understand bitwise operations yet. Used in door orientation //TODO get rid of this public int flipDoorMetadata(int data) { @@ -113,9 +106,6 @@ public class dimHelper extends DimensionManager { return 1; } - - - if(data==4) { return 6; @@ -160,16 +150,8 @@ public class dimHelper extends DimensionManager { entity.mountEntity(null); cart = teleportEntity(oldWorld, cart, link); - - - } - - - - - WorldServer newWorld; if(this.getWorld(link.destDimID)==null) @@ -296,16 +278,11 @@ public class dimHelper extends DimensionManager WorldServer.class.cast(newWorld).getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4); } mod_pocketDim.teleporter.placeInPortal(entity, newWorld, link); - return entity; - - - - - - + return entity; } + /** - * Primary function used to teleport the player using doors. Performes numerous null checks, and also generates the destination door/pocket if it has not done so already. + * Primary function used to teleport the player using doors. Performs numerous null checks, and also generates the destination door/pocket if it has not done so already. * Also ensures correct orientation relative to the door using the pocketTeleporter. * @param world- world the player is currently in * @param linkData- the link the player is using to teleport, sends the player to its dest information. @@ -315,28 +292,23 @@ public class dimHelper extends DimensionManager */ public void teleportToPocket(World world,LinkData linkData, Entity entity) { - if(world.isRemote) + DDProperties properties = DDProperties.instance(); + + if (world.isRemote) { return; } - - - if(linkData!=null) + if (linkData != null) { - - - int destinationID=linkData.destDimID; int x=linkData.destXCoord; int y=linkData.destYCoord; int z=linkData.destZCoord; - - int depth= this.getDimDepth(world.provider.dimensionId); - if(this.dimList.containsKey(destinationID)&&this.dimList.containsKey(world.provider.dimensionId)) + if(this.dimList.containsKey(destinationID) && this.dimList.containsKey(world.provider.dimensionId)) { this.generatePocket(linkData); @@ -384,14 +356,14 @@ public class dimHelper extends DimensionManager } if(count==19) { - entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID); + entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, properties.FabricBlockID); } } } if(entity.worldObj.getBlockId(playerXCoord, playerYCoord-1,playerZCoord )==Block.lavaStill.blockID) { - entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID); + entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, properties.FabricBlockID); } this.generateDoor(world,linkData); @@ -470,21 +442,15 @@ public class dimHelper extends DimensionManager */ public LinkData createLink( int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord,int linkOrientation) { - - - LinkData linkData =new LinkData( locationDimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord ,destinationZCoord,false,linkOrientation); return this.createLink(linkData); - - - } public LinkData createLink(LinkData link) { - - + DDProperties properties = DDProperties.instance(); + if(!this.dimList.containsKey(link.locDimID)) { DimData locationDimData= new DimData(link.locDimID, false, 0, link.locDimID,link.locXCoord,link.locYCoord,link.locZCoord); @@ -514,7 +480,7 @@ public class dimHelper extends DimensionManager if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace)) { - dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID); + dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID); } @@ -620,6 +586,8 @@ public class dimHelper extends DimensionManager int destY = incLink.destYCoord; int destZ = incLink.destZCoord; + DDProperties properties = DDProperties.instance(); + if(!incLink.hasGennedDoor) { @@ -629,7 +597,7 @@ public class dimHelper extends DimensionManager DimData data = this.dimList.get(destinationID); int id =world.getBlockId(locX, locY, locZ); - if(id==mod_pocketDim.ExitDoorID||id==mod_pocketDim.dimDoorID||id==mod_pocketDim.transientDoorID) + if(id==properties.WarpDoorID||id==properties.DimensionalDoorID||id==properties.TransientDoorID) { int doorTypeToPlace=id; @@ -653,7 +621,7 @@ public class dimHelper extends DimensionManager int blockToReplace= this.getWorld(destinationID).getBlockId(destX, destY, destZ); - if(blockToReplace!=mod_pocketDim.dimDoorID&&blockToReplace!=mod_pocketDim.ExitDoorID&&blockToReplace!=mod_pocketDim.transientDoorID) + if(blockToReplace!=properties.DimensionalDoorID&&blockToReplace!=properties.WarpDoorID&&blockToReplace != properties.TransientDoorID) { this.getWorld(destinationID).setBlock(destX, destY-1, destZ, doorTypeToPlace,destOrientation,2); this.getWorld(destinationID).setBlock(destX, destY, destZ, doorTypeToPlace,8,2); @@ -683,6 +651,8 @@ public class dimHelper extends DimensionManager */ public void generatePocket(LinkData incomingLink) { + DDProperties properties = DDProperties.instance(); + try { @@ -764,15 +734,15 @@ public class dimHelper extends DimensionManager { if(Math.abs(xCount)>=19||Math.abs(yCount)>=19||Math.abs(zCount)>=19) { - this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,mod_pocketDim.blockDimWallPermID,0); + this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,properties.PermaFabricBlockID,0); } else { - this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,mod_pocketDim.blockDimWallID,0); - if(mod_pocketDim.TNFREAKINGT) + this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,properties.FabricBlockID,0); + if(properties.TNFREAKINGT_Enabled) { - if((Math.abs(xCount)>=16||Math.abs(yCount)>=16||Math.abs(zCount)>=16)&&rand.nextInt(mod_pocketDim.HOW_MUCH_TNT)==1) + if((Math.abs(xCount)>=16||Math.abs(yCount)>=16||Math.abs(zCount)>=16) && rand.nextInt(properties.NonTntWeight + 1) == 0) { this.getWorld(incomingLink.destDimID).setBlock( x+xCount, y+yCount, z+zCount,Block.tnt.blockID); } @@ -807,6 +777,8 @@ public class dimHelper extends DimensionManager */ public void initPockets() { + DDProperties properties = DDProperties.instance(); + mod_pocketDim.hasInitDims=true; this.load(); if(!this.dimList.isEmpty()) @@ -826,7 +798,7 @@ public class dimHelper extends DimensionManager try { this.getNextFreeDimId(); - registerDimension(dimData.dimID,mod_pocketDim.providerID); + registerDimension(dimData.dimID,properties.PocketProviderID); } catch (Exception e) { @@ -911,9 +883,11 @@ public class dimHelper extends DimensionManager */ public LinkData createPocket(LinkData link , boolean isGoingDown, boolean isRandomRift) { - if(this.getWorld(link.locDimID)==null) + DDProperties properties = DDProperties.instance(); + + if (dimHelper.getWorld(link.locDimID) == null) { - this.initDimension(link.locDimID); + dimHelper.initDimension(link.locDimID); } int dimensionID; @@ -921,11 +895,7 @@ public class dimHelper extends DimensionManager // World world = this.getWorld(link.locDimID); dimensionID = getNextFreeDimId(); - registerDimension(dimensionID,mod_pocketDim.providerID); - - - - + registerDimension(dimensionID, properties.PocketProviderID); DimData locationDimData; DimData destDimData; @@ -1324,6 +1294,7 @@ public class dimHelper extends DimensionManager */ public static boolean removeRift(World world, int x, int y, int z, int range, EntityPlayer player, ItemStack item) { + DDProperties properties = DDProperties.instance(); LinkData nearest=null; float distance=range+1; @@ -1337,7 +1308,7 @@ public class dimHelper extends DimensionManager { while (k> limboSpawnInventory = new HashMap>(); - public static HashMap> limboSpawnInventory=new HashMap>(); + public static ArrayList blocksImmuneToRift = new ArrayList(); - public static ArrayList blocksImmuneToRift= new ArrayList(); + public static boolean hasInitDims = false; + public static boolean isPlayerWearingGoogles = false; - - - - - - - public static boolean riftsInWorldGen; - - public static boolean isLimboActive; - - public static boolean enableIronDimDoor; - - public static boolean enableWoodenDimDoor; - - public static boolean enableRiftSignature; - - public static boolean enableRiftRemover; - - public static boolean enableUnstableDoor; - - public static boolean enableRiftBlade; - - // public static boolean enableDimRail; - - public static boolean enableDimTrapDoor; - - public static boolean enableStabilizedRiftSignature; - - public static boolean enableDoorOpenGL; - - public static boolean hardcoreLimbo; - - public static boolean returnInventory; - - public static boolean hasInitDims=false; - - public static boolean TNFREAKINGT; - - public static boolean isPlayerWearingGoogles=false; - - - - - - - public static RiftGenerator riftGen = new RiftGenerator(); - - - // public static World limbo= null; + private static DDProperties properties; + public static RiftGenerator riftGen; public static long genTime; - public static boolean enableRiftGrief; - - - - - - //public Spells spells = null; - - + public static int teleTimer = 0; @PreInit public void PreInit(FMLPreInitializationEvent event) { + //This should be the FIRST thing that gets done. + properties = DDProperties.create(event.getSuggestedConfigurationFile()); - + //Now do other stuff MinecraftForge.EVENT_BUS.register(new EventHookContainer()); - File configFile = event.getSuggestedConfigurationFile(); + + //These fields MUST be initialized after properties are loaded to prevent + //instances from holding onto null references to the properties. + + loader = new SchematicLoader(); + teleporter = new pocketTeleporter(); + dungeonHelper= new DungeonHelper(); - Configuration config = new Configuration(configFile); - - - DimDoorsConfig.loadConfig(configFile); - - - String schematicDir = configFile.getParent()+"/DimDoors_Custom_schematics"; - this.schematicContainer=schematicDir; - File file= new File(schematicDir); + printDimData = new CommandPrintDimData(); + removeRiftsCommand = new CommandDeleteRifts(); + pruneDimsCommand = new CommandPruneDims(); + removeAllLinksCommand = new CommandDeleteAllLinks(); + deleteDimDataCommand = new CommandDeleteDimData(); + addDungeonRift = new CommandAddDungeonRift(); + endDungeonCreation = new CommandEndDungeonCreation(); + startDungeonCreation = new CommandStartDungeonCreation(); + tracker = new PlayerRespawnTracker(); + riftGen = new RiftGenerator(); + + File file= new File(properties.CustomSchematicDirectory); file.mkdir(); String helpFile = "/mods/DimDoors/How_to_add_dungeons.txt"; @@ -270,70 +180,44 @@ public class mod_pocketDim copyfile.copyFile(helpFile, file+"/How_to_add_dungeons.txt"); } - dungeonHelper.importCustomDungeons(schematicDir); + dungeonHelper.importCustomDungeons(properties.CustomSchematicDirectory); dungeonHelper.registerBaseDungeons(); dungeonHelper.registerDungeonTypeTags(); - - - - - - - - - - - - - - - - } @Init public void Init(FMLInitializationEvent event) { + transientDoor = (new TransientDoor(properties.TransientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor"); - - - - transientDoor = (new TransientDoor(transientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor"); - - // linkDimDoor = (new linkDimDoor(linkDimDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimDoorLink"); - blockDimWall = (new BlockDimWall(blockDimWallID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall"); - blockDimWallPerm = (new BlockDimWallPerm(blockDimWallPermID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setHardness(100000.0F).setUnlocalizedName("blockDimWallPerm"); - ExitDoor = (new ExitDoor(ExitDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp"); - // linkExitDoor = (new linkExitDoor(linkExitDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorexitlink"); - blockRift = (new BlockRift(blockRiftID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift")); - blockLimbo = (new BlockLimbo(blockLimboID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F)); - chaosDoor = (new ChaosDoor(chaosDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) ); - dimDoor = (new dimDoor(dimDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor"); - dimHatch = (new dimHatch(dimHatchID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch"); + blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall"); + blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setHardness(100000.0F).setUnlocalizedName("blockDimWallPerm"); + ExitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp"); + blockRift = (new BlockRift(properties.RiftBlockID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift")); + blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F)); + chaosDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) ); + dimDoor = (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor"); + dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch"); // dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail"); - itemDimDoor = (new itemDimDoor(itemDimDoorID, Material.iron)).setUnlocalizedName("itemDimDoor"); - itemExitDoor = (new itemExitDoor(itemExitDoorID, Material.wood)).setUnlocalizedName("itemDimDoorWarp"); - itemLinkSignature = (new itemLinkSignature(itemLinkSignatureID )).setUnlocalizedName("itemLinkSignature"); - itemRiftRemover = (new itemRiftRemover(itemRiftRemoverID, Material.wood)).setUnlocalizedName("itemRiftRemover"); - itemStableFabric = (new ItemStableFabric(itemStableFabricID, 0)).setUnlocalizedName("itemStableFabric"); - itemChaosDoor = (new ItemChaosDoor(itemChaosDoorID, Material.iron)).setUnlocalizedName("itemChaosDoor"); - itemRiftBlade = (new ItemRiftBlade(itemRiftBladeID, Material.iron)).setUnlocalizedName("ItemRiftBlade"); - itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(itemStabilizedLinkSignatureID)).setUnlocalizedName("itemStabilizedRiftSig"); + itemDimDoor = (new itemDimDoor(properties.DimensionalDoorItemID, Material.iron)).setUnlocalizedName("itemDimDoor"); + itemExitDoor = (new itemExitDoor(properties.WarpDoorItemID, Material.wood)).setUnlocalizedName("itemDimDoorWarp"); + itemLinkSignature = (new itemLinkSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature"); + itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover"); + itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric"); + itemChaosDoor = (new ItemChaosDoor(properties.UnstableDoorItemID, Material.iron)).setUnlocalizedName("itemChaosDoor"); + itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID, Material.iron)).setUnlocalizedName("ItemRiftBlade"); + itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig"); - this.limboBiome= (new BiomeGenLimbo(this.limboBiomeID) ); - this.pocketBiome= (new BiomeGenPocket(this.pocketBiomeID)); + mod_pocketDim.limboBiome= (new BiomeGenLimbo(properties.LimboBiomeID)); + mod_pocketDim.pocketBiome= (new BiomeGenPocket(properties.PocketBiomeID)); + GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen); - GameRegistry.registerWorldGenerator(this.riftGen); - - //GameRegistry.registerBlock(dimRail, "Dimensional Rail"); GameRegistry.registerBlock(chaosDoor, "Unstable Door"); GameRegistry.registerBlock(ExitDoor, "Warp Door"); - //GameRegistry.registerBlock(linkExitDoor, "Warp Door link"); GameRegistry.registerBlock(blockRift, "Rift"); GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric"); - //GameRegistry.registerBlock(linkDimDoor, "Dimensional Door link"); GameRegistry.registerBlock(dimDoor, "Dimensional Door"); GameRegistry.registerBlock(dimHatch,"Transdimensional Trapdoor"); GameRegistry.registerBlock(blockDimWall, "Fabric of Reality"); @@ -342,28 +226,21 @@ public class mod_pocketDim GameRegistry.registerPlayerTracker(tracker); - - - DimensionManager.registerProviderType(this.providerID, pocketProvider.class, false); - DimensionManager.registerProviderType(this.limboProviderID, LimboProvider.class, false); - - - - DimensionManager.registerDimension(this.limboDimID , this.limboProviderID); + DimensionManager.registerProviderType(properties.PocketProviderID, pocketProvider.class, false); + DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false); + DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID); LanguageRegistry.addName(transientDoor , "transientDoor"); - LanguageRegistry.addName(blockRift , "Rift"); LanguageRegistry.addName(blockLimbo , "Unraveled Fabric"); LanguageRegistry.addName(ExitDoor , "Warp Door"); LanguageRegistry.addName(chaosDoor , "Unstable Door"); - //LanguageRegistry.addName(linkDimDoor, "Dimensional Door"); LanguageRegistry.addName(blockDimWall , "Fabric of Reality"); LanguageRegistry.addName(blockDimWallPerm , "Fabric of Reality"); LanguageRegistry.addName(dimDoor, "Dimensional Door"); LanguageRegistry.addName(dimHatch, "Transdimensional Trapdoor"); - LanguageRegistry.addName(itemExitDoor , "Warp Door"); + LanguageRegistry.addName(itemExitDoor, "Warp Door"); LanguageRegistry.addName(itemLinkSignature , "Rift Signature"); LanguageRegistry.addName(itemStabilizedLinkSignature, "Stabilized Rift Signature"); LanguageRegistry.addName(itemRiftRemover , "Rift Remover"); @@ -381,17 +258,15 @@ public class mod_pocketDim GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor"); GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); - EntityRegistry.registerModEntity(MobObelisk.class, "Obelisk", this.obeliskID, this,70, 1, true); - EntityList.IDtoClassMapping.put(this.obeliskID, MobObelisk.class); - EntityList.entityEggs.put(this.obeliskID, new EntityEggInfo(this.obeliskID, 0, 0xffffff)); + EntityRegistry.registerModEntity(MobObelisk.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true); + EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobObelisk.class); + EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff)); LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith"); - - //GameRegistry.addBiome(this.limboBiome); //GameRegistry.addBiome(this.pocketBiome); - if(this.enableIronDimDoor) + if (properties.CraftingDimensionaDoorAllowed) { GameRegistry.addRecipe(new ItemStack(itemDimDoor, 1), new Object[] { @@ -400,7 +275,7 @@ public class mod_pocketDim GameRegistry.addRecipe(new ItemStack(itemDimDoor, 1), new Object[] { - " ", "yxy", " ", 'x', this.itemStableFabric, 'y', Item.doorIron + " ", "yxy", " ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.doorIron }); } @@ -419,14 +294,14 @@ public class mod_pocketDim } **/ - if(this.enableUnstableDoor) + if(properties.CraftingUnstableDoorAllowed) { GameRegistry.addRecipe(new ItemStack(itemChaosDoor, 1), new Object[] { - " ", "yxy", " ", 'x', Item.eyeOfEnder, 'y', this.itemDimDoor + " ", "yxy", " ", 'x', Item.eyeOfEnder, 'y', mod_pocketDim.itemDimDoor }); } - if(this.enableWoodenDimDoor) + if(properties.CraftingWarpDoorAllowed) { GameRegistry.addRecipe(new ItemStack(itemExitDoor, 1), new Object[] { @@ -435,10 +310,10 @@ public class mod_pocketDim GameRegistry.addRecipe(new ItemStack(itemExitDoor, 1), new Object[] { - " ", "yxy", " ", 'x', this.itemStableFabric, 'y', Item.doorWood + " ", "yxy", " ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.doorWood }); } - if(this.enableDimTrapDoor) + if(properties.CraftingTransTrapdoorAllowed) { GameRegistry.addRecipe(new ItemStack(dimHatch, 1), new Object[] { @@ -447,10 +322,10 @@ public class mod_pocketDim GameRegistry.addRecipe(new ItemStack(dimHatch, 1), new Object[] { - " y ", " x ", " y ", 'x', this.itemStableFabric, 'y', Block.trapdoor + " y ", " x ", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Block.trapdoor }); } - if(this.enableRiftSignature) + if(properties.CraftingRiftSignatureAllowed) { GameRegistry.addRecipe(new ItemStack(itemLinkSignature, 1), new Object[] { @@ -459,10 +334,11 @@ public class mod_pocketDim GameRegistry.addRecipe(new ItemStack(itemLinkSignature, 1), new Object[] { - " y ", "yxy", " y ", 'x', this.itemStableFabric, 'y', Item.ingotIron + " y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotIron }); } - if(this.enableRiftRemover) + + if(properties.CraftingRiftRemoverAllowed) { GameRegistry.addRecipe(new ItemStack(itemRiftRemover, 1), new Object[] { @@ -470,78 +346,54 @@ public class mod_pocketDim }); GameRegistry.addRecipe(new ItemStack(itemRiftRemover, 1), new Object[] { - "yyy", "yxy", "yyy", 'x', this.itemStableFabric, 'y', Item.ingotGold + "yyy", "yxy", "yyy", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotGold }); } - - - - if(this.enableRiftBlade) + if (properties.CraftingRiftBladeAllowed) { GameRegistry.addRecipe(new ItemStack(itemRiftBlade, 1), new Object[] { - " x ", " x ", " y ", 'x', Item.enderPearl, 'y',this.itemRiftRemover + " x ", " x ", " y ", 'x', Item.enderPearl, 'y',mod_pocketDim.itemRiftRemover }); } - GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[] - { - " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockDimWall - }); - - - GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[] - { - " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockLimbo - }); - - if (this.enableStabilizedRiftSignature) + if (properties.CraftingStableFabricAllowed) { - GameRegistry.addRecipe(new ItemStack(this.itemStabilizedLinkSignature,1), new Object[] + GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[] { - " y ", "yxy", " y ", 'x', this.itemLinkSignature, 'y', this.itemStableFabric + " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', mod_pocketDim.blockDimWall + }); + } + + if (properties.CraftingStabilizedRiftSignatureAllowed) + { + GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStabilizedLinkSignature,1), new Object[] + { + " y ", "yxy", " y ", 'x', mod_pocketDim.itemLinkSignature, 'y', mod_pocketDim.itemStableFabric }); } - this.blocksImmuneToRift.add(this.blockDimWallID); - this.blocksImmuneToRift.add(this.blockDimWallPermID); - this.blocksImmuneToRift.add(this.dimDoorID); - this.blocksImmuneToRift.add(this.ExitDoorID); - // this.blocksImmuneToRift.add(this.linkDimDoorID); - // this.blocksImmuneToRift.add(this.linkExitDoorID); - this.blocksImmuneToRift.add(this.dimHatchID); - this.blocksImmuneToRift.add(this.chaosDoorID); - this.blocksImmuneToRift.add(this.blockRiftID); - this.blocksImmuneToRift.add(this.transientDoorID); - this.blocksImmuneToRift.add(Block.blockIron.blockID); - this.blocksImmuneToRift.add(Block.blockDiamond.blockID); - this.blocksImmuneToRift.add(Block.blockEmerald.blockID); - this.blocksImmuneToRift.add(Block.blockGold.blockID); - this.blocksImmuneToRift.add(Block.blockLapis.blockID); - this.blocksImmuneToRift.add(Block.bedrock.blockID); + mod_pocketDim.blocksImmuneToRift.add(properties.FabricBlockID); + mod_pocketDim.blocksImmuneToRift.add(properties.PermaFabricBlockID); + mod_pocketDim.blocksImmuneToRift.add(properties.DimensionalDoorID); + mod_pocketDim.blocksImmuneToRift.add(properties.WarpDoorID); + mod_pocketDim.blocksImmuneToRift.add(properties.TransTrapdoorID); + mod_pocketDim.blocksImmuneToRift.add(properties.UnstableDoorID); + mod_pocketDim.blocksImmuneToRift.add(properties.RiftBlockID); + mod_pocketDim.blocksImmuneToRift.add(properties.TransientDoorID); + mod_pocketDim.blocksImmuneToRift.add(Block.blockIron.blockID); + mod_pocketDim.blocksImmuneToRift.add(Block.blockDiamond.blockID); + mod_pocketDim.blocksImmuneToRift.add(Block.blockEmerald.blockID); + mod_pocketDim.blocksImmuneToRift.add(Block.blockGold.blockID); + mod_pocketDim.blocksImmuneToRift.add(Block.blockLapis.blockID); + mod_pocketDim.blocksImmuneToRift.add(Block.bedrock.blockID); dungeonHelper.registerFlipBlocks(); - /** - - - - - - **/ - - - - - - - proxy.loadTextures(); proxy.registerRenderers(); - - } @@ -555,13 +407,12 @@ public class mod_pocketDim { try { - dimHelper.instance.save(); dimHelper.instance.unregsisterDims(); dimHelper.dimList.clear(); dimHelper.blocksToDecay.clear(); dimHelper.instance.interDimLinkList.clear(); - this.hasInitDims=false; + mod_pocketDim.hasInitDims=false; } catch(Exception e) { @@ -573,27 +424,21 @@ public class mod_pocketDim @ServerStarting public void serverStarting(FMLServerStartingEvent event) { - event.registerServerCommand(removeRiftsCommand); event.registerServerCommand(pruneDimsCommand); event.registerServerCommand(removeAllLinksCommand); event.registerServerCommand(deleteDimDataCommand); event.registerServerCommand(addDungeonRift); - event.registerServerCommand(this.startDungeonCreation); - event.registerServerCommand(this.printDimData); - event.registerServerCommand(this.endDungeonCreation); + event.registerServerCommand(mod_pocketDim.startDungeonCreation); + event.registerServerCommand(mod_pocketDim.printDimData); + event.registerServerCommand(mod_pocketDim.endDungeonCreation); dimHelper.instance.load(); - if(!dimHelper.dimList.containsKey(this.limboDimID)) + if(!dimHelper.dimList.containsKey(properties.LimboDimensionID)) { - dimHelper.instance.dimList.put(mod_pocketDim.limboDimID, new DimData( mod_pocketDim.limboDimID, false, 0, new LinkData())); - + dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData())); } } - - - public static int teleTimer=0; - } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java b/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java index 3f3f113..2b5de8f 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java @@ -13,6 +13,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -36,21 +37,22 @@ public class MobObelisk extends EntityFlying implements IMob int destX=0; int destY=0; int destZ=0; + public MobObelisk(World par1World) { - super(par1World); this.texture="/mods/DimDoors/textures/mobs/Monolith0.png"; this.setSize(3F, 9.0F); this.noClip=true; this.scaleFactor= (float) ((rand.nextDouble()/2)+1); this.aggroMax=rand.nextInt(245)+200; - - - - - // TODO Auto-generated constructor stub + + if (properties == null) + properties = DDProperties.instance(); } + + private static DDProperties properties = null; + @Override public boolean canDespawn() { @@ -63,79 +65,72 @@ public class MobObelisk extends EntityFlying implements IMob // TODO Auto-generated method stub return 20; } - + public boolean canBePushed() { return false; } - - public float getRenderSizeModifier() - { - return this.scaleFactor; - } - - public void setEntityPosition(Entity entity, double x, double y, double z) - { - entity.lastTickPosX = entity.prevPosX = entity.posX = x; - entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset; - entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z; - entity.setPosition(x, y, z); - } - - protected void entityInit() - { - super.entityInit(); - this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); - - - } - - - - - + public float getRenderSizeModifier() + { + return this.scaleFactor; + } + + public void setEntityPosition(Entity entity, double x, double y, double z) + { + entity.lastTickPosX = entity.prevPosX = entity.posX = x; + entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset; + entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z; + entity.setPosition(x, y, z); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + @Override public void onEntityUpdate() { - byte b0 = this.dataWatcher.getWatchableObjectByte(16); + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png"; + if(!this.hasJumped&&!this.worldObj.isRemote) + { + + int sanity=0; + double jumpHeight=0; + do + { + jumpHeight = this.posY+rand.nextInt(25); + if(this.worldObj.provider instanceof pocketProvider) + { + jumpHeight = jumpHeight- rand.nextInt(10); + } + sanity++; + } + while(!this.worldObj.isAirBlock((int)this.posX,(int)jumpHeight+6 , (int)this.posZ)&&sanity<20); + this.hasJumped=true; + + this.setLocationAndAngles(this.posX,jumpHeight , this.posZ, this.rotationPitch, this.rotationYaw); + PacketDispatcher.sendPacketToAllInDimension(new Packet34EntityTeleport(this), this.worldObj.provider.dimensionId); + this.worldObj.updateEntity(this); + } - this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png"; - if(!this.hasJumped&&!this.worldObj.isRemote) - { - - int sanity=0; - double jumpHeight=0; - do - { - jumpHeight = this.posY+rand.nextInt(25); - if(this.worldObj.provider instanceof pocketProvider) - { - jumpHeight = jumpHeight- rand.nextInt(10); - } - sanity++; - } - while(!this.worldObj.isAirBlock((int)this.posX,(int)jumpHeight+6 , (int)this.posZ)&&sanity<20); - this.hasJumped=true; - - this.setLocationAndAngles(this.posX,jumpHeight , this.posZ, this.rotationPitch, this.rotationYaw); - PacketDispatcher.sendPacketToAllInDimension(new Packet34EntityTeleport(this), this.worldObj.provider.dimensionId); - this.worldObj.updateEntity(this); - } - super.onEntityUpdate(); - - if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock()) - { - this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); - this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); - this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); - this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); - } - - - + if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock()) + { + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); + } + + + + EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 35); if(entityPlayer != null) @@ -145,15 +140,15 @@ public class MobObelisk extends EntityFlying implements IMob this.playSound("mods.DimDoors.sfx.monk", 1.5F, 1F); this.soundTime=100; } - - - + + + this.faceEntity(entityPlayer, 1, 1); - + if(shouldAttackPlayer(entityPlayer)) { { - + } if(aggro<470) { @@ -161,19 +156,19 @@ public class MobObelisk extends EntityFlying implements IMob { aggro++; } - - + + if(this.worldObj.provider instanceof pocketProvider||this.worldObj.getClosestPlayerToEntity(this, 5)!=null) { - + aggro++; aggro++; - + if(rand.nextBoolean()) { aggro++; } - + } if(aggro>430) { @@ -185,18 +180,18 @@ public class MobObelisk extends EntityFlying implements IMob this.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.tearing",5, 1); } - - - + + + } else if(!this.worldObj.isRemote&&!entityPlayer.capabilities.isCreativeMode) { - - - LinkData link = new LinkData(this.worldObj.provider.dimensionId, mod_pocketDim.limboDimID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0); + + + LinkData link = new LinkData(this.worldObj.provider.dimensionId, properties.LimboDimensionID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0); dimHelper.instance.teleportToPocket(worldObj, link, entityPlayer); this.aggro=0; @@ -207,20 +202,20 @@ public class MobObelisk extends EntityFlying implements IMob this.setDead(); } - - + + } if(!(this.worldObj.provider instanceof LimboProvider || this.worldObj.getClosestPlayerToEntity(this, 5)!=null)||this.aggro>300) { - - for (int i = 0; i < -1+this.textureState/2; ++i) - { - entityPlayer.worldObj.spawnParticle("portal", entityPlayer.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, entityPlayer.posY + this.rand.nextDouble() * (double)entityPlayer.height - 0.75D, entityPlayer.posZ + (this.rand.nextDouble() - 0.5D) * (double)entityPlayer.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D); - } + + for (int i = 0; i < -1+this.textureState/2; ++i) + { + entityPlayer.worldObj.spawnParticle("portal", entityPlayer.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, entityPlayer.posY + this.rand.nextDouble() * (double)entityPlayer.height - 0.75D, entityPlayer.posZ + (this.rand.nextDouble() - 0.5D) * (double)entityPlayer.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D); + } } - - - + + + } else { @@ -230,19 +225,19 @@ public class MobObelisk extends EntityFlying implements IMob { aggro--; } - + } } - - + + } else { - + if(aggro>0) { aggro--; - + if(rand.nextBoolean()) { aggro--; @@ -253,7 +248,7 @@ public class MobObelisk extends EntityFlying implements IMob { soundTime--; } - + if(this.prevPosX==this.posX||this.prevPosY==this.posY||this.prevPosZ==this.posZ) { do @@ -261,13 +256,13 @@ public class MobObelisk extends EntityFlying implements IMob destX= rand.nextInt(40)-20; destY= rand.nextInt(40)-20; destZ= rand.nextInt(40)-20; - - + + } while(!this.isCourseTraversable(destX, destY, destZ, 1)); } - - + + if(Math.abs(this.posX)-Math.abs(this.destX)+Math.abs(this.posY)-Math.abs(this.destY)+Math.abs(this.posZ)-Math.abs(this.destZ)<5) { do @@ -275,158 +270,158 @@ public class MobObelisk extends EntityFlying implements IMob destX= rand.nextInt(40)-20; destY= rand.nextInt(40)-20; destZ= rand.nextInt(40)-20; - - + + } while(!this.isCourseTraversable(destX, destY, destZ, 1)); } - + { - - - + + + } - - - this.textureState= (byte) (this.aggro/25); - if(!this.worldObj.isRemote) - { - this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState)); - } - - - - - + + this.textureState= (byte) (this.aggro/25); + if(!this.worldObj.isRemote) + { + + this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState)); + } + + + + + } - public boolean getCanSpawnHere() - { - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,AxisAlignedBB.getBoundingBox( this.posX-15, posY-4, this.posZ-15, this.posX+15, this.posY+15, this.posZ+15)); - - if(list.size()>0&&this.worldObj.provider.dimensionId==mod_pocketDim.limboDimID) - { - return false; - } - return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); - } - - private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer) - { - return par1EntityPlayer.canEntityBeSeen(this); - - } - - - - private boolean isCourseTraversable(double par1, double par3, double par5, double par7) - { - double d4 = (par1 - this.posX) / par7; - double d5 = (par3 - this.posY) / par7; - double d6 = (par5 - this.posZ) / par7; - AxisAlignedBB axisalignedbb = this.boundingBox.copy(); + public boolean getCanSpawnHere() + { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,AxisAlignedBB.getBoundingBox( this.posX-15, posY-4, this.posZ-15, this.posX+15, this.posY+15, this.posZ+15)); - for (int i = 1; (double)i < par7; ++i) - { - axisalignedbb.offset(d4, d5, d6); + if(list.size()>0&&this.worldObj.provider.dimensionId==properties.LimboDimensionID) + { + return false; + } + return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + } - if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) - { - return false; - } - } + private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer) + { + return par1EntityPlayer.canEntityBeSeen(this); - return true; - } - public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) - { - if(!(par1DamageSource==DamageSource.inWall)) - { - this.aggro=400; - } - return false; - } - public void faceEntity(Entity par1Entity, float par2, float par3) - { - double d0 = par1Entity.posX - this.posX; - double d1 = par1Entity.posZ - this.posZ; - double d2; + } - if (par1Entity instanceof EntityLiving) - { - EntityLiving entityliving = (EntityLiving)par1Entity; - d2 = entityliving.posY + (double)entityliving.getEyeHeight() - (this.posY + (double)this.getEyeHeight()); - } - else - { - d2 = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) - (this.posY + (double)this.getEyeHeight()); - } - double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1); - float f2 = (float)(Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F; - float f3 = (float)(-(Math.atan2(d2, d3) * 180.0D / Math.PI)); - this.rotationPitch = f3; - this.rotationYaw = f2; - - this.rotationYaw = f2; - this.rotationYawHead=f2; - this.renderYawOffset=this.rotationYaw; - } - - private float updateRotation(float par1, float par2, float par3) - { - float f3 = MathHelper.wrapAngleTo180_float(par2 - par1); + private boolean isCourseTraversable(double par1, double par3, double par5, double par7) + { + double d4 = (par1 - this.posX) / par7; + double d5 = (par3 - this.posY) / par7; + double d6 = (par5 - this.posZ) / par7; + AxisAlignedBB axisalignedbb = this.boundingBox.copy(); - if (f3 > par3) - { - f3 = par3; - } + for (int i = 1; (double)i < par7; ++i) + { + axisalignedbb.offset(d4, d5, d6); - if (f3 < -par3) - { - f3 = -par3; - } + if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) + { + return false; + } + } - return par1 + f3; - } - - public float getRotationYawHead() - { - return 0.0F; - } - - - - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { - super.writeEntityToNBT(par1NBTTagCompound); - par1NBTTagCompound.setFloat("soundTime", this.soundTime); - par1NBTTagCompound.setInteger("aggro", this.aggro); - par1NBTTagCompound.setInteger("aggroMax", this.aggroMax); - par1NBTTagCompound.setByte("textureState", this.textureState); - par1NBTTagCompound.setBoolean("hasJumped", this.hasJumped); - par1NBTTagCompound.setFloat("scaleFactor", this.scaleFactor); + return true; + } + public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) + { + if(!(par1DamageSource==DamageSource.inWall)) + { + this.aggro=400; + } + return false; + } + public void faceEntity(Entity par1Entity, float par2, float par3) + { + double d0 = par1Entity.posX - this.posX; + double d1 = par1Entity.posZ - this.posZ; + double d2; - } + if (par1Entity instanceof EntityLiving) + { + EntityLiving entityliving = (EntityLiving)par1Entity; + d2 = entityliving.posY + (double)entityliving.getEyeHeight() - (this.posY + (double)this.getEyeHeight()); + } + else + { + d2 = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) - (this.posY + (double)this.getEyeHeight()); + } + + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1); + float f2 = (float)(Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F; + float f3 = (float)(-(Math.atan2(d2, d3) * 180.0D / Math.PI)); + this.rotationPitch = f3; + this.rotationYaw = f2; + + this.rotationYaw = f2; + this.rotationYawHead=f2; + this.renderYawOffset=this.rotationYaw; + + } + + private float updateRotation(float par1, float par2, float par3) + { + float f3 = MathHelper.wrapAngleTo180_float(par2 - par1); + + if (f3 > par3) + { + f3 = par3; + } + + if (f3 < -par3) + { + f3 = -par3; + } + + return par1 + f3; + } + + public float getRotationYawHead() + { + return 0.0F; + } + + + + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setFloat("soundTime", this.soundTime); + par1NBTTagCompound.setInteger("aggro", this.aggro); + par1NBTTagCompound.setInteger("aggroMax", this.aggroMax); + par1NBTTagCompound.setByte("textureState", this.textureState); + par1NBTTagCompound.setBoolean("hasJumped", this.hasJumped); + par1NBTTagCompound.setFloat("scaleFactor", this.scaleFactor); + + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.soundTime=par1NBTTagCompound.getFloat("soundTime"); + this.aggro=par1NBTTagCompound.getInteger("aggro"); + this.aggroMax=par1NBTTagCompound.getInteger("aggroMax"); + this.textureState=par1NBTTagCompound.getByte("textureState"); + this.hasJumped=par1NBTTagCompound.getBoolean("hasJumped"); + this.scaleFactor=par1NBTTagCompound.getFloat("scaleFactor"); + + } - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { - super.readEntityFromNBT(par1NBTTagCompound); - this.soundTime=par1NBTTagCompound.getFloat("soundTime"); - this.aggro=par1NBTTagCompound.getInteger("aggro"); - this.aggroMax=par1NBTTagCompound.getInteger("aggroMax"); - this.textureState=par1NBTTagCompound.getByte("textureState"); - this.hasJumped=par1NBTTagCompound.getBoolean("hasJumped"); - this.scaleFactor=par1NBTTagCompound.getFloat("scaleFactor"); - } - - } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java b/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java index a7ba272..cf3d489 100644 --- a/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java +++ b/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java @@ -2,15 +2,22 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.Random; -import StevenDimDoors.mod_pocketDim.mod_pocketDim; - import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.MapGenBase; +import StevenDimDoors.mod_pocketDim.DDProperties; public class CustomCaveGen extends MapGenBase { + private static DDProperties properties = null; + + public CustomCaveGen() + { + if (properties == null) + properties = DDProperties.instance(); + } + /** * Generates a larger initial cave node than usual. Called 25% of the time. */ @@ -185,7 +192,7 @@ public class CustomCaveGen extends MapGenBase var49 = true; } - if (var53 == mod_pocketDim.blockLimboID|| var53 == Block.dirt.blockID || var53 == Block.grass.blockID) + if (var53 == properties.LimboBlockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID) { if (var50 < 10) { diff --git a/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java b/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java index c784735..909a109 100644 --- a/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java +++ b/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.List; import java.util.Random; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.Block; @@ -28,111 +29,111 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent; public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider { - private Random rand; + private static Random rand; - /** A NoiseGeneratorOctaves used in generating terrain */ - private NoiseGeneratorOctaves noiseGen1; + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen1; - /** A NoiseGeneratorOctaves used in generating terrain */ - private NoiseGeneratorOctaves noiseGen2; + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen2; - /** A NoiseGeneratorOctaves used in generating terrain */ - private NoiseGeneratorOctaves noiseGen3; + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen3; - /** A NoiseGeneratorOctaves used in generating terrain */ - private NoiseGeneratorOctaves noiseGen4; + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen4; - /** A NoiseGeneratorOctaves used in generating terrain */ - public NoiseGeneratorOctaves noiseGen5; - - public World world; - private final byte[] field_82700_c = new byte[256]; - private final byte[] field_82698_d = new byte[256]; + /** A NoiseGeneratorOctaves used in generating terrain */ + public NoiseGeneratorOctaves noiseGen5; - /** A NoiseGeneratorOctaves used in generating terrain */ - public NoiseGeneratorOctaves noiseGen6; - public NoiseGeneratorOctaves mobSpawnerNoise; + public World world; + private final byte[] field_82700_c = new byte[256]; + private final byte[] field_82698_d = new byte[256]; - /** Reference to the World object. */ - private World worldObj; + /** A NoiseGeneratorOctaves used in generating terrain */ + public NoiseGeneratorOctaves noiseGen6; + public NoiseGeneratorOctaves mobSpawnerNoise; - /** are map structures going to be generated (e.g. strongholds) */ - private final boolean mapFeaturesEnabled = false; + /** Reference to the World object. */ + private World worldObj; - /** Holds the overall noise array used in chunk generation */ - private double[] noiseArray; - private double[] stoneNoise = new double[256]; - private MapGenBase caveGenerator = new CustomCaveGen(); + /** are map structures going to be generated (e.g. strongholds) */ + private final boolean mapFeaturesEnabled = false; - /** Holds Stronghold Generator */ - private MapGenStronghold strongholdGenerator = new MapGenStronghold(); + /** Holds the overall noise array used in chunk generation */ + private double[] noiseArray; + private double[] stoneNoise = new double[256]; + private MapGenBase caveGenerator = new CustomCaveGen(); - /** Holds Village Generator */ - private MapGenVillage villageGenerator = new MapGenVillage(); + /** Holds Stronghold Generator */ + private MapGenStronghold strongholdGenerator = new MapGenStronghold(); - /** Holds Mineshaft Generator */ - private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); - private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); + /** Holds Village Generator */ + private MapGenVillage villageGenerator = new MapGenVillage(); - /** Holds ravine generator */ - private MapGenBase ravineGenerator = new MapGenRavine(); + /** Holds Mineshaft Generator */ + private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); + private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); - /** The biomes that are used to generate the chunk */ - private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1]; + /** Holds ravine generator */ + private MapGenBase ravineGenerator = new MapGenRavine(); - /** A double array that hold terrain noise from noiseGen3 */ - double[] noise3; + /** The biomes that are used to generate the chunk */ + private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1]; - /** A double array that hold terrain noise */ - double[] noise1; + /** A double array that hold terrain noise from noiseGen3 */ + double[] noise3; - /** A double array that hold terrain noise from noiseGen2 */ - double[] noise2; + /** A double array that hold terrain noise */ + double[] noise1; - /** A double array that hold terrain noise from noiseGen5 */ - double[] noise5; + /** A double array that hold terrain noise from noiseGen2 */ + double[] noise2; - /** A double array that holds terrain noise from noiseGen6 */ - double[] noise6; + /** A double array that hold terrain noise from noiseGen5 */ + double[] noise5; - /** - * Used to store the 5x5 parabolic field that is used during terrain generation. - */ - float[] parabolicField; - int[][] field_73219_j = new int[32][32]; - { - // caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); - - } + /** A double array that holds terrain noise from noiseGen6 */ + double[] noise6; + /** + * Used to store the 5x5 parabolic field that is used during terrain generation. + */ + float[] parabolicField; + int[][] field_73219_j = new int[32][32]; + { + // caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); + } + + private static DDProperties properties = null; public LimboGenerator(World par1World, long par2) { - - - super(par1World, par2, false); //par2 = 90899090; - this.rand = new Random(par2); - this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); //base terrain - this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); //hillyness - this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 80); //seems to adjust the size of features, how stretched things are -default 8 - this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4); - this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); - this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); - this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); + this.rand = new Random(par2); + this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); //base terrain + this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); //hillyness + this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 80); //seems to adjust the size of features, how stretched things are -default 8 + this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4); + this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); + this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); + this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); - NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; - // noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens); - this.noiseGen1 = noiseGens[0]; - this.noiseGen2 = noiseGens[1]; - this.noiseGen3 = noiseGens[2]; - this.noiseGen4 = noiseGens[3]; - this.noiseGen5 = noiseGens[4]; - this.noiseGen6 = noiseGens[5]; - this.mobSpawnerNoise = noiseGens[6]; + NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; + // noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens); + this.noiseGen1 = noiseGens[0]; + this.noiseGen2 = noiseGens[1]; + this.noiseGen3 = noiseGens[2]; + this.noiseGen4 = noiseGens[3]; + this.noiseGen5 = noiseGens[4]; + this.noiseGen6 = noiseGens[5]; + this.mobSpawnerNoise = noiseGens[6]; // TODO Auto-generated constructor stub this.worldObj=par1World; + + if (properties == null) + properties = DDProperties.instance(); } @Override @@ -142,27 +143,27 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi } @Override public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) - { - - } + { + + } @Override public Chunk provideChunk(int par1, int par2) - { + { this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); - byte[] var3 = new byte[32768]; - this.generateTerrain(par1, par2, var3); - this.caveGenerator.generate(this, this.worldObj, par1, par2, var3); + byte[] var3 = new byte[32768]; + this.generateTerrain(par1, par2, var3); + this.caveGenerator.generate(this, this.worldObj, par1, par2, var3); - - - Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); - - var4.generateSkylightMap(); - return var4; - } + + Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); + + + var4.generateSkylightMap(); + return var4; + } @Override public Chunk loadChunk(int var1, int var2) { // TODO Auto-generated method stub @@ -173,7 +174,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi public void populate(IChunkProvider var1, int var2, int var3) { // TODO Auto-generated method stub - + } @Override @@ -181,229 +182,229 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi // TODO Auto-generated method stub return super.saveChunks(var1, var2); } - private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) - { - ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); - MinecraftForge.EVENT_BUS.post(event); - if (event.getResult() == Result.DENY) return event.noisefield; + private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) + { + ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return event.noisefield; - if (par1ArrayOfDouble == null) - { - par1ArrayOfDouble = new double[par5 * par6 * par7]; - } + if (par1ArrayOfDouble == null) + { + par1ArrayOfDouble = new double[par5 * par6 * par7]; + } - if (this.parabolicField == null) - { - this.parabolicField = new float[25]; + if (this.parabolicField == null) + { + this.parabolicField = new float[25]; - for (int var8 = -2; var8 <= 2; ++var8) - { - for (int var9 = -2; var9 <= 2; ++var9) - { - float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F); - this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10; - } - } - } + for (int var8 = -2; var8 <= 2; ++var8) + { + for (int var9 = -2; var9 <= 2; ++var9) + { + float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F); + this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10; + } + } + } - double var44 = 884.412D; //large values here create spiky land. add a 0, good -default 884 - double var45 = 9840.412D; //large values here make sheets- default - 684 - this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); - this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D); - this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D); - this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44); - this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44); - boolean var43 = false; - boolean var42 = false; - int var12 = 0; - int var13 = 0; + double var44 = 884.412D; //large values here create spiky land. add a 0, good -default 884 + double var45 = 9840.412D; //large values here make sheets- default - 684 + this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); + this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D); + this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D); + this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44); + this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44); + boolean var43 = false; + boolean var42 = false; + int var12 = 0; + int var13 = 0; - for (int var14 = 0; var14 < par5; ++var14) - { - for (int var15 = 0; var15 < par7; ++var15) - { - float var16 = 0.0F; - float var17 = 0.0F; - float var18 = 0.0F; - byte var19 = 2; - BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)]; + for (int var14 = 0; var14 < par5; ++var14) + { + for (int var15 = 0; var15 < par7; ++var15) + { + float var16 = 0.0F; + float var17 = 0.0F; + float var18 = 0.0F; + byte var19 = 2; + BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)]; - for (int var21 = -var19; var21 <= var19; ++var21) - { - for (int var22 = -var19; var22 <= var19; ++var22) - { - float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F); + for (int var21 = -var19; var21 <= var19; ++var21) + { + for (int var22 = -var19; var22 <= var19; ++var22) + { + float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F); - -//this adjusts the height of the terrain - - var16 += BiomeGenBase.plains.maxHeight * var24+4; - var17 += BiomeGenBase.plains.minHeight * var24-1; - var18 += var24; - } - } - var16 /= var18; - var17 /= var18; - var16 = (var16 * 0.9F + 0.1F); - var17 = (var17 * 4.0F - 1.0F) / 8.0F; - double var47 = this.noise6[var13] / 8000.0D; + //this adjusts the height of the terrain - if (var47 < 0.0D) - { - var47 = -var47 * 0.3D; - } + var16 += BiomeGenBase.plains.maxHeight * var24+4; + var17 += BiomeGenBase.plains.minHeight * var24-1; + var18 += var24; + } + } - var47 = var47 * 3.0D - 2.0D; + var16 /= var18; + var17 /= var18; + var16 = (var16 * 0.9F + 0.1F); + var17 = (var17 * 4.0F - 1.0F) / 8.0F; + double var47 = this.noise6[var13] / 8000.0D; - if (var47 < 0.0D) - { - var47 /= 2.0D; + if (var47 < 0.0D) + { + var47 = -var47 * 0.3D; + } - if (var47 < -1.0D) - { - var47 = -1.0D; - } + var47 = var47 * 3.0D - 2.0D; - var47 /= 1.4D; - var47 /= 2.0D; - } - else - { - if (var47 > 1.0D) - { - var47 = 1.0D; - } + if (var47 < 0.0D) + { + var47 /= 2.0D; - var47 /= 8.0D; - } + if (var47 < -1.0D) + { + var47 = -1.0D; + } - ++var13; + var47 /= 1.4D; + var47 /= 2.0D; + } + else + { + if (var47 > 1.0D) + { + var47 = 1.0D; + } - for (int var46 = 0; var46 < par6; ++var46) - { - double var48 = (double)var17; - double var26 = (double)var16; - var48 += var47 * 0.2D; - var48 = var48 * (double)par6 / 16.0D; - double var28 = (double)par6 / 2.0D + var48 * 4.0D; - double var30 = 0.0D; - double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26; + var47 /= 8.0D; + } - if (var32 < 0.0D) - { - var32 *= 4.0D; - } + ++var13; - double var34 = this.noise1[var12] / 512.0D; - double var36 = this.noise2[var12] / 512.0D; - double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D; + for (int var46 = 0; var46 < par6; ++var46) + { + double var48 = (double)var17; + double var26 = (double)var16; + var48 += var47 * 0.2D; + var48 = var48 * (double)par6 / 16.0D; + double var28 = (double)par6 / 2.0D + var48 * 4.0D; + double var30 = 0.0D; + double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26; - if (var38 < 0.0D) - { - var30 = var34; - } - else if (var38 > 1.0D) - { - var30 = var36; - } - else - { - var30 = var34 + (var36 - var34) * var38; - } + if (var32 < 0.0D) + { + var32 *= 4.0D; + } - var30 -= var32; + double var34 = this.noise1[var12] / 512.0D; + double var36 = this.noise2[var12] / 512.0D; + double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D; - if (var46 > par6 - 4) - { - double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F); - var30 = var30 * (1.0D - var40) + -10.0D * var40; - } + if (var38 < 0.0D) + { + var30 = var34; + } + else if (var38 > 1.0D) + { + var30 = var36; + } + else + { + var30 = var34 + (var36 - var34) * var38; + } - par1ArrayOfDouble[var12] = var30; - ++var12; - } - } - } + var30 -= var32; - return par1ArrayOfDouble; - } + if (var46 > par6 - 4) + { + double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F); + var30 = var30 * (1.0D - var40) + -10.0D * var40; + } + + par1ArrayOfDouble[var12] = var30; + ++var12; + } + } + } + + return par1ArrayOfDouble; + } public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) - { - byte var4 = 4; - byte var5 = 16; - byte var6 = 19; - int var7 = var4 + 1; - byte var8 = 17; - int var9 = var4 + 1; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5); - this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9); + { + byte var4 = 4; + byte var5 = 16; + byte var6 = 19; + int var7 = var4 + 1; + byte var8 = 17; + int var9 = var4 + 1; + this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5); + this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9); - for (int var10 = 0; var10 < var4; ++var10) - { - for (int var11 = 0; var11 < var4; ++var11) - { - for (int var12 = 0; var12 < var5; ++var12) - { - double var13 = 0.125D; - double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; - double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; - double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; - double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; - double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; - double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; - double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; - double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; + for (int var10 = 0; var10 < var4; ++var10) + { + for (int var11 = 0; var11 < var4; ++var11) + { + for (int var12 = 0; var12 < var5; ++var12) + { + double var13 = 0.125D; + double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; + double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; + double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; + double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; + double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; + double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; + double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; + double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; - for (int var31 = 0; var31 < 8; ++var31) - { - double var32 = 0.25D; - double var34 = var15; - double var36 = var17; - double var38 = (var19 - var15) * var32; - double var40 = (var21 - var17) * var32; + for (int var31 = 0; var31 < 8; ++var31) + { + double var32 = 0.25D; + double var34 = var15; + double var36 = var17; + double var38 = (var19 - var15) * var32; + double var40 = (var21 - var17) * var32; - for (int var42 = 0; var42 < 4; ++var42) - { - int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31; - short var44 = 128; - var43 -= var44; - double var45 = 0.25D; - double var49 = (var36 - var34) * var45; - double var47 = var34 - var49; + for (int var42 = 0; var42 < 4; ++var42) + { + int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31; + short var44 = 128; + var43 -= var44; + double var45 = 0.25D; + double var49 = (var36 - var34) * var45; + double var47 = var34 - var49; - for (int var51 = 0; var51 < 4; ++var51) - { - if ((var47 += var49) > 0.0D) - { - par3ArrayOfByte[var43 += var44] = (byte)mod_pocketDim.blockLimboID; - } - else if (var12 * 8 + var31 < var6) - { - par3ArrayOfByte[var43 += var44] = (byte)mod_pocketDim.blockDimWallPermID; - } - - else - { - par3ArrayOfByte[var43 += var44] = 0; - } - } + for (int var51 = 0; var51 < 4; ++var51) + { + if ((var47 += var49) > 0.0D) + { + par3ArrayOfByte[var43 += var44] = (byte)properties.LimboBlockID; + } + else if (var12 * 8 + var31 < var6) + { + par3ArrayOfByte[var43 += var44] = (byte)properties.PermaFabricBlockID; + } - var34 += var38; - var36 += var40; - } + else + { + par3ArrayOfByte[var43 += var44] = 0; + } + } + + var34 += var38; + var36 += var40; + } + + var15 += var23; + var17 += var25; + var19 += var27; + var21 += var29; + } + } + } + } + } - var15 += var23; - var17 += var25; - var19 += var27; - var21 += var29; - } - } - } - } - } - @Override public boolean canSave() { // TODO Auto-generated method stub @@ -417,12 +418,12 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi } @Override - public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) - { - - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4); - return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType)); - } + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4); + return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType)); + } @Override public ChunkPosition findClosestStructure(World var1, String var2, @@ -440,7 +441,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi @Override public void recreateStructures(int var1, int var2) { // TODO Auto-generated method stub - + } - + } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/world/LimboProvider.java b/StevenDimDoors/mod_pocketDim/world/LimboProvider.java index 04adc2d..02e7b82 100644 --- a/StevenDimDoors/mod_pocketDim/world/LimboProvider.java +++ b/StevenDimDoors/mod_pocketDim/world/LimboProvider.java @@ -1,7 +1,5 @@ package StevenDimDoors.mod_pocketDim.world; -import StevenDimDoors.mod_pocketDim.CloudRenderBlank; -import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChunkCoordinates; @@ -10,182 +8,175 @@ import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManagerHell; import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.client.IRenderHandler; +import StevenDimDoors.mod_pocketDim.CloudRenderBlank; +import StevenDimDoors.mod_pocketDim.DDProperties; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - public class LimboProvider extends WorldProvider { - @Override public String getDimensionName() { - // TODO Auto-generated method stub return "Limbo"; } - private IRenderHandler skyRenderer; - + private IRenderHandler skyRenderer; + private DDProperties properties = null; + public LimboProvider() { - this.hasNoSky=false; - - - this.skyRenderer =new limboSkyProvider(); + this.hasNoSky = false; + this.skyRenderer = new limboSkyProvider(); + if (properties == null) + properties = DDProperties.instance(); + } - + @SideOnly(Side.CLIENT) + public IRenderHandler getSkyRenderer() + { + return this.skyRenderer; + } + + + @Override + protected void registerWorldChunkManager() + { + super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1); + //this.dimensionId = ConfigAtum.dimensionID; + } + + @Override + public BiomeGenBase getBiomeGenForCoords(int x, int z) + { + return mod_pocketDim.limboBiome; + } + + public boolean canRespawnHere() + { + return properties.HardcoreLimboEnabled && properties.LimboEnabled; + } + + public boolean isBlockHighHumidity(int x, int y, int z) + { + return false; + } + + + @Override + public boolean canSnowAt(int x, int y, int z) + { + return false; } - @SideOnly(Side.CLIENT) - public IRenderHandler getSkyRenderer() - { - return this.skyRenderer; - } - - - @Override - protected void registerWorldChunkManager() - { - super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1); - //this.dimensionId = ConfigAtum.dimensionID; - } - @Override - public BiomeGenBase getBiomeGenForCoords(int x, int z) + protected void generateLightBrightnessTable() + { + float modifier = 0.0F; + + for (int steps = 0; steps <= 15; ++steps) { - return mod_pocketDim.limboBiome; + float var3 = 1.0F - (float)steps / 15.0F; + this.lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3; + // System.out.println( this.lightBrightnessTable[steps]+"light"); } - - public boolean canRespawnHere() - { - - return mod_pocketDim.hardcoreLimbo&&mod_pocketDim.isLimboActive; - } - public boolean isBlockHighHumidity(int x, int y, int z) - { - return false; - } - - - @Override - public boolean canSnowAt(int x, int y, int z) - { - return false; - } - @Override - protected void generateLightBrightnessTable() - { - float modifier = 0.0F; + } - for (int steps = 0; steps <= 15; ++steps) - { - float var3 = 1.0F - (float)steps / 15.0F; - this.lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3; - // System.out.println( this.lightBrightnessTable[steps]+"light"); - } - } - - public ChunkCoordinates getSpawnPoint() - { - - return this.getRandomizedSpawnPoint(); - } + public ChunkCoordinates getSpawnPoint() + { - public float calculateCelestialAngle(long par1, float par3) - { - int var4 = (int)(par1 % 24000L); - float var5 = ((float)var4 + par3) / 24000.0F - 0.25F; + return this.getRandomizedSpawnPoint(); + } - if (var5 < 0.0F) - { - ++var5; - } + public float calculateCelestialAngle(long par1, float par3) + { + int var4 = (int)(par1 % 24000L); + float var5 = ((float)var4 + par3) / 24000.0F - 0.25F; - if (var5 > 1.0F) - { - --var5; - } + if (var5 < 0.0F) + { + ++var5; + } - float var6 = var5; - var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D); - var5 = var6 + (var5 - var6) / 3.0F; - return 0; - } + if (var5 > 1.0F) + { + --var5; + } - @SideOnly(Side.CLIENT) - public int getMoonPhase(long par1, float par3) - { - return 4; - } + float var6 = var5; + var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D); + var5 = var6 + (var5 - var6) / 3.0F; + return 0; + } - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) + public int getMoonPhase(long par1, float par3) + { + return 4; + } + + @SideOnly(Side.CLIENT) @Override public String getSaveFolder() - { - return (dimensionId == 0 ? null : "DimensionalDoors/Limbo" + dimensionId); - } - - public boolean canCoordinateBeSpawn(int par1, int par2) - { - int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2); - return var3 == mod_pocketDim.blockLimboID; - } - @Override + { + return (dimensionId == 0 ? null : "DimensionalDoors/Limbo" + dimensionId); + } + + public boolean canCoordinateBeSpawn(int par1, int par2) + { + int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2); + return var3 == properties.LimboBlockID; + } + @Override public double getHorizon() - { - return worldObj.getHeight()/4-800; - } + { + return worldObj.getHeight()/4-800; + } public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { - setCloudRenderer( new CloudRenderBlank()); - return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0); + setCloudRenderer( new CloudRenderBlank()); + return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0); } - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) @Override public Vec3 getFogColor(float par1, float par2) - { - return this.worldObj.getWorldVec3Pool().getVecFromPool((double).2, (double).2, (double).2); + { + return this.worldObj.getWorldVec3Pool().getVecFromPool((double).2, (double).2, (double).2); + + } + public int getRespawnDimension(EntityPlayerMP player) + { + return 0; + } - } - public int getRespawnDimension(EntityPlayerMP player) - { - return 0; - } - @Override public IChunkProvider createChunkGenerator() { return new LimboGenerator(worldObj, 45); } - public boolean canBlockFreeze(int x, int y, int z, boolean byWater) - { - return false; - } + + public boolean canBlockFreeze(int x, int y, int z, boolean byWater) + { + return false; + } @Override - public ChunkCoordinates getRandomizedSpawnPoint() - { - ChunkCoordinates var5 = new ChunkCoordinates(0,0,0); + public ChunkCoordinates getRandomizedSpawnPoint() + { + ChunkCoordinates var5 = new ChunkCoordinates(0,0,0); - - int spawnFuzz = 10000; - int spawnFuzzHalf = spawnFuzz / 2; - { - var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; - var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; - var5.posY = 700; - } + int spawnFuzz = 10000; + int spawnFuzzHalf = spawnFuzz / 2; - return var5; - - + { + var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; + var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; + var5.posY = 700; + } + + return var5; } - - - - - } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/world/pocketProvider.java b/StevenDimDoors/mod_pocketDim/world/pocketProvider.java index 9015fd1..89a49e3 100644 --- a/StevenDimDoors/mod_pocketDim/world/pocketProvider.java +++ b/StevenDimDoors/mod_pocketDim/world/pocketProvider.java @@ -1,6 +1,7 @@ package StevenDimDoors.mod_pocketDim.world; import StevenDimDoors.mod_pocketDim.CloudRenderBlank; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import net.minecraft.entity.Entity; @@ -24,11 +25,13 @@ public class pocketProvider extends WorldProvider public boolean isSavingSchematic= false; public int dimToSave; + private static DDProperties properties = null; + public pocketProvider() { this.hasNoSky=true; - - + if (properties == null) + properties = DDProperties.instance(); } @Override @@ -89,8 +92,7 @@ public class pocketProvider extends WorldProvider @Override public String getDimensionName() { - // TODO Auto-generated method stub - return "PocketDim "+this.dimensionId; + return "PocketDim " + this.dimensionId; } @@ -98,16 +100,16 @@ public class pocketProvider extends WorldProvider { int respawnDim; - if(mod_pocketDim.isLimboActive) + if (properties.LimboEnabled) { - respawnDim= mod_pocketDim.limboDimID; + respawnDim = properties.LimboDimensionID; } else { respawnDim= dimHelper.dimList.get(this.dimensionId).exitDimLink.destDimID; } - if(dimHelper.getWorld(respawnDim)==null) + if (dimHelper.getWorld(respawnDim)==null) { dimHelper.initDimension(respawnDim); } diff --git a/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java b/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java index 4608836..c86e15a 100644 --- a/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java +++ b/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java @@ -14,13 +14,10 @@ import cpw.mods.fml.common.network.Player; // This just handles the data packets in the server public class ClientPacketHandler implements IPacketHandler{ + @Override + public void onPacketData(INetworkManager manager, + Packet250CustomPayload packet, Player player) { + // TODO Auto-generated method stub - - -@Override -public void onPacketData(INetworkManager manager, - Packet250CustomPayload packet, Player player) { - // TODO Auto-generated method stub - -} + } } diff --git a/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java b/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java index 9060ce8..cdc012e 100644 --- a/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java +++ b/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java @@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.blocks.dimDoor; @@ -24,6 +25,14 @@ public class RenderDimDoor extends TileEntitySpecialRenderer { FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16); + public RenderDimDoor() + { + if (properties == null) + properties = DDProperties.instance(); + } + + private static DDProperties properties = null; + /** * Renders the dimdoor. */ @@ -31,7 +40,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer { try { - dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord); + dimDoor.class.cast(Block.blocksList[properties.DimensionalDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord); } catch(Exception e) @@ -268,7 +277,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) { - if(mod_pocketDim.enableDoorOpenGL) + if (properties.DoorRenderingEnabled) { this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8); } diff --git a/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java b/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java index cb55c7a..886b5cd 100644 --- a/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java +++ b/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java @@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.blocks.dimDoor; @@ -22,253 +23,261 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderDimRail extends TileEntitySpecialRenderer { - FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16); + FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16); - /** - * Renders the dimdoor. - */ - public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, double y, double z, float par8) - { - try - { - dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord); + public RenderDimRail() + { + if (properties == null) + properties = DDProperties.instance(); + } + + private static DDProperties properties = null; - } - catch(Exception e) - { - e.printStackTrace(); - } - - - float playerX = (float)this.tileEntityRenderer.playerX; - float playerY = (float)this.tileEntityRenderer.playerY; - float playerZ = (float)this.tileEntityRenderer.playerZ; - - float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ); - GL11.glDisable(GL11.GL_LIGHTING); - Random rand = new Random(31100L); - float var13 = 0.75F; + /** + * Renders the dimdoor. + */ + public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, double y, double z, float par8) + { + try + { + dimDoor.class.cast(Block.blocksList[properties.DimensionalDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord); - for (int count = 0; count < 16; ++count) - { - GL11.glPushMatrix(); - float var15 = (float)(16 - count); - float var16 = 0.2625F; - float var17 = 1.0F / (var15 + 1.0F); + } + catch(Exception e) + { + e.printStackTrace(); + } - if (count == 0) - { - this.bindTextureByName("/RIFT.png"); - var17 = 0.1F; - var15 = 25.0F; - var16 = 0.125F; - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - } - if (count == 1) - { - this.bindTextureByName("/WARP.png"); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); - var16 = .5F; - } + float playerX = (float)this.tileEntityRenderer.playerX; + float playerY = (float)this.tileEntityRenderer.playerY; + float playerZ = (float)this.tileEntityRenderer.playerZ; - float startY = (float)(+(y + (double)var13)); - float ratioY = startY + ActiveRenderInfo.objectY; - float ratioY2 = startY + var15 + ActiveRenderInfo.objectY; - float yConverted = ratioY / ratioY2; - - float startZ = (float)(+(z + (double)var13)); - float ratioZ = startZ + ActiveRenderInfo.objectZ; - float ratioZ2 = startZ + var15 + ActiveRenderInfo.objectZ; - float zConverted = ratioZ / ratioZ2; - - float startX = (float)(+(x + (double)var13)); - float ratioX = startX + ActiveRenderInfo.objectX; - float ratioX2 = startX + var15 + ActiveRenderInfo.objectX; - float xConverted = ratioX / ratioX2; - - + float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ); + GL11.glDisable(GL11.GL_LIGHTING); + Random rand = new Random(31100L); + float var13 = 0.75F; - - yConverted += (float)(y + (double)var13); - xConverted += (float)(x + (double)var13); - zConverted += (float)(z + (double)var13); + for (int count = 0; count < 16; ++count) + { + GL11.glPushMatrix(); + float var15 = (float)(16 - count); + float var16 = 0.2625F; + float var17 = 1.0F / (var15 + 1.0F); - GL11.glTranslatef( (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F,0, 0.0F); - GL11.glTranslatef(0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F, 0.0F); + if (count == 0) + { + this.bindTextureByName("/RIFT.png"); + var17 = 0.1F; + var15 = 25.0F; + var16 = 0.125F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } - GL11.glTranslatef(0,0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F); + if (count == 1) + { + this.bindTextureByName("/WARP.png"); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + var16 = .5F; + } - GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - switch ((tile.orientation%4)+4) - { - case 4: - GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); - GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); - GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); - - break; - case 5: - - GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); - GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); - GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); - break; - case 6: - GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); - GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); - GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); - - break; - case 7: - GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); - GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); - GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); - break; - - - - } - - - GL11.glEnable(GL11.GL_TEXTURE_GEN_S); - GL11.glEnable(GL11.GL_TEXTURE_GEN_T); - GL11.glEnable(GL11.GL_TEXTURE_GEN_R); - GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); - GL11.glPopMatrix(); - GL11.glMatrixMode(GL11.GL_TEXTURE); - GL11.glPushMatrix(); - GL11.glLoadIdentity(); - GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F*var15, 0.0F); - GL11.glScalef(var16, var16, var16); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - GL11.glRotatef((float)(count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - - Tessellator var24 = Tessellator.instance; - var24.startDrawingQuads(); - - - - float var21 = rand.nextFloat() * 0.5F + 0.1F; - float var22 = rand.nextFloat() * 0.4F + 0.4F; - float var23 = rand.nextFloat() * 0.6F + 0.5F; + float startY = (float)(+(y + (double)var13)); + float ratioY = startY + ActiveRenderInfo.objectY; + float ratioY2 = startY + var15 + ActiveRenderInfo.objectY; + float yConverted = ratioY / ratioY2; - if (count == 0) - { - var23 = 1.0F; - var22 = 1.0F; - yConverted = 1.0F; - } - var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F); - if(tile.openOrClosed) - { + float startZ = (float)(+(z + (double)var13)); + float ratioZ = startZ + ActiveRenderInfo.objectZ; + float ratioZ2 = startZ + var15 + ActiveRenderInfo.objectZ; + float zConverted = ratioZ / ratioZ2; - switch (tile.orientation) - { - case 0: - - var24.addVertex(x+.01F, y-1 , z); - var24.addVertex(x+.01, y-1, z+1.0D); - var24.addVertex(x+.01 , y+1 , z + 1.0D); - var24.addVertex(x+.01 , y+1 , z); - break; - case 1: - var24.addVertex(x , y+1 , z+.01); - var24.addVertex(x+1 , y+1 , z+.01); - var24.addVertex(x+1, y-1, z+.01); - var24.addVertex(x, y-1, z+.01); + float startX = (float)(+(x + (double)var13)); + float ratioX = startX + ActiveRenderInfo.objectX; + float ratioX2 = startX + var15 + ActiveRenderInfo.objectX; + float xConverted = ratioX / ratioX2; - break; - case 2: // - var24.addVertex(x+.99 , y+1 , z); - var24.addVertex(x+.99 , y+1 , z + 1.0D); - var24.addVertex(x+.99, y-1, z+1.0D); - var24.addVertex(x+.99, y-1, z); - break; - case 3: - var24.addVertex(x, y-1, z+.99); - var24.addVertex(x+1, y-1, z+.99); - var24.addVertex(x+1 , y+1 , z+.99); - var24.addVertex(x , y+1 , z+.99); - break; - case 4:// - // GL11.glTranslatef(); - var24.addVertex(x+.15F, y-1 , z); - var24.addVertex(x+.15, y-1, z+1.0D); - var24.addVertex(x+.15 , y+1 , z + 1.0D); - var24.addVertex(x+.15 , y+1 , z); - break; - case 5: - var24.addVertex(x , y+1 , z+.15); - var24.addVertex(x+1 , y+1 , z+.15); - var24.addVertex(x+1, y-1, z+.15); - var24.addVertex(x, y-1, z+.15); + yConverted += (float)(y + (double)var13); + xConverted += (float)(x + (double)var13); + zConverted += (float)(z + (double)var13); + + GL11.glTranslatef( (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F,0, 0.0F); + GL11.glTranslatef(0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F, 0.0F); + + GL11.glTranslatef(0,0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F); + + GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + switch ((tile.orientation%4)+4) + { + case 4: + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + + break; + case 5: + + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + break; + case 6: + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + + break; + case 7: + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + break; - break; - case 6: // - var24.addVertex(x+.85 , y+1 , z); - var24.addVertex(x+.85 , y+1 , z + 1.0D); - var24.addVertex(x+.85, y-1, z+1.0D); - var24.addVertex(x+.85, y-1, z); - break; - case 7: - var24.addVertex(x, y-1, z+.85); - var24.addVertex(x+1, y-1, z+.85); - var24.addVertex(x+1 , y+1 , z+.85); - var24.addVertex(x , y+1 , z+.85); - break; - default: - break; - } - } - - - - - - - var24.draw(); - - GL11.glPopMatrix(); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - } + } - GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_GEN_S); - GL11.glDisable(GL11.GL_TEXTURE_GEN_T); - GL11.glDisable(GL11.GL_TEXTURE_GEN_R); - GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); - GL11.glEnable(GL11.GL_LIGHTING); - } - private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) - { - this.field_76908_a.clear(); - this.field_76908_a.put(par1).put(par2).put(par3).put(par4); - this.field_76908_a.flip(); - return this.field_76908_a; - } + GL11.glEnable(GL11.GL_TEXTURE_GEN_S); + GL11.glEnable(GL11.GL_TEXTURE_GEN_T); + GL11.glEnable(GL11.GL_TEXTURE_GEN_R); + GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F*var15, 0.0F); + GL11.glScalef(var16, var16, var16); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + GL11.glRotatef((float)(count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); - public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) - { - if(mod_pocketDim.enableDoorOpenGL) - { - this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8); - } - } + Tessellator var24 = Tessellator.instance; + var24.startDrawingQuads(); + + + + float var21 = rand.nextFloat() * 0.5F + 0.1F; + float var22 = rand.nextFloat() * 0.4F + 0.4F; + float var23 = rand.nextFloat() * 0.6F + 0.5F; + + if (count == 0) + { + var23 = 1.0F; + var22 = 1.0F; + yConverted = 1.0F; + } + var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F); + if(tile.openOrClosed) + { + + switch (tile.orientation) + { + case 0: + + var24.addVertex(x+.01F, y-1 , z); + var24.addVertex(x+.01, y-1, z+1.0D); + var24.addVertex(x+.01 , y+1 , z + 1.0D); + var24.addVertex(x+.01 , y+1 , z); + break; + case 1: + var24.addVertex(x , y+1 , z+.01); + var24.addVertex(x+1 , y+1 , z+.01); + var24.addVertex(x+1, y-1, z+.01); + var24.addVertex(x, y-1, z+.01); + + + + break; + case 2: // + var24.addVertex(x+.99 , y+1 , z); + var24.addVertex(x+.99 , y+1 , z + 1.0D); + var24.addVertex(x+.99, y-1, z+1.0D); + var24.addVertex(x+.99, y-1, z); + break; + case 3: + var24.addVertex(x, y-1, z+.99); + var24.addVertex(x+1, y-1, z+.99); + var24.addVertex(x+1 , y+1 , z+.99); + var24.addVertex(x , y+1 , z+.99); + break; + case 4:// + // GL11.glTranslatef(); + + var24.addVertex(x+.15F, y-1 , z); + var24.addVertex(x+.15, y-1, z+1.0D); + var24.addVertex(x+.15 , y+1 , z + 1.0D); + var24.addVertex(x+.15 , y+1 , z); + break; + case 5: + var24.addVertex(x , y+1 , z+.15); + var24.addVertex(x+1 , y+1 , z+.15); + var24.addVertex(x+1, y-1, z+.15); + var24.addVertex(x, y-1, z+.15); + + + + break; + case 6: // + var24.addVertex(x+.85 , y+1 , z); + var24.addVertex(x+.85 , y+1 , z + 1.0D); + var24.addVertex(x+.85, y-1, z+1.0D); + var24.addVertex(x+.85, y-1, z); + break; + case 7: + var24.addVertex(x, y-1, z+.85); + var24.addVertex(x+1, y-1, z+.85); + var24.addVertex(x+1 , y+1 , z+.85); + var24.addVertex(x , y+1 , z+.85); + break; + default: + break; + } + } + + + + + + + var24.draw(); + + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_GEN_S); + GL11.glDisable(GL11.GL_TEXTURE_GEN_T); + GL11.glDisable(GL11.GL_TEXTURE_GEN_R); + GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); + GL11.glEnable(GL11.GL_LIGHTING); + } + + private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) + { + this.field_76908_a.clear(); + this.field_76908_a.put(par1).put(par2).put(par3).put(par4); + this.field_76908_a.flip(); + return this.field_76908_a; + } + + public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) + { + if (properties.DoorRenderingEnabled) + { + this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8); + } + } } diff --git a/schematics/fallingTNThall.schematic b/schematics/fallingTNThall.schematic new file mode 100644 index 0000000..819575f Binary files /dev/null and b/schematics/fallingTNThall.schematic differ diff --git a/schematics/tntPuzzleTrap.schematic b/schematics/tntPuzzleTrap.schematic new file mode 100644 index 0000000..8d6898e Binary files /dev/null and b/schematics/tntPuzzleTrap.schematic differ