mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Made solar panel lose efficiency with transparent blocks above it
Closes #244
This commit is contained in:
parent
936df5fd5f
commit
f89196a701
2 changed files with 21 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -831,7 +831,7 @@ booklet.actuallyadditions.chapter.coalGen.name=Coal Generator
|
|||
booklet.actuallyadditions.chapter.coalGen.text.1=The <item>Coal Generator<r> generates <imp><rf> RF/t<r> through the use of everything that can be put into a furnace. <n>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 <item>Solar Panel<r> <imp>produces <rf> RF/t<r> when it has direct daylight above it and it is daytime. <n><n><i>Panelled walls
|
||||
booklet.actuallyadditions.chapter.solarPanel.text.1=The <item>Solar Panel<r> <imp>produces <rf> RF/t<r> when it has direct daylight above it and it is daytime. Any blocks above it that are transparent will <imp>decrease its efficiency<r>, however. <n><n><i>Panelled walls
|
||||
|
||||
booklet.actuallyadditions.chapter.heatCollector.name=Heat Collector
|
||||
booklet.actuallyadditions.chapter.heatCollector.text.1=The <item>Heat Collector<r> is a block that <imp>produces <rf> RF/t<r>. <n>To do that, it needs to be <imp>surrounded with at least <min> Lava Blocks<r> directly around it on any side except the top one. But watch out, it sometimes <imp>destroys some of these Lava Blocks<r>!
|
||||
|
|
Loading…
Reference in a new issue