From 33169dc2fb1e5668d1750a17a8a932ea4d481b49 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Thu, 11 Jul 2013 20:42:57 -0400 Subject: [PATCH 1/5] Renamed printAllLinkData and limbo decay --- StevenDimDoors/mod_pocketDim/DimData.java | 2 +- .../mod_pocketDim/EventHookContainer.java | 140 +++++------------- .../commands/CommandDeleteAllLinks.java | 2 +- .../commands/CommandDeleteDimensionData.java | 2 +- .../commands/CommandDeleteRifts.java | 2 +- .../commands/CommandPrintDimensionData.java | 2 +- .../commands/CommandPruneDimensions.java | 2 +- .../mod_pocketDim/helpers/dimHelper.java | 4 +- 8 files changed, 42 insertions(+), 114 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/DimData.java b/StevenDimDoors/mod_pocketDim/DimData.java index 2da42b18..043856c1 100644 --- a/StevenDimDoors/mod_pocketDim/DimData.java +++ b/StevenDimDoors/mod_pocketDim/DimData.java @@ -232,7 +232,7 @@ public class DimData implements Serializable return null; } - public ArrayList printAllLinkData() + public ArrayList getLinksInDim() { //TODO: We might want to modify this function, but I'm afraid of breaking something right now. //To begin with, the name is wrong. This doesn't print anything! >_o ~SenseiKiwi diff --git a/StevenDimDoors/mod_pocketDim/EventHookContainer.java b/StevenDimDoors/mod_pocketDim/EventHookContainer.java index 1e23a2da..f2188afe 100644 --- a/StevenDimDoors/mod_pocketDim/EventHookContainer.java +++ b/StevenDimDoors/mod_pocketDim/EventHookContainer.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Random; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; +import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; @@ -17,6 +18,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; @@ -46,7 +48,6 @@ public class EventHookContainer } @SideOnly(Side.CLIENT) - @ForgeSubscribe public void onSoundLoad(SoundLoadEvent event) { @@ -60,7 +61,6 @@ public class EventHookContainer @ForgeSubscribe public void onWorldLoad(WorldEvent.Load event) { - if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote) { System.out.println("Registering Pocket Dims"); @@ -69,9 +69,7 @@ public class EventHookContainer dimHelper.dimList.clear(); dimHelper.instance.interDimLinkList.clear(); dimHelper.instance.initPockets(); - } - for(Integer ids : dimHelper.getIDs()) { World world = dimHelper.getWorld(ids); @@ -79,140 +77,70 @@ public class EventHookContainer if(dimHelper.dimList.containsKey(world.provider.dimensionId)) { - - for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).printAllLinkData()) - { - if(linkCount>100) - { - break; - } - linkCount++; - int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord); - if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace)) - { - dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID); - } - - + //TODO added temporary Try/catch block to prevent a crash here, getLinksInDim needs to be looked at + try + { + for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).getLinksInDim()) + { + if(linkCount>100) + { + break; + } + linkCount++; + int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord); + if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace)) + { + dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID); + } + } + } + catch(Exception e) + { + e.printStackTrace(); } - } - } - - - - - - + } } + @ForgeSubscribe public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event) { - if(event.entity instanceof EntityPlayer) + if(event.entity instanceof EntityPlayer) { - // System.out.println(event.entity.worldObj.provider.dimensionId); - + // System.out.println(event.entity.worldObj.provider.dimensionId); // PacketDispatcher.sendPacketToPlayer(DimUpdatePacket.sendPacket(event.world.provider.dimensionId,1),(Player) event.entity); - - - } - } @ForgeSubscribe public void onPlayerFall(LivingFallEvent event) { - - event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID); - + event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID); } @ForgeSubscribe public void onPlayerInteract(PlayerInteractEvent event) { - - - - /** - if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { - - int x = event.x; - int y = event.y; - + int y = event.y; int z = event.z; - - - - - + if(event.entityPlayer.getHeldItem()!=null) { if(event.entityPlayer.getHeldItem().getItem() instanceof ItemBlock) { - // if(event.entityPlayer instanceof EntityPlayerMP) + if(event.entityPlayer instanceof EntityPlayerMP) { - Point3D point = new Point3D(x,y,z); dimHelper.blocksToDecay.add(point); } - } - else - { - event.setCanceled(true); - } - - - } - - } - **/ - + } + } + } } - - - - - // @ForgeSubscribe - public void onPlayerEvent(PlayerEvent event) - { - /** - if(!event.entity.worldObj.isRemote) - { - ItemStack item = event.entityPlayer.inventory.getCurrentItem(); - if(item!=null) - { - if(item.getItem() instanceof ItemRiftBlade) - { - List list = event.entity.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox( event.entityPlayer.posX-7,event.entityPlayer.posY-7, event.entityPlayer.posZ-7, event.entityPlayer.posX+7,event.entityPlayer.posY+7, event.entityPlayer.posZ+7)); - list.remove(event.entity); - - for(EntityLiving ent : list) - { - - Vec3 var3 = event.entityPlayer.getLook(1.0F).normalize(); - Vec3 var4 = event.entityPlayer.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - event.entityPlayer.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( event.entityPlayer.posY + (double) event.entityPlayer.getEyeHeight()), ent.posZ - event.entityPlayer.posZ); - double var5 = var4.lengthVector(); - var4 = var4.normalize(); - double var7 = var3.dotProduct(var4); - if( (var7+.1) > 1.0D - 0.025D / var5 ? event.entityPlayer.canEntityBeSeen(ent) : false) - { - System.out.println(list.size()); - ItemRiftBlade.class.cast(item.getItem()).teleportToEntity(item,ent, event.entityPlayer); - break; - - //ItemRiftBlade.class.cast(item.getItem()).teleportTo(event.entityPlayer, ent.posX, ent.posY, ent.posZ); - } - } - - } - } - } - **/ - } + @ForgeSubscribe public void onPlayerDrops(PlayerDropsEvent event) { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java index 191424e5..29b8028f 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java @@ -57,7 +57,7 @@ public class CommandDeleteAllLinks extends DDCommandBase if(dimHelper.dimList.containsKey(targetDim)) { DimData dim = dimHelper.dimList.get(targetDim); - ArrayList linksInDim = dim.printAllLinkData(); + ArrayList linksInDim = dim.getLinksInDim(); for (LinkData link : linksInDim) { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java index 388e3dbf..f25e8d9d 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java @@ -61,7 +61,7 @@ public class CommandDeleteDimensionData extends DDCommandBase for(DimData dimData :dimHelper.dimList.values()) { Collection links= new ArrayList(); - links.addAll( dimData.printAllLinkData()); + links.addAll( dimData.getLinksInDim()); for(LinkData link : links) { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java index d109d82c..0f61224d 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java @@ -58,7 +58,7 @@ public class CommandDeleteRifts extends DDCommandBase if(dimHelper.dimList.containsKey(targetDim)) { DimData dim = dimHelper.dimList.get(targetDim); - ArrayList linksInDim = dim.printAllLinkData(); + ArrayList linksInDim = dim.getLinksInDim(); for(LinkData link : linksInDim) { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java b/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java index 7a8c5c0c..ddb2df93 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java @@ -56,7 +56,7 @@ public class CommandPrintDimensionData extends DDCommandBase return DDCommandResult.UNREGISTERED_DIMENSION; } - ArrayList links = dimData.printAllLinkData(); + ArrayList links = dimData.getLinksInDim(); sender.sendChatToPlayer("Dimension ID = " + dimData.dimID); sender.sendChatToPlayer("Dimension Depth = " + dimData.depth); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java b/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java index b130dbf7..dacb16ea 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java @@ -47,7 +47,7 @@ public class CommandPruneDimensions extends DDCommandBase for (DimData data : allDims) { - for (LinkData link : data.printAllLinkData()) + for (LinkData link : data.getLinksInDim()) { linkedDimensions.add(link.destDimID); } diff --git a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java index b017b636..97938adb 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java @@ -824,7 +824,7 @@ public class dimHelper extends DimensionManager DeleteFolder.deleteFolder(save); dimData.hasBeenFilled = false; dimData.hasDoor = false; - for(LinkData link : dimData.printAllLinkData()) + for(LinkData link : dimData.getLinksInDim()) { link.hasGennedDoor = false; LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); @@ -1248,7 +1248,7 @@ public class dimHelper extends DimensionManager { break; } - linksInDim = dimData.printAllLinkData(); + linksInDim = dimData.getLinksInDim(); if(!linksInDim.isEmpty()) { break; From d6e7fbbde59cd56318c93f9fb56d9b3606a60dc6 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Thu, 11 Jul 2013 23:58:59 -0400 Subject: [PATCH 2/5] Reworked dimension population other mods shouldnt attempt to generate in pockets/limbo now. Expect pockets to gen 40x faster on hexxit --- .../mod_pocketDim/CommonTickHandler.java | 153 ++++++++++++++++++ .../mod_pocketDim/DDProperties.java | 2 +- .../mod_pocketDim/EventHookContainer.java | 8 + .../mod_pocketDim/world/LimboGenerator.java | 63 ++------ .../mod_pocketDim/world/PocketGenerator.java | 90 ++--------- 5 files changed, 187 insertions(+), 129 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java index 9fc01cf4..09e2c478 100644 --- a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java +++ b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java @@ -1,12 +1,16 @@ package StevenDimDoors.mod_pocketDim; +import java.util.ArrayList; import java.util.EnumSet; import java.util.Random; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; +import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; +import StevenDimDoors.mod_pocketDim.ticking.MobObelisk; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; +import net.minecraft.entity.Entity; import net.minecraft.world.World; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ITickHandler; @@ -19,6 +23,11 @@ public class CommonTickHandler implements ITickHandler public int tickCount=0; public int tickCount2=0; private static DDProperties properties = null; + public static ArrayList chunksToPopulate= new ArrayList(); + public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100; + private static final int MAX_MONOLITH_SPAWN_Y = 245; + private static final int CHUNK_SIZE = 16; + public CommonTickHandler() { @@ -40,6 +49,22 @@ public class CommonTickHandler implements ITickHandler { if (type.equals(EnumSet.of(TickType.SERVER))) { + if(!CommonTickHandler.chunksToPopulate.isEmpty()) + { + for(int[] chunkData : CommonTickHandler.chunksToPopulate) + { + if(chunkData[0]==properties.LimboDimensionID) + { + this.placeMonolithsInLimbo(chunkData[0], chunkData[1], chunkData[2]); + } + else + { + this.placeMonolithsInPockets(chunkData[0], chunkData[1], chunkData[2]); + } + + } + } + CommonTickHandler.chunksToPopulate.clear(); } } @@ -53,6 +78,134 @@ public class CommonTickHandler implements ITickHandler return null; } + private void placeMonolithsInPockets(int worldID, int chunkX, int chunkZ) + { + World worldObj = dimHelper.getWorld(worldID); + DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId); + int sanity = 0; + int blockID = 0; + boolean didSpawn=false; + + if (dimData == null || + dimData.dungeonGenerator == null || + dimData.dungeonGenerator.isOpen) + { + return; + } + + //The following initialization code is based on code from ChunkProviderGenerate. + //It makes our generation depend on the world seed. + Random random = new Random(worldObj.getSeed()); + long factorA = random.nextLong() / 2L * 2L + 1L; + long factorB = random.nextLong() / 2L * 2L + 1L; + random.setSeed((long)chunkX * factorA + (long)chunkZ * factorB ^ worldObj.getSeed()); + + int x, y, z; + do + { + //Select a random column within the chunk + x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); + z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); + y = MAX_MONOLITH_SPAWN_Y; + blockID = worldObj.getBlockId(x, y, z); + + while (blockID == 0 &&y>0) + { + y--; + blockID = worldObj.getBlockId(x, y, z); + + } + while(blockID == mod_pocketDim.blockDimWall.blockID&&y>0) + { + y--; + blockID = worldObj.getBlockId(x, y, z); + } + while (blockID == 0 &&y>0) + { + y--; + blockID = worldObj.getBlockId(x, y, z); + + } + if(y > 0) + { + + + + int jumpSanity=0; + int jumpHeight=0; + do + { + + jumpHeight = y+random.nextInt(10); + + jumpSanity++; + } + while(!worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20); + + + + + Entity mob = new MobObelisk(worldObj); + mob.setLocationAndAngles(x, jumpHeight, z, 1, 1); + worldObj.spawnEntityInWorld(mob); + didSpawn=true; + } + + sanity++; + + } + while (sanity<5&&!didSpawn); + } + + private void placeMonolithsInLimbo(int worldID, int var2, int var3) + { + World world = dimHelper.getWorld(worldID); + + if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance) + { + int y =0; + int x = var2*16 + rand.nextInt(16); + int z = var3*16 + rand.nextInt(16); + int yTest; + do + { + + x = var2*16 + rand.nextInt(16); + z = var3*16 + rand.nextInt(16); + + while(world.getBlockId(x, y, z)==0&&y<255) + { + y++; + } + y = yCoordHelper.getFirstUncovered(world,x , y+2, z); + + yTest=yCoordHelper.getFirstUncovered(world,x , y+5, z); + if(yTest>245) + { + return; + } + + int jumpSanity=0; + int jumpHeight=0; + do + { + jumpHeight = y+rand.nextInt(25); + + jumpSanity++; + } + while(!world.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20); + + + Entity mob = new MobObelisk(world); + mob.setLocationAndAngles(x, jumpHeight, z, 1, 1); + + + world.spawnEntityInWorld(mob); + + } + while (yTest > y); + } + } //replaces rifts in game that have been destroyed/have blocks placed over them. private void onTickInGame() { diff --git a/StevenDimDoors/mod_pocketDim/DDProperties.java b/StevenDimDoors/mod_pocketDim/DDProperties.java index 61aec250..2c95909f 100644 --- a/StevenDimDoors/mod_pocketDim/DDProperties.java +++ b/StevenDimDoors/mod_pocketDim/DDProperties.java @@ -208,7 +208,7 @@ public class DDProperties "Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true); MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28, - "Sets the chance (out of " + LimboGenerator.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " + + "Sets the chance (out of " + CommonTickHandler.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " + "spawn in a given Limbo chunk. The default chance is 28.").getInt(); ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3, diff --git a/StevenDimDoors/mod_pocketDim/EventHookContainer.java b/StevenDimDoors/mod_pocketDim/EventHookContainer.java index f2188afe..0bd8d1bb 100644 --- a/StevenDimDoors/mod_pocketDim/EventHookContainer.java +++ b/StevenDimDoors/mod_pocketDim/EventHookContainer.java @@ -8,6 +8,10 @@ import java.util.Random; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade; +import StevenDimDoors.mod_pocketDim.world.LimboGenerator; +import StevenDimDoors.mod_pocketDim.world.LimboProvider; +import StevenDimDoors.mod_pocketDim.world.PocketGenerator; +import StevenDimDoors.mod_pocketDim.world.pocketProvider; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; @@ -29,11 +33,13 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.client.event.sound.SoundLoadEvent; +import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.world.WorldEvent; public class EventHookContainer @@ -102,6 +108,8 @@ public class EventHookContainer } } + + @ForgeSubscribe public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event) { diff --git a/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java b/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java index 33849332..0dae107c 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.CommonTickHandler; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -33,7 +34,6 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent; public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider { - public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100; private static Random rand; /** A NoiseGeneratorOctaves used in generating terrain */ @@ -158,15 +158,17 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi 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); - - - - Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); - - var4.generateSkylightMap(); + + if(!var4.isTerrainPopulated) + { + var4.isTerrainPopulated=true; + CommonTickHandler.chunksToPopulate.add(new int[] {properties.LimboDimensionID,par1,par2}); + } + + + return var4; } @Override @@ -178,50 +180,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi @Override public void populate(IChunkProvider var1, int var2, int var3) { - if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance) - { - int y =0; - int x = var2*16 + rand.nextInt(16); - int z = var3*16 + rand.nextInt(16); - int yTest; - do - { - - x = var2*16 + rand.nextInt(16); - z = var3*16 + rand.nextInt(16); - - while(this.worldObj.getBlockId(x, y, z)==0&&y<255) - { - y++; - } - y = yCoordHelper.getFirstUncovered(this.worldObj,x , y+2, z); - - yTest=yCoordHelper.getFirstUncovered(this.worldObj,x , y+5, z); - if(yTest>245) - { - return; - } - - int jumpSanity=0; - int jumpHeight=0; - do - { - jumpHeight = y+rand.nextInt(25); - - jumpSanity++; - } - while(!this.worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20); - - - Entity mob = new MobObelisk(this.worldObj); - mob.setLocationAndAngles(x, jumpHeight, z, 1, 1); - - - this.worldObj.spawnEntityInWorld(mob); - - } - while (yTest > y); - } + } @Override diff --git a/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java b/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java index 226fbc7e..e897446c 100644 --- a/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java +++ b/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java @@ -13,6 +13,8 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderGenerate; +import StevenDimDoors.mod_pocketDim.CommonTickHandler; +import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -23,13 +25,17 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv { private World worldObj; - private static final int MAX_MONOLITH_SPAWN_Y = 245; - private static final int CHUNK_SIZE = 16; + private DDProperties properties = null; + + public PocketGenerator(World par1World, long par2, boolean par4) { super(par1World, par2, par4); this.worldObj = par1World; + + if (properties == null) + properties = DDProperties.instance(); } @Override @@ -49,6 +55,12 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv byte[] var3 = new byte[32768]; Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ); + + if(!chunk.isTerrainPopulated) + { + chunk.isTerrainPopulated=true; + CommonTickHandler.chunksToPopulate.add(new int[] {chunk.worldObj.provider.dimensionId,chunkX,chunkZ}); + } return chunk; } @@ -62,81 +74,7 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv @Override public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ) { - //Check whether we want to populate this chunk with Monoliths. - DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId); - int sanity = 0; - int blockID = 0; - boolean didSpawn=false; - if (dimData == null || - dimData.dungeonGenerator == null || - dimData.dungeonGenerator.isOpen) - { - return; - } - - //The following initialization code is based on code from ChunkProviderGenerate. - //It makes our generation depend on the world seed. - Random random = new Random(worldObj.getSeed()); - long factorA = random.nextLong() / 2L * 2L + 1L; - long factorB = random.nextLong() / 2L * 2L + 1L; - random.setSeed((long)chunkX * factorA + (long)chunkZ * factorB ^ worldObj.getSeed()); - - int x, y, z; - do - { - //Select a random column within the chunk - x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); - z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); - y = MAX_MONOLITH_SPAWN_Y; - blockID = worldObj.getBlockId(x, y, z); - - while (blockID == 0 &&y>0) - { - y--; - blockID = worldObj.getBlockId(x, y, z); - - } - while(blockID == mod_pocketDim.blockDimWall.blockID&&y>0) - { - y--; - blockID = worldObj.getBlockId(x, y, z); - } - while (blockID == 0 &&y>0) - { - y--; - blockID = worldObj.getBlockId(x, y, z); - - } - if(y > 0) - { - - - - int jumpSanity=0; - int jumpHeight=0; - do - { - - jumpHeight = y+random.nextInt(10); - - jumpSanity++; - } - while(!this.worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20); - - - - - Entity mob = new MobObelisk(worldObj); - mob.setLocationAndAngles(x, jumpHeight, z, 1, 1); - worldObj.spawnEntityInWorld(mob); - didSpawn=true; - } - - sanity++; - - } - while (sanity<5&&!didSpawn); } @Override From 314b2dee04afd05ae033c50c4b6a6a2532c4b41d Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Fri, 12 Jul 2013 23:40:21 -0400 Subject: [PATCH 3/5] Added method to return dungeons already generated. --- .../mod_pocketDim/helpers/DungeonHelper.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 725c2e3a..6fce9ab1 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -15,6 +15,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; +import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.DungeonGenerator; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -531,6 +532,8 @@ public class DungeonHelper int depth = dimHelper.instance.getDimDepth(incoming.locDimID); int depthWeight = rand.nextInt(depth + 2) + rand.nextInt(depth + 2) - 2; + ArrayList array = getDungeonDataBelow(dimHelper.dimList.get(incoming.destDimID)); + array.hashCode(); int count = 10; boolean flag = true; try @@ -718,4 +721,36 @@ public class DungeonHelper WeightedContainer resultContainer = (WeightedContainer) WeightedRandom.getRandomItem(random, weights); return (resultContainer != null) ? resultContainer.getData() : null; } + public static ArrayList getDungeonDataBelow(DimData dimData) + { + DimData startingDim = dimHelper.dimList.get(dimHelper.instance.getLinkDataFromCoords(dimData.exitDimLink.destXCoord, dimData.exitDimLink.destYCoord, dimData.exitDimLink.destZCoord, dimData.exitDimLink.destDimID).destDimID); + + return getDungeonDataAbove(startingDim); + } + private static ArrayList getDungeonDataAbove(DimData dimData) + { + ArrayList dungeonData = new ArrayList(); + if(dimData.dungeonGenerator!=null) + { + dungeonData.add(dimData.dungeonGenerator); + + for(LinkData link : dimData.getLinksInDim()) + { + if(dimHelper.dimList.containsKey(link.destDimID)) + { + if(dimHelper.dimList.get(link.destDimID).dungeonGenerator!=null&&dimHelper.instance.getDimDepth(link.destDimID)==dimData.depth+1) + { + for(DungeonGenerator dungeonGen :getDungeonDataAbove(dimHelper.dimList.get(link.destDimID)) ) + { + if(!dungeonData.contains(dungeonGen)) + { + dungeonData.add(dungeonGen); + } + } + } + } + } + } + return dungeonData; + } } \ No newline at end of file From 4508c2fd74836579c4f1bd2e09f1323be5c4a942 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Sat, 13 Jul 2013 14:13:01 -0400 Subject: [PATCH 4/5] Added creative tab --- .../mod_pocketDim/blocks/BlockLimbo.java | 2 +- .../mod_pocketDim/blocks/ExitDoor.java | 1 - .../mod_pocketDim/blocks/dimHatch.java | 2 +- .../mod_pocketDim/blocks/linkDimDoor.java | 2 + .../mod_pocketDim/blocks/linkExitDoor.java | 1 + .../mod_pocketDim/helpers/DungeonHelper.java | 16 ++- .../mod_pocketDim/items/ItemChaosDoor.java | 2 +- .../mod_pocketDim/items/ItemRiftBlade.java | 2 +- .../items/ItemStabilizedRiftSignature.java | 133 +++++------------- .../mod_pocketDim/items/ItemStableFabric.java | 2 +- .../mod_pocketDim/items/itemDimDoor.java | 2 +- .../mod_pocketDim/items/itemExitDoor.java | 2 +- .../items/itemLinkSignature.java | 2 +- .../mod_pocketDim/items/itemRiftRemover.java | 2 +- .../mod_pocketDim/mod_pocketDim.java | 26 +++- 15 files changed, 84 insertions(+), 113 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java b/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java index 68b935d0..579df2f2 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java @@ -32,7 +32,7 @@ public class BlockLimbo extends Block { super(i, Material.ground); setTickRandomly(false); - this.setCreativeTab(CreativeTabs.tabBlock); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); diff --git a/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java b/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java index 0b904147..60b2a151 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java @@ -33,7 +33,6 @@ public class ExitDoor extends dimDoor { super(par1, Material.wood); - // this.blockIndexInTexture = 19; // TODO Auto-generated constructor stub diff --git a/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java b/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java index 97de7736..c4aaad2a 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java +++ b/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java @@ -21,7 +21,7 @@ public class dimHatch extends BlockTrapDoor public dimHatch(int par1,int par2, Material par2Material) { super(par1, Material.iron); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); // this.setTextureFile("/PocketBlockTextures.png"); // this.blockIndexInTexture = 16; } diff --git a/StevenDimDoors/mod_pocketDim/blocks/linkDimDoor.java b/StevenDimDoors/mod_pocketDim/blocks/linkDimDoor.java index 8842a123..1f97f82d 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/linkDimDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/linkDimDoor.java @@ -23,8 +23,10 @@ public class linkDimDoor extends dimDoor { private Icon blockIconBottom; public linkDimDoor(int par1, Material material) { + super(par1, material); // TODO Auto-generated constructor stub + } diff --git a/StevenDimDoors/mod_pocketDim/blocks/linkExitDoor.java b/StevenDimDoors/mod_pocketDim/blocks/linkExitDoor.java index a6fe0f0c..ac8211ec 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/linkExitDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/linkExitDoor.java @@ -26,6 +26,7 @@ public class linkExitDoor extends ExitDoor super(par1, Material.wood); //this.blockIndexInTexture = 20; + // TODO Auto-generated constructor stub diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 6fce9ab1..2639f0a4 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -532,8 +532,7 @@ public class DungeonHelper int depth = dimHelper.instance.getDimDepth(incoming.locDimID); int depthWeight = rand.nextInt(depth + 2) + rand.nextInt(depth + 2) - 2; - ArrayList array = getDungeonDataBelow(dimHelper.dimList.get(incoming.destDimID)); - array.hashCode(); + int count = 10; boolean flag = true; try @@ -651,6 +650,11 @@ public class DungeonHelper { flag = false; } + + if(getDungeonDataInChain(dimHelper.dimList.get(incoming.locDimID)).contains(dungeon)) + { + flag=false; + } } while (!flag && count > 0); } @@ -721,13 +725,13 @@ public class DungeonHelper WeightedContainer resultContainer = (WeightedContainer) WeightedRandom.getRandomItem(random, weights); return (resultContainer != null) ? resultContainer.getData() : null; } - public static ArrayList getDungeonDataBelow(DimData dimData) + public static ArrayList getDungeonDataInChain(DimData dimData) { DimData startingDim = dimHelper.dimList.get(dimHelper.instance.getLinkDataFromCoords(dimData.exitDimLink.destXCoord, dimData.exitDimLink.destYCoord, dimData.exitDimLink.destZCoord, dimData.exitDimLink.destDimID).destDimID); - return getDungeonDataAbove(startingDim); + return getDungeonDataBelow(startingDim); } - private static ArrayList getDungeonDataAbove(DimData dimData) + private static ArrayList getDungeonDataBelow(DimData dimData) { ArrayList dungeonData = new ArrayList(); if(dimData.dungeonGenerator!=null) @@ -740,7 +744,7 @@ public class DungeonHelper { if(dimHelper.dimList.get(link.destDimID).dungeonGenerator!=null&&dimHelper.instance.getDimDepth(link.destDimID)==dimData.depth+1) { - for(DungeonGenerator dungeonGen :getDungeonDataAbove(dimHelper.dimList.get(link.destDimID)) ) + for(DungeonGenerator dungeonGen :getDungeonDataBelow(dimHelper.dimList.get(link.destDimID)) ) { if(!dungeonData.contains(dungeonGen)) { diff --git a/StevenDimDoors/mod_pocketDim/items/ItemChaosDoor.java b/StevenDimDoors/mod_pocketDim/items/ItemChaosDoor.java index 88374a5b..317cf4ba 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemChaosDoor.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemChaosDoor.java @@ -22,7 +22,7 @@ public class ItemChaosDoor extends itemDimDoor { super(par1, par2Material); this.doorMaterial = par2Material; - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } public void registerIcons(IconRegister par1IconRegister) { diff --git a/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java b/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java index 7d444f41..59031e94 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java @@ -32,7 +32,7 @@ public class ItemRiftBlade extends itemDimDoor super(par1, par2Material); // this.setTextureFile("/PocketBlockTextures.png"); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setMaxStackSize(1); // this.itemIcon=5; diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java b/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java index 605580ad..e3e43fd6 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java @@ -27,14 +27,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature { super(par); this.setMaxStackSize(1); - // this.setTextureFile("/PocketBlockTextures.png"); - this.setCreativeTab(CreativeTabs.tabTransport); - - // this.itemIndex=5; + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setMaxDamage(0); - this.hasSubtypes=true; - //TODO move to proxy - + this.hasSubtypes=true; if (properties == null) properties = DDProperties.instance(); } @@ -44,8 +39,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature public boolean hasEffect(ItemStack par1ItemStack) { // adds effect if item has a link stored - - if(par1ItemStack.hasTagCompound()) { if(par1ItemStack.stackTagCompound.getBoolean("isCreated")) @@ -53,14 +46,12 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature return true; } } - return false; + return false; } - public void registerIcons(IconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); - } @Override @@ -69,38 +60,23 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature int key; LinkData linkData; int thisWorldID=par3World.provider.dimensionId; - - + Integer[] linkCoords =this.readFromNBT(par1ItemStack); - - - - //par1ItemStack= par2EntityPlayer.getCurrentEquippedItem(); - Integer[] linkCoords =this.readFromNBT(par1ItemStack); - - - - //System.out.println(key); - int offset = 2; - if(par1ItemStack.getTagCompound()!=null) - { + int offset = 2; + if(par1ItemStack.getTagCompound()!=null) + { if(par1ItemStack.getTagCompound().getBoolean("isCreated")) { boolean hasEnder = false; - // checks to see if the item has a link stored, if so, it creates it - + // checks to see if the item has a link stored, if so, it creates it if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID)) { if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID)) - { par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID); - } hasEnder=true; - } - - + } if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID) { offset = 1; @@ -110,7 +86,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature if(dimHelper.instance.getLinkDataFromCoords(linkCoords[0], linkCoords[1], linkCoords[2], par3World)==null) { dimHelper.instance.createLink(linkCoords[3], par3World.provider.dimensionId, linkCoords[0], linkCoords[1], linkCoords[2],par4, par5+offset, par6); - } dimHelper.instance.createLink(par3World.provider.dimensionId, linkCoords[3], par4, par5+offset, par6, linkCoords[0], linkCoords[1], linkCoords[2]); par2EntityPlayer.sendChatToPlayer("Rift Created"); @@ -119,37 +94,20 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature { par2EntityPlayer.sendChatToPlayer("No Ender Pearls!"); } - - - - - - } } - else if(!par3World.isRemote) - { - if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID) - { - offset = 1; - } - //otherwise, it creates the first half of the link. Next click will complete it. - key= dimHelper.instance.createUniqueInterDimLinkKey(); - this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId); - - - - par2EntityPlayer.sendChatToPlayer("Rift Signature Stored"); - - - } - - //dimHelper.instance.save(); - - - - return true; - - + } + else if(!par3World.isRemote) + { + if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID) + { + offset = 1; + } + //otherwise, it creates the first half of the link. Next click will complete it. + key= dimHelper.instance.createUniqueInterDimLinkKey(); + this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId); + par2EntityPlayer.sendChatToPlayer("Rift Signature Stored"); + } + return true; } @SideOnly(Side.CLIENT) @@ -159,7 +117,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature */ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - if(par1ItemStack.hasTagCompound()) { if(par1ItemStack.stackTagCompound.getBoolean("isCreated")) @@ -167,9 +124,7 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature Integer[] coords = this.readFromNBT(par1ItemStack); par3List.add(String.valueOf("Leads to dim "+coords[3] +" with depth "+dimHelper.instance.getDimDepth(dimHelper.instance.getDimDepth(coords[3])))); par3List.add("at x="+coords[0]+" y="+coords[1]+" z="+coords[2]); - } - } else { @@ -177,41 +132,34 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature par3List.add ("second click creates two rifts,"); par3List.add("that link the first location"); par3List.add("with the second location"); - - } } public void writeToNBT(ItemStack itemStack,int x, int y, int z, int dimID) { - NBTTagCompound tag; - - if(itemStack.hasTagCompound()) - { - tag = itemStack.getTagCompound(); - - } - else - { - tag= new NBTTagCompound(); - } - - tag.setInteger("linkX", x); - tag.setInteger("linkY", y); - tag.setInteger("linkZ", z); - tag.setInteger("linkDimID", dimID); - tag.setBoolean("isCreated", true); - - itemStack.setTagCompound(tag); + NBTTagCompound tag; + if(itemStack.hasTagCompound()) + { + tag = itemStack.getTagCompound(); + } + else + { + tag= new NBTTagCompound(); + } + tag.setInteger("linkX", x); + tag.setInteger("linkY", y); + tag.setInteger("linkZ", z); + tag.setInteger("linkDimID", dimID); + tag.setBoolean("isCreated", true); + itemStack.setTagCompound(tag); } /** * Read the stack fields from a NBT object. */ public Integer[] readFromNBT(ItemStack itemStack) - { - + { NBTTagCompound tag; Integer[] linkCoords = new Integer[5]; if(itemStack.hasTagCompound()) @@ -226,11 +174,8 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature linkCoords[1]=tag.getInteger("linkY"); linkCoords[2]=tag.getInteger("linkZ"); linkCoords[3]=tag.getInteger("linkDimID"); - - } - return linkCoords; - + return linkCoords; } diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java index e7f715d7..50dafe83 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java @@ -33,7 +33,7 @@ public class ItemStableFabric extends Item { super(par1); // this.setitemIcon(Item.doorWood.getIconFromDamage(0)); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } public void registerIcons(IconRegister par1IconRegister) diff --git a/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java b/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java index a0a65496..15ed3611 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java +++ b/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java @@ -31,7 +31,7 @@ public class itemDimDoor extends ItemDoor { super(par1, par2Material); this.setMaxStackSize(64); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); if (properties == null) properties = DDProperties.instance(); } diff --git a/StevenDimDoors/mod_pocketDim/items/itemExitDoor.java b/StevenDimDoors/mod_pocketDim/items/itemExitDoor.java index 7b032300..50312bac 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemExitDoor.java +++ b/StevenDimDoors/mod_pocketDim/items/itemExitDoor.java @@ -22,7 +22,7 @@ public class itemExitDoor extends itemDimDoor { super(par1, par2Material); this.doorMaterial = par2Material; - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } diff --git a/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java b/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java index 56361d02..6f2c75e5 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java @@ -29,7 +29,7 @@ public class itemLinkSignature extends Item super(par1); this.setMaxStackSize(1); // this.setTextureFile("/PocketBlockTextures.png"); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); // this.itemIcon=5; this.setMaxDamage(0); diff --git a/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java b/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java index 1e7a4f05..3ba055e5 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java +++ b/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java @@ -28,7 +28,7 @@ public class itemRiftRemover extends Item super(par1); this.setMaxStackSize(1); // this.setTextureFile("/PocketBlockTextures.png"); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); // this.itemIcon=6; this.setMaxDamage(5); diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 9a554855..7a03bf1a 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -6,6 +6,7 @@ import java.util.HashMap; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.item.EntityItem; @@ -133,6 +134,23 @@ public class mod_pocketDim public static long genTime; public static int teleTimer = 0; + + public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") + { + @Override + public ItemStack getIconItemStack() + { + return new ItemStack(mod_pocketDim.itemDimDoor, 1, 0); + } + + @Override + public String getTranslatedTabLabel() + { + return "Dimensional Doors"; + } + }; + + @PreInit public void PreInit(FMLPreInitializationEvent event) @@ -217,6 +235,8 @@ public class mod_pocketDim LanguageRegistry.addName(itemChaosDoor , "Unstable Door"); LanguageRegistry.addName(itemDimDoor, "Dimensional Door"); LanguageRegistry.addName(itemRiftBlade , "Rift Blade"); + + LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items"); TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT); TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER); @@ -403,13 +423,13 @@ public class mod_pocketDim CommandPrintDimensionData.instance().register(event); CommandPruneDimensions.instance().register(event); CommandStartDungeonCreation.instance().register(event); - dimHelper.instance.load(); + if(!dimHelper.dimList.containsKey(properties.LimboDimensionID)) { dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData())); } - - } + + } \ No newline at end of file From ec2156fce13cef27d5e2754565ea14c117ccf369 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Sat, 13 Jul 2013 14:15:04 -0400 Subject: [PATCH 5/5] derp --- StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java index d055f13e..5324bf83 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java @@ -22,7 +22,7 @@ public class BlockDimWall extends Block { super(i, Material.ground); setTickRandomly(true); - this.setCreativeTab(CreativeTabs.tabBlock); + this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);