From 1346f22e4e0b30bb2b4f88bd4792e3fd5b3e7b7e Mon Sep 17 00:00:00 2001 From: Brian Ricketts Date: Sun, 3 Mar 2013 00:12:17 -0600 Subject: [PATCH] Added full OmniWrench support and partial IC2 wrench support IC2 team: if you're reading this, ADD FREAKING SHIFT-RIGHT-CLICK FUNCTIONALITY TO YOUR STUPID WRENCH! --- .../assemblyline/common/AssemblyLine.java | 17 +++++++++-------- .../common/block/BlockALMachine.java | 16 ++++++++++------ .../machine/imprinter/BlockImprintable.java | 2 ++ .../machine/imprinter/TileEntityFilterable.java | 1 + 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/minecraft/assemblyline/common/AssemblyLine.java b/src/minecraft/assemblyline/common/AssemblyLine.java index d1cb75039..42d25f071 100644 --- a/src/minecraft/assemblyline/common/AssemblyLine.java +++ b/src/minecraft/assemblyline/common/AssemblyLine.java @@ -1,6 +1,7 @@ package assemblyline.common; import ic2.api.Ic2Recipes; +import ic2.api.Items; import java.io.File; import java.util.logging.Logger; @@ -229,21 +230,21 @@ public class AssemblyLine { System.out.println("IC2 Found...adding IC2 recipes for Assembly Line."); // Armbot - Ic2Recipes.addCraftingRecipe(new ItemStack(blockArmbot, 1), "II ", "SIS", "MCM", 'S', "advancedAlloy", 'C', "electronicCircuit", 'I', "ingotRefinedIron", 'M', "generator"); + Ic2Recipes.addCraftingRecipe(new ItemStack(blockArmbot, 1), "II ", "SIS", "MCM", 'S', Items.getItem("advancedAlloy"), 'C', Items.getItem("electronicCircuit"), 'I', "ingotRefinedIron", 'M', Items.getItem("generator")); // Disk - Ic2Recipes.addCraftingRecipe(new ItemStack(itemDisk, 1), "III", "ICI", "III", 'I', itemImprint, 'C', "advancedCircuit"); + Ic2Recipes.addCraftingRecipe(new ItemStack(itemDisk, 1), "III", "ICI", "III", 'I', itemImprint, 'C', Items.getItem("advancedCircuit")); // Encoder - Ic2Recipes.addCraftingRecipe(new ItemStack(blockEncoder, 1), "SIS", "SCS", "SSS", 'I', itemImprint, 'S', "ingotRefinedIron", 'C', "advancedCircuit"); + Ic2Recipes.addCraftingRecipe(new ItemStack(blockEncoder, 1), "SIS", "SCS", "SSS", 'I', itemImprint, 'S', "ingotRefinedIron", 'C', Items.getItem("advancedCircuit")); // Detector - Ic2Recipes.addCraftingRecipe(new ItemStack(blockDetector, 1), "SES", "SCS", "S S", 'S', "ingotRefinedIron", 'C', "electronicCircuit", 'E', Item.eyeOfEnder); + Ic2Recipes.addCraftingRecipe(new ItemStack(blockDetector, 1), "SES", "SCS", "S S", 'S', "ingotRefinedIron", 'C', Items.getItem("electronicCircuit"), 'E', Item.eyeOfEnder); // Conveyor Belt - Ic2Recipes.addCraftingRecipe(new ItemStack(blockConveyorBelt, 10), "III", "WMW", 'I', "ingotRefinedIron", 'W', Block.planks, 'M', "generator"); + Ic2Recipes.addCraftingRecipe(new ItemStack(blockConveyorBelt, 10), "III", "WMW", 'I', "ingotRefinedIron", 'W', Block.planks, 'M', Items.getItem("generator")); // Rejector - Ic2Recipes.addCraftingRecipe(new ItemStack(blockRejector, 1), "WPW", "@R@", '@', "ingotRefinedIron", 'R', Item.redstone, 'P', Block.pistonBase, 'C', "electronicCircuit", 'W', "insulatedCopperCableItem"); + Ic2Recipes.addCraftingRecipe(new ItemStack(blockRejector, 1), "WPW", "@R@", '@', "ingotRefinedIron", 'R', Item.redstone, 'P', Block.pistonBase, 'C', Items.getItem("electronicCircuit"), 'W', Items.getItem("insulatedCopperCableItem")); // Turntable - Ic2Recipes.addCraftingRecipe(new ItemStack(blockTurntable, 1), "M", "P", 'M', "generator", 'P', Block.pistonBase); + Ic2Recipes.addCraftingRecipe(new ItemStack(blockTurntable, 1), "M", "P", 'M', Items.getItem("generator"), 'P', Block.pistonBase); // Manipulator - Ic2Recipes.addShapelessCraftingRecipe(new ItemStack(blockManipulator, 2), new Object[] { Block.dispenser, "electronicCircuit" }); + Ic2Recipes.addShapelessCraftingRecipe(new ItemStack(blockManipulator, 2), Block.dispenser, Items.getItem("electronicCircuit")); } private void createStandardRecipes() diff --git a/src/minecraft/assemblyline/common/block/BlockALMachine.java b/src/minecraft/assemblyline/common/block/BlockALMachine.java index b1e8b33c9..185d05459 100644 --- a/src/minecraft/assemblyline/common/block/BlockALMachine.java +++ b/src/minecraft/assemblyline/common/block/BlockALMachine.java @@ -1,14 +1,12 @@ package assemblyline.common.block; import ic2.api.Items; -import assemblyline.common.CommonProxy; -import universalelectricity.core.implement.IItemElectric; -import universalelectricity.prefab.BlockMachine; -import universalelectricity.prefab.implement.IToolConfigurator; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; +import universalelectricity.prefab.BlockMachine; +import buildcraft.api.tools.IToolWrench; public class BlockALMachine extends BlockMachine { @@ -45,10 +43,16 @@ public class BlockALMachine extends BlockMachine { if (isHoldingWrench(player)) { + if (player.isSneaking()) + { + if (this.onSneakMachineActivated(world, x, y, z, player, side, hitX, hitY, hitZ)) + return true; + if (this.onSneakUseWrench(world, x, y, z, player, side, hitX, hitY, hitZ)) + return true; + } return this.onUseWrench(world, x, y, z, player, side, hitX, hitY, hitZ); } } - return super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ); } @@ -59,7 +63,7 @@ public class BlockALMachine extends BlockMachine { if (player.getCurrentEquippedItem() != null) { - return (Items.getItem("wrench") != null && player.getCurrentEquippedItem().isItemEqual(Items.getItem("wrench"))); + return ((Items.getItem("wrench") != null && player.getCurrentEquippedItem().isItemEqual(Items.getItem("wrench"))) || player.getCurrentEquippedItem().getItem() instanceof IToolWrench); } return false; diff --git a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java index 136df0383..90011fc31 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java @@ -12,6 +12,7 @@ import net.minecraft.world.World; import universalelectricity.prefab.implement.IRedstoneReceptor; import assemblyline.api.IFilterable; import assemblyline.common.block.BlockALMachine; +import cpw.mods.fml.common.FMLCommonHandler; /** * Extend this block class if a filter is allowed to be placed inside of this block. @@ -83,6 +84,7 @@ public abstract class BlockImprintable extends BlockALMachine { ((TileEntityFilterable) tileEntity).toggleInversion(); world.markBlockForRenderUpdate(x, y, z); + world.markBlockForUpdate(x, y, z); } } diff --git a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java index ca7c9ab49..9bce1cb15 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java @@ -138,6 +138,7 @@ public abstract class TileEntityFilterable extends TileEntityAssemblyNetwork imp x = dis.readInt(); y = dis.readInt(); z = dis.readInt(); + this.worldObj.markBlockForRenderUpdate(x, y, z); NBTTagCompound tag = Packet.readNBTTagCompound(dis); readFromNBT(tag); }