diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index 1d360c113..502013e76 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -11,8 +11,6 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; -import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceSolar; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; @@ -64,9 +62,10 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn public void updateEntity(){ super.updateEntity(); if(!this.worldObj.isRemote){ - if(!this.hasBlockAbove() && this.worldObj.isDaytime()){ - if(PRODUCE <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ - this.storage.receiveEnergy(PRODUCE, false); + int power = this.getPowerToGenerate(PRODUCE); + if(this.worldObj.isDaytime() && power > 0){ + if(power <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ + this.storage.receiveEnergy(power, false); this.markDirty(); } } @@ -77,14 +76,25 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn } } - public boolean hasBlockAbove(){ + public int getPowerToGenerate(int power){ for(int y = 1; y <= this.worldObj.getHeight()-this.pos.getY(); y++){ - IBlockState state = this.worldObj.getBlockState(this.pos.up(y)); - if(state.getMaterial().isOpaque()){ - return true; + if(power > 0){ + BlockPos pos = this.pos.up(y); + IBlockState state = this.worldObj.getBlockState(pos); + + if(state.getMaterial().isOpaque()){ + power = 0; + } + else if(!state.getBlock().isAir(state, this.worldObj, pos)){ + power--; + } + } + else{ + break; } } - return false; + + return power; } @Override diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 2aa7e31ef..598fbe4e5 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -831,7 +831,7 @@ booklet.actuallyadditions.chapter.coalGen.name=Coal Generator booklet.actuallyadditions.chapter.coalGen.text.1=The Coal Generator generates RF/t through the use of everything that can be put into a furnace. Note that it only starts burning something up if there's enough space for the energy generated. booklet.actuallyadditions.chapter.solarPanel.name=Solar Panel -booklet.actuallyadditions.chapter.solarPanel.text.1=The Solar Panel produces RF/t when it has direct daylight above it and it is daytime. Panelled walls +booklet.actuallyadditions.chapter.solarPanel.text.1=The Solar Panel produces RF/t when it has direct daylight above it and it is daytime. Any blocks above it that are transparent will decrease its efficiency, however. Panelled walls booklet.actuallyadditions.chapter.heatCollector.name=Heat Collector booklet.actuallyadditions.chapter.heatCollector.text.1=The Heat Collector is a block that produces RF/t. To do that, it needs to be surrounded with at least Lava Blocks directly around it on any side except the top one. But watch out, it sometimes destroys some of these Lava Blocks!