From 58d5f6dd146f353b697a98f2e3b6bee5b26976ef Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Mon, 7 Jul 2014 01:59:26 -0400 Subject: [PATCH 1/9] Minor Changes Minor annotation changes to remove some warnings... and keep up my GitHub spree. --- .../mod_pocketDim/world/fortresses/ComponentNetherGateway.java | 3 ++- .../world/fortresses/DDNetherFortressGenerator.java | 3 ++- .../world/fortresses/DDStructureNetherBridgeStart.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java index 8b05b399..db6ef448 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java @@ -66,7 +66,8 @@ public class ComponentNetherGateway extends StructureComponent * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at * the end, it adds Fences... */ - public boolean addComponentParts(World world, Random random, StructureBoundingBox bounds) + @Override + public boolean addComponentParts(World world, Random random, StructureBoundingBox bounds) { int NETHER_SLAB_METADATA = 6; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java index 644a5c1b..95319394 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java @@ -18,7 +18,8 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge MapGenStructureIO.func_143034_b(DDStructureNetherBridgeStart.class, "Fortress"); } - protected StructureStart getStructureStart(int chunkX, int chunkZ) + @Override + protected StructureStart getStructureStart(int chunkX, int chunkZ) { return new DDStructureNetherBridgeStart(this.worldObj, this.rand, chunkX, chunkZ, DDProperties.instance()); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java index bc7cc065..27781970 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java @@ -105,7 +105,8 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart /** * Keeps iterating Structure Pieces and spawning them until the checks tell it to stop */ - public void generateStructure(World world, Random random, StructureBoundingBox generationBounds) + @Override + public void generateStructure(World world, Random random, StructureBoundingBox generationBounds) { if (hasGateway) { From dc55359aaf37e69de39a96d41766d238d5c42cbc Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Mon, 7 Jul 2014 03:56:47 -0400 Subject: [PATCH 2/9] Minor Changes Made various minor changes to eliminate warnings or to improve clarity. --- .../mod_pocketDim/blocks/BaseDimDoor.java | 40 +++++++------------ .../mod_pocketDim/blocks/BlockDimWall.java | 1 + .../mod_pocketDim/blocks/BlockDoorGold.java | 19 ++++----- .../mod_pocketDim/blocks/DimensionalDoor.java | 5 +-- .../mod_pocketDim/blocks/TransTrapdoor.java | 7 ++-- .../mod_pocketDim/blocks/WarpDoor.java | 1 - 6 files changed, 28 insertions(+), 45 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java index 3b94723c..f8bd4e19 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java @@ -11,7 +11,6 @@ import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; @@ -22,7 +21,6 @@ import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.core.DDTeleporter; import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.PocketManager; -import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -159,16 +157,13 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn reversed = !reversed; } } - if (isUpperDoorBlock(fullMetadata)) + { return this.upperTextures[reversed ? 1 : 0]; - else - return this.lowerTextures[reversed ? 1 : 0]; - } - else - { - return this.lowerTextures[0]; + } + return this.lowerTextures[reversed ? 1 : 0]; } + return this.lowerTextures[0]; } //Called to update the render information on the tile entity. Could probably implement a data watcher, @@ -180,29 +175,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn { int metadata = world.getBlockMetadata(x, y, z); TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; - dimTile.openOrClosed = this.isDoorOnRift(world, x, y, z)&&this.isUpperDoorBlock(metadata); + dimTile.openOrClosed = isDoorOnRift(world, x, y, z) && isUpperDoorBlock(metadata); dimTile.orientation = this.getFullMetadata(world, x, y, z) & 7; } return this; } - public boolean isDoorOnRift(World world, int x, int y, int z) + public static boolean isDoorOnRift(World world, int x, int y, int z) { - if(this.isUpperDoorBlock( world.getBlockMetadata(x, y, z))) + if (isUpperDoorBlock(world.getBlockMetadata(x, y, z))) { - if(PocketManager.getLink(x, y, z, world.provider.dimensionId) != null||PocketManager.getLink(x, y-1, z, world.provider.dimensionId) != null) - { - return true; - } + // Target block is the upper block + return (PocketManager.getLink(x, y, z, world.provider.dimensionId) != null || + PocketManager.getLink(x, y - 1, z, world.provider.dimensionId) != null); } - else - { - if(PocketManager.getLink(x, y, z, world.provider.dimensionId) != null||PocketManager.getLink(x, y+1, z, world.provider.dimensionId) != null) - { - return true; - } - } - return false; + // Target block is the lower block + return (PocketManager.getLink(x, y, z, world.provider.dimensionId) != null || + PocketManager.getLink(x, y + 1, z, world.provider.dimensionId) != null); } /** @@ -359,7 +348,8 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn /** * Returns the ID of the items to drop on destruction. */ - public int idDropped(int metadata, Random random, int fortune) + @Override + public int idDropped(int metadata, Random random, int fortune) { return isUpperDoorBlock(metadata) ? 0 : this.getDrops(); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java index 82e451a5..fd1b46cd 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java @@ -88,6 +88,7 @@ public class BlockDimWall extends Block subItems.add(new ItemStack(this, 1, ix)); } } + @Override public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java index 1e8f91e7..2d3ac307 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java @@ -2,17 +2,15 @@ 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.mod_pocketDim; -import StevenDimDoors.mod_pocketDim.config.DDProperties; import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.IconFlipped; import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.item.Item; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockDoorGold extends BlockDoor { @@ -110,15 +108,12 @@ public class BlockDoorGold extends BlockDoor reversed = !reversed; } } - if (BaseDimDoor.isUpperDoorBlock(fullMetadata)) + { return this.upperTextures[reversed ? 1 : 0]; - else - return this.lowerTextures[reversed ? 1 : 0]; - } - else - { - return this.lowerTextures[0]; + } + return this.lowerTextures[reversed ? 1 : 0]; } + return this.lowerTextures[0]; } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java index 42d25f6f..2d9eef51 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java @@ -9,10 +9,8 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; -@SuppressWarnings("deprecation") public class DimensionalDoor extends BaseDimDoor { - public DimensionalDoor(int blockID, Material material, DDProperties properties) { super(blockID, material, properties); @@ -27,10 +25,11 @@ public class DimensionalDoor extends BaseDimDoor DimLink link = dimension.getLink(x, y, z); if (link == null) { - dimension.createLink(x, y, z, LinkTypes.POCKET,world.getBlockMetadata(x, y - 1, z)); + dimension.createLink(x, y, z, LinkTypes.POCKET, world.getBlockMetadata(x, y - 1, z)); } } } + @Override public int getDrops() { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java index d1b7fd4c..aa4d4bc4 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java @@ -18,7 +18,6 @@ import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor; -@SuppressWarnings("deprecation") public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider { @@ -61,7 +60,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit { this.placeLink(world, x, y, z); world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world)); - this.updateAttachedTile(world, x, y, z); + updateAttachedTile(world, x, y, z); } @Override @@ -76,8 +75,8 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit { return new TileEntityTransTrapdoor(); } - - public void updateAttachedTile(World world, int x, int y, int z) + + public static void updateAttachedTile(World world, int x, int y, int z) { TileEntity tile = world.getBlockTileEntity(x, y, z); if (tile instanceof TileEntityTransTrapdoor) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java index 6f7d881b..58cfd05e 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java @@ -9,7 +9,6 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; -@SuppressWarnings("deprecation") public class WarpDoor extends BaseDimDoor { public WarpDoor(int blockID, Material material, DDProperties properties) From 52bae00dc6e0c01fd24857ba594c397c066fd791 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Sun, 6 Jul 2014 04:01:07 -0400 Subject: [PATCH 3/9] Minor Change Minor change to remove a warning --- .../StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java index e9788320..7a443fc7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java @@ -162,7 +162,7 @@ public class DungeonSchematic extends Schematic { applyFilter(standardizer); } - private Map getAssignedToStandardIDMapping(DDProperties properties) + private static Map getAssignedToStandardIDMapping(DDProperties properties) { //If we ever need this broadly or support other mods, this should be moved to a separate class TreeMap mapping = new TreeMap(); From 7d840ff895d2494197c2fb3b1bd5f9ce2a25d491 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Sun, 6 Jul 2014 04:31:42 -0400 Subject: [PATCH 4/9] Fixed Pick Block Results We previously returned the Vanilla counterparts to our doors as the items to be used by the pick block button - used in Creative mode for replicating nearby blocks. This was incorrect because we would want to return the actual door item needed to place the particular door in question. More importantly, this might solve our issues with WAILA reporting the wrong information when players look at our doors. I read the code for the most recent version of WAILA and it uses various functions to choose how to identify a block. The result of Block.idPicked() is probably used as the main source for the identities of our blocks. --- .../mod_pocketDim/blocks/BaseDimDoor.java | 4 ++-- .../mod_pocketDim/blocks/BlockDoorGold.java | 8 +++++++ .../blocks/BlockGoldDimDoor.java | 6 ++++++ .../mod_pocketDim/blocks/DimensionalDoor.java | 7 +++++++ .../mod_pocketDim/blocks/IDimDoor.java | 2 ++ .../mod_pocketDim/blocks/TransTrapdoor.java | 21 ++++++++++++++++--- .../mod_pocketDim/blocks/TransientDoor.java | 6 ++++++ .../mod_pocketDim/blocks/UnstableDoor.java | 8 +++++++ .../mod_pocketDim/blocks/WarpDoor.java | 7 +++++++ 9 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java index f8bd4e19..d26a0e38 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java @@ -340,9 +340,9 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn */ @Override @SideOnly(Side.CLIENT) - public int idPicked(World par1World, int par2, int par3, int par4) + public int idPicked(World world, int x, int y, int z) { - return this.getDrops(); + return this.getDoorItem(); } /** diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java index 2d3ac307..d3e703d2 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.IconFlipped; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -35,6 +36,13 @@ public class BlockDoorGold extends BlockDoor upperTextures[1] = new IconFlipped(upperTextures[0], true, false); lowerTextures[1] = new IconFlipped(lowerTextures[0], true, false); } + + @Override + @SideOnly(Side.CLIENT) + public int idPicked(World world, int x, int y, int z) + { + return mod_pocketDim.itemGoldenDoor.itemID; + } @Override public int idDropped(int par1, Random par2Random, int par3) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java index 5a788dbb..3feb0755 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java @@ -34,6 +34,12 @@ public class BlockGoldDimDoor extends BaseDimDoor } } + @Override + public int getDoorItem() + { + return mod_pocketDim.itemGoldenDimensionalDoor.itemID; + } + @Override public int getDrops() { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java index 2d9eef51..3537a778 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.LinkTypes; @@ -30,6 +31,12 @@ public class DimensionalDoor extends BaseDimDoor } } + @Override + public int getDoorItem() + { + return mod_pocketDim.itemDimensionalDoor.itemID; + } + @Override public int getDrops() { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java index b3884dc1..82b4562b 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java @@ -12,5 +12,7 @@ public interface IDimDoor public int getDrops(); + public int getDoorItem(); + public TileEntity initDoorTE(World world, int x, int y, int z); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java index aa4d4bc4..4a1df0d3 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java @@ -2,6 +2,9 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import net.minecraft.block.Block; import net.minecraft.block.BlockTrapDoor; import net.minecraft.block.ITileEntityProvider; @@ -99,18 +102,30 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit } } } - + + @Override + @SideOnly(Side.CLIENT) + public int idPicked(World world, int x, int y, int z) + { + return this.getDoorItem(); + } @Override public int idDropped(int metadata, Random random, int fortuneLevel) { - return getDrops(); + return this.getDrops(); } + + @Override + public int getDoorItem() + { + return mod_pocketDim.transTrapdoor.blockID; + } @Override public int getDrops() { - return Block.trapdoor.blockID; + return Block.trapdoor.blockID; } public static boolean isTrapdoorSetLow(int metadata) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java index fb0a1871..0eac6317 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java @@ -72,6 +72,12 @@ public class TransientDoor extends BaseDimDoor } } } + + @Override + public int getDoorItem() + { + return 0; + } @Override public int getDrops() diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java index e59a94c4..6f14c667 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.NewDimData; @@ -24,6 +25,13 @@ public class UnstableDoor extends BaseDimDoor dimension.createLink(x, y, z, LinkTypes.RANDOM,world.getBlockMetadata(x, y - 1, z)); } } + + @Override + public int getDoorItem() + { + return mod_pocketDim.itemUnstableDoor.itemID; + } + @Override public int getDrops() { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java index 58cfd05e..f860f6e7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.LinkTypes; @@ -30,6 +31,12 @@ public class WarpDoor extends BaseDimDoor } } + @Override + public int getDoorItem() + { + return mod_pocketDim.itemWarpDoor.itemID; + } + @Override public int getDrops() { From 2904ec146d241273f38738cc081a983167b3ae5e Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Wed, 9 Jul 2014 04:01:37 -0400 Subject: [PATCH 5/9] Implemented Automatic Versioning in Build Script 1. Changed build.gradle so that it edits the version numbers in mod_pocketDim.java and mcmod.info. 2. Changed mod_pocketDim to use a placeholder for its version number and fixed an annotation that was wrong. It would cause our mod_pocketDim instance to not initialize properly. I removed what seemed to be workarounds that were hiding the problem. 3. Fixed space in TileEntityDimDoor.invalidate() and corrected a non-static access to a static field in mod_pocketDim. 4. Changed mcmod.info so that it users placeholders for the mod version and MC version values. --- build.gradle | 12 ++++----- .../mod_pocketDim/mod_pocketDim.java | 7 +++-- .../tileentities/TileEntityDimDoor.java | 27 ++++++++++--------- src/main/resources/mcmod.info | 4 +-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 6d689445..abc17714 100644 --- a/build.gradle +++ b/build.gradle @@ -13,10 +13,8 @@ buildscript { apply plugin: 'forge' - - version = "2.2.4-" + System.getenv("BUILD_NUMBER") -group= "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +group = "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "DimensionalDoors" minecraft { @@ -28,17 +26,19 @@ sourceCompatibility = '1.6' processResources { - // replace stuff in mcmod.info, nothing else + // Replace stuff $version and $mcversion in mcmod.info and mod_pocketDim.java from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' + include 'mod_pocketDim.java' - // replace version and mcversion + // Replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } - // copy everything else, thats not the mcmod.info + // Copy everything else from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' + exclude 'mod_pocketDim.java' } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 62dd8456..95dce466 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -97,7 +97,7 @@ serverPacketHandlerSpec = @SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class)) public class mod_pocketDim { - public static final String version = "1.6.4-R2.2.4"; + public static final String version = "$version"; public static final String modid = "dimdoors"; //TODO need a place to stick all these constants @@ -107,8 +107,8 @@ public class mod_pocketDim @SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy") public static CommonProxy proxy; - @Instance("PocketDimensions") - public static mod_pocketDim instance = new mod_pocketDim(); + @Instance(mod_pocketDim.modid) + public static mod_pocketDim instance; public static Block transientDoor; public static Block warpDoor; @@ -169,7 +169,6 @@ public class mod_pocketDim @EventHandler public void onPreInitialization(FMLPreInitializationEvent event) { - instance = this; //This should be the FIRST thing that gets done. String path = event.getSuggestedConfigurationFile().getAbsolutePath().replace(modid, "DimDoors"); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java index 115aa646..fe478b65 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java @@ -36,19 +36,20 @@ public class TileEntityDimDoor extends DDTileEntityBase } return null; } - - public void invalidate() - { - this.tileEntityInvalid = true; - - if(this.worldObj.getBlockId(xCoord, yCoord, zCoord)==0&&!this.worldObj.isRemote) - { - if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null) - { - mod_pocketDim.instance.fastRiftRegenerator.registerRiftForRegen(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId); - } - } - } + + @Override + public void invalidate() + { + this.tileEntityInvalid = true; + + if(this.worldObj.getBlockId(xCoord, yCoord, zCoord)==0&&!this.worldObj.isRemote) + { + if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null) + { + mod_pocketDim.fastRiftRegenerator.registerRiftForRegen(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId); + } + } + } @Override public void readFromNBT(NBTTagCompound nbt) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 92ac4ade..7a43be90 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -6,10 +6,10 @@ "modid": "dimdoors", "name": "Dimensional Doors", "description": "Bend and twist reality itself, creating pocket dimensions, rifts, and much more", -"version": "1.6.4-R2.2.4", +"version": "$version", "credits": "Created by StevenRS11, Coded by StevenRS11 and SenseiKiwi, Logo and Testing by Jaitsu", "logoFile": "/dimdoors_logo.png", -"mcversion": "", +"mcversion": "$mcversion", "url": "http://www.minecraftforum.net/topic/1650007-147smpssplan-dimensional-doors-v110-physics-what-physics-updated-with-fancy-opengl/", "updateUrl": "", "authors": [ "StevenRS11", "SenseiKiwi" ], From 1106319f8ca2b9c5d3accc2345b10d390b5d6b31 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Wed, 9 Jul 2014 04:15:37 -0400 Subject: [PATCH 6/9] Fixed build.gradle Fixed a mistake in specifying the path for mod_pocketDim.java. --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index abc17714..1dc1451c 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ processResources // Replace stuff $version and $mcversion in mcmod.info and mod_pocketDim.java from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - include 'mod_pocketDim.java' + include 'StevenDimDoors/mod_pocketDim/mod_pocketDim.java' // Replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version @@ -38,7 +38,7 @@ processResources // Copy everything else from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' - exclude 'mod_pocketDim.java' + exclude 'StevenDimDoors/mod_pocketDim/mod_pocketDim.java' } } From c4abae8fdd658567729a57ea940955c56abbeaca Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Wed, 9 Jul 2014 15:11:16 -0400 Subject: [PATCH 7/9] Fixed build.gradle (again) Made some more changes to build.gradle in the hopes that the version information will automatically update in mod_pocketDim.java. It has only worked on mcmod.info in previous attempts. --- build.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 1dc1451c..15559345 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,10 @@ group = "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-n archivesBaseName = "DimensionalDoors" minecraft { - version = "1.6.4-9.11.1.964" + version = "1.6.4-9.11.1.964" + + replaceIn "mod_pocketDim.java" + replace "@VERSION@", project.version } targetCompatibility = '1.6' @@ -26,11 +29,10 @@ sourceCompatibility = '1.6' processResources { - // Replace stuff $version and $mcversion in mcmod.info and mod_pocketDim.java + // Replace stuff $version and $mcversion in mcmod.info from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - include 'StevenDimDoors/mod_pocketDim/mod_pocketDim.java' - + // Replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } @@ -38,7 +40,6 @@ processResources // Copy everything else from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' - exclude 'StevenDimDoors/mod_pocketDim/mod_pocketDim.java' } } From 83998969f623063c929ca4e2c5e143bc10e760b5 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Wed, 9 Jul 2014 15:14:56 -0400 Subject: [PATCH 8/9] Fixed Version in mod_pocketDim Forgot to change the placeholder in mod_pocketDim --- src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 95dce466..a044a066 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -97,7 +97,7 @@ serverPacketHandlerSpec = @SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class)) public class mod_pocketDim { - public static final String version = "$version"; + public static final String version = "@VERSION@"; public static final String modid = "dimdoors"; //TODO need a place to stick all these constants From 8da0339c78a1d7b0198afd59557251a3121fa73f Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Wed, 9 Jul 2014 23:44:49 -0400 Subject: [PATCH 9/9] Improved DDTeleporter Made various changes to clarify code in DDTeleporter. For instance, we had a whole switch block that was used to give the same outcome on every case except the default. I rewrote the code there to remove the block. Also changed DDTeleporter.checkDestination() since it was redoing the destination orientation checks unnecessarily, changing the entity's yaw when it shouldn't have side effects, and some other little things. --- .../mod_pocketDim/core/DDTeleporter.java | 103 +++++++----------- 1 file changed, 37 insertions(+), 66 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java b/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java index f8f7bc10..debd31aa 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java @@ -51,59 +51,49 @@ public class DDTeleporter private DDTeleporter() { } - /**Checks if the destination supplied is valid, ie, filled by any non-replaceable block. - * - * @param entity - * @param world - * @param destination - * @param properties - * @return + /** + * Checks if the destination supplied is safe (i.e. filled by any replaceable or non-opaque blocks) */ - private static boolean checkDestination(Entity entity, WorldServer world, Point4D destination,DDProperties properties) + private static boolean checkDestination(WorldServer world, Point4D destination, int orientation) { int x = destination.getX(); int y = destination.getY(); int z = destination.getZ(); int blockIDTop; - int blockIDBottom; - + int blockIDBottom; Point3D point; - - int orientation; - orientation = getDestinationOrientation(destination, properties); - entity.rotationYaw = (orientation * 90) + 90; switch (orientation) { case 0: - point = new Point3D(MathHelper.floor_double(x - 0.5), y - 1, MathHelper.floor_double(z + 0.5)); + point = new Point3D(x - 1, y - 1, z); break; case 1: - point = new Point3D(MathHelper.floor_double(x + 0.5), y - 1, MathHelper.floor_double(z - 0.5)); + point = new Point3D(x, y - 1, z - 1); break; case 2: - point = new Point3D(MathHelper.floor_double(x + 1.5), y - 1, MathHelper.floor_double(z + 0.5)); + point = new Point3D(x + 1, y - 1, z); break; case 3: - point = new Point3D(MathHelper.floor_double(x + 0.5), y - 1, MathHelper.floor_double(z + 1.5)); + point = new Point3D(x, y - 1, z + 1); break; default: point = new Point3D(x, y - 1, z); break; } blockIDBottom = world.getBlockId(point.getX(), point.getY(), point.getZ()); - blockIDTop = world.getBlockId(point.getX(), point.getY()+1, point.getZ()); + blockIDTop = world.getBlockId(point.getX(), point.getY() + 1, point.getZ()); if (Block.blocksList[blockIDBottom] != null) { - if(!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ())&&world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ())) + if (!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ())) { return false; } } if (Block.blocksList[blockIDTop] != null) { - if (!Block.blocksList[blockIDTop].isBlockReplaceable(world, point.getX(), point.getY()+1, point.getZ())) + if (!Block.blocksList[blockIDTop].isBlockReplaceable(world, point.getX(), point.getY() + 1, point.getZ())) { return false; } @@ -125,56 +115,37 @@ public class DDTeleporter } else { - //Teleport the entity to the precise destination point + // Teleport the entity to the precise destination point orientation = -1; } - if (!checkDestination(entity, world, destination, properties)) - { - if (entity instanceof EntityPlayerMP) - { - EntityPlayer player = (EntityPlayer) entity; - player.rotationYaw = (orientation * 90) + 90; - switch (orientation) - { - case 0: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - break; - case 1: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - break; - case 2: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - break; - case 3: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - break; - default: - player.setPositionAndUpdate(x, y - 1, z); - break; - } - } - } - else if (entity instanceof EntityPlayer) + if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; - switch (orientation) + if (checkDestination(world, destination, orientation)) { - case 0: - player.setPositionAndUpdate(x - 0.5, y - 1, z + 0.5); - break; - case 1: - player.setPositionAndUpdate(x + 0.5, y - 1, z - 0.5); - break; - case 2: - player.setPositionAndUpdate(x + 1.5, y - 1, z + 0.5); - break; - case 3: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 1.5); - break; - default: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - break; + switch (orientation) + { + case 0: + player.setPositionAndUpdate(x - 0.5, y - 1, z + 0.5); + break; + case 1: + player.setPositionAndUpdate(x + 0.5, y - 1, z - 0.5); + break; + case 2: + player.setPositionAndUpdate(x + 1.5, y - 1, z + 0.5); + break; + case 3: + player.setPositionAndUpdate(x + 0.5, y - 1, z + 1.5); + break; + default: + player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); + break; + } + } + else + { + player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); } } else if (entity instanceof EntityMinecart) @@ -200,7 +171,7 @@ public class DDTeleporter entity.worldObj.updateEntityWithOptionalForce(entity, false); break; case 3: - DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 1.5 ); + DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 1.5); entity.motionZ = 0.39; entity.worldObj.updateEntityWithOptionalForce(entity, false); break;