diff --git a/client/src/main/resources/textures/blocks/concrete_plate.png b/client/src/main/resources/textures/blocks/concrete_plate.png deleted file mode 100644 index 090657d3..00000000 Binary files a/client/src/main/resources/textures/blocks/concrete_plate.png and /dev/null differ diff --git a/client/src/main/resources/textures/blocks/wire_cross.png b/client/src/main/resources/textures/blocks/wire_cross.png index 66eba385..9e2d78d0 100755 Binary files a/client/src/main/resources/textures/blocks/wire_cross.png and b/client/src/main/resources/textures/blocks/wire_cross.png differ diff --git a/client/src/main/resources/textures/blocks/wire_cross_overlay.png b/client/src/main/resources/textures/blocks/wire_cross_overlay.png deleted file mode 100755 index 96729e15..00000000 Binary files a/client/src/main/resources/textures/blocks/wire_cross_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/blocks/wire_line.png b/client/src/main/resources/textures/blocks/wire_line.png index a1ae2050..c7940bd7 100755 Binary files a/client/src/main/resources/textures/blocks/wire_line.png and b/client/src/main/resources/textures/blocks/wire_line.png differ diff --git a/client/src/main/resources/textures/blocks/wire_line_overlay.png b/client/src/main/resources/textures/blocks/wire_line_overlay.png deleted file mode 100755 index 9f24cbca..00000000 Binary files a/client/src/main/resources/textures/blocks/wire_line_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/wire.png b/client/src/main/resources/textures/items/wire.png index 1b3aa447..2bb7d0c2 100755 Binary files a/client/src/main/resources/textures/items/wire.png and b/client/src/main/resources/textures/items/wire.png differ diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index 6ac7764a..cada79b7 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -464,7 +464,7 @@ public class Block { } public boolean isNormalCube() { - return this.material.isOpaque() && this.isFullCube() && !this.canProvidePower(); + return this.material.isOpaque() && this.isFullCube(); } public boolean isVisuallyOpaque() { @@ -861,26 +861,6 @@ public class Block { return this.colorMultiplier(worldIn, pos, 0); } - public boolean canProvidePower() { - return false; - } - - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) { - return 0; - } - - public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) { - return 0; - } - - public boolean hasSignalProcessing() { - return false; - } - - public int getSignal(World worldIn, BlockPos pos, int input) { - return 0; - } - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) { } @@ -1075,4 +1055,16 @@ public class Block { public final Item getItem() { return this.item; } + + public boolean canConnectToWire() { + return false; + } + + public double getResistance(World worldIn, BlockPos pos, State state) { + return Double.POSITIVE_INFINITY; + } + + public double powerTick(World worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) { + return 0.0; + } } diff --git a/common/src/main/java/common/block/artificial/BlockCake.java b/common/src/main/java/common/block/artificial/BlockCake.java index c2708bac..37866033 100755 --- a/common/src/main/java/common/block/artificial/BlockCake.java +++ b/common/src/main/java/common/block/artificial/BlockCake.java @@ -219,16 +219,6 @@ public class BlockCake extends Block return new Property[] {BITES}; } - public int getSignal(World worldIn, BlockPos pos, int input) - { - return (7 - ((Integer)worldIn.getState(pos).getValue(BITES)).intValue()) * 2; - } - - public boolean hasSignalProcessing() - { - return true; - } - public Model getModel(ModelProvider provider, String name, State state) { return cake_slices[state.getValue(BITES)]; } diff --git a/common/src/main/java/common/block/artificial/BlockPortalFrame.java b/common/src/main/java/common/block/artificial/BlockPortalFrame.java index e54c5fd8..4112308c 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -97,16 +97,6 @@ public class BlockPortalFrame extends Block implements Rotatable return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false)); } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return ((Boolean)worldIn.getState(pos).getValue(ORB)).booleanValue() ? 15 : 0; - } - protected Property[] getProperties() { return new Property[] {FACING, ORB}; diff --git a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java index 3c899c39..f77272a4 100755 --- a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java @@ -13,7 +13,6 @@ import common.model.ModelProvider; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; -import common.util.Facing; import common.world.IBlockAccess; import common.world.IWorldAccess; import common.world.State; @@ -206,20 +205,10 @@ public abstract class BlockBasePressurePlate extends Block worldIn.notifyNeighborsOfStateChange(pos.down(), this); } - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return this.getSignalStrength(state); - } - - public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return side == Facing.UP ? this.getSignalStrength(state) : 0; - } - /** * Can this block provide power. Only wire currently seems to have this change based on its state. */ - public boolean canProvidePower() + public boolean canConnectToWire() { return true; } diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index 420dc33f..2745bc75 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -7,7 +7,6 @@ import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; import common.init.Items; -import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.CheatTab; import common.item.Item; @@ -468,16 +467,6 @@ public class BlockBrewingStand extends BlockContainer return Items.brewing_stand; } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return Container.calcSignal(worldIn.getTileEntity(pos)); - } - public BlockLayer getBlockLayer() { return BlockLayer.CUTOUT; diff --git a/common/src/main/java/common/block/tech/BlockButton.java b/common/src/main/java/common/block/tech/BlockButton.java index 91b6cc5f..9830f36d 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -207,20 +207,14 @@ public class BlockButton extends Block implements Directional super.onBlockRemoved(worldIn, pos, state); } - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; - } - - public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (state.getValue(FACING) == side ? 15 : 0); - } + public double getResistance(World worldIn, BlockPos pos, State state) { + return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); + } /** * Can this block provide power. Only wire currently seems to have this change based on its state. */ - public boolean canProvidePower() + public boolean canConnectToWire() { return true; } diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index 9d4b5669..8ec807da 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -584,16 +584,6 @@ public class BlockCauldron extends Block return Items.cauldron; } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return ((Integer)worldIn.getState(pos).getValue(LEVEL)).intValue(); - } - protected Property[] getProperties() { return new Property[] {LEVEL}; diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index 3c81620d..5efaeebb 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -13,7 +13,6 @@ import common.entity.animal.EntityCat; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.SoundEvent; -import common.inventory.Container; import common.inventory.IInventory; import common.inventory.InventoryHelper; import common.item.CheatTab; @@ -238,16 +237,6 @@ public class BlockChest extends BlockContainer implements Rotatable return false; } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return Container.calcSignalFrom(this.getChest(worldIn, pos)); - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/tech/BlockDaylightDetector.java b/common/src/main/java/common/block/tech/BlockDaylightDetector.java index ee33b535..eecd9121 100755 --- a/common/src/main/java/common/block/tech/BlockDaylightDetector.java +++ b/common/src/main/java/common/block/tech/BlockDaylightDetector.java @@ -47,10 +47,9 @@ public class BlockDaylightDetector extends BlockContainer this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F); } - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return ((Integer)state.getValue(POWER)).intValue(); - } + public double getResistance(World worldIn, BlockPos pos, State state) { + return state.getValue(POWER) > 0 ? (double)(15 - state.getValue(POWER)) * 10000.0 : super.getResistance(worldIn, pos, state); + } public void updatePower(AWorldServer worldIn, BlockPos pos) { @@ -143,7 +142,7 @@ public class BlockDaylightDetector extends BlockContainer /** * Can this block provide power. Only wire currently seems to have this change based on its state. */ - public boolean canProvidePower() + public boolean canConnectToWire() { return true; } diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index 2bd32c28..f9d30fb2 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -6,7 +6,6 @@ import common.block.Material; import common.entity.item.EntityItem; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.CheatTab; import common.item.ItemStack; @@ -159,16 +158,6 @@ public class BlockDispenser extends BlockContainer implements Directional return new Vec3(d0, d1, d2); } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return Container.calcSignal(worldIn.getTileEntity(pos)); - } - /** * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render */ diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index c29761f0..7cf3711c 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -8,7 +8,6 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.Blocks; import common.init.Items; -import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.Item; import common.model.Model; @@ -196,16 +195,6 @@ public class BlockFurnace extends BlockContainer implements Rotatable super.onBlockRemoved(worldIn, pos, state); } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return Container.calcSignal(worldIn.getTileEntity(pos)); - } - public Item getItem(World worldIn, BlockPos pos) { return Items.furnace; diff --git a/common/src/main/java/common/block/tech/BlockHopper.java b/common/src/main/java/common/block/tech/BlockHopper.java index f0bbc18a..62b11b06 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -7,7 +7,6 @@ import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.CheatTab; import common.item.Item; @@ -195,16 +194,6 @@ public class BlockHopper extends BlockContainer implements DirectionalDown return true; } - public boolean hasSignalProcessing() - { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) - { - return Container.calcSignal(worldIn.getTileEntity(pos)); - } - public BlockLayer getBlockLayer() { return BlockLayer.CUTOUT_MIPPED; diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index 64b52811..20fcef25 100755 --- a/common/src/main/java/common/block/tech/BlockLever.java +++ b/common/src/main/java/common/block/tech/BlockLever.java @@ -231,20 +231,14 @@ public class BlockLever extends Block super.onBlockRemoved(worldIn, pos, state); } - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; - } - - public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing() == side ? 15 : 0); - } + public double getResistance(World worldIn, BlockPos pos, State state) { + return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); + } /** * Can this block provide power. Only wire currently seems to have this change based on its state. */ - public boolean canProvidePower() + public boolean canConnectToWire() { return true; } diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index 9941d92d..205a5a2c 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -6,7 +6,6 @@ import common.block.ITileEntityProvider; import common.block.Material; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.CheatTab; import common.properties.Property; @@ -62,14 +61,6 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti worldIn.removeTileEntity(pos); } - public boolean hasSignalProcessing() { - return true; - } - - public int getSignal(World worldIn, BlockPos pos, int input) { - return Container.calcSignal(worldIn.getTileEntity(pos)); - } - public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam) { super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam); TileEntity tileentity = worldIn.getTileEntity(pos); diff --git a/common/src/main/java/common/block/tech/BlockPressurePlate.java b/common/src/main/java/common/block/tech/BlockPressurePlate.java index c0b2f387..b6441680 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlate.java @@ -24,6 +24,10 @@ public class BlockPressurePlate extends BlockBasePressurePlate this.sensitivity = sensitivityIn; } + public double getResistance(World worldIn, BlockPos pos, State state) { + return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); + } + protected int getSignalStrength(State state) { return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; diff --git a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java index e5b0e10b..67b9509b 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java @@ -36,6 +36,10 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate } } + public double getResistance(World worldIn, BlockPos pos, State state) { + return state.getValue(POWER) > 0 ? (double)(15 - state.getValue(POWER)) * 10000.0 : super.getResistance(worldIn, pos, state); + } + protected int getSignalStrength(State state) { return ((Integer)state.getValue(POWER)).intValue(); diff --git a/common/src/main/java/common/block/tech/BlockTripWireHook.java b/common/src/main/java/common/block/tech/BlockTripWireHook.java index 9f6d184b..b53612f4 100755 --- a/common/src/main/java/common/block/tech/BlockTripWireHook.java +++ b/common/src/main/java/common/block/tech/BlockTripWireHook.java @@ -319,20 +319,14 @@ public class BlockTripWireHook extends Block implements Rotatable super.onBlockRemoved(worldIn, pos, state); } - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; - } - - public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (state.getValue(FACING) == side ? 15 : 0); - } + public double getResistance(World worldIn, BlockPos pos, State state) { + return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); + } /** * Can this block provide power. Only wire currently seems to have this change based on its state. */ - public boolean canProvidePower() + public boolean canConnectToWire() { return true; } diff --git a/common/src/main/java/common/block/tech/BlockWire.java b/common/src/main/java/common/block/tech/BlockWire.java index 30529155..6955c7da 100755 --- a/common/src/main/java/common/block/tech/BlockWire.java +++ b/common/src/main/java/common/block/tech/BlockWire.java @@ -1,7 +1,8 @@ package common.block.tech; -import java.util.EnumSet; +import java.util.ArrayDeque; import java.util.List; +import java.util.Queue; import java.util.Set; import common.block.Block; @@ -21,13 +22,10 @@ import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; -import common.util.ExtMath; import common.util.Facing; import common.util.Identifyable; -import common.util.ParticleType; import common.world.IBlockAccess; import common.world.IWorldAccess; -import common.world.AWorldClient; import common.world.State; import common.world.World; import common.world.AWorldServer; @@ -35,327 +33,211 @@ import common.world.AWorldServer; public class BlockWire extends Block { private static final Model wire_none = ModelProvider.getModelProvider().getModel("wire_cross") - .add(5, 0.25f, 5, 11, 0.25f, 11).noShade() - .u().uv(5, 5, 11, 11).tint().noCull() - .add(5, 0.25f, 5, 11, 0.25f, 11).noShade() - .u("wire_cross_overlay").uv(5, 5, 11, 11).noCull() + .add(2, 0.25f, 2, 14, 0.25f, 14).noShade() + .u("wire_line").uv(2, 2, 14, 14).noCull() ; private static final Model wire_nsew = ModelProvider.getModelProvider().getModel("wire_cross").uvLock() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(0, 0, 16, 16).noCull() + .u().uv(0, 0, 16, 16).noCull() ; private static final Model wire_unusueuw = ModelProvider.getModelProvider().getModel("wire_cross").uvLock() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(0, 0, 16, 16).noCull() + .u().uv(0, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0.25f, 0, 0, 0.25f, 16, 16).noShade() - .e("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0.25f, 0, 0, 0.25f, 16, 16).noShade() - .e("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .e("wire_line").uv(0, 0, 16, 16).rot(90).noCull() ; private static final Model wire_unus = ModelProvider.getModelProvider().getModel("wire_cross") .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() + .u("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() ; private static final Model wire_ueuw = ModelProvider.getModelProvider().getModel("wire_cross") .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line").uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line_overlay").uv(0, 0, 16, 16).noCull() + .u("wire_line").uv(0, 0, 16, 16).noCull() .add(0.25f, 0, 0, 0.25f, 16, 16).noShade() - .e("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0.25f, 0, 0, 0.25f, 16, 16).noShade() - .e("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .e("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() ; private static Model wire_n(boolean rot) { return ModelProvider.getModelProvider().getModel("wire_cross") .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .u("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot ? ModelRotation.X0_Y90 : ModelRotation.X0_Y0); } private static Model wire_ne(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u().uv(5, 0, 16, 11).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 11).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 9).noShade() + .u().uv(7, 0, 16, 9).noCull() .rotate(rot); } private static Model wire_uew(boolean rot) { Model model = ModelProvider.getModelProvider().getModel("wire_cross") .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line").uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line_overlay").uv(0, 0, 16, 16).noCull() + .u("wire_line").uv(0, 0, 16, 16).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull(); + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull(); return rot ? model.uvLock().rotate(ModelRotation.X0_Y180) : model; } private static Model wire_nue(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u().uv(5, 0, 16, 11).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 11).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 9).noShade() + .u().uv(7, 0, 16, 9).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(270).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(270).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(270).noCull() .rotate(rot); } private static Model wire_une(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u().uv(5, 0, 16, 11).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 11).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 9).noShade() + .u().uv(7, 0, 16, 9).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_nse(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .rotate(rot); } private static Model wire_uns(boolean lock, ModelRotation rot) { Model model = ModelProvider.getModelProvider().getModel("wire_cross") .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .u("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); return lock ? model.uvLock() : model; } private static Model wire_nsue(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(270).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(270).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(270).noCull() .rotate(rot); } private static Model wire_unse(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_nuse(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unue(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u().uv(5, 0, 16, 11).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 11).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 11).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 9).noShade() + .u().uv(7, 0, 16, 9).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unusue(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unusew(boolean rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(0, 0, 16, 16).noCull() + .u().uv(0, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot ? ModelRotation.X0_Y90 : ModelRotation.X0_Y0); } private static Model wire_unusuew(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(0, 0, 16, 16).noCull() + .u().uv(0, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unuse(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_nusue(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 15.75f, 16, 16, 15.75f).noShade() - .n("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .n("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unsew(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(0, 0, 16, 16).noCull() + .u().uv(0, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unsuew(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(0, 0, 16, 16).tint().noCull() - .add(0, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(0, 0, 16, 16).noCull() + .u().uv(0, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } private static Model wire_unsue(ModelRotation rot) { return ModelProvider.getModelProvider().getModel("wire_cross").uvLock() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u().uv(5, 0, 16, 16).tint().noCull() - .add(5, 0.25f, 0, 16, 0.25f, 16).noShade() - .u("wire_cross_overlay").uv(5, 0, 16, 16).noCull() + .add(7, 0.25f, 0, 16, 0.25f, 16).noShade() + .u().uv(7, 0, 16, 16).noCull() .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(0, 0, 0.25f, 16, 16, 0.25f).noShade() - .s("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .s("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line").uv(0, 0, 16, 16).rot(90).tint().noCull() - .add(15.75f, 0, 0, 15.75f, 16, 16).noShade() - .w("wire_line_overlay").uv(0, 0, 16, 16).rot(90).noCull() + .w("wire_line").uv(0, 0, 16, 16).rot(90).noCull() .rotate(rot); } @@ -364,7 +246,7 @@ public class BlockWire extends Block public static final PropertyEnum SOUTH = PropertyEnum.create("south", EnumAttachPosition.class); public static final PropertyEnum WEST = PropertyEnum.create("west", EnumAttachPosition.class); public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15); - private boolean canProvidePower = true; + private final Set blocksNeedingUpdate = Sets.newHashSet(); public BlockWire() @@ -421,12 +303,6 @@ public class BlockWire extends Block return false; } - public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) - { - State iblockstate = worldIn.getState(pos); - return iblockstate.getBlock() != this ? super.colorMultiplier(worldIn, pos, renderPass) : this.colorMultiplier(((Integer)iblockstate.getValue(POWER)).intValue()); - } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return worldIn.isBlockSolid(pos.down()) || worldIn.getState(pos.down()).getBlock() == Blocks.glowstone; @@ -452,9 +328,9 @@ public class BlockWire extends Block int i = ((Integer)state.getValue(POWER)).intValue(); int j = 0; j = this.getMaxCurrentStrength(worldIn, pos2, j); - this.canProvidePower = false; +// this.canProvidePower = false; int k = 0; // TODO: worldIn.isBlockIndirectlyGettingPowered(pos1); - this.canProvidePower = true; +// this.canProvidePower = true; if (k > 0 && k > j - 1) { @@ -647,57 +523,6 @@ public class BlockWire extends Block return this.getItem(); } - public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - return !this.canProvidePower ? 0 : this.getWeakPower(worldIn, pos, state, side); - } - - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) - { - if (!this.canProvidePower) - { - return 0; - } - else - { - int i = ((Integer)state.getValue(POWER)).intValue(); - - if (i == 0) - { - return 0; - } - else if (side == Facing.UP) - { - return i; - } - else - { - EnumSet enumset = EnumSet.noneOf(Facing.class); - - for (Facing enumfacing : Facing.Plane.HORIZONTAL) - { - if (this.isConnectedTo(worldIn, pos, enumfacing)) - { - enumset.add(enumfacing); - } - } - - if (side.getAxis().isHorizontal() && enumset.isEmpty()) - { - return i; - } - else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY())) - { - return i; - } - else - { - return 0; - } - } - } - } - private boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, Facing side) { BlockPos blockpos = pos.offset(side); @@ -733,59 +558,50 @@ public class BlockWire extends Block // } else { - return block.canProvidePower() && side != null; + return block.canConnectToWire() && side != null; } } - - /** - * Can this block provide power. Only wire currently seems to have this change based on its state. - */ - public boolean canProvidePower() - { - return this.canProvidePower; + + public double doPowerPhase(AWorldServer world, BlockPos pos, Random rand, double voltage, double currentLimit) { // TODO: implement + Queue queue = new ArrayDeque(); + Set traversed = Sets.newHashSet(); + traversed.add(pos); + queue.add(pos); + double converted = 0.0; + while((pos = queue.poll()) != null) { + for(Facing off : Facing.values()) { + BlockPos bpos = pos.offset(off); + if(!traversed.contains(bpos)) { + traversed.add(bpos); + State state = world.getState(bpos); + if(state.getBlock().canConnectToWire() || state.getBlock() instanceof BlockWire) { + double power = state.getBlock().powerTick(world, bpos, state, rand, voltage, currentLimit); + converted += power; + voltage -= state.getBlock().getResistance(world, bpos, state) * (power / voltage); + if(voltage <= 0.0) { + queue.clear(); + break; + } + queue.add(bpos); + } + } + } + } + return converted; } - private int colorMultiplier(int powerLevel) - { - float f = (float)powerLevel / 15.0F; - float f1 = f * 0.6F + 0.4F; + public double getResistance(World worldIn, BlockPos pos, State state) { + return 5.0; + } - if (powerLevel == 0) - { - f1 = 0.3F; - } + public double powerTick(World worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) { + return 0.01; + } - float f2 = f * f * 0.7F - 0.5F; - float f3 = f * f * 0.6F - 0.7F; - - if (f2 < 0.0F) - { - f2 = 0.0F; - } - - if (f3 < 0.0F) - { - f3 = 0.0F; - } - - int i = ExtMath.clampi((int)(f1 * 255.0F), 0, 255); - int j = ExtMath.clampi((int)(f2 * 255.0F), 0, 255); - int k = ExtMath.clampi((int)(f3 * 255.0F), 0, 255); - return -16777216 | i << 16 | j << 8 | k; - } - - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) - { - int i = ((Integer)state.getValue(POWER)).intValue(); - - if (i != 0) - { - double d0 = (double)pos.getX() + 0.5D + ((double)rand.floatv() - 0.5D) * 0.2D; - double d1 = (double)((float)pos.getY() + 0.0625F); - double d2 = (double)pos.getZ() + 0.5D + ((double)rand.floatv() - 0.5D) * 0.2D; - worldIn.spawnParticle(ParticleType.DUST, d0, d1, d2, this.colorMultiplier(i)); - } - } +// public boolean canConnectToWire() +// { +// return true; +// } public Item getItem(World worldIn, BlockPos pos) { diff --git a/common/src/main/java/common/inventory/Container.java b/common/src/main/java/common/inventory/Container.java index 629713f6..56ab7bb2 100755 --- a/common/src/main/java/common/inventory/Container.java +++ b/common/src/main/java/common/inventory/Container.java @@ -9,7 +9,6 @@ import common.entity.npc.EntityNPC; import common.item.Item; import common.item.ItemStack; import common.network.IPlayer; -import common.tileentity.TileEntity; import common.util.ExtMath; public abstract class Container @@ -772,39 +771,4 @@ public abstract class Container { return true; } - - /** - * Like the version that takes an inventory. If the given TileEntity is not an Inventory, 0 is returned instead. - */ - public static int calcSignal(TileEntity te) - { - return te instanceof IInventory ? calcSignalFrom((IInventory)te) : 0; - } - - public static int calcSignalFrom(IInventory inv) - { - if (inv == null) - { - return 0; - } - else - { - int i = 0; - float f = 0.0F; - - for (int j = 0; j < inv.getSizeInventory(); ++j) - { - ItemStack itemstack = inv.getStackInSlot(j); - - if (itemstack != null) - { - f += (float)itemstack.getSize() / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize()); - ++i; - } - } - - f = f / (float)inv.getSizeInventory(); - return ExtMath.floorf(f * 14.0F) + (i > 0 ? 1 : 0); - } - } }