diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index ce09f290..4b4a9158 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -71,6 +71,7 @@ import WayofTime.alchemicalWizardry.common.compress.BaseCompressionHandler; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketAngel; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketRegistry; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonChest; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon; import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist; @@ -698,6 +699,7 @@ public class AlchemicalWizardry GameRegistry.registerTileEntity(TEReagentConduit.class, "containerReagentConduit"); GameRegistry.registerTileEntity(TEBellJar.class, "containerBellJar"); GameRegistry.registerTileEntity(TEAlchemicCalcinator.class, "containerAlchemicCalcinator"); + GameRegistry.registerTileEntity(TEDemonChest.class, "containerDemonChest"); ModBlocks.bloodRune.setHarvestLevel("pickaxe", 2); ModBlocks.speedRune.setHarvestLevel("pickaxe", 2); ModBlocks.efficiencyRune.setHarvestLevel("pickaxe", 2); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java index 3938757a..b730ebef 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java @@ -4,8 +4,13 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; import net.minecraft.block.BlockLadder; +import net.minecraft.block.BlockRedstoneComparator; +import net.minecraft.block.BlockRedstoneRepeater; import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.BlockTrapDoor; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; @@ -87,29 +92,153 @@ public class BlockSet metadata = southUpSet; break; } - }else if(block instanceof BlockLadder) + } + else if(block instanceof BlockLadder) { - int[] northSet = new int[]{2, 3, 0, 1}; - int[] eastSet = new int[]{1, 0, 2, 3}; - int[] southSet = new int[]{3, 2, 1, 0}; - int[] westSet = new int[]{0, 1, 3, 2}; + int[] northSet = new int[]{3, 2, 5, 4}; + int[] eastSet = new int[]{4, 5, 3, 2}; + int[] southSet = new int[]{2, 3, 4, 5}; + int[] westSet = new int[]{5, 4, 2, 3}; switch (meta) { - case 0: + case 3: + metadata = northSet; + break; + case 4: + metadata = eastSet; + break; + case 2: + metadata = southSet; + break; + case 5: metadata = westSet; break; + } + }else if(block instanceof BlockTrapDoor) + { + int div = meta / 4; + int mod = meta % 4; + int[] northSet = new int[]{1 + div*4, 0 + div*4, 3 + div*4, 2 + div*4}; + int[] eastSet = new int[]{2 + div*4, 3 + div*4, 1 + div*4, 0 + div*4}; + int[] southSet = new int[]{0 + div*4, 1 + div*4, 2 + div*4, 3 + div*4}; + int[] westSet = new int[]{3 + div*4, 2 + div*4, 0 + div*4, 1 + div*4}; + + + switch (mod) + { + case 0: + metadata = southSet; + break; + case 1: + metadata = northSet; + break; + case 2: + metadata = eastSet; + break; + case 3: + metadata = westSet; + break; + } + }else if(block instanceof BlockTorch) + { + int[] northSet = new int[]{3, 4, 1, 2}; + int[] eastSet = new int[]{2, 1, 3, 4}; + int[] southSet = new int[]{4, 3, 2, 1}; + int[] westSet = new int[]{1, 2, 4, 3}; + + + switch (meta) + { + case 1: + metadata = westSet; + break; + case 2: + metadata = eastSet; + break; + case 3: + metadata = northSet; + break; + case 4: + metadata = southSet; + break; + } + }else if(block instanceof BlockDoor) + { + int[] northSet = new int[]{3, 1, 2, 0}; + int[] eastSet = new int[]{0, 2, 3, 1}; + int[] southSet = new int[]{1, 3, 0, 2}; + int[] westSet = new int[]{2, 0, 1, 3}; + + + switch (meta) + { + case 0: + metadata = eastSet; + break; + case 1: + metadata = southSet; + break; + case 2: + metadata = westSet; + break; + case 3: + metadata = northSet; + break; + } + }else if(block instanceof BlockRedstoneComparator) + { + int div = meta / 4; + int mod = meta % 4; + int[] northSet = new int[]{0 + div*4, 2 + div*4, 3 + div*4, 1 + div*4}; + int[] eastSet = new int[]{1 + div*4, 3 + div*4, 0 + div*4, 2 + div*4}; + int[] southSet = new int[]{2 + div*4, 0 + div*4, 1 + div*4, 3 + div*4}; + int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, 0 + div*4}; + + + switch (mod) + { + case 0: + metadata = northSet; + break; case 1: metadata = eastSet; break; case 2: - metadata = northSet; + metadata = southSet; break; case 3: + metadata = westSet; + break; + } + }else if(block instanceof BlockRedstoneRepeater) + { + int div = meta / 4; + int mod = meta % 4; + int[] northSet = new int[]{0 + div*4, 2 + div*4, 3 + div*4, 1 + div*4}; + int[] eastSet = new int[]{1 + div*4, 3 + div*4, 0 + div*4, 2 + div*4}; + int[] southSet = new int[]{2 + div*4, 0 + div*4, 1 + div*4, 3 + div*4}; + int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, 0 + div*4}; + + + switch (mod) + { + case 0: + metadata = northSet; + break; + case 1: + metadata = eastSet; + break; + case 2: metadata = southSet; break; + case 3: + metadata = westSet; + break; } } + + } public List getPositions() diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java index 018c2699..37b4e933 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java @@ -1,11 +1,12 @@ package WayofTime.alchemicalWizardry.common.demonVillage; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.common.Int3; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.common.Int3; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; public class DemonVillagePath { @@ -24,7 +25,7 @@ public class DemonVillagePath this.length = length; } - public Int3 constructFullPath(World world, int clearance, Block block, int meta) + public Int3 constructFullPath(TEDemonPortal portal, World world, int clearance) { int xPos = this.xi; int yPos = this.yi; @@ -33,13 +34,13 @@ public class DemonVillagePath for (int i = -rad; i <= rad; i++) { - this.constructPartialPath(world, clearance, block, meta, xPos - rad * dir.offsetX + i * dir.offsetZ, yPos, zPos - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad); + this.constructPartialPath(portal, world, clearance, xPos - rad * dir.offsetX + i * dir.offsetZ, yPos, zPos - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad); } return this.getFinalLocation(world, clearance); } - public void constructPartialPath(World world, int clearance, Block roadBlock, int meta, int xi, int yi, int zi, ForgeDirection dir, int length) + public void constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, ForgeDirection dir, int length) { int xPos = xi; int yPos = yi; @@ -59,7 +60,7 @@ public class DemonVillagePath if (!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)) { - world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, roadBlock, meta, 3); + world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); yPos += sign * yOffset; break; } else @@ -70,7 +71,7 @@ public class DemonVillagePath if (!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)) { - world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, roadBlock, meta, 3); + world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); yPos += sign * yOffset; break; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java index 047122ea..1521518e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; +import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; @@ -28,6 +29,17 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode return new TEDemonChest(); } + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) + { + super.breakBlock(world, x, y, z, block, meta); + TileEntity tile = world.getTileEntity(x, y, z); + if(tile instanceof TEDemonChest) + { + ((TEDemonChest) tile).notifyPortalOfInteraction(); + } + } + // @Override // public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) // { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java index 0562946c..3b3064f0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java @@ -116,7 +116,7 @@ public class TEDemonPortal extends TileEntity { return 0; } - return 0.3f; + return 0.6f; } public float getDemonPortalChance() @@ -922,7 +922,7 @@ public class TEDemonPortal extends TileEntity { DemonVillagePath path = new DemonVillagePath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5, dir, 6); - Int3 next = path.constructFullPath(worldObj, this.getRoadStepClearance(), this.getRoadBlock(), this.getRoadMeta()); + Int3 next = path.constructFullPath(this, worldObj, this.getRoadStepClearance()); if (next != null) { @@ -1372,7 +1372,7 @@ public class TEDemonPortal extends TileEntity DemonVillagePath path = new DemonVillagePath(xi, yi, zi, dir, length); - path.constructFullPath(worldObj, this.getRoadStepClearance(), this.getRoadBlock(), this.getRoadMeta()); + path.constructFullPath(this, worldObj, this.getRoadStepClearance()); } public int placeMaterialOnNextAvailable() @@ -1387,7 +1387,13 @@ public class TEDemonPortal extends TileEntity public Block getRoadBlock() { - return Blocks.nether_brick; + switch(this.tier) + { + case 0: + return rand.nextFloat() < 0.6 ? Blocks.cobblestone : Blocks.mossy_cobblestone; + default: + return Blocks.nether_brick; + } } public int getRoadMeta()