Lamps require energy to work. Again. Closes #2227
This commit is contained in:
parent
22b0cdfe23
commit
7ba962196b
4 changed files with 30 additions and 21 deletions
src/main/java/techreborn/blockentity
|
@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import techreborn.blocks.lighting.BlockLamp;
|
||||
import techreborn.blocks.lighting.LampBlock;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
||||
public class LampBlockEntity extends PowerAcceptorBlockEntity
|
||||
|
@ -52,14 +52,14 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
BlockState state = world.getBlockState(pos);
|
||||
Block b = state.getBlock();
|
||||
if (b instanceof BlockLamp) {
|
||||
double cost = getEuPerTick(((BlockLamp) b).getCost());
|
||||
if (b instanceof LampBlock) {
|
||||
double cost = getEuPerTick(((LampBlock) b).getCost());
|
||||
if (getEnergy() > cost) {
|
||||
useEnergy(getEuPerTick(cost));
|
||||
if (!BlockLamp.isActive(state))
|
||||
BlockLamp.setActive(true, world, pos);
|
||||
} else if (BlockLamp.isActive(state)) {
|
||||
BlockLamp.setActive(false, world, pos);
|
||||
if (!LampBlock.isActive(state))
|
||||
LampBlock.setActive(true, world, pos);
|
||||
} else if (LampBlock.isActive(state)) {
|
||||
LampBlock.setActive(false, world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity
|
|||
// Blame tooltip for this
|
||||
return true;
|
||||
}
|
||||
Direction me = BlockLamp.getFacing(world.getBlockState(pos)).getOpposite();
|
||||
Direction me = LampBlock.getFacing(world.getBlockState(pos)).getOpposite();
|
||||
return direction == me;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import reborncore.common.blockentity.MultiblockWriter;
|
|||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import techreborn.blocks.lighting.BlockLamp;
|
||||
import techreborn.blocks.lighting.LampBlock;
|
||||
import techreborn.blocks.misc.BlockRubberLog;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
@ -240,7 +240,7 @@ public class GreenhouseControllerBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = -1; j < 2; j++) {
|
||||
writer.add(i * 3 + 2, 3, j * 3, (world, pos) -> BlockLamp.isActive(world.getBlockState(pos)), lamp);
|
||||
writer.add(i * 3 + 2, 3, j * 3, (world, pos) -> LampBlock.isActive(world.getBlockState(pos)), lamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue