From b388a00e05cbecb42560857fb54344692b9d65db Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Wed, 12 Jun 2013 17:59:34 -0400 Subject: [PATCH 1/2] redid commands, added more rotation support. --- .../mod_pocketDim/SchematicLoader.java | 149 ++++++++++++++++++ .../commands/CommandAddDungeonRift.java | 2 +- .../commands/CommandDeleteAllLinks.java | 2 +- .../commands/CommandDeleteDimData.java | 2 +- .../commands/CommandDeleteRifts.java | 2 +- .../commands/CommandEndDungeonCreation.java | 2 +- .../commands/CommandPrintDimData.java | 2 +- .../commands/CommandPruneDims.java | 2 +- .../commands/CommandStartDungeonCreation.java | 2 +- .../mod_pocketDim/helpers/DungeonHelper.java | 40 ++++- .../mod_pocketDim/mod_pocketDim.java | 2 +- .../mods/DimDoors/How_to_add_dungeons.txt | 37 +++-- 12 files changed, 216 insertions(+), 28 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/SchematicLoader.java b/StevenDimDoors/mod_pocketDim/SchematicLoader.java index 9371e384..53eb9fc7 100644 --- a/StevenDimDoors/mod_pocketDim/SchematicLoader.java +++ b/StevenDimDoors/mod_pocketDim/SchematicLoader.java @@ -54,6 +54,8 @@ public class SchematicLoader public ArrayList sideLinks = new ArrayList(); public ArrayList exitLinks = new ArrayList(); + public HashMap>> rotationMap = new HashMap>>(); + public int transMeta; public int cX; @@ -67,6 +69,9 @@ public class SchematicLoader public SchematicLoader() { + + + } @@ -203,6 +208,56 @@ public class SchematicLoader } } + 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) @@ -376,6 +431,53 @@ public class SchematicLoader } } + 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) @@ -541,6 +643,53 @@ public class SchematicLoader } } + 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) diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java index a342ee09..91066809 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java @@ -19,7 +19,7 @@ public class CommandAddDungeonRift extends CommandBase { public String getCommandName()//the name of our command { - return "add_dungeon_rift"; + return "dimdoors-genDungeonRift"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java index 2f406c97..4ac64e9b 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java @@ -16,7 +16,7 @@ public class CommandDeleteAllLinks extends CommandBase { public String getCommandName()//the name of our command { - return "delete_all_links"; + return "dimdoors-deleteLinksInDim"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimData.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimData.java index 4865ef14..d09afd49 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimData.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimData.java @@ -17,7 +17,7 @@ public class CommandDeleteDimData extends CommandBase { public String getCommandName()//the name of our command { - return "delete_dim_data"; + return "dimdoors-deleteDimData"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java index cc1cadbc..0eeca5ff 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java @@ -16,7 +16,7 @@ public class CommandDeleteRifts extends CommandBase { public String getCommandName()//the name of our command { - return "delete_rifts"; + return "dimdoors-cleanupRifts"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java index f9a5122c..f992d992 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java @@ -12,7 +12,7 @@ public class CommandEndDungeonCreation extends CommandBase { public String getCommandName()//the name of our command { - return "end_dungeon_creation"; + return "dimdoors-endDungeonCreation"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimData.java b/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimData.java index 143bd838..3d2aa9ba 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimData.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimData.java @@ -17,7 +17,7 @@ public class CommandPrintDimData extends CommandBase { public String getCommandName()//the name of our command { - return "print_dim_data"; + return "dimdoors-printDimData"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandPruneDims.java b/StevenDimDoors/mod_pocketDim/commands/CommandPruneDims.java index d5eae82c..8da22481 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandPruneDims.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandPruneDims.java @@ -13,7 +13,7 @@ public class CommandPruneDims extends CommandBase { public String getCommandName()//the name of our command { - return "prune_pocket_dims"; + return "dimdoors-prunePockets"; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java index 9c709bfd..9ac8e1b1 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java @@ -20,7 +20,7 @@ public class CommandStartDungeonCreation extends CommandBase { public String getCommandName()//the name of our command { - return "start_dungeon_creation"; + return "dimdoors-startDungeonCreation"; } @Override diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 0dd38426..0bee3e0a 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -11,7 +11,6 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DungeonGenerator; @@ -20,6 +19,7 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.jnbt.ByteArrayTag; import StevenDimDoors.mod_pocketDim.helpers.jnbt.CompoundTag; import StevenDimDoors.mod_pocketDim.helpers.jnbt.IntTag; +import StevenDimDoors.mod_pocketDim.helpers.jnbt.ListTag; import StevenDimDoors.mod_pocketDim.helpers.jnbt.NBTOutputStream; import StevenDimDoors.mod_pocketDim.helpers.jnbt.ShortTag; import StevenDimDoors.mod_pocketDim.helpers.jnbt.StringTag; @@ -70,6 +70,8 @@ public class DungeonHelper public ArrayList exits = new ArrayList(); + + public ArrayList tagList = new ArrayList(); @@ -90,11 +92,18 @@ public class DungeonHelper if(name.length<4) { - System.out.println("Importing custom dungeon gen mechanics failed, adding to secondary list"); + System.out.println("Could not parse filename tags, not adding dungeon to generation lists"); this.customDungeons.add(new DungeonGenerator(0,schematicFile.getAbsolutePath(),true)); System.out.println("Imported "+schematicFile.getName()); + } + else if(!(name[2].equals("open")||name[2].equals("closed"))||!this.tagList.contains(name[0])) + { + System.out.println("Could not parse filename tags, not adding dungeon to generation lists"); + this.customDungeons.add(new DungeonGenerator(0,schematicFile.getAbsolutePath(),true)); + System.out.println("Imported "+schematicFile.getName()); + } else { @@ -137,7 +146,7 @@ public class DungeonHelper this.exits.add(new DungeonGenerator(weight,path,open)); } - else if(name[0].equals("mazes")) + else if(name[0].equals("maze")) { this.mazes.add(new DungeonGenerator(weight,path,open)); @@ -231,7 +240,16 @@ public class DungeonHelper this.metadataNextList.add(Block.redstoneRepeaterActive.blockID); } - + public void registerDungeonTypeTags() + { + tagList.add("hub"); + tagList.add("trap"); + tagList.add("simpleHall"); + tagList.add("complexHall"); + tagList.add("exit"); + tagList.add("deadEnd"); + tagList.add("maze"); + } public void registerBaseDungeons() { this.hubs.add(new DungeonGenerator(0, "/schematics/4WayBasicHall.schematic", false)); @@ -376,7 +394,7 @@ public class DungeonHelper //ArrayList tileEntities = new ArrayList(); - NBTTagList tileEntites = new NBTTagList(); + ArrayList tileEntites= new ArrayList(); byte[] blocks = new byte[width * height * length]; byte[] addBlocks = null; byte[] blockData = new byte[width * height * length]; @@ -419,17 +437,23 @@ public class DungeonHelper if (Block.blocksList[blockID] instanceof BlockContainer) { + //TODO fix this + /** TileEntity tileEntityBlock = world.getBlockTileEntity(x+xMin, y+yMin, z+zMin); NBTTagCompound tag = new NBTTagCompound(); tileEntityBlock.writeToNBT(tag); + CompoundTag tagC = new CompoundTag("TileEntity",Map.class.cast(tag.getTags())); + + // Get the list of key/values from the block - if (tag != null) + if (tagC != null) { - tileEntites.appendTag(tag); + tileEntites.add(tagC); } + **/ } @@ -453,7 +477,7 @@ public class DungeonHelper schematic.put("Width", new ShortTag("Width", (short) width)); schematic.put("Length", new ShortTag("Length", (short) length)); schematic.put("Height", new ShortTag("Height", (short) height)); - schematic.put("TileEntites", tileEntites); + schematic.put("TileEntites", new ListTag("TileEntities",CompoundTag.class,tileEntites)); if (addBlocks != null) { schematic.put("AddBlocks", new ByteArrayTag("AddBlocks", addBlocks)); } diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 594b2b0b..607432c1 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -3,7 +3,6 @@ package StevenDimDoors.mod_pocketDim; import java.io.File; import java.net.URL; -import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; @@ -277,6 +276,7 @@ public class mod_pocketDim dungeonHelper.importCustomDungeons(schematicDir); dungeonHelper.registerBaseDungeons(); + dungeonHelper.registerDungeonTypeTags(); diff --git a/resources/mods/DimDoors/How_to_add_dungeons.txt b/resources/mods/DimDoors/How_to_add_dungeons.txt index 7abc9e46..7e214e36 100644 --- a/resources/mods/DimDoors/How_to_add_dungeons.txt +++ b/resources/mods/DimDoors/How_to_add_dungeons.txt @@ -1,38 +1,53 @@ Adding dungeons is pretty simple, but you have to know the various flags and stuff I use to read them in and build them. Ill walk you through the process here, and provide all the flags and a breif description of what they mean here. -You will also need WorldEdit installed and running to export your dungeon. - To get started, run minecraft with DimDoors installed and type the following command- -/start_dungeon_creation +/dimdoors-startDungeonCreation This will generate an empty pocket dim for you to build with that is in the proper orientation (north). If you do not use this command, you WILL run into issues later. -So on to the building- You can ONLY use vanilla blocks in the dungeons. Everything that is not vanilla MC will be turned into fabric of reality when I gen them, or it will crash horribly. The only exceptions to this are DimDoors blocks, which will always be turned into fabric of reality. +So on to the building- You can ONLY use vanilla blocks in the dungeons. Everything that is not vanilla MC will be turned into fabric of reality when I gen them, or it will crash horribly. The only exceptions to this are DimDoors doors, which will be treated like mundane, vanilla doors of the same material. -The first step is to make your entrance door. This is where the player will appear when they teleport in for the first time. It is marked by a vanilla wooden door. It will be replaced by a wooden warp door on generation. +The first step is to make your entrance door. This is where the player will appear when they teleport in for the first time. It is marked by a vanilla wooden door. It will be replaced by a wooden warp door on generation, and by default is set as the door you entered from. -As you build your dungeon, there are a few restrictions. Any chests you place will get filled with random loot, and not what you place in them. Any dispensers will get a few stacks of arrows. Other than that, any vanilla mechanics should work fine, except rails. Im working on that now. +As you build your dungeon, there are a few restrictions. Any chests you place will get filled with random loot, and not what you place in them. Any dispensers will get a few stacks of arrows. Other than that, any vanilla mechanics should work fine, except rails. Im working on that now, as well as saving inventories. Any vanilla iron doors you place will become iron dim doors, and link to more dungeon pockets, so use these to make your dungeon lead farther into a dungeon chain. -If you want your dungeon to link back the overworld, place a vanilla wooden door on top of a sandstone block. This will mark it as an exit door, and it will gen as a wooden Dim door leading to the overworld (or whatever dim this chain started in) +If you want your dungeon to link back the overworld, place a vanilla wooden door on top of a sandstone block. This will mark it as an exit door, and it will gen as a wooden Dim door leading to the overworld (or whatever dim this chain started in). The sandstone block will become whatever is under it. -Once you have finished creating your dungeon, you need to use the command /end_dungeon_creation . +Once you have finished creating your dungeon, you need to use the command /dimdoors-endDungeonCreation . To name it, use the following format- ___ -The dungeon types are ‘hub’, ‘simpleHall’, ‘complexHall’, ‘trap', ‘maze’, ‘exit’, and ‘deadEnd’. +The dungeon types are ‘hub’, ‘simpleHall’, ‘complexHall’, ‘trap', ‘maze’, ‘exit’, and ‘deadEnd', see explanation further down. -isOpen determines if the dungeon is an open-air style pocket, or a closed in/walled it pocket that will spawn Monoliths. +isOpen determines if the dungeon is an open-air style pocket, or a closed in/walled it pocket that will spawn Monoliths. Correct arguments are 'open' or 'closed'. Spawn weight determines how frequently you want it to appear. The default is one, and it will have the same relative weight as all the others. For example- hub_hallWith5Doors_1.schematic -Congratulations! You have added your own dungeon. You can use the command /add_dungeon_rift to gen it, or use /add_dungeon_rift list to list all avalible dungeons. +Congratulations! You have added your own dungeon. You can use the command /dimdoors-genDungeonRift to gen it, or use /dimdoors-genDungeonRift list to list all avalible dungeons. +These tags are just guidelines, feel free to do whatever you feel like, but the generation algorithm is set up with these in mind- + + +hub- Dungeons that have 4 or more iron doors in them should be labled as hubs, so they dont gen one after another. + +simpleHall- this dungeons contain a single iron door, (possibly two, but not three) and dont contain redstone traps/etc. These are the halls that separate rooms, and should generally be tagged with 'closed' as well. + +complexHall- these dungeons are more like rooms, and can be open. They can have piston puzzles/locks, and up to three iron doors. In addition, they can contain wooden doors to link to the surface. + +trap- these are primarily traps, and often contain only a single iron door. The traps should never instantly kill the player, and should always be surmountable. They can contain either a reward/chest, or simply allow progress. Piston traps are very fun for these. + +maze- can contain up to 3 iron dim doors. They can be simple labryinths, or full of changing walls, etc. They should not, however, be primarily trying to kill the player. (though they can have possibly lethal elements). Think of half trap, half hub. + +exit- primary purpose is to link back to overworld with a wooden door. Should never contain iron doors. + +deadEnd- no doors, except enterace door. Usually contain some sort of treasure. + From e531c1e301e7b391c508cf389a52c990e194a69e Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Wed, 12 Jun 2013 19:05:46 -0400 Subject: [PATCH 2/2] derptityderp --- StevenDimDoors/mod_pocketDim/mod_pocketDim.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 22ee0c23..d01e49ee 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -2,10 +2,7 @@ package StevenDimDoors.mod_pocketDim; import java.io.File; -<<<<<<< HEAD -import java.net.URL; -======= ->>>>>>> 9a8510a705bbcfedccea599fa90fea3c98734253 + import java.util.ArrayList; import java.util.HashMap;