diff --git a/client/src/main/java/client/renderer/RenderGlobal.java b/client/src/main/java/client/renderer/RenderGlobal.java index 104aaad7..f159f56d 100755 --- a/client/src/main/java/client/renderer/RenderGlobal.java +++ b/client/src/main/java/client/renderer/RenderGlobal.java @@ -682,7 +682,7 @@ public class RenderGlobal TileEntity tileentity1 = this.theWorld.getTileEntity(blockpos); Block block = this.theWorld.getState(blockpos).getBlock(); - if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockSign)) + if (tileentity1 != null && block instanceof BlockSign) { TileEntityRenderer.instance.renderTile(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); } @@ -1565,7 +1565,7 @@ public class RenderGlobal double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getState(blockpos).getBlock(); - if (!(block instanceof BlockChest) && !(block instanceof BlockSign)) + if (!(block instanceof BlockSign)) { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { diff --git a/client/src/main/java/client/renderer/entity/RenderItem.java b/client/src/main/java/client/renderer/entity/RenderItem.java index 7042cd02..222cdb5f 100755 --- a/client/src/main/java/client/renderer/entity/RenderItem.java +++ b/client/src/main/java/client/renderer/entity/RenderItem.java @@ -137,7 +137,7 @@ public class RenderItem private void renderBuiltin(ItemStack stack) { if(stack.getItem().getBlock() instanceof BlockStandingSign sign) { - this.state = sign.getState().withProperty(BlockStandingSign.ROTATION, 8); + this.state = sign.getState(); TileEntityRenderer.instance.renderItem(this.sign, 0.0D, 0.0D, 0.0D, 0.0F); this.state = null; } diff --git a/client/src/main/java/client/renderer/tileentity/SignRenderer.java b/client/src/main/java/client/renderer/tileentity/SignRenderer.java index fe74e108..ccb779f4 100755 --- a/client/src/main/java/client/renderer/tileentity/SignRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SignRenderer.java @@ -31,7 +31,23 @@ public class SignRenderer extends TileRenderer if (state.getBlock() == Blocks.sign) { GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); - float f1 = state.getBlock() == Blocks.sign ? (float)(state.getValue(BlockStandingSign.ROTATION) * 360) / 16.0F : 0.0F; + int r = state.getBlock() == Blocks.sign ? state.getValue(BlockWallSign.FACING).getIndex() : 0; + float f1 = 0.0F; + + if (r == 2) + { + f1 = 180.0F; + } + + if (r == 4) + { + f1 = 90.0F; + } + + if (r == 5) + { + f1 = -90.0F; + } GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F); this.model.signStick.showModel = true; } diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java b/client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java index 03e41255..5728e0c9 100755 --- a/client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java @@ -10,7 +10,6 @@ import client.world.WorldClient; import common.collect.Maps; import common.entity.Entity; import common.tileentity.TileEntity; -import common.tileentity.TileEntityChest; import common.tileentity.TileEntityDisplay; import common.tileentity.TileEntitySign; import common.util.BlockPos; diff --git a/common/src/main/java/common/block/tile/BlockSign.java b/common/src/main/java/common/block/tile/BlockSign.java index 53c10386..4df94dca 100755 --- a/common/src/main/java/common/block/tile/BlockSign.java +++ b/common/src/main/java/common/block/tile/BlockSign.java @@ -3,9 +3,12 @@ package common.block.tile; import common.block.Block; import common.block.ITileEntityProvider; import common.block.Material; +import common.block.Rotatable; import common.entity.npc.EntityNPC; import common.init.Items; +import common.item.CheatTab; import common.item.Item; +import common.properties.Property; import common.tileentity.TileEntity; import common.tileentity.TileEntitySign; import common.util.BlockPos; @@ -16,7 +19,7 @@ import common.world.IBlockAccess; import common.world.State; import common.world.World; -public class BlockSign extends Block implements ITileEntityProvider +public class BlockSign extends Block implements ITileEntityProvider, Rotatable { public BlockSign() { @@ -24,6 +27,8 @@ public class BlockSign extends Block implements ITileEntityProvider float f = 0.25F; float f1 = 1.0F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); + this.setTab(CheatTab.DECORATION); } public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) @@ -127,6 +132,11 @@ public class BlockSign extends Block implements ITileEntityProvider { return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlace(worldIn, pos); } + + protected Property[] getProperties() + { + return new Property[] {FACING}; + } public boolean isXrayVisible() { diff --git a/common/src/main/java/common/block/tile/BlockStandingSign.java b/common/src/main/java/common/block/tile/BlockStandingSign.java index 8ca42cf9..4d79958d 100755 --- a/common/src/main/java/common/block/tile/BlockStandingSign.java +++ b/common/src/main/java/common/block/tile/BlockStandingSign.java @@ -1,34 +1,41 @@ package common.block.tile; import common.block.Block; +import common.block.Rotatable; import common.entity.npc.EntityNPC; import common.init.Blocks; import common.item.CheatTab; -import common.item.Item; import common.item.ItemStack; -import common.properties.Property; import common.properties.PropertyInteger; import common.tileentity.TileEntity; import common.tileentity.TileEntitySign; import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; +import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockStandingSign extends BlockSign +public class BlockStandingSign extends BlockSign implements Rotatable { - public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15); - - public BlockStandingSign() + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { - this.setDefaultState(this.getBaseState().withProperty(ROTATION, Integer.valueOf(0))); - this.setTab(CheatTab.DECORATION); + Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + + switch (enumfacing) + { + case NORTH: + case SOUTH: + this.setBlockBounds(0.0f, 0.0f, 0.5f - 0.0625f, 1.0f, 1.0f, 0.5f + 0.0625f); + break; + + case WEST: + case EAST: + this.setBlockBounds(0.5f - 0.0625f, 0.0f, 0.0f, 0.5f + 0.0625f, 1.0f, 1.0f); + } } - /** - * Called when a neighboring block changes. - */ public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.getState(pos.down()).getBlock().getMaterial().isSolid()) @@ -40,11 +47,6 @@ public class BlockStandingSign extends BlockSign super.onUpdate(worldIn, pos, state, neighborBlock); } - protected Property[] getProperties() - { - return new Property[] {ROTATION}; - } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { if (side == Facing.DOWN) @@ -75,8 +77,7 @@ public class BlockStandingSign extends BlockSign { if (side == Facing.UP) { - int i = ExtMath.floord((double)((playerIn.rotYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; - worldIn.setState(pos, Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3); + worldIn.setState(pos, Blocks.sign.getState().withProperty(BlockStandingSign.FACING, playerIn.getHorizontalFacing().getOpposite()), 3); } else { diff --git a/common/src/main/java/common/block/tile/BlockWallSign.java b/common/src/main/java/common/block/tile/BlockWallSign.java index 8c957e4a..100c378f 100755 --- a/common/src/main/java/common/block/tile/BlockWallSign.java +++ b/common/src/main/java/common/block/tile/BlockWallSign.java @@ -2,8 +2,6 @@ package common.block.tile; import common.block.Block; import common.block.Rotatable; -import common.item.Item; -import common.properties.Property; import common.util.BlockPos; import common.util.Facing; import common.world.IWorldAccess; @@ -12,12 +10,6 @@ import common.world.World; public class BlockWallSign extends BlockSign implements Rotatable { - public BlockWallSign() - { - this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); - } - - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); @@ -47,9 +39,6 @@ public class BlockWallSign extends BlockSign implements Rotatable } } - /** - * Called when a neighboring block changes. - */ public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); @@ -62,11 +51,6 @@ public class BlockWallSign extends BlockSign implements Rotatable super.onUpdate(worldIn, pos, state, neighborBlock); } - - protected Property[] getProperties() - { - return new Property[] {FACING}; - } protected boolean hasRegisteredItem() { return false; diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index f3683177..9ded5a22 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -687,22 +687,10 @@ public abstract class Converter { mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.SOUTH), 62, 3, 9, 15); mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.WEST), 62, 4, 10); mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.EAST), 62, 5, 11); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 0), 63, 0); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 1), 63, 1); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 2), 63, 2); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 3), 63, 3); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 4), 63, 4); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 5), 63, 5); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 6), 63, 6); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 7), 63, 7); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 8), 63, 8); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 9), 63, 9); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 10), 63, 10); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 11), 63, 11); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 12), 63, 12); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 13), 63, 13); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 14), 63, 14); - mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 15), 63, 15); + mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.SOUTH), 63, 0, 1, 14, 15); + mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.WEST), 63, 2, 3, 4, 5); + mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.NORTH), 63, 6, 7, 8, 9); + mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.EAST), 63, 10, 11, 12, 13); mapBlock(Blocks.oak_door, 64); mapBlock(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.NORTH), 65); mapBlock(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.SOUTH), 65, 3, 9, 15);