mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Fixed Solar Panel working even though blocked
Fixes https://github.com/Ellpeck/ActuallyAdditions/issues/22
This commit is contained in:
parent
e885808cc1
commit
29476bce61
1 changed files with 10 additions and 1 deletions
|
@ -51,11 +51,20 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasBlockAbove(){
|
||||||
|
for(int y = yCoord+1; y <= worldObj.getHeight(); y++){
|
||||||
|
if(!worldObj.getBlock(xCoord, y, zCoord).isAir(worldObj, xCoord, y, zCoord)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if(!worldObj.isRemote){
|
if(!worldObj.isRemote){
|
||||||
if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){
|
if(!this.hasBlockAbove() && worldObj.isDaytime()){
|
||||||
if(ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue() <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
if(ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue() <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
||||||
this.storage.receiveEnergy(ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue(), false);
|
this.storage.receiveEnergy(ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue(), false);
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
|
Loading…
Reference in a new issue