Finish porting to new power api
This commit is contained in:
parent
4f80a8c651
commit
aa6eb60d46
19 changed files with 103 additions and 150 deletions
|
@ -148,11 +148,9 @@ public class CableBlockEntity extends BlockEntity
|
|||
return;
|
||||
}
|
||||
Collections.shuffle(acceptors);
|
||||
acceptors.forEach(blockEntity -> {
|
||||
Energy.of(this)
|
||||
.into(Energy.of(blockEntity))
|
||||
.move();
|
||||
});
|
||||
acceptors.forEach(blockEntity -> Energy.of(this)
|
||||
.into(Energy.of(blockEntity))
|
||||
.move());
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
|
|
|
@ -37,6 +37,7 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.generator.BlockSolarPanel;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
@ -49,7 +50,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
boolean canSeeSky = false;
|
||||
boolean lastState = false;
|
||||
SolarPanels panel;
|
||||
private SolarPanels panel;
|
||||
|
||||
public SolarPanelBlockEntity() {
|
||||
super(TRBlockEntities.SOLAR_PANEL);
|
||||
|
@ -77,7 +78,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
if (panel == TRContent.SolarPanels.CREATIVE) {
|
||||
if (getPanel() == TRContent.SolarPanels.CREATIVE) {
|
||||
checkOverfill = false;
|
||||
setEnergy(Integer.MAX_VALUE);
|
||||
return;
|
||||
|
@ -91,9 +92,9 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
}
|
||||
int powerToAdd;
|
||||
if (isSunOut()) {
|
||||
powerToAdd = panel.generationRateD;
|
||||
powerToAdd = getPanel().generationRateD;
|
||||
} else if (canSeeSky) {
|
||||
powerToAdd = panel.generationRateN;
|
||||
powerToAdd = getPanel().generationRateN;
|
||||
} else {
|
||||
powerToAdd = 0;
|
||||
}
|
||||
|
@ -103,7 +104,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return panel.internalCapacity;
|
||||
return getPanel().internalCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,7 +119,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return panel.generationRateD;
|
||||
return getPanel().generationRateD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,7 +129,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return panel.powerTier;
|
||||
return getPanel().powerTier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,6 +137,13 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
// Nope
|
||||
}
|
||||
|
||||
public SolarPanels getPanel() {
|
||||
if(panel == null){
|
||||
updatePanel();
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
|
||||
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.maxEnergy") + ": "
|
||||
|
|
|
@ -114,6 +114,9 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
@Override
|
||||
public Direction getFacingEnum() {
|
||||
if(world == null){
|
||||
return null;
|
||||
}
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockEnergyStorage) {
|
||||
return ((BlockEnergyStorage) block).getFacing(world.getBlockState(pos));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue