From ca38b43b67fb7a4f96dc547757ea434fc6eabed0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 28 Nov 2016 13:11:29 +0100 Subject: [PATCH] Fermenting barrel comparator output --- .../mod/booklet/InitBooklet.java | 2 +- .../mod/tile/TileEntityFermentingBarrel.java | 15 ++++++++++++++- .../assets/actuallyadditions/lang/en_US.lang | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 5e3481c4f..08b0868a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -226,7 +226,7 @@ public final class InitBooklet{ //RF Generating Blocks new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText()); new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText()); - new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addItemToPage(new ItemStack(InitItems.itemCanolaSeed)).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText()); + new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addItemToPage(new ItemStack(InitItems.itemCanolaSeed)).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText()); new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant(); new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockBioReactor), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index ebbb76dba..3a2169d5f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -45,6 +45,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari private int lastCanola; private int lastOil; private int lastProcessTime; + private int lastCompare; public TileEntityFermentingBarrel(){ super("fermentingBarrel"); @@ -80,13 +81,19 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari this.oilTank.fillInternal(new FluidStack(InitFluids.fluidOil, produce), true); this.canolaTank.drainInternal(produce, true); - this.markDirty(); } } else{ this.currentProcessTime = 0; } + int compare = this.getComparatorStrength(); + if(compare != this.lastCompare){ + this.lastCompare = compare; + + this.markDirty(); + } + if((this.canolaTank.getFluidAmount() != this.lastCanola || this.oilTank.getFluidAmount() != this.lastOil || this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()){ this.lastProcessTime = this.currentProcessTime; this.lastCanola = this.canolaTank.getFluidAmount(); @@ -95,6 +102,12 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari } } + @Override + public int getComparatorStrength(){ + float calc = ((float)this.oilTank.getFluidAmount()/(float)this.oilTank.getCapacity())*15F; + return (int)calc; + } + @SideOnly(Side.CLIENT) public int getProcessScaled(int i){ return this.currentProcessTime*i/PROCESS_TIME; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 8aa3d1e41..9dc8ecacb 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -881,6 +881,7 @@ booklet.actuallyadditions.chapter.heatCollector.text.1=The Heat Collector< booklet.actuallyadditions.chapter.canola.name=Canola and Oil booklet.actuallyadditions.chapter.canola.text.1=Using Canola, you can make a simple, yet effective power generation system from natural resources. To do this, first find some Canola Plants in the wild and plant them on your farm. The Canola you get out of them can be used in a Canola Press to make Canola Oil. This can be used in an Oil Generator. It displays the amount of power it generates in its GUI, however, it can be upgraded further to yield more power than that! booklet.actuallyadditions.chapter.canola.text.2=For starters, you can use a Fermenting Barrel to convert the Canola Oil into Oil. If you're still not satisfied with the power that generates, place it on the ground and throw in a Crystallized Canola Seed to make Crystallized Oil. If that isn't enough for you either, make a Empowered Canola Seed, toss that into some Crystallized Oil to get Empowered Oil! +booklet.actuallyadditions.chapter.canola.text.4=The Fermenting Barrel can have a Comparator attached to it which will result in the Redstone strength being equivalent to the percentage of the output tank. booklet.actuallyadditions.chapter.canola.text.5=If you break the Oil Generator, it will keep the liquid inside. Place it in the crafting grid to empty it out. It will stop generating when powered by Redstone. Additionally, using a Comparator will yield the percentage of energy stored. booklet.actuallyadditions.chapter.wings.name=Wings Of The Bats