From 5a69c0545b4c6e0ef8d12deab52265f8815e384b Mon Sep 17 00:00:00 2001 From: Sen Date: Wed, 16 Jul 2025 11:02:09 +0200 Subject: [PATCH] the (no) redstone patch TM --- .../textures/blocks/concrete_plate.png | Bin 252 -> 0 bytes .../resources/textures/blocks/wire_cross.png | Bin 5871 -> 5399 bytes .../textures/blocks/wire_cross_overlay.png | Bin 75 -> 0 bytes .../resources/textures/blocks/wire_line.png | Bin 5688 -> 5196 bytes .../textures/blocks/wire_line_overlay.png | Bin 164 -> 0 bytes .../main/resources/textures/items/wire.png | Bin 4755 -> 4921 bytes common/src/main/java/common/block/Block.java | 34 +- .../common/block/artificial/BlockCake.java | 10 - .../block/artificial/BlockPortalFrame.java | 10 - .../block/tech/BlockBasePressurePlate.java | 13 +- .../common/block/tech/BlockBrewingStand.java | 11 - .../java/common/block/tech/BlockButton.java | 14 +- .../java/common/block/tech/BlockCauldron.java | 10 - .../java/common/block/tech/BlockChest.java | 11 - .../block/tech/BlockDaylightDetector.java | 9 +- .../common/block/tech/BlockDispenser.java | 11 - .../java/common/block/tech/BlockFurnace.java | 11 - .../java/common/block/tech/BlockHopper.java | 11 - .../java/common/block/tech/BlockLever.java | 14 +- .../java/common/block/tech/BlockMachine.java | 9 - .../common/block/tech/BlockPressurePlate.java | 4 + .../tech/BlockPressurePlateWeighted.java | 4 + .../common/block/tech/BlockTripWireHook.java | 14 +- .../java/common/block/tech/BlockWire.java | 412 +++++------------- .../main/java/common/inventory/Container.java | 36 -- 25 files changed, 152 insertions(+), 496 deletions(-) delete mode 100644 client/src/main/resources/textures/blocks/concrete_plate.png delete mode 100755 client/src/main/resources/textures/blocks/wire_cross_overlay.png delete mode 100755 client/src/main/resources/textures/blocks/wire_line_overlay.png 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 090657d35ab2345c4c0c10b69fc3646bf5278d85..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00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ypU1InyEQ?u ztkp6JzIel02euK8o?x7}^;{%-63Q8AnMyS3Tl=?nFp>t`-(tXGj#|6gA^ zaUWYtl3e{{Pv(3k!DX9wF*7onWEPYpyH=FgDrJIFHa#c*AD#d@X1sURV+-kg*)eV{gdLp_7Z!K~(! z4Ok5(cd_nLu{29eNi|P0)-^Fpv;+}}x=AUiiMr+{X=z3Vmd2*$h6a-}*a9YBWV7Wn zv@|g`F)=kXwluZ0Fq$mGE+J*1#HFC1kdkcWmS2>c2y}F2Zen_>enDRPWHa_a0b?rz zb1OsR5JLkiQ%froi^d6vG^3Y!#H6o>^Q{ROv~;TL^WV&#-T0nw-L|Sg&9Mic>33P%sCV78K-UrWPT& zB{;PZ7C1Q6A?XK)Z9YNm$ja&=+MV+YDvL7HGfMo+^YGe_MIpolpUmXcykfkTBP+4d z2gR66>gHZq|Kvlw?E{-7<{>c)oixWh8m<$pUfW`|jFfMngNd`(Yc)I$ztaD0e0s#D; BC$j(m diff --git a/client/src/main/resources/textures/items/wire.png b/client/src/main/resources/textures/items/wire.png index 1b3aa44784f5a9518dedd311eb97dc03150196d8..2bb7d0c22fb54de0ea601e665b2d707d26ed41b6 100755 GIT binary patch delta 1346 zcmV-I1-<%{CAlV$B!9qqR9JLUVRs;Ka&Km7Y-J#Hd2nSQWq4_3004N}&6aJF8iw(ftIl(^hmhf{?Fgt{e_D?vkRIm<`_M$ zkVEEziTUFyvnL;Bzkc|0awB)w1BOU2%JI|UT7SyP-)N$OnSXvzWOY5*ZXe{Z^xK`H zWk`lcj7eLH@=_#xJfNkZ9NY3STl%<#Z9m3#?!=DUjZV_keJQ#B9TK9~6hdL%g~X#5 z35NqRZgo;HN$5!w3(-$WL?48gCkV*1I9*qUM}4>&o-Vqfa?R+u+}+a(yq3sakmEHz zl{?bsRA%TuSbq+-W_&BpcBpdxF8br{y;+}o#x6>T2z6YWI=3=sShvB%Fl`R{qEEOL zD$;Bj&5+d<)S9n;L#vdDfvZ!XMuj@HEJ;#uNmEQIS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K5q@~07*qoM6N<$g6lY8dH?_b 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); - } - } }