From 3b0cfca5fa838e5a8d7f6adc0255d4d2cbd3f784 Mon Sep 17 00:00:00 2001 From: Shadows_of_Fire Date: Fri, 7 Jul 2017 16:42:02 -0400 Subject: [PATCH] Align lamps properly with docs Make light updates smoother as well, and use a better access to the needed blockstate --- .../actuallyadditions/mod/blocks/BlockColoredLamp.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index fd7024646..20d3fdd0d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -68,10 +68,9 @@ public class BlockColoredLamp extends BlockBase{ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){ ItemStack stack = player.getHeldItem(hand); //Turning On - if(player.isSneaking()){ - if(!world.isRemote){ - world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getStateFromMeta(this.getMetaFromState(state)), 2); - } + if(stack.isEmpty() && player.isSneaking()){ + world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2); + world.notifyLightSet(pos); return true; } @@ -96,13 +95,12 @@ public class BlockColoredLamp extends BlockBase{ } } } - return false; } @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(CreativeTabs tab, NonNullList list){ + public void getSubBlocks(CreativeTabs tab, NonNullList list){ for(int j = 0; j < ALL_LAMP_TYPES.length; j++){ list.add(new ItemStack(this, 1, j)); }