mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Oil Generators respond to comparators
This commit is contained in:
parent
26a3e02044
commit
cfd7ec41df
5 changed files with 23 additions and 4 deletions
|
@ -238,8 +238,8 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
@Override
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IInventory){
|
||||
return Container.calcRedstoneFromInventory((IInventory)tile);
|
||||
if(tile instanceof TileEntityBase){
|
||||
return ((TileEntityBase)tile).getComparatorStrength();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -228,6 +228,10 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
|||
this.updateEntity();
|
||||
}
|
||||
|
||||
public int getComparatorStrength(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateEntity(){
|
||||
this.ticksElapsed++;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -81,6 +82,11 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorStrength(){
|
||||
return Container.calcRedstoneFromInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
|
|
|
@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe;
|
|||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -106,10 +107,12 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
|
|||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.world.isRemote){
|
||||
int lastCompare = this.getComparatorStrength();
|
||||
boolean flag = this.currentBurnTime > 0;
|
||||
|
||||
if(this.currentBurnTime > 0 && this.currentEnergyProduce > 0){
|
||||
this.currentBurnTime--;
|
||||
|
||||
this.storage.receiveEnergyInternal(this.currentEnergyProduce, false);
|
||||
}
|
||||
else if(!this.isRedstonePowered){
|
||||
|
@ -130,7 +133,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
|
|||
}
|
||||
}
|
||||
|
||||
if(flag != this.currentBurnTime > 0){
|
||||
if(flag != this.currentBurnTime > 0 || lastCompare != this.getComparatorStrength()){
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
|
@ -144,6 +147,12 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorStrength(){
|
||||
float calc = ((float)this.storage.getEnergyStored()/(float)this.storage.getMaxEnergyStored())*15F;
|
||||
return (int)calc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidHandler getFluidHandler(EnumFacing facing){
|
||||
return facing != EnumFacing.DOWN ? this.tank : null;
|
||||
|
|
|
@ -881,7 +881,7 @@ booklet.actuallyadditions.chapter.heatCollector.text.1=The <item>Heat Collector<
|
|||
booklet.actuallyadditions.chapter.canola.name=Canola and Oil
|
||||
booklet.actuallyadditions.chapter.canola.text.1=Using <item>Canola<r>, you can make a simple, yet effective power generation system from <imp>natural resources<r>. <n>To do this, first find some <item>Canola Plants<r> in the wild and plant them on your farm. <n><n>The <item>Canola<r> you get out of them can be used in a <item>Canola Press<r> to make <item>Canola Oil<r>. <n><n>This can be <imp>used in an<r> <item>Oil Generator<r>. It displays the amount of power it generates in its GUI, however, it can be <imp>upgraded further<r> to yield <imp>more power<r> than that!
|
||||
booklet.actuallyadditions.chapter.canola.text.2=For starters, you can use a <item>Fermenting Barrel<r> to convert the <item>Canola Oil<r> into <item>Oil<r>. <n><n>If you're still not satisfied with the power that generates, <imp>place it on the ground<r> and throw in a <item>Crystallized Canola Seed<r> to make <item>Crystallized Oil<r>. <n><n>If that isn't enough for you either, make a <item>Empowered Canola Seed<r>, toss that into some <item>Crystallized Oil<r> to get <item>Empowered Oil<r>!
|
||||
booklet.actuallyadditions.chapter.canola.text.5=If you break the <item>Oil Generator<r>, it will keep the liquid inside. <n>If you want to empty it out, just <imp>place it in the crafting grid<r> and all of the fluid will be drained. <n>It will <imp>stop generating<r> when powered by <imp>Redstone<r>.
|
||||
booklet.actuallyadditions.chapter.canola.text.5=If you break the <item>Oil Generator<r>, it will keep the liquid inside. <n>Place it in the <imp>crafting grid<r> to empty it out. <n>It will <imp>stop generating<r> when powered by <imp>Redstone<r>. <n>Additionally, using a <item>Comparator<r> will yield the percentage of <imp>energy stored<r>.
|
||||
|
||||
booklet.actuallyadditions.chapter.wings.name=Wings Of The Bats
|
||||
booklet.actuallyadditions.chapter.wings.text.1=Sometimes, bats will drop <item>Wings<r>. These wings can be used to make <item>Wings Of The Bats<r>, which allow you to <imp>fly<r> in a <imp>creative way<r>. <n>However, after about <secs> seconds, your weight won't be <imp>supported anymore<r> and you will <imp>drop to the ground<r>. <n>To remove exhaustion from your wings, either <imp>stand on the ground<r> to remove exhaustion <imp>slowly<r>, or hang on to the ceiling by <imp>flying up below a solid block<r> like a bat while the wings aren't fully exhausted to remove exhaustion <imp>fast<r>.
|
||||
|
|
Loading…
Reference in a new issue