Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.fuzzycraft.botanichorizons.addons.tileentity;

import cpw.mods.fml.common.FMLLog;
import net.fuzzycraft.botanichorizons.util.InventoryHelper;
import net.fuzzycraft.botanichorizons.util.multiblock.MultiblockHelper;
import net.minecraft.entity.item.EntityItem;
Expand Down Expand Up @@ -42,6 +41,8 @@ public SimpleAutomationTileEntity(MultiblockHelper structure) {

// Business logic

abstract void consumeNonItemResources(R recipe, int parallel);

// process recipes
public void handleCrafts() {
int parallel = 64;
Expand Down Expand Up @@ -88,6 +89,7 @@ public void handleCrafts() {
// perform recipe in batch
ItemStack output = output_instance.copy();
output.stackSize = output.stackSize * parallel;
consumeNonItemResources(recipe, parallel);

// commit to inventory
inventoryHandler.setInventorySlotContents(INPUT_SIZE + OUTPUT_SIZE - 1, output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

public class TileAdvancedAlchemyPool extends TileAdvancedManaPool {

public static final int MANA_CAPACITY = 50000;

public TileAdvancedAlchemyPool() {
super(Multiblocks.poolAlchemy);
super(Multiblocks.poolAlchemy, MANA_CAPACITY);
}

@Override
Expand All @@ -42,6 +44,6 @@ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public void renderHUD(Minecraft mc, ScaledResolution res) {
ChargeState state = ChargeState.genState(isOnline, storedMana, ACTIVATE_MANA);
String tooltip = state.getLocalisedHudString(BHBlocks.autoPoolAlchemy);
HUDHandler.drawSimpleManaHUD(state.color, storedMana, MANA_CAPACITY, tooltip, res);
HUDHandler.drawSimpleManaHUD(state.color, storedMana, manaCapacity, tooltip, res);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public RecipeElvenTrade findMatchingRecipe(@Nonnull ItemStack stack) {
return null;
}

@Override
void consumeNonItemResources(RecipeElvenTrade recipe, int parallel) {
storedMana -= parallel * RECIPE_MANA;
}

// Botania has an annoying habit of specifying multiple ingredients as ["oreDict", "oreDict", "oreDict"]
// Reduce these cases into a simple number
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.client.core.handler.HUDHandler;

public class TileAdvancedConjurationPool extends TileAdvancedManaPool {

public static final int MANA_CAPACITY = 1000000;

public TileAdvancedConjurationPool() {
super(Multiblocks.poolConjuration);
super(Multiblocks.poolConjuration, MANA_CAPACITY);
}

@Override
Expand All @@ -43,6 +44,6 @@ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public void renderHUD(Minecraft mc, ScaledResolution res) {
ChargeState state = ChargeState.genState(isOnline, storedMana, ACTIVATE_MANA);
String tooltip = state.getLocalisedHudString(BHBlocks.autoPoolConjuration);
HUDHandler.drawSimpleManaHUD(state.color, storedMana, MANA_CAPACITY, tooltip, res);
HUDHandler.drawSimpleManaHUD(state.color, storedMana, manaCapacity, tooltip, res);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.fuzzycraft.botanichorizons.addons.tileentity;

import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.fuzzycraft.botanichorizons.addons.BHBlocks;
Expand All @@ -18,8 +17,10 @@

public class TileAdvancedCraftingPool extends TileAdvancedManaPool {

public static final int MANA_CAPACITY = 50000;

public TileAdvancedCraftingPool() {
super(Multiblocks.poolInfusion);
super(Multiblocks.poolInfusion, MANA_CAPACITY);
}

@Override
Expand All @@ -45,6 +46,6 @@ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public void renderHUD(Minecraft mc, ScaledResolution res) {
ChargeState state = ChargeState.genState(isOnline, storedMana, ACTIVATE_MANA);
String tooltip = state.getLocalisedHudString(BHBlocks.autoPoolInfusion);
HUDHandler.drawSimpleManaHUD(state.color, storedMana, MANA_CAPACITY, tooltip, res);
HUDHandler.drawSimpleManaHUD(state.color, storedMana, manaCapacity, tooltip, res);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public abstract class TileAdvancedManaPool extends SimpleAutomationTileEntity<RecipeManaInfusion> {

// Balance
public static final int MANA_CAPACITY = 50000;
public final int manaCapacity;
public static final int CYCLE_TICKS = 20; // time between checks
public static final int MAX_PARALLELS = 64;
public static final int ACTIVATE_MANA = 1000;
Expand All @@ -22,8 +22,9 @@ public abstract class TileAdvancedManaPool extends SimpleAutomationTileEntity<Re

// Constructors

public TileAdvancedManaPool(MultiblockHelper structure) {
public TileAdvancedManaPool(MultiblockHelper structure, int capacity) {
super(structure);
manaCapacity = capacity;
}

// Business logic
Expand Down Expand Up @@ -63,6 +64,11 @@ public int getAvailableParallels(@NotNull RecipeManaInfusion recipe) {
return parallel;
}

@Override
void consumeNonItemResources(RecipeManaInfusion recipe, int parallel) {
storedMana -= parallel * recipe.getManaToConsume();
}

@Override
public int getRecipeInputStackSize(@NotNull RecipeManaInfusion recipe) {
return 1;
Expand All @@ -75,7 +81,7 @@ public int getRecipeInputStackSize(@NotNull RecipeManaInfusion recipe) {

@Override
public int getManaMaximum() {
return MANA_CAPACITY;
return manaCapacity;
}

// IWandable delegate
Expand Down