Merge pull request #43 from SenseiKiwi/master

Added New Dungeons and Fixed Various Minor Bugs
This commit is contained in:
StevenRS11 2013-07-17 00:02:10 -07:00
commit 216c99e3e5
26 changed files with 94 additions and 141 deletions

View file

@ -2,8 +2,6 @@ package StevenDimDoors.mod_pocketDim;
import java.io.File;
import StevenDimDoors.mod_pocketDim.world.LimboGenerator;
import net.minecraftforge.common.Configuration;
public class DDProperties

View file

@ -43,7 +43,7 @@ public class SchematicLoader
public SchematicLoader() { }
public int transformMetadata(int metadata, int orientation, int blockID)
private static int transformMetadata(int metadata, int orientation, int blockID)
{
if (DungeonHelper.instance().metadataFlipList.contains(blockID))
{
@ -900,12 +900,10 @@ public class SchematicLoader
else if (currentBlock == DungeonHelper.FABRIC_OF_REALITY_EXPORT_ID)
{
currentBlock = mod_pocketDim.blockDimWall.blockID;
blockChanged = true;
}
else if (currentBlock == DungeonHelper.PERMAFABRIC_EXPORT_ID)
{
currentBlock = mod_pocketDim.blockDimWallPerm.blockID;
blockChanged = true;
}
else if ((Block.blocksList[currentBlock] == null && currentBlock != 0) || currentBlock > MAX_VANILLA_BLOCK_ID)
{
@ -915,21 +913,30 @@ public class SchematicLoader
//Place blocks and set metadata
if (currentBlock > 0)
{
int fixedMetadata;
if (!blockChanged)
{
//Calculate new metadata for blocks that have orientations (e.g. doors, pistons)
//We're using a workaround to get the desired rotation relative to the schematic's entrance
int fixedMetadata = transformMetadata(blockMetadata, (orientation + NORTH_DOOR_METADATA - entryDirection + 16) % 4, currentBlock);
fixedMetadata = transformMetadata(blockMetadata, (orientation + NORTH_DOOR_METADATA - entryDirection + 16) % 4, currentBlock);
}
else
{
//Don't include metadata for changed blocks. It's possible that the metadata belonged to a mod block.
//If we include it now, it could cause our Fabric of Reality to change into permafabric.
fixedMetadata = 0;
}
//Convert vanilla doors to dim doors or place blocks
if (currentBlock == Block.doorIron.blockID)
{
setBlockDirectly(world, realX, realY, realZ, properties.DimensionalDoorID, fixedMetadata);
blockChanged = true;
}
else if (currentBlock == Block.doorWood.blockID)
{
setBlockDirectly(world, realX, realY, realZ, properties.WarpDoorID, fixedMetadata);
blockChanged = true;
}
else
{
@ -1156,10 +1163,6 @@ public class SchematicLoader
}
angle = angle % 4;
//Rotations are considered in counterclockwise form because coordinate systems are
//often assumed to be right-handed and convenient formulas are available for
//common counterclockwise rotations.
//Reference: http://en.wikipedia.org/wiki/Rotation_matrix#Common_rotations
int rx;
int rz;
switch (angle)

View file

@ -22,11 +22,12 @@ import net.minecraft.world.World;
public class BlockDimWall extends Block
{
private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
private Icon[] blockIcon = new Icon[2];
public BlockDimWall(int i, int j, Material par2Material)
public BlockDimWall(int blockID, int j, Material par2Material)
{
super(i, Material.ground);
setTickRandomly(true);
super(blockID, Material.ground);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@ -38,7 +39,7 @@ public class BlockDimWall extends Block
}
else
{
return 10000000000000F;
return SUPER_HIGH_HARDNESS;
}
}
@ -65,9 +66,11 @@ public class BlockDimWall extends Block
@Override
public int damageDropped(int metadata)
{
return metadata;
//Return 0 to avoid dropping Ancient Fabric even if the player somehow manages to break it
return 0;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
{
@ -91,49 +94,30 @@ public class BlockDimWall extends Block
/**
* replaces the block clicked with the held block, instead of placing the block on top of it. Shift click to disable.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
if(entityPlayer.getCurrentEquippedItem()!=null)
//Check if the metadata value is 0 -- we don't want the user to replace Ancient Fabric
if (entityPlayer.getCurrentEquippedItem() != null && world.getBlockMetadata(x, y, z) == 0)
{
Item playerEquip = entityPlayer.getCurrentEquippedItem().getItem();
if(!(playerEquip instanceof ItemBlock))
{
return false;
}
else
if (playerEquip instanceof ItemBlock)
{
Block block = Block.blocksList[playerEquip.itemID];
if(!Block.isNormalCube(playerEquip.itemID))
if (!Block.isNormalCube(playerEquip.itemID) || block instanceof BlockContainer || block.blockID == this.blockID)
{
return false;
}
if(block instanceof BlockContainer)
if (!world.isRemote)
{
return false;
}
}
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock)
{
if(par1World.isRemote)
{
return true;
}
if (!entityPlayer.capabilities.isCreativeMode)
{
entityPlayer.getCurrentEquippedItem().stackSize--;
}
par1World.setBlock(par2, par3, par4, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(),0);
world.setBlock(x, y, z, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(), 0);
}
return true;
}
}
else
{
return false;
}
return false;
}

View file

@ -2,24 +2,21 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import cpw.mods.fml.common.FMLCommonHandler;
import StevenDimDoors.mod_pocketDim.BlankTeleporter;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import StevenDimDoors.mod_pocketDim.BlankTeleporter;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
import cpw.mods.fml.common.FMLCommonHandler;
public class BlockDimWallPerm extends Block
{
@ -28,7 +25,6 @@ public class BlockDimWallPerm extends Block
public BlockDimWallPerm(int i, int j, Material par2Material)
{
super(i, Material.ground);
setTickRandomly(true);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
if (properties == null)
properties = DDProperties.instance();

View file

@ -2,23 +2,18 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockLimbo extends Block
{

View file

@ -5,7 +5,6 @@ import java.util.Random;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;

View file

@ -14,7 +14,7 @@ public class CommandDeleteAllLinks extends DDCommandBase
private CommandDeleteAllLinks()
{
super("dd-deletelinks", "FIXME");
super("dd-deletelinks", "???");
}
public static CommandDeleteAllLinks instance()

View file

@ -14,7 +14,7 @@ public class CommandDeleteDimensionData extends DDCommandBase
private CommandDeleteDimensionData()
{
super("dd-deletedimension", "FIXME");
super("dd-deletedimension", "???");
}
public static CommandDeleteDimensionData instance()

View file

@ -15,7 +15,7 @@ public class CommandDeleteRifts extends DDCommandBase
private CommandDeleteRifts()
{
super("dd-???", "FIXME");
super("dd-???", "???");
}
public static CommandDeleteRifts instance()

View file

@ -319,6 +319,8 @@ public class DungeonHelper
hubs.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/longDoorHallway.schematic", false));
hubs.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/smallRotundaWithExit.schematic", false));
hubs.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/fortRuins.schematic", true));
hubs.add(new DungeonGenerator(10, "/schematics/Hub_SK-Claustrophobia_Open_10.schematic", true));
hubs.add(new DungeonGenerator(50, "/schematics/Hub_SK-HeartOfDisorder_Open_50.schematic", true));
simpleHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/collapsedSingleTunnel1.schematic", false));
simpleHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/singleStraightHall1.schematic", false));
@ -328,6 +330,11 @@ public class DungeonHelper
simpleHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/simpleStairsUp.schematic", false));
simpleHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/simpleStairsDown.schematic", false));
simpleHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/simpleSmallT1.schematic", false));
simpleHalls.add(new DungeonGenerator(50, "/schematics/SimpleHall_SK-LeftDownStairs_Open_50.schematic", true));
simpleHalls.add(new DungeonGenerator(50, "/schematics/SimpleHall_SK-LeftUpPath_Open_50.schematic", true));
simpleHalls.add(new DungeonGenerator(50, "/schematics/SimpleHall_SK-RightDownStairs_Open_50.schematic", true));
simpleHalls.add(new DungeonGenerator(50, "/schematics/SimpleHall_SK-RightUpPath_Open_50.schematic", true));
simpleHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/SimpleHall_SK-SpiralHallway_Open_100.schematic", true));
complexHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/tntPuzzleTrap.schematic", false));
complexHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/brokenPillarsO.schematic", true));
@ -337,6 +344,8 @@ public class DungeonHelper
complexHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/mediumPillarStairs.schematic", true));
complexHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/ruinsO.schematic", true));
complexHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/pitStairs.schematic", true));
complexHalls.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/ComplexHall_SK-HiddenStairs_Open_100.schematic", true));
complexHalls.add(new DungeonGenerator(10, "/schematics/ComplexHall_SK-LostGarden_Open_10.schematic", true));
deadEnds.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/azersDungeonO.schematic", false));
deadEnds.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/diamondTowerTemple1.schematic", true));
@ -349,6 +358,8 @@ public class DungeonHelper
deadEnds.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/tntTrapO.schematic", true));
deadEnds.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/smallDesert.schematic", true));
deadEnds.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/smallPond.schematic", true));
deadEnds.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic", true));
deadEnds.add(new DungeonGenerator(50, "/schematics/DeadEnd_SK-UnstableDesert_Open_50.schematic", true));
pistonTraps.add(new DungeonGenerator(2 * DEFAULT_DUNGEON_WEIGHT, "/schematics/hallwayPitFallTrap.schematic", false));
pistonTraps.add(new DungeonGenerator(2 * DEFAULT_DUNGEON_WEIGHT, "/schematics/pistonFloorHall.schematic", false));
@ -359,6 +370,7 @@ public class DungeonHelper
pistonTraps.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/simpleDropHall.schematic", false));
pistonTraps.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/fallingTNThall.schematic", false));
pistonTraps.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/lavaPyramid.schematic", true));
pistonTraps.add(new DungeonGenerator(10, "/schematics/Trap_SK-RestlessCorridor_Open_10.schematic", true));
mazes.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/smallMaze1.schematic", false));
mazes.add(new DungeonGenerator(DEFAULT_DUNGEON_WEIGHT, "/schematics/smallMultilevelMaze.schematic", false));

View file

@ -1,23 +1,13 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemBlockDimWall extends ItemBlock
{
private final static String[] subNames = {"Fabric of Reality", "Fabric of Reality Permanent"};
private final static String[] subNames = {"Fabric of Reality", "Ancient Fabric"};
public ItemBlockDimWall(int par1)
{
@ -38,6 +28,6 @@ public class ItemBlockDimWall extends ItemBlock
public String getUnlocalizedName(ItemStack par1ItemStack)
{
return this.subNames[getItemDamageFromStack(par1ItemStack)];
return subNames[getItemDamageFromStack(par1ItemStack)];
}
}

View file

@ -2,46 +2,31 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemChaosDoor extends itemDimDoor
{
private Material doorMaterial;
public ItemChaosDoor(int par1, Material par2Material)
{
super(par1, par2Material);
this.doorMaterial = par2Material;
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Caution- leads to random destination");
par3List.add("Caution: Leads to random destination");
}
}

View file

@ -1,27 +1,22 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
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;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
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;
public class itemDimDoor extends ItemDoor
{
@ -41,13 +36,14 @@ public class itemDimDoor extends ItemDoor
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Place on the block under a rift");
par3List.add ("to activate that rift,");
par3List.add("or place anywhere else");
par3List.add("to create a pocket dim");
par3List.add("to activate that rift or place");
par3List.add("anywhere else to create a");
par3List.add("pocket dimension.");
}
@Override
@ -81,7 +77,7 @@ public class itemDimDoor extends ItemDoor
{
int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
if (!this.canPlace(par3World, par4, par5, par6, var12)||!this.canPlace(par3World, par4, par5+1, par6, var12))
if (!canPlace(par3World, par4, par5, par6, var12) || !canPlace(par3World, par4, par5+1, par6, var12))
{
return false;
}
@ -137,7 +133,6 @@ public class itemDimDoor extends ItemDoor
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
boolean didFindThing = false;
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null&&!par2World.isRemote)
{
@ -173,19 +168,15 @@ public class itemDimDoor extends ItemDoor
{
int var12 = MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
if (!this.canPlace(par2World, par4, par5, par6, var12)||!this.canPlace(par2World, par4, par5-1, par6, var12)||dimHelper.instance.getLinkDataFromCoords(par4, par5, par6, par2World)==null)
if (!canPlace(par2World, par4, par5, par6, var12) || !canPlace(par2World, par4, par5-1, par6, var12) ||
dimHelper.instance.getLinkDataFromCoords(par4, par5, par6, par2World) == null)
{
return par1ItemStack;
}
else
{
placeDoorBlock(par2World, par4, par5-1, par6, var12, var11);
--par1ItemStack.stackSize;
}

View file

@ -225,7 +225,7 @@ public class mod_pocketDim
LanguageRegistry.addName(ExitDoor , "Warp Door");
LanguageRegistry.addName(chaosDoor , "Unstable Door");
LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
LanguageRegistry.addName(blockDimWallPerm , "Fabric of Reality Permanent/Unpushable");
LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric");
LanguageRegistry.addName(dimDoor, "Dimensional Door");
LanguageRegistry.addName(dimHatch, "Transdimensional Trapdoor");
@ -242,7 +242,7 @@ public class mod_pocketDim
* Add names for multiblock inventory item
*/
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 0), "Fabric of Reality");
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 1), "Fabric of Reality Permanent/Pushable");
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 1), "Ancient Fabric");
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.