diff --git a/src/main/java/com/hbm/blocks/BlockDummyable.java b/src/main/java/com/hbm/blocks/BlockDummyable.java index c7d7bd432..e128f8e95 100644 --- a/src/main/java/com/hbm/blocks/BlockDummyable.java +++ b/src/main/java/com/hbm/blocks/BlockDummyable.java @@ -5,6 +5,8 @@ import com.hbm.handler.ThreeInts; import com.hbm.interfaces.ICopiable; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IPersistentNBT; +import com.hbm.util.EntityDamageUtil; +import com.hbm.util.fauxpointtwelve.BlockPos; import com.hbm.world.gen.nbt.INBTBlockTransformable; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; @@ -13,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -32,10 +35,14 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraft.client.renderer.Tessellator; import java.util.ArrayList; import java.util.List; import java.util.Random; +import java.util.Set; + +import org.lwjgl.opengl.GL11; public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable, INBTBlockTransformable { @@ -595,4 +602,151 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl return meta; } + public int[][] getAllDimensions() { + return new int[][] { getDimensions() }; + } + + @SideOnly(Side.CLIENT) + public void drawPlacementHighlight(EntityPlayer player, float interp) { + MovingObjectPosition mop = EntityDamageUtil.getMouseOver(player, 5.0D); + + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { + double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp; + double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp; + double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) interp; + + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + int o = -getOffset(); + int pY = mop.blockY + getHeightOffset(); + + //Orientation + ForgeDirection facing = ForgeDirection.NORTH; + if(i == 0) facing = ForgeDirection.getOrientation(2); + if(i == 1) facing = ForgeDirection.getOrientation(5); + if(i == 2) facing = ForgeDirection.getOrientation(3); + if(i == 3) facing = ForgeDirection.getOrientation(4); + + facing = getDirModified(facing); + + double originX = mop.blockX + facing.offsetX * o; + double originY = pY + (mop.sideHit == 1 ? 1 : 0); + double originZ = mop.blockZ + facing.offsetZ * o; + + boolean canPlace = checkRequirement(player.worldObj, mop.blockX, pY + 1, mop.blockZ, facing, o); + Tessellator tess = Tessellator.instance; + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F); + GL11.glLineWidth(2.0F); + GL11.glDepthMask(false); + tess.startDrawing(GL11.GL_LINES); + tess.setBrightness(240); + + if (canPlace) { + tess.setColorRGBA(0, 255, 0, 255); + } else { + tess.setColorRGBA(255, 0, 0, 255); + } + + //Gets the list of different dimensions that each XLmultiblock has, and generates the list of blocks that needs to be highlighted. + //Each XL multiblock has the getAllDimensions overridden in its own class. Each NEEDS it or it will show the incorect shape. + List blocks = new java.util.ArrayList<>(); + Set set = new java.util.HashSet<>(); + + for(int[] dims : getAllDimensions()) { + //Some of the multiblocks have offsets for the placements, so this allows for the ones that dont need it to have a bunch of 0s at the end. + int offFwd = dims.length > 6 ? dims[6] : 0; + int offUp = dims.length > 7 ? dims[7] : 0; + int offLat = dims.length > 8 ? dims[8] : 0; + int worldOffX; + int worldOffY; + int worldOffZ; + + worldOffY = offUp; + worldOffX = facing.offsetX * offFwd + facing.getRotation(ForgeDirection.UP).offsetX * offLat; + worldOffZ = facing.offsetZ * offFwd + facing.getRotation(ForgeDirection.UP).offsetZ * offLat; + + int[] rot = MultiblockHandlerXR.rotate(dims, facing); + for(int bx = -rot[4] + worldOffX; bx <= rot[5] + worldOffX; bx++) { + for(int by = -rot[1] + worldOffY; by <= rot[0] + worldOffY; by++) { + for(int bz = -rot[2] + worldOffZ; bz <= rot[3] + worldOffZ; bz++) { + BlockPos bp = new BlockPos( + MathHelper.floor_double(originX) + bx, + MathHelper.floor_double(originY) + by, + MathHelper.floor_double(originZ) + bz + ); + blocks.add(bp); + set.add(bp); + } + } + + } + } + //This looks for the blocks nearby and draws lines between the vertexes to make different shaped boxes. + //Most of this was taken from Mellow (Thanks mellow) -Wolf + for(BlockPos pos : blocks) { + boolean px = set.contains(pos.add(1, 0, 0)); + boolean nx = set.contains(pos.add(-1, 0, 0)); + boolean ppy = set.contains(pos.add(0, 1, 0)); + boolean ny = set.contains(pos.add(0, -1, 0)); + boolean ppz = set.contains(pos.add(0, 0, 1)); + boolean nz = set.contains(pos.add(0, 0, -1)); + + double minX = pos.getX() - dX; + double maxX = pos.getX() + 1 - dX; + double minY = pos.getY() - dY; + double maxY = pos.getY() + 1 - dY; + double minZ = pos.getZ() - dZ; + double maxZ = pos.getZ() + 1 - dZ; + + if(!ppy) { + if(!nx) { tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); } + if(!ppz) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); } + if(!px) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, maxY, minZ); } + if(!nz) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(minX, maxY, minZ); } + } + if(!ny) { + if(!nx) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, minY, maxZ); } + if(!ppz) { tess.addVertex(minX, minY, maxZ); tess.addVertex(maxX, minY, maxZ); } + if(!px) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(maxX, minY, minZ); } + if(!nz) { tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, minZ); } + } + if(!nz) { + if(!nx) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); } + if(!ppy) { tess.addVertex(minX, maxY, minZ); tess.addVertex(maxX, maxY, minZ); } + if(!px) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, minY, minZ); } + if(!ny) { tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, minZ); } + } + if(!ppz) { + if(!nx) { tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, maxY, maxZ); } + if(!ppy) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); } + if(!px) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, minY, maxZ); } + if(!ny) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(minX, minY, maxZ); } + } + if(!nx) { + if(!nz) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); } + if(!ppy) { tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); } + if(!ppz) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(minX, minY, maxZ); } + if(!ny) { tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, minY, minZ); } + } + if(!px) { + if(!nz) { tess.addVertex(maxX, minY, minZ); tess.addVertex(maxX, maxY, minZ); } + if(!ppy) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, maxY, maxZ); } + if(!ppz) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, minY, maxZ); } + if(!ny) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(maxX, minY, minZ); } + } + } + + tess.draw(); + tess.setTranslation(0, 0, 0); + + GL11.glDepthMask(true); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, OpenGlHelper.lastBrightnessX, OpenGlHelper.lastBrightnessY); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + } } \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/machine/MachineAnnihilator.java b/src/main/java/com/hbm/blocks/machine/MachineAnnihilator.java index 38bb83680..1c00e165b 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineAnnihilator.java +++ b/src/main/java/com/hbm/blocks/machine/MachineAnnihilator.java @@ -31,7 +31,13 @@ public class MachineAnnihilator extends BlockDummyable { @Override public int[] getDimensions() { return new int[] {2, 0, 4, 4, 1, 1}; } @Override public int getOffset() { return 4; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {2, 0, 4, 4, 1, 1}, + new int[] {8, -2, 1, 1, 1, 1, -3, 0, 0} + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/MachineBigAssTank.java b/src/main/java/com/hbm/blocks/machine/MachineBigAssTank.java index aea632987..77df48aff 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineBigAssTank.java +++ b/src/main/java/com/hbm/blocks/machine/MachineBigAssTank.java @@ -43,7 +43,18 @@ public class MachineBigAssTank extends BlockDummyable implements IPersistentInfo @Override public int[] getDimensions() { return new int[] {5, 0, 4, 4, 4, 4}; } @Override public int getOffset() { return 6; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {5, 0, 4, 4, 4, 4}, + new int[] {4, 0, 5, -4, 2, 2}, + new int[] {4, 0, -4, 5, 2, 2}, + new int[] {4, 0, 2, 2, 5, -4}, + new int[] {4, 0, 2, 2, -4, 5}, + new int[] {3, 0, 6, -5, 0, 0}, + new int[] {3, 0, -5, 6, 0, 0} + }; + } @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java b/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java index 9b7910686..282405fe7 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java @@ -49,7 +49,16 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver public int getOffset() { return 3; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {0, 0, 3, 3, 2, 3}, + new int[]{8, -1, 3, -1, 2, 0}, + new int[]{13, 0, 0, 3, 2, 1}, + new int[]{14, -13, -1, 2, 1, 0}, + new int[]{3, -1, 2, 3, -1, 3} + }; + } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java b/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java index b8401426a..e190051ed 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java @@ -68,7 +68,14 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist public int getOffset() { return 1; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {2, 0, 1, 1, 2, 2}, + new int[] {3, -3, 1, 0, -1, 2}, + new int[] {6, -3, 1, 1, 2, 0}, + }; + } @Override public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineChungus.java b/src/main/java/com/hbm/blocks/machine/MachineChungus.java index 8972ca7ac..6614dbfe8 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChungus.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChungus.java @@ -89,7 +89,15 @@ public class MachineChungus extends BlockDummyable implements ITooltipProvider, public int getOffset() { return 3; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 3, 0, 0, 3, 2, 2 }, + new int[] { 4, -4, 0, 3, 1, 1 }, + new int[] { 3, 0, 6, -1, 1, 1 }, + new int[] { 2, 0, 10, -7, 1, 1 }, + }; + } @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/MachineCoker.java b/src/main/java/com/hbm/blocks/machine/MachineCoker.java index 695698016..4c26a4aa7 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCoker.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCoker.java @@ -43,7 +43,17 @@ public class MachineCoker extends BlockDummyable implements ITooltipProvider { public int getOffset() { return 1; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {22, 0, 1, 1, 1, 1}, + new int[] {5, 0, 2, 2, 2, 2, 0, 1, 0}, + new int[] {0, 1, 0, 0, 0, 0, 2, 1, 2}, + new int[] {0, 1, 0, 0, 0, 0, 2, 1, -2}, + new int[] {0, 1, 0, 0, 0, 0, -2, 1, 2}, + new int[] {0, 1, 0, 0, 0, 0, -2, 1, -2}, + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { if(super.checkRequirement(world, x, y, z, dir, o)) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineCompressor.java b/src/main/java/com/hbm/blocks/machine/MachineCompressor.java index f22bc3fc1..22cc0d0e8 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCompressor.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCompressor.java @@ -34,7 +34,14 @@ public class MachineCompressor extends BlockDummyable { public int getOffset() { return 2; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {2, 0, 1, 2, 1, 1}, + new int[] {3, -3, 1, 1, 1, 1}, + new int[] {8, -4, 0, 0, 1, 1} + }; + } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); diff --git a/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java b/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java index ec787564a..0a4825728 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java +++ b/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java @@ -32,7 +32,24 @@ public class MachineElectrolyser extends BlockDummyable { public int getOffset() { return 5; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {0, 0, 5, 5, 1, 3}, + new int[] {2, -1, 5, 5, 1, 1}, + new int[] {3, -3, 5, 5, 0, 0}, + new int[] {3, -1, 4, -4, -3, 3}, + new int[] {3, -1, 2, -2, -3, 3}, + new int[] {3, -1, 0, 0, -3, 3}, + new int[] {3, -1, -2, 2, -3, 3}, + new int[] {3, -1, -4, 4, -3, 3}, + new int[] {0, 0, 0, 0, -1, 2, 4, 3, 0}, + new int[] {0, 0, 0, 0, -1, 2, 2, 3, 0}, + new int[] {0, 0, 0, 0, -1, 2, 0, 3, 0}, + new int[] {0, 0, 0, 0, -1, 2, -2, 3, 0}, + new int[] {0, 0, 0, 0, -1, 2, -4, 3, 0}, + }; + } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, -1); diff --git a/src/main/java/com/hbm/blocks/machine/MachineExcavator.java b/src/main/java/com/hbm/blocks/machine/MachineExcavator.java index c91d6bb16..06dfce2e8 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineExcavator.java +++ b/src/main/java/com/hbm/blocks/machine/MachineExcavator.java @@ -44,7 +44,15 @@ public class MachineExcavator extends BlockDummyable { public int getHeightOffset() { return 3; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {3, 0, 3, 3, 3, 3}, + new int[] {-1, 3, 3, -2, 3, -2}, + new int[] {-1, 3, 3, -2, -2, 3}, + new int[] {-1, 3, -2, 3, 3, 3}, + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { x += dir.offsetX * o; diff --git a/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java b/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java index e0d906181..e062201dc 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java +++ b/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java @@ -32,7 +32,17 @@ public class MachineExposureChamber extends BlockDummyable { public int getOffset() { return 2; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + getDimensions(), + new int[] {3, 0, 0, 0, -3, 8}, + new int[] {0, 0, 1, -1, -3, 6, 0, 2, 0}, + new int[] {0, 0, -1, 1, -3, 6, 0, 2, 0}, + new int[] {3, 0, 1, -1, 0, 1, 0, 0, -7}, + new int[] {3, 0, -1, 1, 0, 1, 0, 0, -7}, + }; + } @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java b/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java index 761aa10ed..d872fc7a9 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java @@ -46,7 +46,20 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI public int getOffset() { return 0; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {3, 0, 0, 0, 0, 0}, + new int[] {1, 0, 3, 3, 3, 3, 0, 2, 0}, + new int[] {-1, 2, 0, 1, 0, 1, -2, 2, -2}, + new int[] {-1, 2, 0, 1, 0, 1, 3, 2, -2}, + new int[] {-1, 2, 0, 1, 0, 1, -2, 2, 3}, + new int[] {-1, 2, 0, 1, 0, 1, 3, 2, 3}, + new int[] {10, -4, 2, 2, 2, 2}, + new int[] {24, -9, 1, 1, 1, 1}, + new int[] {1, 0, -2, 3, 1, 1, 0, 15, 0}, + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineICF.java b/src/main/java/com/hbm/blocks/machine/MachineICF.java index 29bca9b90..6e39bd62e 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineICF.java +++ b/src/main/java/com/hbm/blocks/machine/MachineICF.java @@ -33,7 +33,14 @@ public class MachineICF extends BlockDummyable { public int getOffset() { return 1; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {5, 0, 1, 1, 8, 8}, + new int[] {1, 1, -1, 2, 8, 8, 0, 3, 0}, + new int[] {1, 1, 2, -1, 8, 8, 0, 3, 0}, + }; + } @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java b/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java index 56f05147d..ad8af4b7b 100644 --- a/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java +++ b/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java @@ -47,7 +47,16 @@ public class MachinePumpjack extends BlockDummyable implements IPersistentInfoPr public int getOffset() { return 0; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {3, 0, 0, 0, 0, 6}, + new int[] {0, 0, -1, 1, -2, 4}, + new int[] {0, 0, 1, -1, -1, 5}, + new int[] {0, 0, -1, 1, 1, 1, 0, 0, -3}, + new int[] {0, 0, 1, -1, 2, 2, 0, 0, -3}, + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/MachineStrandCaster.java b/src/main/java/com/hbm/blocks/machine/MachineStrandCaster.java index 354e91136..10345bcb8 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineStrandCaster.java +++ b/src/main/java/com/hbm/blocks/machine/MachineStrandCaster.java @@ -47,7 +47,13 @@ public class MachineStrandCaster extends BlockDummyable implements ICrucibleAcce public int getOffset() { return 0; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 0, 0, 6, 0, 1, 0 }, + new int[] { 2, 0, 1, 0, 1, 0 } + }; + } @Override public TileEntity createNewTileEntity(World world, int meta) { if(meta >= 12) return new TileEntityMachineStrandCaster(); diff --git a/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java b/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java index 1316a02eb..5d892c5ea 100644 --- a/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java +++ b/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java @@ -62,7 +62,15 @@ public class ReactorZirnox extends BlockDummyable { public int getOffset() { return 2; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {1, 0, 2, 2, 2, 2,}, + new int[] {4, -2, 1, 1, 1, 1}, + new int[] {4, -2, 0, 0, 2, -2}, + new int[] {4, -2, 0, 0, -2, 2} + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/SoyuzLauncher.java b/src/main/java/com/hbm/blocks/machine/SoyuzLauncher.java index 598f9aef4..98106fada 100644 --- a/src/main/java/com/hbm/blocks/machine/SoyuzLauncher.java +++ b/src/main/java/com/hbm/blocks/machine/SoyuzLauncher.java @@ -168,7 +168,18 @@ public class SoyuzLauncher extends BlockDummyable { public int getOffset() { return 0; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 0, 1, 6, 6, 6, 6 }, + new int[] { -2, 4, -3, 6, -3, 6 }, + new int[] { -2, 4, 6, -3, -3, 6 }, + new int[] { -2, 4, 6, -3, 6, -3 }, + new int[] { -2, 4, -3, 6, 6, -3 }, + new int[] { 0, 4, 1, 1, -6, 8 }, + new int[] { 0, 4, 2, 2, 9, -5 }, + }; + } private final Random field_149933_a = new Random(); private static boolean keepInventory; diff --git a/src/main/java/com/hbm/blocks/machine/Watz.java b/src/main/java/com/hbm/blocks/machine/Watz.java index 41f6767ed..bedbd245e 100644 --- a/src/main/java/com/hbm/blocks/machine/Watz.java +++ b/src/main/java/com/hbm/blocks/machine/Watz.java @@ -53,7 +53,16 @@ public class Watz extends BlockDummyable { public int getOffset() { return 3; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {2, 0, 3, 3, 1, 1}, + new int[] {2, 0, 2, 2, 2, -2}, + new int[] {2, 0, 2, 2, -2, 2}, + new int[] {2, 0, 1, 1, 3, -3}, + new int[] {2, 0, 1, 1, -3, 3}, + }; + } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java index 46f5abc0f..db8df5641 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java @@ -35,7 +35,13 @@ public class MachineFusionKlystron extends BlockDummyable implements ITooltipPro @Override public int[] getDimensions() { return new int[] { 3, 0, 4, 3, 2, 2 }; } @Override public int getOffset() { return 3; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 3, 0, 4, 3, 2, 2 }, + new int[] { 4, -3, 4, 3, 1, 1 }, + }; + } @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java index 5b0b2edba..198f49f88 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java @@ -28,7 +28,13 @@ public class MachineFusionKlystronCreative extends BlockDummyable implements ITo @Override public int[] getDimensions() { return new int[] { 3, 0, 4, 3, 2, 2 }; } @Override public int getOffset() { return 3; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 3, 0, 4, 3, 2, 2 }, + new int[] { 4, -3, 4, 3, 1, 1 }, + }; + } @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java index 2af2192b9..64dd13fec 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java @@ -44,7 +44,17 @@ public class MachineFusionMHDT extends BlockDummyable implements ILookOverlay, I public int getOffset() { return 7; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 2, 0, 6, 7, 2, 2 }, + new int[] { 3, -2, 6, 2, 1, 1 }, + new int[] { 3, -2, -6, 7, 1, 1 }, + new int[] { 3, -2, -3, 5, 2, 2 }, + new int[] { 4, -3, -3, 5, 1, 1 }, + new int[] { 1, 0, 0, 1, 3, 3, 3, 0, 0 }, + }; + } @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java index 5da87a630..7f06b7840 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java @@ -31,6 +31,21 @@ public class MachineFusionPlasmaForge extends BlockDummyable { @Override public int[] getDimensions() { return new int[] { 2, 0, 2, 2, 5, 5 }; } @Override public int getOffset() { return 5; } + + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 2, 0, 2, 2, 5, 5 }, + new int[] { 4, -3, 0, 0, 4, 4 }, + new int[] { 2, 0, 3, -2, 4, 4 }, + new int[] { 2, 0, -2, 3, 4, 4 }, + new int[] { 2, 0, 4, -3, 3, 3 }, + new int[] { 2, 0, -3, 4, 3, 3 }, + new int[] { 2, 0, 5, -4, 2, 2 }, + new int[] { 2, 0, -4, 5, 2, 2 }, + new int[] { 3, -2, 1, 1, 5, 5 } + }; + } @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKConsole.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKConsole.java index de8789215..568c4f3ec 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKConsole.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKConsole.java @@ -107,7 +107,13 @@ public class RBMKConsole extends BlockDummyable implements IToolable { public int getOffset() { return 1; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {3, 0, 0, 0, 2, 2}, + new int[] {0, 0, 0, 1, 2, 2}, + }; + } @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKCraneConsole.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKCraneConsole.java index 680856254..9468765bd 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKCraneConsole.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKCraneConsole.java @@ -38,7 +38,13 @@ public class RBMKCraneConsole extends BlockDummyable implements IToolable { public int getOffset() { return 1; } - + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] {1, 0, 0, 0, 1, 1}, + new int[] {0, 0, 0, 1, 1, 1}, + }; + } @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java index f1a16b507..65272819c 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java +++ b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java @@ -1,5 +1,6 @@ package com.hbm.main; +import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ICustomBlockHighlight; import com.hbm.config.ClientConfig; import com.hbm.config.RadiationConfig; @@ -414,6 +415,16 @@ public class ModEventHandlerRenderer { public void onDrawHighlight(DrawBlockHighlightEvent event) { EntityPlayer player = MainRegistry.proxy.me(); + + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemBlock) { + Block b = Block.getBlockFromItem(player.getHeldItem().getItem()); + if(b instanceof BlockDummyable) { + ((BlockDummyable) b).drawPlacementHighlight(player, event.partialTicks); + event.setCanceled(true); + return; + } + } + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_drill) { XFactoryDrill.drawBlockHighlight(player, player.getHeldItem(), event.partialTicks); event.setCanceled(true);