mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 15:48:34 +01:00
Added configuration for Leaf-Eating Generator
This commit is contained in:
parent
17e4bd8547
commit
2d001c16d1
3 changed files with 16 additions and 11 deletions
|
@ -238,7 +238,7 @@ public final class InitBooklet{
|
|||
new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
|
||||
new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("<min>", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText());
|
||||
new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addItemsToPage(new ItemStack(InitItems.itemCanolaSeed)).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidRefinedCanolaOil).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("<rf>", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("<range>", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant();
|
||||
new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_ENERGY_PRODUCTION.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_WORK_RANGE.getValue()), 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();
|
||||
|
||||
//No RF Using Items
|
||||
|
|
|
@ -75,7 +75,11 @@ public enum ConfigIntValues{
|
|||
COAL_GENERATOR_ENERGY_SEND("Coal Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 80, 1, 1000000000, "Amount of energy Coal Generator can send per tick."),
|
||||
COAL_GENERATOR_ENERGY_PRODUCTION("Coal Generator: Energy Production", ConfigCategories.MACHINE_ENERGY_VALUES, 30, 1, 1000000000, "Amount of energy Coal Generator can produces per tick."),
|
||||
OIL_GENERATOR_ENERGY_CAPACITY("Oil Generator: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 50000, 1000, 1000000000, "Amount of energy Oil Generator can store."),
|
||||
OIL_GENERATOR_ENERGY_SEND("Oil Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Oil Generator can send per tick.");
|
||||
OIL_GENERATOR_ENERGY_SEND("Oil Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Oil Generator can send per tick."),
|
||||
LEAF_GENERATOR_ENERGY_CAPACITY("Leaf-Eating Generator: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 35000, 1000, 1000000000, "Amount of energy Leaf-Eating Generator can store."),
|
||||
LEAF_GENERATOR_ENERGY_SEND("Leaf-Eating Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 450, 1, 1000000000, "Amount of energy Leaf-Eating Generator can send per tick."),
|
||||
LEAF_GENERATOR_ENERGY_PRODUCTION("Leaf-Eating Generator: Energy Production", ConfigCategories.MACHINE_ENERGY_VALUES, 300, 1, 1000000000, "Amount of energy Leaf-Eating Generator produces per leaf block."),
|
||||
LEAF_GENERATOR_WORK_RANGE("Leaf-Eating Generator: Work Range", ConfigCategories.MACHINE_ENERGY_VALUES, 7, 1, 16, "Radius (in blocks) in which Leaf-Eating Generator consumes leaves.");
|
||||
|
||||
public final String name;
|
||||
public final String category;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -24,9 +25,7 @@ import java.util.List;
|
|||
|
||||
public class TileEntityLeafGenerator extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay{
|
||||
|
||||
public static final int RANGE = 7;
|
||||
public static final int ENERGY_PRODUCED = 300;
|
||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(35000, 0, 450);
|
||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(ConfigIntValues.LEAF_GENERATOR_ENERGY_CAPACITY.getValue(), 0, ConfigIntValues.LEAF_GENERATOR_ENERGY_SEND.getValue());
|
||||
private int nextUseCounter;
|
||||
private int oldEnergy;
|
||||
|
||||
|
@ -54,13 +53,15 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
|
|||
|
||||
if(this.nextUseCounter >= 5){
|
||||
this.nextUseCounter = 0;
|
||||
|
||||
if(ENERGY_PRODUCED <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){
|
||||
|
||||
int energyProduction = ConfigIntValues.LEAF_GENERATOR_ENERGY_PRODUCTION.getValue();
|
||||
int workRange = ConfigIntValues.LEAF_GENERATOR_WORK_RANGE.getValue();
|
||||
if(energyProduction <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){
|
||||
List<BlockPos> breakPositions = new ArrayList<BlockPos>();
|
||||
|
||||
for(int reachX = -RANGE; reachX < RANGE+1; reachX++){
|
||||
for(int reachZ = -RANGE; reachZ < RANGE+1; reachZ++){
|
||||
for(int reachY = -RANGE; reachY < RANGE+1; reachY++){
|
||||
for(int reachX = -workRange; reachX <= workRange; reachX++){
|
||||
for(int reachZ = -workRange; reachZ <= workRange; reachZ++){
|
||||
for(int reachY = -workRange; reachY <= workRange; reachY++){
|
||||
BlockPos pos = this.pos.add(reachX, reachY, reachZ);
|
||||
Block block = this.world.getBlockState(pos).getBlock();
|
||||
if(block != null && block.isLeaves(this.world.getBlockState(pos), this.world, pos)){
|
||||
|
@ -78,7 +79,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
|
|||
|
||||
this.world.setBlockToAir(theCoord);
|
||||
|
||||
this.storage.receiveEnergyInternal(ENERGY_PRODUCED, false);
|
||||
this.storage.receiveEnergyInternal(energyProduction, false);
|
||||
|
||||
AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 25, 0, 0.075F, 0.8F);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue