mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 15:48:34 +01:00
Added configuration for Item Repairer
This commit is contained in:
parent
30ca7b5937
commit
cfbbf9d59d
3 changed files with 22 additions and 18 deletions
|
@ -229,7 +229,7 @@ public final class InitBooklet{
|
|||
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", ConfigIntValues.POWERED_FURNACE_ENERGY_USE.getValue()));
|
||||
new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LAVA_FACTORY_ENERGY_USE.getValue()), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText());
|
||||
new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator));
|
||||
new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", TileEntityItemRepairer.ENERGY_USE));
|
||||
new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", ConfigIntValues.ITEM_REPAIRER_ENERGY_USE.getValue()));
|
||||
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
|
||||
new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockPlayerInterface), new PageTextOnly(1).addTextReplacement("<range>", ConfigIntValues.PLAYER_INTERFACE_WORK_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
|
||||
new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDisplayStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
|
||||
|
|
|
@ -83,7 +83,7 @@ public enum ConfigIntValues{
|
|||
BIO_REACTOR_ENERGY_CAPACITY("Bio Reactor: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 200000, 1000, 1000000000, "Amount of energy Bio Reactor can store."),
|
||||
BIO_REACTOR_ENERGY_SEND("Bio Reactor: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 800, 1, 1000000000, "Amount of energy Bio Reactor can send per tick."),
|
||||
BIO_REACTOR_ENERGY_PRODUCTION("Bio Reactor: Energy Production Per Type", ConfigCategories.MACHINE_ENERGY_VALUES, 2, 1, 10000, "Amount of energy Bio Reactor produces per item time.\nResulting energy production is: (this value * amount of different items) ^ 2."),
|
||||
BIO_REACTOR_BURN_TIME("Bio Reactor: Maximum Burn Time", ConfigCategories.MACHINE_VALUES, 200, 1, 72000, "Maximum time in ticks Bio Reactor can burn one item.\nLow values can result in nonoperability of Bio Reactor."),
|
||||
BIO_REACTOR_BURN_TIME("Bio Reactor: Maximum Burn Time", ConfigCategories.MACHINE_RECIPE_COSTS, 200, 1, 72000, "Maximum time in ticks Bio Reactor can burn one item.\nLow values can result in nonoperability of Bio Reactor."),
|
||||
LASER_RELAY_MAXIMUM_DISTANCE("Laser Relay: Maximum Distance", ConfigCategories.MACHINE_VALUES, 15, 1, 48, "Maximum distance in blocks between two Laser Relays"),
|
||||
LASER_RELAY_MAXIMUM_UPGRADED_DISTANCE("Laser Relay: Maximum Distance With Range Upgrade", ConfigCategories.MACHINE_VALUES, 35, 1, 96, "Maximum distance in blocks between two Laser Relays with Range upgrade"),
|
||||
POWERED_FURNACE_ENERGY_CAPACITY("Powered Furnace: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 30000, 1000, 1000000000, "Amount of energy Powered Furnace can store."),
|
||||
|
@ -109,7 +109,10 @@ public enum ConfigIntValues{
|
|||
LAVA_FACTORY_ENERGY_CAPACITY("Lava Factory: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 300000, 1000, 1000000000, "Amount of energy Lava Factory can store."),
|
||||
LAVA_FACTORY_ENERGY_RECEIVE("Lava Factory: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 2000, 1, 1000000000, "Amount of energy Lava Factory can receive per tick."),
|
||||
LAVA_FACTORY_ENERGY_USE("Lava Factory: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 150000, 1, 1000000000, "Amount of energy Lava Factory uses to create block of lava."),
|
||||
LAVA_FACTORY_PRODUCTION_DURATION("Lava Factory: Production Duration", ConfigCategories.MACHINE_RECIPE_COSTS, 200, 1, 72000, "Time in ticks required by Lava Factory to produce block of lava.");
|
||||
LAVA_FACTORY_PRODUCTION_DURATION("Lava Factory: Production Duration", ConfigCategories.MACHINE_RECIPE_COSTS, 200, 1, 72000, "Time in ticks required by Lava Factory to produce block of lava."),
|
||||
ITEM_REPAIRER_ENERGY_CAPACITY("Item Repairer: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 300000, 1000, 1000000000, "Amount of energy Item Repairer can store."),
|
||||
ITEM_REPAIRER_ENERGY_RECEIVE("Item Repairer: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 6000, 1, 1000000000, "Amount of energy Item Repairer can receive per tick."),
|
||||
ITEM_REPAIRER_ENERGY_USE("Item Repairer: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 2500, 1, 1000000000, "Amount of energy Item Repairer uses per tick.");
|
||||
|
||||
public final String name;
|
||||
public final String category;
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -24,8 +26,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase{
|
|||
|
||||
public static final int SLOT_INPUT = 0;
|
||||
public static final int SLOT_OUTPUT = 1;
|
||||
public static final int ENERGY_USE = 2500;
|
||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 6000, 0);
|
||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(ConfigIntValues.ITEM_REPAIRER_ENERGY_CAPACITY.getValue(), ConfigIntValues.ITEM_REPAIRER_ENERGY_RECEIVE.getValue(), 0);
|
||||
public int nextRepairTick;
|
||||
private int lastEnergy;
|
||||
|
||||
|
@ -36,17 +37,16 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase{
|
|||
public static boolean canBeRepaired(ItemStack stack){
|
||||
if(StackUtil.isValid(stack)){
|
||||
Item item = stack.getItem();
|
||||
if(item != null){
|
||||
if(item.isRepairable() && item.getMaxDamage(stack) > 0){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
String reg = item.getRegistryName().toString();
|
||||
if(reg != null){
|
||||
for(String strg : ConfigStringListValues.REPAIRER_EXTRA_WHITELIST.getValue()){
|
||||
if(reg.equals(strg)){
|
||||
return true;
|
||||
}
|
||||
if(item.isRepairable() && item.getMaxDamage(stack) > 0){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
ResourceLocation resourceLocation = item.getRegistryName();
|
||||
if(resourceLocation != null){
|
||||
String reg = resourceLocation.toString();
|
||||
for(String strg : ConfigStringListValues.REPAIRER_EXTRA_WHITELIST.getValue()){
|
||||
if(reg.equals(strg)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,9 +85,10 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase{
|
|||
this.nextRepairTick = 0;
|
||||
}
|
||||
else{
|
||||
if(this.storage.getEnergyStored() >= ENERGY_USE){
|
||||
int energyUse = ConfigIntValues.ITEM_REPAIRER_ENERGY_USE.getValue();
|
||||
if(this.storage.getEnergyStored() >= energyUse){
|
||||
this.nextRepairTick++;
|
||||
this.storage.extractEnergyInternal(ENERGY_USE, false);
|
||||
this.storage.extractEnergyInternal(energyUse, false);
|
||||
if(this.nextRepairTick >= 4){
|
||||
this.nextRepairTick = 0;
|
||||
input.setItemDamage(input.getItemDamage()-1);
|
||||
|
|
Loading…
Reference in a new issue