Fixed Solar Panel working even though blocked

Fixes https://github.com/Ellpeck/ActuallyAdditions/issues/22
This commit is contained in:
Ellpeck 2015-11-26 18:45:06 +01:00
parent e885808cc1
commit 29476bce61

View file

@ -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();