diff --git a/electrical/src/main/java/resonantinduction/electrical/generator/thermopile/BlockThermopile.java b/electrical/src/main/java/resonantinduction/electrical/generator/thermopile/BlockThermopile.java index f3420e7e..78ab86a4 100644 --- a/electrical/src/main/java/resonantinduction/electrical/generator/thermopile/BlockThermopile.java +++ b/electrical/src/main/java/resonantinduction/electrical/generator/thermopile/BlockThermopile.java @@ -11,7 +11,6 @@ public class BlockThermopile extends BlockTile public BlockThermopile(int id) { super(id, UniversalElectricity.machine); - setTextureName(Reference.PREFIX + "material_metal_top"); } @Override diff --git a/electrical/src/main/java/resonantinduction/electrical/levitator/PartLevitator.java b/electrical/src/main/java/resonantinduction/electrical/levitator/PartLevitator.java index 11080883..ab792efa 100644 --- a/electrical/src/main/java/resonantinduction/electrical/levitator/PartLevitator.java +++ b/electrical/src/main/java/resonantinduction/electrical/levitator/PartLevitator.java @@ -29,8 +29,8 @@ import resonantinduction.electrical.Electrical; import resonantinduction.electrical.tesla.TileTesla; import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.VectorWorld; -import calclavia.components.tool.ToolModeLink; import calclavia.lib.render.EnumColor; +import calclavia.lib.utility.LinkUtility; import calclavia.lib.utility.WrenchUtility; import calclavia.lib.utility.inventory.InventoryUtility; import codechicken.lib.data.MCDataInput; @@ -79,19 +79,19 @@ public class PartLevitator extends PartFace { if (WrenchUtility.isWrench(itemStack)) { - if (tryLink(ToolModeLink.getLink(itemStack), ToolModeLink.getSide(itemStack))) + if (tryLink(LinkUtility.getLink(itemStack), LinkUtility.getSide(itemStack))) { if (world().isRemote) player.addChatMessage("Successfully linked devices."); - ToolModeLink.clearLink(itemStack); + LinkUtility.clearLink(itemStack); } else { if (world().isRemote) player.addChatMessage("Marked link for device."); - ToolModeLink.setLink(itemStack, new VectorWorld(world(), x(), y(), z())); - ToolModeLink.setSide(itemStack, (byte) placementSide.ordinal()); + LinkUtility.setLink(itemStack, new VectorWorld(world(), x(), y(), z())); + LinkUtility.setSide(itemStack, (byte) placementSide.ordinal()); } return true; diff --git a/electrical/src/main/java/resonantinduction/electrical/tesla/BlockTesla.java b/electrical/src/main/java/resonantinduction/electrical/tesla/BlockTesla.java index 7424b66f..983a904e 100644 --- a/electrical/src/main/java/resonantinduction/electrical/tesla/BlockTesla.java +++ b/electrical/src/main/java/resonantinduction/electrical/tesla/BlockTesla.java @@ -14,9 +14,9 @@ import resonantinduction.core.Reference; import resonantinduction.core.render.RIBlockRenderingHandler; import universalelectricity.api.UniversalElectricity; import universalelectricity.api.vector.VectorWorld; -import calclavia.components.tool.ToolModeLink; import calclavia.lib.prefab.block.BlockSidedIO; import calclavia.lib.utility.LanguageUtility; +import calclavia.lib.utility.LinkUtility; import calclavia.lib.utility.WrenchUtility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -106,18 +106,18 @@ public class BlockTesla extends BlockSidedIO implements ITileEntityProvider if (WrenchUtility.isWrench(itemStack)) { - if (((TileTesla)tile).tryLink(ToolModeLink.getLink(itemStack))) + if (((TileTesla)tile).tryLink(LinkUtility.getLink(itemStack))) { if (world.isRemote) player.addChatMessage("Successfully linked devices."); - ToolModeLink.clearLink(itemStack); + LinkUtility.clearLink(itemStack); } else { if (world.isRemote) player.addChatMessage("Marked link for device."); - ToolModeLink.setLink(itemStack, new VectorWorld(world, x, y, z)); + LinkUtility.setLink(itemStack, new VectorWorld(world, x, y, z)); } return true; diff --git a/mechanical/src/main/java/resonantinduction/mechanical/logistic/belt/BlockDetector.java b/mechanical/src/main/java/resonantinduction/mechanical/logistic/belt/BlockDetector.java index 1f7e93cf..0ce1c111 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/logistic/belt/BlockDetector.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/logistic/belt/BlockDetector.java @@ -19,8 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly; /** @author Briman0094 */ public class BlockDetector extends BlockImprintable { - Icon eye_red; - Icon eye_green; + Icon front_red, front_green, side_green, side_red; public BlockDetector(int id) { @@ -28,47 +27,14 @@ public class BlockDetector extends BlockImprintable setTextureName(Reference.PREFIX + "material_metal_side"); } - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) - { - int angle = MathHelper.floor_double((entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - int change = 2; - - switch (angle) - { - case 0: - change = ForgeDirection.NORTH.ordinal(); - break; - case 1: - change = ForgeDirection.EAST.ordinal(); - break; - case 2: - change = ForgeDirection.SOUTH.ordinal(); - break; - case 3: - change = ForgeDirection.WEST.ordinal(); - break; - } - - if (entity.rotationPitch < -70f) // up - { - change = ForgeDirection.DOWN.ordinal(); - } - if (entity.rotationPitch > 70f) // down - { - change = ForgeDirection.UP.ordinal(); - } - - world.setBlockMetadataWithNotify(x, y, z, change, 3); - } - @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister iconReg) { - super.registerIcons(iconReg); - this.eye_green = iconReg.registerIcon(Reference.PREFIX + "detector_green"); - this.eye_red = iconReg.registerIcon(Reference.PREFIX + "detector_red"); + front_green = iconReg.registerIcon(Reference.PREFIX + "detector_front_green"); + front_red = iconReg.registerIcon(Reference.PREFIX + "detector_front_red"); + side_green = iconReg.registerIcon(Reference.PREFIX + "detector_side_green"); + side_red = iconReg.registerIcon(Reference.PREFIX + "detector_side_red"); super.registerIcons(iconReg); } @@ -76,24 +42,17 @@ public class BlockDetector extends BlockImprintable @SideOnly(Side.CLIENT) public Icon getBlockTexture(IBlockAccess iBlockAccess, int x, int y, int z, int side) { + boolean isInverted = false; + boolean isFront = false; TileEntity tileEntity = iBlockAccess.getBlockTileEntity(x, y, z); + if (tileEntity instanceof TileDetector) { - if (side == ForgeDirection.getOrientation(iBlockAccess.getBlockMetadata(x, y, z)).ordinal()) - { - if (((TileDetector) tileEntity).isInverted()) - { - return this.eye_red; - - } - else - { - return this.eye_green; - } - } + isFront = side == ((TileDetector) tileEntity).getDirection().ordinal(); + isInverted = ((TileDetector) tileEntity).isInverted(); } - return this.blockIcon; + return isInverted ? (isFront ? front_red : side_red) : (isFront ? front_green : side_green); } @Override @@ -102,17 +61,24 @@ public class BlockDetector extends BlockImprintable { if (side == ForgeDirection.SOUTH.ordinal()) { - return this.eye_green; + return front_green; } - return this.blockIcon; + return side_green; } @Override public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) { - world.setBlockMetadataWithNotify(x, y, z, side, 3); - return true; + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + if (tileEntity instanceof TileDetector) + { + ((TileDetector) tileEntity).toggleInversion(); + return true; + } + + return false; } @Override diff --git a/src/main/java/resonantinduction/core/ResonantInduction.java b/src/main/java/resonantinduction/core/ResonantInduction.java index 7e6311a2..679fa648 100644 --- a/src/main/java/resonantinduction/core/ResonantInduction.java +++ b/src/main/java/resonantinduction/core/ResonantInduction.java @@ -21,13 +21,13 @@ import resonantinduction.core.resource.TileMaterial; import resonantinduction.core.resource.fluid.TileFluidMixture; import resonantinduction.core.resource.item.ItemOreResource; import calclavia.components.tool.ToolMode; -import calclavia.components.tool.ToolModeLink; import calclavia.lib.content.ContentRegistry; import calclavia.lib.network.PacketAnnotation; import calclavia.lib.network.PacketHandler; import calclavia.lib.network.PacketTile; import calclavia.lib.prefab.item.ItemBlockMetadata; import calclavia.lib.utility.LanguageUtility; +import calclavia.lib.utility.LinkUtility; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; @@ -92,7 +92,6 @@ public class ResonantInduction ResonantInduction.LOGGER.setParent(FMLLog.getLogger()); NetworkRegistry.instance().registerGuiHandler(this, proxy); Modstats.instance().getReporter().registerMod(this); - ToolMode.REGISTRY.add(new ToolModeLink()); Settings.load(); diff --git a/src/main/resources/assets/resonantinduction/languages/en_US.properties b/src/main/resources/assets/resonantinduction/languages/en_US.properties index fa876aa7..2a92234a 100644 --- a/src/main/resources/assets/resonantinduction/languages/en_US.properties +++ b/src/main/resources/assets/resonantinduction/languages/en_US.properties @@ -75,6 +75,7 @@ tile.resonantinduction\:grate.name=Grate tile.resonantinduction\:conveyorBelt.name=Conveyor Belt tile.resonantinduction\:tank.name=Tank tile.resonantinduction\:detector.name=Detector +tile.resonantinduction\:detector.tooltip=Outputs a Redstone signal upon item detection. Wrench to invert imprint filter. tile.resonantinduction\:manipulator.name=Manipulator tile.resonantinduction\:rejector.name=Rejector diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/detector_front_green.png b/src/main/resources/assets/resonantinduction/textures/blocks/detector_front_green.png new file mode 100644 index 00000000..9fb53711 Binary files /dev/null and b/src/main/resources/assets/resonantinduction/textures/blocks/detector_front_green.png differ diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/detector_front_red.png b/src/main/resources/assets/resonantinduction/textures/blocks/detector_front_red.png new file mode 100644 index 00000000..f97f8a7f Binary files /dev/null and b/src/main/resources/assets/resonantinduction/textures/blocks/detector_front_red.png differ diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/detector_green.png b/src/main/resources/assets/resonantinduction/textures/blocks/detector_green.png deleted file mode 100644 index 6f05dcde..00000000 Binary files a/src/main/resources/assets/resonantinduction/textures/blocks/detector_green.png and /dev/null differ diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/detector_red.png b/src/main/resources/assets/resonantinduction/textures/blocks/detector_red.png deleted file mode 100644 index 9484a2c3..00000000 Binary files a/src/main/resources/assets/resonantinduction/textures/blocks/detector_red.png and /dev/null differ diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/detector_side_green.png b/src/main/resources/assets/resonantinduction/textures/blocks/detector_side_green.png new file mode 100644 index 00000000..eb279dfc Binary files /dev/null and b/src/main/resources/assets/resonantinduction/textures/blocks/detector_side_green.png differ diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/detector_side_red.png b/src/main/resources/assets/resonantinduction/textures/blocks/detector_side_red.png new file mode 100644 index 00000000..48131355 Binary files /dev/null and b/src/main/resources/assets/resonantinduction/textures/blocks/detector_side_red.png differ diff --git a/src/main/resources/assets/resonantinduction/textures/blocks/thermopile.png b/src/main/resources/assets/resonantinduction/textures/blocks/thermopile.png new file mode 100644 index 00000000..a40786d4 Binary files /dev/null and b/src/main/resources/assets/resonantinduction/textures/blocks/thermopile.png differ