From 0b8a81ef6d1e05dab89770e01c448d5e83498df1 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Fri, 19 Jul 2013 07:24:11 -0400 Subject: [PATCH 1/2] Fixed Explosion Resistance Bug Fixed Ancient Fabric and Eternal Fabric being vulnerable to explosions. I also noticed that a lot of DD blocks have unusual stats. I'm not sure whether those stats were assigned intentionally or simply because of copying and pasting code, but the values are certainly counterintuitive when you consider some of the block materials. --- .../mod_pocketDim/blocks/BlockDimWall.java | 22 ++++++++++++++++--- .../mod_pocketDim/mod_pocketDim.java | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java index 4dc353d..d7bcd5e 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java @@ -13,6 +13,7 @@ import net.minecraft.block.BlockContainer; 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.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -23,6 +24,7 @@ import net.minecraft.world.World; public class BlockDimWall extends Block { private static final float SUPER_HIGH_HARDNESS = 10000000000000F; + private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F; private Icon[] blockIcon = new Icon[2]; public BlockDimWall(int blockID, int j, Material par2Material) @@ -31,9 +33,10 @@ public class BlockDimWall extends Block this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } - public float getBlockHardness(World par1World, int par2, int par3, int par4) + @Override + public float getBlockHardness(World world, int x, int y, int z) { - if (par1World.getBlockMetadata(par2, par3, par4) == 0) + if (world.getBlockMetadata(x, y, z) == 0) { return this.blockHardness; } @@ -41,7 +44,20 @@ public class BlockDimWall extends Block { return SUPER_HIGH_HARDNESS; } - } + } + + @Override + public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) + { + if (world.getBlockMetadata(x, y, z) == 0) + { + return super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ); + } + else + { + return SUPER_EXPLOSION_RESISTANCE; + } + } public void registerIcons(IconRegister par1IconRegister) { diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 7394114..40a3b57 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -179,7 +179,7 @@ public class mod_pocketDim transientDoor = (new TransientDoor(properties.TransientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor"); blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall"); - blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setUnlocalizedName("blockDimWallPerm"); + blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm"); ExitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp"); blockRift = (new BlockRift(properties.RiftBlockID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift")); blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F)); From 7044d80457501d675167386ebe2b4c0ce122e6bf Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Fri, 19 Jul 2013 09:28:54 -0400 Subject: [PATCH 2/2] Added Support for Hopper Metadata Rotation Added code for SchematicLoader so that hoppers will rotate properly. This was probably not considered an issue before we had support for tile entity exports and imports. Now it's critical that we support hoppers. There are other blocks that are still not supported - we should really fix this in the future so that all blocks will rotate. The code for this is overly complicated - we should look into a simpler method. --- .../mod_pocketDim/SchematicLoader.java | 91 +++++++++++++------ 1 file changed, 63 insertions(+), 28 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/SchematicLoader.java b/StevenDimDoors/mod_pocketDim/SchematicLoader.java index b678dbb..c993836 100644 --- a/StevenDimDoors/mod_pocketDim/SchematicLoader.java +++ b/StevenDimDoors/mod_pocketDim/SchematicLoader.java @@ -36,6 +36,8 @@ import StevenDimDoors.mod_pocketDim.ticking.MobObelisk; public class SchematicLoader { private final static int EAST_DOOR_METADATA = 0; + private final static int SOUTH_DOOR_METADATA = 1; + private final static int WEST_DOOR_METADATA = 2; private final static int NORTH_DOOR_METADATA = 3; private final static int MAX_VANILLA_BLOCK_ID = 158; @@ -49,8 +51,26 @@ public class SchematicLoader { switch (orientation) { - case 0: + case EAST_DOOR_METADATA: + if (blockID == Block.hopperBlock.blockID) + { + switch (metadata) + { + case 2: + metadata = 5; + break; + case 3: + metadata = 4; + break; + case 4: + metadata = 2; + break; + case 5: + metadata = 3; + break; + } + } if(Block.blocksList[blockID] instanceof BlockStairs) { @@ -238,7 +258,27 @@ public class SchematicLoader } } break; - case 1: + case SOUTH_DOOR_METADATA: + + if (blockID == Block.hopperBlock.blockID) + { + switch (metadata) + { + case 2: + metadata = 3; + break; + case 3: + metadata = 2; + break; + case 4: + metadata = 5; + break; + case 5: + metadata = 4; + break; + } + } + if(Block.blocksList[blockID] instanceof BlockStairs) { switch (metadata) @@ -443,8 +483,27 @@ public class SchematicLoader } break; - case 2: + case WEST_DOOR_METADATA: + if (blockID == Block.hopperBlock.blockID) + { + switch (metadata) + { + case 2: + metadata = 4; + break; + case 3: + metadata = 5; + break; + case 4: + metadata = 3; + break; + case 5: + metadata = 2; + break; + } + } + if(Block.blocksList[blockID] instanceof BlockStairs) { @@ -588,14 +647,8 @@ public class SchematicLoader case 13: metadata = 10; break; - - } - - - } - else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator) { switch (metadata) @@ -648,34 +701,16 @@ public class SchematicLoader case 12: metadata = 15; break; - - } - - - } - - - - - - break; - case 3: + case NORTH_DOOR_METADATA: /** * this is the default case- never need to change anything here * */ - - - - break; - } - - } return metadata; }