Does anyone know how to turn redstone wire on by right clicking with an item, and returning it to normal when releasing right click? I am using this code, but it is not working properly:
public boolean onItemUse(ItemStack is, EntityPlayer player, World w, int x, int y, int z, int l, float f, float f1, float f3){
if(w.getBlockId(x, y, z) == Block.redstoneWire.blockID){
w.setBlockMetadataWithNotify(x, y, z, 15, 3);
}
return false;
}
What happens is if I hold right click on a redstone wire, it will pulse on and off rapidly, and not effect any other wire in the circuit (visibly). If I place a door in the circuit, I can hear a door opening and closing, but nothing visual happens. Obviously, the problem is that the redstone is returning to its normal state as soon as I set it to powered, but is there any way to keep it powered throughout?
Thanks