From 3db0dca0733fea4baaa7a51f8ba4a93c2c545edd Mon Sep 17 00:00:00 2001 From: Sen Date: Fri, 27 Jun 2025 18:04:17 +0200 Subject: [PATCH] remove block metadata T2 --- client/src/main/java/client/Client.java | 2 +- common/src/main/java/common/block/Block.java | 35 ++++++++---- .../common/block/artificial/BlockBed.java | 4 -- .../common/block/artificial/BlockCake.java | 8 --- .../common/block/artificial/BlockDoor.java | 34 ------------ .../common/block/artificial/BlockFence.java | 8 --- .../block/artificial/BlockFenceGate.java | 21 ------- .../common/block/artificial/BlockHay.java | 20 ------- .../common/block/artificial/BlockLadder.java | 8 --- .../common/block/artificial/BlockPane.java | 8 --- .../common/block/artificial/BlockPortal.java | 9 --- .../block/artificial/BlockPortalFrame.java | 16 ------ .../block/artificial/BlockQuartzPillar.java | 15 ----- .../common/block/artificial/BlockSkull.java | 4 -- .../common/block/artificial/BlockSlab.java | 8 --- .../common/block/artificial/BlockStairs.java | 16 ------ .../block/artificial/BlockTrapDoor.java | 21 ------- .../common/block/artificial/BlockWall.java | 4 -- .../common/block/foliage/BlockCactus.java | 8 --- .../java/common/block/foliage/BlockCocoa.java | 11 ---- .../java/common/block/foliage/BlockCrops.java | 8 --- .../block/foliage/BlockDoublePlant.java | 10 ---- .../common/block/foliage/BlockFarmland.java | 8 --- .../java/common/block/foliage/BlockGrass.java | 8 --- .../block/foliage/BlockHugeMushroom.java | 8 --- .../common/block/foliage/BlockLeaves.java | 10 ---- .../common/block/foliage/BlockLilyPad.java | 5 -- .../java/common/block/foliage/BlockLog.java | 18 ------ .../common/block/foliage/BlockMycelium.java | 8 --- .../common/block/foliage/BlockPumpkin.java | 4 -- .../java/common/block/foliage/BlockReed.java | 8 --- .../common/block/foliage/BlockSapling.java | 11 ---- .../java/common/block/foliage/BlockStem.java | 8 --- .../common/block/foliage/BlockTianSoil.java | 5 -- .../java/common/block/foliage/BlockVine.java | 30 ---------- .../java/common/block/foliage/BlockWart.java | 8 --- .../java/common/block/liquid/BlockLiquid.java | 8 --- .../java/common/block/natural/BlockFire.java | 8 --- .../java/common/block/natural/BlockOre.java | 2 +- .../common/block/natural/BlockPodzol.java | 4 -- .../java/common/block/natural/BlockSnow.java | 8 --- .../java/common/block/tech/BlockAnvil.java | 10 ---- .../common/block/tech/BlockBrewingStand.java | 18 ------ .../java/common/block/tech/BlockButton.java | 42 -------------- .../java/common/block/tech/BlockCauldron.java | 8 --- .../java/common/block/tech/BlockChest.java | 8 --- .../block/tech/BlockDaylightDetector.java | 8 --- .../common/block/tech/BlockDispenser.java | 16 ------ .../java/common/block/tech/BlockFurnace.java | 8 --- .../java/common/block/tech/BlockHopper.java | 16 ------ .../java/common/block/tech/BlockLever.java | 16 ------ .../java/common/block/tech/BlockMachine.java | 4 -- .../common/block/tech/BlockPistonBase.java | 16 ------ .../common/block/tech/BlockPistonHead.java | 16 ------ .../common/block/tech/BlockPistonMoving.java | 16 ------ .../common/block/tech/BlockPressurePlate.java | 8 --- .../tech/BlockPressurePlateWeighted.java | 8 --- .../java/common/block/tech/BlockRail.java | 8 --- .../common/block/tech/BlockRailDetector.java | 16 ------ .../common/block/tech/BlockRailPowered.java | 16 ------ .../block/tech/BlockRedstoneComparator.java | 21 ------- .../block/tech/BlockRedstoneRepeater.java | 11 ---- .../common/block/tech/BlockRedstoneWire.java | 8 --- .../main/java/common/block/tech/BlockTNT.java | 8 --- .../java/common/block/tech/BlockTorch.java | 34 ------------ .../java/common/block/tech/BlockTripWire.java | 30 ---------- .../common/block/tech/BlockTripWireHook.java | 21 ------- .../common/block/tech/BlockWarpChest.java | 8 --- .../common/block/tile/BlockBannerHanging.java | 5 -- .../block/tile/BlockBannerStanding.java | 5 -- .../common/block/tile/BlockStandingSign.java | 8 --- .../java/common/block/tile/BlockWallSign.java | 8 --- .../main/java/common/init/BlockRegistry.java | 35 ++---------- common/src/main/java/common/world/State.java | 55 +++---------------- .../server/clipboard/ReorderRegistry.java | 19 ++++--- .../server/clipboard/RotationRegistry.java | 2 +- .../server/command/commands/CommandBlock.java | 2 +- 77 files changed, 51 insertions(+), 934 deletions(-) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index ebc4af3d..69d904fb 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -1930,7 +1930,7 @@ public class Client implements IThreadListener { String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ()) ); for(Entry entry : block.getProperties().entrySet()) { - str.append("\n" + (block.getSavedProperties().contains(entry.getKey()) ? TextColor.NEON : TextColor.LGRAY) + entry.getKey().getName() + TextColor.RESET + ": " + (entry.getValue() instanceof Boolean bool ? (bool ? TextColor.GREEN : TextColor.RED) + "" + entry.getValue() + TextColor.RESET : entry.getValue())); + str.append("\n" + (block.getBlock().getSavedProperties().contains(entry.getKey()) ? TextColor.NEON : TextColor.LGRAY) + entry.getKey().getName() + TextColor.RESET + ": " + (entry.getValue() instanceof Boolean bool ? (bool ? TextColor.GREEN : TextColor.RED) + "" + entry.getValue() + TextColor.RESET : entry.getValue())); } return str.toString(); diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index 6ea1c5a3..e7e54576 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -9,6 +9,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; +import java.util.Set; +import java.util.Map.Entry; import java.util.function.Function; import common.block.artificial.BlockSlab; @@ -17,6 +19,7 @@ import common.collect.ImmutableMap; import common.collect.Iterables; import common.collect.Lists; import common.collect.Maps; +import common.collect.Sets; import common.collect.UnmodifiableIterator; import common.enchantment.EnchantmentHelper; import common.entity.Entity; @@ -43,6 +46,7 @@ import common.util.Facing; import common.util.HitPosition; import common.util.Vec3; import common.util.HitPosition.ObjectType; +import common.util.Pair; import common.vars.Vars; import common.world.Explosion; import common.world.IBlockAccess; @@ -289,6 +293,24 @@ public class Block { } return ImmutableList.copyOf(list); } + + private static ImmutableList getStateList(ImmutableList saved, ImmutableList states) { + Set>> uniq = Sets.newHashSet(); + List list = Lists.newArrayList(); + for(State state : states) { + List> props = Lists.newArrayList(); + for(Entry entry : state.getProperties().entrySet()) { + if(saved.contains(entry.getKey())) + props.add(new Pair(entry.getKey(), entry.getValue())); + } + if(!uniq.contains(props)) { + uniq.add(props); + list.add(state); + } + } + uniq.clear(); + return ImmutableList.copyOf(list); + } public Block(Material material) { this.miningLevel = (material == Material.SOLID || material == Material.HEAVY) ? 0 : -1; @@ -306,7 +328,7 @@ public class Block { this.states = getStateList(this.properties, this); this.setDefaultState(this.getBaseState()); this.savedProps = getPropertyList(this.getProperties(), this.getUnsavedProperties()); - this.saved = getStateList(this.savedProps, this); + this.saved = getStateList(this.savedProps, this.states); } public Block setStepSound(SoundType sound) { @@ -429,7 +451,7 @@ public class Block { return this.states.get(0); } - public Collection getPropertyMap() { + public Collection getSavedProperties() { return this.savedProps; } @@ -437,15 +459,6 @@ public class Block { return this.getState(); } - public int getMetaFromState(State state) { - if(state != null && !state.getPropertyNames().isEmpty()) { - throw new IllegalArgumentException("Don\'t know how to convert " + state + " back into data..."); - } - else { - return 0; - } - } - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) { return state; } diff --git a/common/src/main/java/common/block/artificial/BlockBed.java b/common/src/main/java/common/block/artificial/BlockBed.java index 1d7f8668..d2697694 100755 --- a/common/src/main/java/common/block/artificial/BlockBed.java +++ b/common/src/main/java/common/block/artificial/BlockBed.java @@ -185,10 +185,6 @@ public class BlockBed extends Block implements Rotatable { .withProperty(FACING, Facing.getHorizontal(meta)); } - public int getMetaFromState(State state) { - return ((Facing)state.getValue(FACING)).getHorizontalIndex() | (state.getValue(PART) == BlockBed.EnumPartType.HEAD ? 8 : 0); - } - protected Property[] getProperties() { return new Property[] {FACING, PART}; } diff --git a/common/src/main/java/common/block/artificial/BlockCake.java b/common/src/main/java/common/block/artificial/BlockCake.java index 5ed23440..2befa3dc 100755 --- a/common/src/main/java/common/block/artificial/BlockCake.java +++ b/common/src/main/java/common/block/artificial/BlockCake.java @@ -222,14 +222,6 @@ public class BlockCake extends Block return this.getState().withProperty(BITES, Integer.valueOf(meta > 6 ? 0 : meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(BITES)).intValue(); - } - protected Property[] getProperties() { return new Property[] {BITES}; diff --git a/common/src/main/java/common/block/artificial/BlockDoor.java b/common/src/main/java/common/block/artificial/BlockDoor.java index f82e39b4..03a24f82 100755 --- a/common/src/main/java/common/block/artificial/BlockDoor.java +++ b/common/src/main/java/common/block/artificial/BlockDoor.java @@ -378,40 +378,6 @@ public class BlockDoor extends Block implements Rotatable return (meta & 8) > 0 ? this.getState().withProperty(HALF, BlockDoor.EnumDoorHalf.UPPER).withProperty(HINGE, (meta & 1) > 0 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf((meta & 2) > 0)) : this.getState().withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER).withProperty(FACING, Facing.getHorizontal(meta & 3).rotateYCCW()).withProperty(OPEN, Boolean.valueOf((meta & 4) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - - if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER) - { - i = i | 8; - - if (state.getValue(HINGE) == BlockDoor.EnumHingePosition.RIGHT) - { - i |= 1; - } - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 2; - } - } - else - { - i = i | ((Facing)state.getValue(FACING)).rotateY().getHorizontalIndex(); - - if (((Boolean)state.getValue(OPEN)).booleanValue()) - { - i |= 4; - } - } - - return i; - } - protected static int removeHalfBit(int meta) { return meta & 7; diff --git a/common/src/main/java/common/block/artificial/BlockFence.java b/common/src/main/java/common/block/artificial/BlockFence.java index 5e072bcb..59358c9e 100755 --- a/common/src/main/java/common/block/artificial/BlockFence.java +++ b/common/src/main/java/common/block/artificial/BlockFence.java @@ -181,14 +181,6 @@ public class BlockFence extends Block return worldIn.client ? true : ItemLead.attachToFence(playerIn, worldIn, pos); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return 0; - } - /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. diff --git a/common/src/main/java/common/block/artificial/BlockFenceGate.java b/common/src/main/java/common/block/artificial/BlockFenceGate.java index 53384e89..eae45f15 100755 --- a/common/src/main/java/common/block/artificial/BlockFenceGate.java +++ b/common/src/main/java/common/block/artificial/BlockFenceGate.java @@ -179,27 +179,6 @@ public class BlockFenceGate extends Block implements Rotatable return this.getState().withProperty(FACING, Facing.getHorizontal(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(POWERED, Boolean.valueOf((meta & 8) != 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - if (((Boolean)state.getValue(OPEN)).booleanValue()) - { - i |= 4; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, OPEN, POWERED, IN_WALL}; diff --git a/common/src/main/java/common/block/artificial/BlockHay.java b/common/src/main/java/common/block/artificial/BlockHay.java index a93007bd..55946e64 100755 --- a/common/src/main/java/common/block/artificial/BlockHay.java +++ b/common/src/main/java/common/block/artificial/BlockHay.java @@ -41,26 +41,6 @@ public class BlockHay extends BlockRotatedPillar return this.getState().withProperty(AXIS, enumfacing$axis); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - Facing.Axis enumfacing$axis = (Facing.Axis)state.getValue(AXIS); - - if (enumfacing$axis == Facing.Axis.X) - { - i |= 4; - } - else if (enumfacing$axis == Facing.Axis.Z) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {AXIS}; diff --git a/common/src/main/java/common/block/artificial/BlockLadder.java b/common/src/main/java/common/block/artificial/BlockLadder.java index b8d4fc80..65bea537 100755 --- a/common/src/main/java/common/block/artificial/BlockLadder.java +++ b/common/src/main/java/common/block/artificial/BlockLadder.java @@ -151,14 +151,6 @@ public class BlockLadder extends Block implements Rotatable return this.getState().withProperty(FACING, enumfacing); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/artificial/BlockPane.java b/common/src/main/java/common/block/artificial/BlockPane.java index c8d474bb..53355517 100755 --- a/common/src/main/java/common/block/artificial/BlockPane.java +++ b/common/src/main/java/common/block/artificial/BlockPane.java @@ -195,14 +195,6 @@ public class BlockPane extends Block return BlockLayer.CUTOUT_MIPPED; } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return 0; - } - protected Property[] getProperties() { return new Property[] {NORTH, EAST, WEST, SOUTH}; diff --git a/common/src/main/java/common/block/artificial/BlockPortal.java b/common/src/main/java/common/block/artificial/BlockPortal.java index 0b82a136..1c6a8848 100755 --- a/common/src/main/java/common/block/artificial/BlockPortal.java +++ b/common/src/main/java/common/block/artificial/BlockPortal.java @@ -19,7 +19,6 @@ import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; -import common.util.Facing.Axis; import common.world.IWorldAccess; import common.world.AWorldClient; import common.world.State; @@ -269,14 +268,6 @@ public class BlockPortal extends Block .withProperty(DIM, meta & 7); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return (state.getValue(AXIS) == Axis.Z ? 8 : 0) | state.getValue(DIM); - } - protected Property[] getProperties() { return new Property[] {AXIS, DIM}; diff --git a/common/src/main/java/common/block/artificial/BlockPortalFrame.java b/common/src/main/java/common/block/artificial/BlockPortalFrame.java index 2aeaa4f7..7b4d8705 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -115,22 +115,6 @@ public class BlockPortalFrame extends Block implements Rotatable return this.getState().withProperty(ORB, Boolean.valueOf((meta & 4) != 0)).withProperty(FACING, Facing.getHorizontal(meta & 3)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - - if (((Boolean)state.getValue(ORB)).booleanValue()) - { - i |= 4; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, ORB}; diff --git a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java index ddfbecdd..b8ca8a2f 100644 --- a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java +++ b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java @@ -52,21 +52,6 @@ public class BlockQuartzPillar extends BlockRotatedPillar return state; } - public int getMetaFromState(State state) - { - int meta = 0; - switch (state.getValue(AXIS)) - { - case X: - meta = 1; - break; - case Z: - meta = 2; - break; - } - return meta; - } - protected Property[] getProperties() { return new Property[] {AXIS}; diff --git a/common/src/main/java/common/block/artificial/BlockSkull.java b/common/src/main/java/common/block/artificial/BlockSkull.java index c6788d43..6b307822 100755 --- a/common/src/main/java/common/block/artificial/BlockSkull.java +++ b/common/src/main/java/common/block/artificial/BlockSkull.java @@ -38,10 +38,6 @@ public class BlockSkull extends Block implements Rotatable { return this.getState().withProperty(FACING, Facing.getHorizontal(meta)); } - public int getMetaFromState(State state) { - return state.getValue(FACING).getHorizontalIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; } diff --git a/common/src/main/java/common/block/artificial/BlockSlab.java b/common/src/main/java/common/block/artificial/BlockSlab.java index 347125a8..fbb0fd1c 100755 --- a/common/src/main/java/common/block/artificial/BlockSlab.java +++ b/common/src/main/java/common/block/artificial/BlockSlab.java @@ -63,14 +63,6 @@ public class BlockSlab extends Block implements Directional .withProperty(FACING, (meta == 0 || meta >= 6) ? Facing.DOWN : (meta == 1 ? Facing.UP : Facing.getHorizontal(meta - 2))); } - - public int getMetaFromState(State state) - { - if(state.getValue(DOUBLE)) - return state.getValue(SEAMLESS) ? 7 : 6; - Facing dir = state.getValue(FACING); - return dir == Facing.DOWN ? 0 : (dir == Facing.UP ? 1 : (dir.getHorizontalIndex() + 2)); - } protected Property[] getProperties() { diff --git a/common/src/main/java/common/block/artificial/BlockStairs.java b/common/src/main/java/common/block/artificial/BlockStairs.java index 17492719..73888e39 100755 --- a/common/src/main/java/common/block/artificial/BlockStairs.java +++ b/common/src/main/java/common/block/artificial/BlockStairs.java @@ -746,22 +746,6 @@ public class BlockStairs extends Block implements Rotatable return iblockstate; } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - - if (state.getValue(HALF) == BlockStairs.EnumHalf.TOP) - { - i |= 4; - } - - i = i | 5 - ((Facing)state.getValue(FACING)).getIndex(); - return i; - } - /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. diff --git a/common/src/main/java/common/block/artificial/BlockTrapDoor.java b/common/src/main/java/common/block/artificial/BlockTrapDoor.java index b5e2adca..ca8e72d0 100755 --- a/common/src/main/java/common/block/artificial/BlockTrapDoor.java +++ b/common/src/main/java/common/block/artificial/BlockTrapDoor.java @@ -265,27 +265,6 @@ public class BlockTrapDoor extends Block implements Rotatable return this.getState().withProperty(FACING, getFacing(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(HALF, (meta & 8) == 0 ? BlockTrapDoor.DoorHalf.BOTTOM : BlockTrapDoor.DoorHalf.TOP); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | getMetaForFacing((Facing)state.getValue(FACING)); - - if (((Boolean)state.getValue(OPEN)).booleanValue()) - { - i |= 4; - } - - if (state.getValue(HALF) == BlockTrapDoor.DoorHalf.TOP) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, OPEN, HALF}; diff --git a/common/src/main/java/common/block/artificial/BlockWall.java b/common/src/main/java/common/block/artificial/BlockWall.java index 1ca2a161..692d5cdd 100755 --- a/common/src/main/java/common/block/artificial/BlockWall.java +++ b/common/src/main/java/common/block/artificial/BlockWall.java @@ -142,10 +142,6 @@ public class BlockWall extends Block return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); } - public int getMetaFromState(State state) { - return 0; - } - protected Property[] getProperties() { return new Property[] {UP, NORTH, EAST, WEST, SOUTH}; diff --git a/common/src/main/java/common/block/foliage/BlockCactus.java b/common/src/main/java/common/block/foliage/BlockCactus.java index 7a496474..268e767e 100755 --- a/common/src/main/java/common/block/foliage/BlockCactus.java +++ b/common/src/main/java/common/block/foliage/BlockCactus.java @@ -153,14 +153,6 @@ public class BlockCactus extends Block return this.getState().withProperty(AGE, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(AGE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {AGE}; diff --git a/common/src/main/java/common/block/foliage/BlockCocoa.java b/common/src/main/java/common/block/foliage/BlockCocoa.java index 71c03c02..aee6d9d9 100755 --- a/common/src/main/java/common/block/foliage/BlockCocoa.java +++ b/common/src/main/java/common/block/foliage/BlockCocoa.java @@ -208,17 +208,6 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable return this.getState().withProperty(FACING, Facing.getHorizontal(meta)).withProperty(AGE, Integer.valueOf((meta & 12) == 12 ? 0 : ((meta & 12) >> 2))); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - i = i | ((Integer)state.getValue(AGE)).intValue() << 2; - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, AGE}; diff --git a/common/src/main/java/common/block/foliage/BlockCrops.java b/common/src/main/java/common/block/foliage/BlockCrops.java index 6b5e57ee..c0294da8 100755 --- a/common/src/main/java/common/block/foliage/BlockCrops.java +++ b/common/src/main/java/common/block/foliage/BlockCrops.java @@ -210,14 +210,6 @@ public class BlockCrops extends BlockBush implements IGrowable return this.getState().withProperty(AGE, Integer.valueOf(meta > 7 ? 0 : meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(AGE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {AGE}; diff --git a/common/src/main/java/common/block/foliage/BlockDoublePlant.java b/common/src/main/java/common/block/foliage/BlockDoublePlant.java index e194886d..d92b04a0 100755 --- a/common/src/main/java/common/block/foliage/BlockDoublePlant.java +++ b/common/src/main/java/common/block/foliage/BlockDoublePlant.java @@ -1,7 +1,6 @@ package common.block.foliage; import common.block.Block; -import common.block.Rotatable; import common.block.Material; import common.block.SoundType; import common.color.Colorizer; @@ -20,7 +19,6 @@ import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; -import common.util.Facing; import common.util.Identifyable; import common.util.Facing.Axis; import common.vars.Vars; @@ -266,14 +264,6 @@ public class BlockDoublePlant extends BlockBush implements IGrowable return (meta & 8) > 0 ? this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER) : this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 : 0; - } - protected Property[] getProperties() { return new Property[] {HALF}; diff --git a/common/src/main/java/common/block/foliage/BlockFarmland.java b/common/src/main/java/common/block/foliage/BlockFarmland.java index 1ffb8066..a10af9f7 100755 --- a/common/src/main/java/common/block/foliage/BlockFarmland.java +++ b/common/src/main/java/common/block/foliage/BlockFarmland.java @@ -164,14 +164,6 @@ public class BlockFarmland extends Block return this.getState().withProperty(MOISTURE, Integer.valueOf(meta & 7)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(MOISTURE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {MOISTURE}; diff --git a/common/src/main/java/common/block/foliage/BlockGrass.java b/common/src/main/java/common/block/foliage/BlockGrass.java index 66b7d827..52be0176 100755 --- a/common/src/main/java/common/block/foliage/BlockGrass.java +++ b/common/src/main/java/common/block/foliage/BlockGrass.java @@ -124,14 +124,6 @@ public class BlockGrass extends Block implements IGrowable return BlockLayer.CUTOUT_MIPPED; } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return 0; - } - protected Property[] getProperties() { return new Property[] {SNOWY}; diff --git a/common/src/main/java/common/block/foliage/BlockHugeMushroom.java b/common/src/main/java/common/block/foliage/BlockHugeMushroom.java index 0079f1d6..bb8c78e1 100755 --- a/common/src/main/java/common/block/foliage/BlockHugeMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockHugeMushroom.java @@ -87,14 +87,6 @@ public class BlockHugeMushroom extends Block return this.getState().withProperty(VARIANT, BlockHugeMushroom.EnumType.byMetadata(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)).getMetadata(); - } - protected Property[] getProperties() { return new Property[] {VARIANT}; diff --git a/common/src/main/java/common/block/foliage/BlockLeaves.java b/common/src/main/java/common/block/foliage/BlockLeaves.java index d95cb516..0c1cc2ff 100755 --- a/common/src/main/java/common/block/foliage/BlockLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockLeaves.java @@ -308,16 +308,6 @@ public class BlockLeaves extends BlockLeavesBase return this.getState().withProperty(DECAY, Boolean.valueOf((meta & 8) == 0)); } - public int getMetaFromState(State state) { - int i = 0; - - if(!((Boolean)state.getValue(DECAY)).booleanValue()) { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {DECAY}; } diff --git a/common/src/main/java/common/block/foliage/BlockLilyPad.java b/common/src/main/java/common/block/foliage/BlockLilyPad.java index 6d6d24bb..81a64ba6 100755 --- a/common/src/main/java/common/block/foliage/BlockLilyPad.java +++ b/common/src/main/java/common/block/foliage/BlockLilyPad.java @@ -91,11 +91,6 @@ public class BlockLilyPad extends BlockBush implements Rotatable { return this.getState().withProperty(FACING, Facing.getHorizontal(meta)); } - - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getHorizontalIndex(); - } protected Property[] getProperties() { diff --git a/common/src/main/java/common/block/foliage/BlockLog.java b/common/src/main/java/common/block/foliage/BlockLog.java index ae209891..aa16b972 100755 --- a/common/src/main/java/common/block/foliage/BlockLog.java +++ b/common/src/main/java/common/block/foliage/BlockLog.java @@ -89,24 +89,6 @@ public class BlockLog extends BlockRotatedPillar return state; } - public int getMetaFromState(State state) - { - int meta = 0; - - switch ((Facing.Axis)state.getValue(AXIS)) - { - case X: - meta = 1; - break; - - case Z: - meta = 2; - break; - } - - return meta; - } - protected Property[] getProperties() { return new Property[] {AXIS}; diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index d13bda0e..72c13857 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -87,14 +87,6 @@ public class BlockMycelium extends Block return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return 0; - } - protected Property[] getProperties() { return new Property[] {SNOWY}; diff --git a/common/src/main/java/common/block/foliage/BlockPumpkin.java b/common/src/main/java/common/block/foliage/BlockPumpkin.java index 201f602b..d3b4c9be 100755 --- a/common/src/main/java/common/block/foliage/BlockPumpkin.java +++ b/common/src/main/java/common/block/foliage/BlockPumpkin.java @@ -33,10 +33,6 @@ public class BlockPumpkin extends Block implements Rotatable { return this.getState().withProperty(FACING, Facing.getHorizontal(meta)); } - public int getMetaFromState(State state) { - return state.getValue(FACING).getHorizontalIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; } diff --git a/common/src/main/java/common/block/foliage/BlockReed.java b/common/src/main/java/common/block/foliage/BlockReed.java index b977c13e..e791165b 100755 --- a/common/src/main/java/common/block/foliage/BlockReed.java +++ b/common/src/main/java/common/block/foliage/BlockReed.java @@ -173,14 +173,6 @@ public class BlockReed extends Block return this.getState().withProperty(AGE, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(AGE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {AGE}; diff --git a/common/src/main/java/common/block/foliage/BlockSapling.java b/common/src/main/java/common/block/foliage/BlockSapling.java index 05bd2412..7b082d6d 100755 --- a/common/src/main/java/common/block/foliage/BlockSapling.java +++ b/common/src/main/java/common/block/foliage/BlockSapling.java @@ -122,17 +122,6 @@ public class BlockSapling extends BlockBush implements IGrowable return this.getState() /* .withProperty(TYPE, BlockPlanks.EnumType.byMetadata(meta & 7)) */ .withProperty(STAGE, meta & 1); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { -// int i = 0; -// i = i | ((BlockPlanks.EnumType)state.getValue(TYPE)).getMetadata(); -// i = i | ((Integer)state.getValue(STAGE)).intValue() << 3; - return state.getValue(STAGE); - } - protected Property[] getProperties() { return new Property[] {STAGE}; diff --git a/common/src/main/java/common/block/foliage/BlockStem.java b/common/src/main/java/common/block/foliage/BlockStem.java index c0d3382b..9e9d448d 100755 --- a/common/src/main/java/common/block/foliage/BlockStem.java +++ b/common/src/main/java/common/block/foliage/BlockStem.java @@ -221,14 +221,6 @@ public class BlockStem extends BlockBush implements DirectionalUp, IGrowable return this.getState().withProperty(AGE, Integer.valueOf(meta > 7 ? 0 : meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(AGE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {AGE, FACING}; diff --git a/common/src/main/java/common/block/foliage/BlockTianSoil.java b/common/src/main/java/common/block/foliage/BlockTianSoil.java index 28967997..20bb3d2b 100755 --- a/common/src/main/java/common/block/foliage/BlockTianSoil.java +++ b/common/src/main/java/common/block/foliage/BlockTianSoil.java @@ -36,11 +36,6 @@ public class BlockTianSoil extends Block return Blocks.tian.getItemDropped(Blocks.tian.getState(), rand, fortune); } - public int getMetaFromState(State state) - { - return 0; - } - protected Property[] getProperties() { return new Property[] {SNOWY}; diff --git a/common/src/main/java/common/block/foliage/BlockVine.java b/common/src/main/java/common/block/foliage/BlockVine.java index a7440890..8904bd83 100755 --- a/common/src/main/java/common/block/foliage/BlockVine.java +++ b/common/src/main/java/common/block/foliage/BlockVine.java @@ -449,36 +449,6 @@ public class BlockVine extends Block return this.getState().withProperty(SOUTH, Boolean.valueOf((meta & 1) > 0)).withProperty(WEST, Boolean.valueOf((meta & 2) > 0)).withProperty(NORTH, Boolean.valueOf((meta & 4) > 0)).withProperty(EAST, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - - if (((Boolean)state.getValue(SOUTH)).booleanValue()) - { - i |= 1; - } - - if (((Boolean)state.getValue(WEST)).booleanValue()) - { - i |= 2; - } - - if (((Boolean)state.getValue(NORTH)).booleanValue()) - { - i |= 4; - } - - if (((Boolean)state.getValue(EAST)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {UP, NORTH, EAST, SOUTH, WEST}; diff --git a/common/src/main/java/common/block/foliage/BlockWart.java b/common/src/main/java/common/block/foliage/BlockWart.java index 2b9f2e1a..144493fe 100755 --- a/common/src/main/java/common/block/foliage/BlockWart.java +++ b/common/src/main/java/common/block/foliage/BlockWart.java @@ -116,14 +116,6 @@ public class BlockWart extends BlockBush return this.getState().withProperty(AGE, Integer.valueOf(meta > 3 ? 0 : meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(AGE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {AGE}; diff --git a/common/src/main/java/common/block/liquid/BlockLiquid.java b/common/src/main/java/common/block/liquid/BlockLiquid.java index d99dc97c..5f1008e1 100755 --- a/common/src/main/java/common/block/liquid/BlockLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockLiquid.java @@ -386,14 +386,6 @@ public abstract class BlockLiquid extends Block return this.getState().withProperty(LEVEL, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(LEVEL)).intValue(); - } - protected Property[] getProperties() { return new Property[] {LEVEL}; diff --git a/common/src/main/java/common/block/natural/BlockFire.java b/common/src/main/java/common/block/natural/BlockFire.java index 687087d0..3de59193 100755 --- a/common/src/main/java/common/block/natural/BlockFire.java +++ b/common/src/main/java/common/block/natural/BlockFire.java @@ -445,14 +445,6 @@ public class BlockFire extends Block return this.getState().withProperty(AGE, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(AGE)).intValue(); - } - protected Property[] getProperties() { return new Property[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}; diff --git a/common/src/main/java/common/block/natural/BlockOre.java b/common/src/main/java/common/block/natural/BlockOre.java index d04455e6..90a278cd 100755 --- a/common/src/main/java/common/block/natural/BlockOre.java +++ b/common/src/main/java/common/block/natural/BlockOre.java @@ -66,7 +66,7 @@ public class BlockOre extends Block public int quantityDroppedWithBonus(int fortune, Random random) { if (fortune > 0 && - this.getItem() != this.getItemDropped((State)this.getValidStates().iterator().next(), random, fortune)) + this.getItem() != this.getItemDropped(this.getState(), random, fortune)) { int i = random.zrange(fortune + 2) - 1; diff --git a/common/src/main/java/common/block/natural/BlockPodzol.java b/common/src/main/java/common/block/natural/BlockPodzol.java index 8552fc4c..38979a15 100644 --- a/common/src/main/java/common/block/natural/BlockPodzol.java +++ b/common/src/main/java/common/block/natural/BlockPodzol.java @@ -29,10 +29,6 @@ public class BlockPodzol extends Block { return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } - public int getMetaFromState(State state) { - return 0; - } - protected Property[] getProperties() { return new Property[] {SNOWY}; } diff --git a/common/src/main/java/common/block/natural/BlockSnow.java b/common/src/main/java/common/block/natural/BlockSnow.java index c64de387..b9c56207 100755 --- a/common/src/main/java/common/block/natural/BlockSnow.java +++ b/common/src/main/java/common/block/natural/BlockSnow.java @@ -167,14 +167,6 @@ public class BlockSnow extends Block return ((Integer)worldIn.getState(pos).getValue(LAYERS)).intValue() == 1; } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(LAYERS)).intValue() - 1; - } - protected Property[] getProperties() { return new Property[] {LAYERS}; diff --git a/common/src/main/java/common/block/tech/BlockAnvil.java b/common/src/main/java/common/block/tech/BlockAnvil.java index 4c99dd49..e74bf4f3 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -129,16 +129,6 @@ public class BlockAnvil extends BlockFalling implements Rotatable return this.getState().withProperty(FACING, Facing.getHorizontal(meta & 3)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - return i; - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index 978c6257..5f034f20 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -516,24 +516,6 @@ public class BlockBrewingStand extends BlockContainer return iblockstate; } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - - for (int j = 0; j < 3; ++j) - { - if (((Boolean)state.getValue(HAS_BOTTLE[j])).booleanValue()) - { - i |= 1 << j; - } - } - - return i; - } - protected Property[] getProperties() { return new Property[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]}; diff --git a/common/src/main/java/common/block/tech/BlockButton.java b/common/src/main/java/common/block/tech/BlockButton.java index cf712034..c106c88b 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -353,48 +353,6 @@ public class BlockButton extends Block implements Directional return this.getState().withProperty(FACING, enumfacing).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i; - - switch ((Facing)state.getValue(FACING)) - { - case EAST: - i = 1; - break; - - case WEST: - i = 2; - break; - - case SOUTH: - i = 3; - break; - - case NORTH: - i = 4; - break; - - case UP: - default: - i = 5; - break; - - case DOWN: - i = 0; - } - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, POWERED}; diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index e91fcc09..1d274257 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -651,14 +651,6 @@ public class BlockCauldron extends Block return this.getState().withProperty(LEVEL, Integer.valueOf(meta > 3 ? 0 : meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.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 db0345af..43f3d33b 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -619,14 +619,6 @@ public class BlockChest extends BlockContainer implements Rotatable return this.getState().withProperty(FACING, enumfacing); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getIndex(); - } - 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 e6a2e193..1a6e361f 100755 --- a/common/src/main/java/common/block/tech/BlockDaylightDetector.java +++ b/common/src/main/java/common/block/tech/BlockDaylightDetector.java @@ -164,14 +164,6 @@ public class BlockDaylightDetector extends BlockContainer return this.getState().withProperty(POWER, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(POWER)).intValue(); - } - protected Property[] getProperties() { return new Property[] {POWER}; diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index a7d7bba7..ab5ea623 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -282,22 +282,6 @@ public class BlockDispenser extends BlockContainer implements Directional return this.getState().withProperty(FACING, getFacing(meta)).withProperty(TRIGGERED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getIndex(); - - if (((Boolean)state.getValue(TRIGGERED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, TRIGGERED}; diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index b92aa33d..e69aef68 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -262,14 +262,6 @@ public class BlockFurnace extends BlockContainer implements Rotatable return this.getState().withProperty(FACING, enumfacing); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/tech/BlockHopper.java b/common/src/main/java/common/block/tech/BlockHopper.java index b68c4bec..a6eaddf1 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -279,22 +279,6 @@ public class BlockHopper extends BlockContainer implements DirectionalDown return this.getState().withProperty(FACING, getFacing(((meta & 7) == 1 || (meta & 7) > 5) ? 0 : meta)).withProperty(ENABLED, Boolean.valueOf(isEnabled(meta))); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getIndex(); - - if (!((Boolean)state.getValue(ENABLED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, ENABLED}; diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index 0d4f3e63..4aa93c35 100755 --- a/common/src/main/java/common/block/tech/BlockLever.java +++ b/common/src/main/java/common/block/tech/BlockLever.java @@ -257,22 +257,6 @@ public class BlockLever extends Block return this.getState().withProperty(FACING, BlockLever.EnumOrientation.byMetadata(meta & 7)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((BlockLever.EnumOrientation)state.getValue(FACING)).getMetadata(); - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, POWERED}; diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index 2c88635a..339459bb 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -89,10 +89,6 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti return this.getState().withProperty(FACING, Facing.getHorizontal(meta)); } - public int getMetaFromState(State state) { - return ((Facing)state.getValue(FACING)).getHorizontalIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; } diff --git a/common/src/main/java/common/block/tech/BlockPistonBase.java b/common/src/main/java/common/block/tech/BlockPistonBase.java index 629fc665..7394de33 100755 --- a/common/src/main/java/common/block/tech/BlockPistonBase.java +++ b/common/src/main/java/common/block/tech/BlockPistonBase.java @@ -687,22 +687,6 @@ public class BlockPistonBase extends Block implements Directional return this.getState().withProperty(FACING, getFacing(meta)).withProperty(EXTENDED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getIndex(); - - if (((Boolean)state.getValue(EXTENDED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, EXTENDED}; diff --git a/common/src/main/java/common/block/tech/BlockPistonHead.java b/common/src/main/java/common/block/tech/BlockPistonHead.java index d8e39df6..054580e4 100755 --- a/common/src/main/java/common/block/tech/BlockPistonHead.java +++ b/common/src/main/java/common/block/tech/BlockPistonHead.java @@ -238,22 +238,6 @@ public class BlockPistonHead extends Block implements Directional return this.getState().withProperty(FACING, getFacing(meta)).withProperty(TYPE, (meta & 8) > 0 ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getIndex(); - - if (state.getValue(TYPE) == BlockPistonHead.EnumPistonType.STICKY) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, TYPE, SHORT}; diff --git a/common/src/main/java/common/block/tech/BlockPistonMoving.java b/common/src/main/java/common/block/tech/BlockPistonMoving.java index 27b04938..479e42e6 100755 --- a/common/src/main/java/common/block/tech/BlockPistonMoving.java +++ b/common/src/main/java/common/block/tech/BlockPistonMoving.java @@ -290,22 +290,6 @@ public class BlockPistonMoving extends BlockContainer return this.getState().withProperty(FACING, BlockPistonHead.getFacing(meta)).withProperty(TYPE, (meta & 8) > 0 ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getIndex(); - - if (state.getValue(TYPE) == BlockPistonHead.EnumPistonType.STICKY) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, TYPE}; diff --git a/common/src/main/java/common/block/tech/BlockPressurePlate.java b/common/src/main/java/common/block/tech/BlockPressurePlate.java index 338cbbab..2eb17df8 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlate.java @@ -75,14 +75,6 @@ public class BlockPressurePlate extends BlockBasePressurePlate return this.getState().withProperty(POWERED, Boolean.valueOf(meta == 1)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Boolean)state.getValue(POWERED)).booleanValue() ? 1 : 0; - } - protected Property[] getProperties() { return new Property[] {POWERED}; diff --git a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java index 375fd766..64d5acf2 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java @@ -62,14 +62,6 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate return this.getState().withProperty(POWER, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(POWER)).intValue(); - } - protected Property[] getProperties() { return new Property[] {POWER}; diff --git a/common/src/main/java/common/block/tech/BlockRail.java b/common/src/main/java/common/block/tech/BlockRail.java index bdfa0aae..c5f77876 100755 --- a/common/src/main/java/common/block/tech/BlockRail.java +++ b/common/src/main/java/common/block/tech/BlockRail.java @@ -38,14 +38,6 @@ public class BlockRail extends BlockRailBase return this.getState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); - } - protected Property[] getProperties() { return new Property[] {SHAPE}; diff --git a/common/src/main/java/common/block/tech/BlockRailDetector.java b/common/src/main/java/common/block/tech/BlockRailDetector.java index 7a3a59d0..126e33d6 100755 --- a/common/src/main/java/common/block/tech/BlockRailDetector.java +++ b/common/src/main/java/common/block/tech/BlockRailDetector.java @@ -184,22 +184,6 @@ public class BlockRailDetector extends BlockRailBase return this.getState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata((meta & 7) > 5 ? 0 : (meta & 7))).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {SHAPE, POWERED}; diff --git a/common/src/main/java/common/block/tech/BlockRailPowered.java b/common/src/main/java/common/block/tech/BlockRailPowered.java index 72fa440d..cc62294e 100755 --- a/common/src/main/java/common/block/tech/BlockRailPowered.java +++ b/common/src/main/java/common/block/tech/BlockRailPowered.java @@ -171,22 +171,6 @@ public class BlockRailPowered extends BlockRailBase return this.getState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata((meta & 7) > 5 ? 0 : (meta & 7))).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {SHAPE, POWERED}; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneComparator.java b/common/src/main/java/common/block/tech/BlockRedstoneComparator.java index b769faf1..d45048ed 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneComparator.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneComparator.java @@ -282,27 +282,6 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile return this.getState().withProperty(FACING, Facing.getHorizontal(meta)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)).withProperty(MODE, (meta & 4) > 0 ? BlockRedstoneComparator.Mode.SUBTRACT : BlockRedstoneComparator.Mode.COMPARE); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - if (state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT) - { - i |= 4; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, MODE, POWERED}; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java b/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java index 17dd4e8d..0d83b6fe 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java @@ -144,17 +144,6 @@ public class BlockRedstoneRepeater extends BlockRedstoneDiode return this.getState().withProperty(FACING, Facing.getHorizontal(meta)).withProperty(LOCKED, Boolean.valueOf(false)).withProperty(DELAY, Integer.valueOf(1 + (meta >> 2))); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - i = i | ((Integer)state.getValue(DELAY)).intValue() - 1 << 2; - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, DELAY, LOCKED}; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneWire.java b/common/src/main/java/common/block/tech/BlockRedstoneWire.java index 102808c6..7d4ec7d1 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneWire.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneWire.java @@ -811,14 +811,6 @@ public class BlockRedstoneWire extends Block return this.getState().withProperty(POWER, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(POWER)).intValue(); - } - protected Property[] getProperties() { return new Property[] {NORTH, EAST, SOUTH, WEST, POWER}; diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index a58e086a..be3bff6a 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -166,14 +166,6 @@ public class BlockTNT extends Block return this.getState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0; - } - protected Property[] getProperties() { return new Property[] {EXPLODE}; diff --git a/common/src/main/java/common/block/tech/BlockTorch.java b/common/src/main/java/common/block/tech/BlockTorch.java index fd0fe12e..0af989df 100755 --- a/common/src/main/java/common/block/tech/BlockTorch.java +++ b/common/src/main/java/common/block/tech/BlockTorch.java @@ -277,40 +277,6 @@ public class BlockTorch extends Block implements DirectionalUp return iblockstate; } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - - switch ((Facing)state.getValue(FACING)) - { - case EAST: - i = i | 1; - break; - - case WEST: - i = i | 2; - break; - - case SOUTH: - i = i | 3; - break; - - case NORTH: - i = i | 4; - break; - - case DOWN: - case UP: - default: - i = i | 5; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/tech/BlockTripWire.java b/common/src/main/java/common/block/tech/BlockTripWire.java index cc1363c8..398a134d 100755 --- a/common/src/main/java/common/block/tech/BlockTripWire.java +++ b/common/src/main/java/common/block/tech/BlockTripWire.java @@ -272,36 +272,6 @@ public class BlockTripWire extends Block return this.getState().withProperty(POWERED, Boolean.valueOf((meta & 1) > 0)).withProperty(SUSPENDED, Boolean.valueOf((meta & 2) > 0)).withProperty(ATTACHED, Boolean.valueOf((meta & 4) > 0)).withProperty(DISARMED, Boolean.valueOf((meta & 8) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 1; - } - - if (((Boolean)state.getValue(SUSPENDED)).booleanValue()) - { - i |= 2; - } - - if (((Boolean)state.getValue(ATTACHED)).booleanValue()) - { - i |= 4; - } - - if (((Boolean)state.getValue(DISARMED)).booleanValue()) - { - i |= 8; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH}; diff --git a/common/src/main/java/common/block/tech/BlockTripWireHook.java b/common/src/main/java/common/block/tech/BlockTripWireHook.java index 8aca2476..77024a15 100755 --- a/common/src/main/java/common/block/tech/BlockTripWireHook.java +++ b/common/src/main/java/common/block/tech/BlockTripWireHook.java @@ -350,27 +350,6 @@ public class BlockTripWireHook extends Block implements Rotatable return this.getState().withProperty(FACING, Facing.getHorizontal(meta & 3)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)).withProperty(ATTACHED, Boolean.valueOf((meta & 4) > 0)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - int i = 0; - i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - - if (((Boolean)state.getValue(POWERED)).booleanValue()) - { - i |= 8; - } - - if (((Boolean)state.getValue(ATTACHED)).booleanValue()) - { - i |= 4; - } - - return i; - } - protected Property[] getProperties() { return new Property[] {FACING, POWERED, ATTACHED, SUSPENDED}; diff --git a/common/src/main/java/common/block/tech/BlockWarpChest.java b/common/src/main/java/common/block/tech/BlockWarpChest.java index 1d6f8d5a..4d6c5191 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -146,14 +146,6 @@ public class BlockWarpChest extends Block implements Rotatable return this.getState().withProperty(FACING, enumfacing); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/tile/BlockBannerHanging.java b/common/src/main/java/common/block/tile/BlockBannerHanging.java index 2babfe4a..00256303 100644 --- a/common/src/main/java/common/block/tile/BlockBannerHanging.java +++ b/common/src/main/java/common/block/tile/BlockBannerHanging.java @@ -71,11 +71,6 @@ public class BlockBannerHanging extends BlockBanner return this.getState().withProperty(FACING, enumfacing); } - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/block/tile/BlockBannerStanding.java b/common/src/main/java/common/block/tile/BlockBannerStanding.java index f3560af2..7a50c147 100644 --- a/common/src/main/java/common/block/tile/BlockBannerStanding.java +++ b/common/src/main/java/common/block/tile/BlockBannerStanding.java @@ -34,11 +34,6 @@ public class BlockBannerStanding extends BlockBanner return this.getState().withProperty(ROTATION, Integer.valueOf(meta)); } - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(ROTATION)).intValue(); - } - protected Property[] getProperties() { return new Property[] {ROTATION}; diff --git a/common/src/main/java/common/block/tile/BlockStandingSign.java b/common/src/main/java/common/block/tile/BlockStandingSign.java index 89513200..bbc45dfe 100755 --- a/common/src/main/java/common/block/tile/BlockStandingSign.java +++ b/common/src/main/java/common/block/tile/BlockStandingSign.java @@ -40,14 +40,6 @@ public class BlockStandingSign extends BlockSign return this.getState().withProperty(ROTATION, Integer.valueOf(meta)); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Integer)state.getValue(ROTATION)).intValue(); - } - protected Property[] getProperties() { return new Property[] {ROTATION}; diff --git a/common/src/main/java/common/block/tile/BlockWallSign.java b/common/src/main/java/common/block/tile/BlockWallSign.java index 46a844ae..3922feaf 100755 --- a/common/src/main/java/common/block/tile/BlockWallSign.java +++ b/common/src/main/java/common/block/tile/BlockWallSign.java @@ -78,14 +78,6 @@ public class BlockWallSign extends BlockSign implements Rotatable return this.getState().withProperty(FACING, enumfacing); } - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((Facing)state.getValue(FACING)).getIndex(); - } - protected Property[] getProperties() { return new Property[] {FACING}; diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index 4ae3a708..af32bfc7 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -4,7 +4,6 @@ import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import common.block.*; @@ -139,12 +138,10 @@ import common.collect.BiMap; import common.collect.HashBiMap; import common.collect.Lists; import common.collect.Maps; -import common.collect.Sets; import common.color.DyeColor; import common.item.CheatTab; import common.log.Log; import common.model.TextureAnimation; -import common.properties.Property; import common.util.Util; import common.world.State; @@ -661,37 +658,15 @@ public abstract class BlockRegistry { register("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken")); register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0)); - Map map = Maps.newLinkedHashMap(); for(Block block : BLOCKS) { for(State state : block.getValidStates()) { - STATE_NAMES.put(state, state.buildSaved()); + STATE_NAMES.put(state, state.getId()); } - for(int n = 0; n < 16; n++) { - State state = block.getStateFromMeta(n); - String id = STATE_NAMES.get(state); - if(!STATE_MAP.containsKey(id)) { - STATE_MAP.put(id, state); - STATE_IDS.put(state, STATES.size()); - STATES.add(state); - } + for(State state : block.getSavedStates()) { + STATE_MAP.put(STATE_NAMES.get(state), state); + STATE_IDS.put(state, STATES.size()); + STATES.add(state); } - StringBuilder sb = new StringBuilder("\n\n\tpublic Property[] getUnsavedProperties() {\n\t\treturn new Property[] {"); - boolean put = false; - Set props = Sets.newHashSet(block.getPropertyMap()); - for(Property prop : block.getState().getSavedProperties()) { - props.remove(prop); - } - for(Property prop : props) { - if(put) - sb.append(", "); - sb.append(prop.getName().toUpperCase()); - put = true; - } - if(put) - map.put(block.getClass(), sb.append("};\n\t}").toString()); - } - for(Entry entry : map.entrySet()) { - System.out.printf("%s.java\n%s\n", entry.getKey().getSimpleName(), entry.getValue()); } Log.SYSTEM.debug("%d Blöcke registriert", BLOCK_MAP.size()); diff --git a/common/src/main/java/common/world/State.java b/common/src/main/java/common/world/State.java index 28d0bc15..27e91e12 100755 --- a/common/src/main/java/common/world/State.java +++ b/common/src/main/java/common/world/State.java @@ -4,17 +4,14 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; import java.util.function.Function; import common.block.Block; import common.collect.ImmutableMap; -import common.collect.ImmutableSet; import common.collect.ImmutableTable; import common.collect.Iterables; import common.collect.Maps; -import common.collect.Sets; import common.collect.StandardTable; import common.collect.Table; import common.init.BlockRegistry; @@ -37,42 +34,6 @@ public class State { private final Block block; private final ImmutableMap properties; private ImmutableTable map; - private ImmutableSet saved; - - private static Set getSavedProperties(Block block) { - Set stored = Sets.newHashSet(); - Map map = Maps.newHashMap(); - for(int z = 0; z < 16; z++) { - State sub = block.getStateFromMeta(z); - for(Entry entry : sub.getProperties().entrySet()) { - if(map.containsKey(entry.getKey())) { - if(!map.get(entry.getKey()).equals(entry.getValue())) - stored.add(entry.getKey()); - } - else { - map.put(entry.getKey(), entry.getValue()); - } - } - } - for(int z = 0; z < 16; z++) { - State sub = block.getStateFromMeta(z); - Map smap = sub.getProperties(); - for(Property prop : map.keySet()) { - if(!smap.containsKey(prop)) - stored.add(prop); - } - } - return stored; - } - - private static String filterProperties(State state, Set stored) { - StringBuilder sb = new StringBuilder(BlockRegistry.getName(state.getBlock())); - for(Entry entry : state.getProperties().entrySet()) { - if(stored.contains(entry.getKey())) - sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue())); - } - return sb.toString(); - } public State(Block block, ImmutableMap properties) { this.block = block; @@ -97,10 +58,6 @@ public class State { return Collections.unmodifiableCollection(this.properties.keySet()); } - public Collection getSavedProperties() { - return this.saved; - } - public > T getValue(Property property) { if(!this.properties.containsKey(property)) { throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block); @@ -175,10 +132,12 @@ public class State { this.map = ImmutableTable.copyOf(table); } - public String buildSaved() { - if(this.saved != null) - throw new IllegalStateException(); - this.saved = ImmutableSet.copyOf(getSavedProperties(this.block)); - return filterProperties(this, this.saved); + public String getId() { + StringBuilder sb = new StringBuilder(BlockRegistry.getName(this.getBlock())); + for(Entry entry : this.getProperties().entrySet()) { + if(this.getBlock().getSavedProperties().contains(entry.getKey())) + sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue())); + } + return sb.toString(); } } diff --git a/server/src/main/java/server/clipboard/ReorderRegistry.java b/server/src/main/java/server/clipboard/ReorderRegistry.java index c806aca0..ba7e3b46 100755 --- a/server/src/main/java/server/clipboard/ReorderRegistry.java +++ b/server/src/main/java/server/clipboard/ReorderRegistry.java @@ -1,8 +1,6 @@ package server.clipboard; -import java.util.HashMap; import java.util.HashSet; -import java.util.Map; import java.util.Set; import common.block.Block; @@ -16,15 +14,14 @@ import common.color.DyeColor; import common.init.BlockRegistry; import common.init.Blocks; import common.init.WoodType; -import common.util.Facing; import common.util.Vec3i; import common.world.State; public abstract class ReorderRegistry { private static final Set PLACE_LAST = new HashSet(); private static final Set PLACE_FINAL = new HashSet(); - private static final Map STATE_ATTACH = new HashMap(); - private static final Map BLOCK_ATTACH = new HashMap(); +// private static final Map STATE_ATTACH = new HashMap(); +// private static final Map BLOCK_ATTACH = new HashMap(); public static boolean shouldPlaceLast(Block id) { return PLACE_LAST.contains(id); @@ -35,11 +32,15 @@ public abstract class ReorderRegistry { } public static Vec3i getAttachment(State state) { - Vec3i direction = BLOCK_ATTACH.get(state.getBlock()); - if (direction != null) return direction; - return STATE_ATTACH.get(state); + return null; //TODO: add attachment clean } +// public static Vec3i getAttachment(State state) { +// Vec3i direction = BLOCK_ATTACH.get(state.getBlock()); +// if (direction != null) return direction; +// return STATE_ATTACH.get(state); +// } + public static void register() { for(WoodType wood : WoodType.values()) { PLACE_LAST.add(BlockRegistry.byName(wood.getName() + "_sapling")); @@ -124,6 +125,7 @@ public abstract class ReorderRegistry { PLACE_FINAL.add(Blocks.wall_banner); } + /* private static void addAttach(State state, Facing dir) { STATE_ATTACH.put(state, dir.getDirectionVec()); } @@ -247,4 +249,5 @@ public abstract class ReorderRegistry { addAttach(Blocks.blue_mushroom, Facing.DOWN); } + */ } diff --git a/server/src/main/java/server/clipboard/RotationRegistry.java b/server/src/main/java/server/clipboard/RotationRegistry.java index f4b48421..15b96599 100755 --- a/server/src/main/java/server/clipboard/RotationRegistry.java +++ b/server/src/main/java/server/clipboard/RotationRegistry.java @@ -16,7 +16,7 @@ public abstract class RotationRegistry { public static void register() { List values = Lists.newArrayList(); for(Block block : common.init.BlockRegistry.blocks()) { - for(Property prop : block.getPropertyMap()) { + for(Property prop : block.getSavedProperties()) { for(Comparable v : prop.getStates()) { if(!(v instanceof DirectionVec vec)) continue; diff --git a/server/src/main/java/server/command/commands/CommandBlock.java b/server/src/main/java/server/command/commands/CommandBlock.java index fe281ac8..ca569efa 100644 --- a/server/src/main/java/server/command/commands/CommandBlock.java +++ b/server/src/main/java/server/command/commands/CommandBlock.java @@ -27,7 +27,7 @@ public class CommandBlock extends Command { if(idx >= 0) { Block block = BlockRegistry.byNameExact(last.substring(0, idx)); if(block != null) - return Lists.newArrayList(Iterables.transform(block.getValidStates(), state -> BlockRegistry.getName(state))); + return Lists.newArrayList(Iterables.transform(block.getSavedStates(), state -> BlockRegistry.getName(state))); } return BlockRegistry.getKeys(); }