mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 07:38:34 +01:00
Align lamps properly with docs
Make light updates smoother as well, and use a better access to the needed blockstate
This commit is contained in:
parent
2258b7bed7
commit
3b0cfca5fa
1 changed files with 4 additions and 6 deletions
|
@ -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){
|
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);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
//Turning On
|
//Turning On
|
||||||
if(player.isSneaking()){
|
if(stack.isEmpty() && player.isSneaking()){
|
||||||
if(!world.isRemote){
|
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
||||||
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getStateFromMeta(this.getMetaFromState(state)), 2);
|
world.notifyLightSet(pos);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,13 +95,12 @@ public class BlockColoredLamp extends BlockBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList list){
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||||
for(int j = 0; j < ALL_LAMP_TYPES.length; j++){
|
for(int j = 0; j < ALL_LAMP_TYPES.length; j++){
|
||||||
list.add(new ItemStack(this, 1, j));
|
list.add(new ItemStack(this, 1, j));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue