Add config values for Leaf & Coal Generators. Closes #1277 (#1286)

This commit is contained in:
iTitus 2019-11-08 18:07:11 +01:00 committed by Brennan Ward
parent b409090ec4
commit 35a048de3d
4 changed files with 45 additions and 13 deletions

View file

@ -175,7 +175,7 @@ public final class InitBooklet {
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText());
chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145));
chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.COAL_GENERATOR_CF_PRODUCTION.getValue()), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
ArrayList<BookletPage> empowererPages = new ArrayList<>();
empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand)));
for (int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++) {
@ -278,7 +278,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_CF_PER_LEAF.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_AREA.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

View file

@ -103,9 +103,37 @@ public enum ConfigIntValues {
"Mining Lens Energy",
ConfigCategories.MACHINE_VALUES,
60000,
1,
Integer.MAX_VALUE,
"The energy use of the Atomic Reconstructor's Mining Lens."),
COAL_GENERATOR_CF_PRODUCTION(
"Coal Generator Energy Production",
ConfigCategories.MACHINE_VALUES,
30,
1,
Integer.MAX_VALUE,
"The energy use of the Atomic Reconstructor's Mining Lens.");
"The Coal Generator's Energy Production in CF/tick while burning."),
LEAF_GENERATOR_COOLDOWN(
"Leaf Generator Cooldown",
ConfigCategories.MACHINE_VALUES,
5,
0,
Integer.MAX_VALUE,
"The cooldown between two generation cycles of the Leaf Generator, in ticks"),
LEAF_GENERATOR_CF_PER_LEAF(
"Leaf Generator Energy Production",
ConfigCategories.MACHINE_VALUES,
300,
1,
Integer.MAX_VALUE,
"The Leaf Generator's Energy Production in CF/Leaf"),
LEAF_GENERATOR_AREA(
"Leaf Generator Area",
ConfigCategories.MACHINE_VALUES,
7,
1,
Integer.MAX_VALUE,
"The size of the Leaf Generator's harvesting area. Default is 7x7x7, must be an odd number.");
public final String name;
public final String category;

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -24,7 +25,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements ISharingEnergyProvider {
public static final int PRODUCE = 30;
public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 0, 80);
public int maxBurnTime;
public int currentBurnTime;
@ -77,7 +77,10 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
if (this.currentBurnTime > 0) {
this.currentBurnTime--;
this.storage.addEnergyRaw(PRODUCE);
int produce = ConfigIntValues.COAL_GENERATOR_CF_PRODUCTION.getValue();
if (produce > 0) {
this.storage.addEnergyRaw(produce);
}
}
ItemStack stack = this.inv.getStackInSlot(0);

View file

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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,8 +25,6 @@ import net.minecraftforge.energy.IEnergyStorage;
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);
private int nextUseCounter;
private int oldEnergy;
@ -52,15 +51,17 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
if (!this.world.isRemote) {
if (!this.isRedstonePowered) {
if (this.nextUseCounter >= 5) {
if (this.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN.getValue()) {
this.nextUseCounter = 0;
if (ENERGY_PRODUCED <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) {
int energyProduced = ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue();
if (energyProduced > 0 && energyProduced <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) {
List<BlockPos> breakPositions = new ArrayList<>();
for (int reachX = -RANGE; reachX < RANGE + 1; reachX++) {
for (int reachZ = -RANGE; reachZ < RANGE + 1; reachZ++) {
for (int reachY = -RANGE; reachY < RANGE + 1; reachY++) {
int range = ConfigIntValues.LEAF_GENERATOR_AREA.getValue();
for (int reachX = -range; reachX < range + 1; reachX++) {
for (int reachZ = -range; reachZ < range + 1; reachZ++) {
for (int reachY = -range; reachY < range + 1; 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(energyProduced, 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);
}