Fix lamp not shining on north. Closes #2371
This commit is contained in:
parent
81337c3698
commit
585f149c16
2 changed files with 16 additions and 5 deletions
|
@ -159,10 +159,7 @@ public class CableBlockEntity extends BlockEntity
|
||||||
// Tickable
|
// Tickable
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (world == null) {
|
if (world == null || world.isClient) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (world.isClient) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||||
import team.reborn.energy.EnergySide;
|
import team.reborn.energy.EnergySide;
|
||||||
import techreborn.blocks.lighting.LampBlock;
|
import techreborn.blocks.lighting.LampBlock;
|
||||||
import techreborn.init.TRBlockEntities;
|
import techreborn.init.TRBlockEntities;
|
||||||
|
import techreborn.init.TRContent;
|
||||||
|
|
||||||
public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop {
|
public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop {
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canAcceptEnergy(EnergySide side) {
|
protected boolean canAcceptEnergy(EnergySide side) {
|
||||||
return side == EnergySide.UNKNOWN || getFacing().getOpposite() != Direction.values()[side.ordinal()];
|
return side == EnergySide.UNKNOWN || getFacing().getOpposite() == Direction.values()[side.ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,9 +93,22 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDr
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MachineBaseBlockEntity
|
||||||
|
@Override
|
||||||
|
public Direction getFacing(){
|
||||||
|
if (world == null){
|
||||||
|
return Direction.NORTH;
|
||||||
|
}
|
||||||
|
return LampBlock.getFacing(world.getBlockState(pos));
|
||||||
|
}
|
||||||
|
|
||||||
// IToolDrop
|
// IToolDrop
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||||
|
// I know it is weird. But world is nullable
|
||||||
|
if (world == null) {
|
||||||
|
return new ItemStack(TRContent.Machine.LAMP_INCANDESCENT.block);
|
||||||
|
}
|
||||||
return new ItemStack(world.getBlockState(pos).getBlock());
|
return new ItemStack(world.getBlockState(pos).getBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue