Added configuration for Drill (energy) parameters

This commit is contained in:
OneEyeMaker 2017-09-21 17:54:25 +03:00
parent 1fe930b395
commit f556c34a7c
5 changed files with 68 additions and 24 deletions

View file

@ -18,6 +18,7 @@ public enum ConfigCategories{
MACHINE_VALUES("Machine Values", "Values for Machines"), MACHINE_VALUES("Machine Values", "Values for Machines"),
MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"), MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"),
WORLD_GEN("World Gen", "Everything regarding World Generation"), WORLD_GEN("World Gen", "Everything regarding World Generation"),
TOOL_ENERGY_VALUES("Tool Energy Values", "Energy values for various tools"),
OTHER("Other", "Everything else"); OTHER("Other", "Everything else");
public final String name; public final String name;

View file

@ -10,10 +10,7 @@
package de.ellpeck.actuallyadditions.mod.config; package de.ellpeck.actuallyadditions.mod.config;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.*;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -31,6 +28,10 @@ public final class ConfigValues{
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
} }
for(ConfigDoubleValues currConf : ConfigDoubleValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getDouble();
}
for(ConfigBoolValues currConf : ConfigBoolValues.values()){ for(ConfigBoolValues currConf : ConfigBoolValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean();
} }

View file

@ -0,0 +1,37 @@
package de.ellpeck.actuallyadditions.mod.config.values;
import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
public enum ConfigDoubleValues
{
DRILL_SPEED_I_COST_MULTIPLIER("Drill: Speed I cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.5D, 1.0D, 10.0D, "Energy consumption multiplier for Speed I upgrade"),
DRILL_SPEED_II_COST_MULTIPLIER("Drill: Speed II cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.5D, 1.0D, 10.0D, "Energy consumption multiplier for Speed II upgrade; total cost for this upgrade is multiplied on Speed I cost"),
DRILL_SPEED_III_COST_MULTIPLIER("Drill: Speed III cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.5D, 1.0D, 10.0D, "Energy consumption multiplier for Speed III upgrade; total cost for this upgrade is multiplied on Speed I and Speed II costs"),
DRILL_SILK_TOUCH_COST_MULTIPLIER("Drill: Silk Touch cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 2.0D, 1.0D, 10.0D, "Energy consumption multiplier for Silk Touch upgrade"),
DRILL_FORTUNE_I_COST_MULTIPLIER("Drill: Fortune I cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.5D, 1.0D, 10.0D, "Energy consumption multiplier for Fortune I upgrade"),
DRILL_FORTUNE_II_COST_MULTIPLIER("Drill: Fortune II cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.5D, 1.0D, 10.0D, "Energy consumption multiplier for Fortune II upgrade; total cost for this upgrade is multiplied on Fortune I cost"),
DRILL_SIZE_3_COST_MULTIPLIER("Drill: 3x3 Upgrade cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.25D, 1.0D, 10.0D, "Energy consumption multiplier for 3x3 digging upgrade"),
DRILL_SIZE_5_COST_MULTIPLIER("Drill: 5x5 Upgrade cost multiplier", ConfigCategories.TOOL_ENERGY_VALUES, 1.25D, 1.0D, 10.0D, "Energy consumption multiplier for 5x5 digging upgrade; total cost for this upgrade is multiplied on 3x3 digging upgrade cost");
public final String name;
public final String category;
public final double defaultValue;
public final double min;
public final double max;
public final String desc;
public double currentValue;
ConfigDoubleValues(String name, ConfigCategories category, double defaultValue, double min, double max, String desc){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
this.min = min;
this.max = max;
this.desc = desc;
}
public double getValue(){
return this.currentValue;
}
}

View file

@ -30,8 +30,12 @@ public enum ConfigIntValues{
FONT_SIZE_SMALL("Booklet Small Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's small font in percent. Set to 0 to use defaults from the lang file."), FONT_SIZE_SMALL("Booklet Small Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's small font in percent. Set to 0 to use defaults from the lang file."),
FONT_SIZE_MEDIUM("Booklet Medium Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's medium font in percent. Set to 0 to use defaults from the lang file."), FONT_SIZE_MEDIUM("Booklet Medium Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's medium font in percent. Set to 0 to use defaults from the lang file."),
FONT_SIZE_LARGE("Booklet Large Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's large font in percent. Set to 0 to use defaults from the lang file."), FONT_SIZE_LARGE("Booklet Large Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's large font in percent. Set to 0 to use defaults from the lang file."),
ELEVEN("What is 11", ConfigCategories.OTHER, 11, 0, 12, "11?"); ELEVEN("What is 11", ConfigCategories.OTHER, 11, 0, 12, "11?"),
DRILL_ENERGY_CAPACITY("Drill: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 250000, 1000, 1000000000, "Amount of energy Drills can store"),
DRILL_ENERGY_TRANSFER("Drill: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Drill can receive per tick"),
DRILL_ENERGY_USE("Drill: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 100, 1, 1000000000, "Base amount energy used by Drill per mined block");
public final String name; public final String name;
public final String category; public final String category;

View file

@ -10,9 +10,15 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigDoubleValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
@ -42,17 +48,12 @@ import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ItemDrill extends ItemEnergy{ public class ItemDrill extends ItemEnergy{
public static final int HARVEST_LEVEL = 4; public static final int HARVEST_LEVEL = 4;
private static final int ENERGY_USE = 100;
public ItemDrill(String name){ public ItemDrill(String name){
super(250000, 1000, name); super(ConfigIntValues.DRILL_ENERGY_CAPACITY.getValue(), ConfigIntValues.DRILL_ENERGY_TRANSFER.getValue(), name);
this.setMaxDamage(0); this.setMaxDamage(0);
this.setHasSubtypes(true); this.setHasSubtypes(true);
@ -191,7 +192,7 @@ public class ItemDrill extends ItemEnergy{
Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack); Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack);
if(slot == EntityEquipmentSlot.MAINHAND){ if(slot == EntityEquipmentSlot.MAINHAND){
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0)); map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ConfigIntValues.DRILL_ENERGY_USE.getValue() ? 8.0F : 0.1F, 0));
map.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool Modifier", -2.5F, 0)); map.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool Modifier", -2.5F, 0));
} }
@ -270,41 +271,41 @@ public class ItemDrill extends ItemEnergy{
* @return The Energy use per Block * @return The Energy use per Block
*/ */
public int getEnergyUsePerBlock(ItemStack stack){ public int getEnergyUsePerBlock(ItemStack stack){
int use = ENERGY_USE; double energyToUse = ConfigIntValues.DRILL_ENERGY_USE.getValue();
//Speed //Speed
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){
use += 50; energyToUse *= ConfigDoubleValues.DRILL_SPEED_I_COST_MULTIPLIER.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){
use += 75; energyToUse *= ConfigDoubleValues.DRILL_SPEED_II_COST_MULTIPLIER.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)){
use += 175; energyToUse *= ConfigDoubleValues.DRILL_SPEED_III_COST_MULTIPLIER.getValue();
} }
} }
} }
//Silk Touch //Silk Touch
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){
use += 100; energyToUse *= ConfigDoubleValues.DRILL_SILK_TOUCH_COST_MULTIPLIER.getValue();
} }
//Fortune //Fortune
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){
use += 40; energyToUse *= ConfigDoubleValues.DRILL_FORTUNE_I_COST_MULTIPLIER.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II)){
use += 80; energyToUse *= ConfigDoubleValues.DRILL_FORTUNE_II_COST_MULTIPLIER.getValue();
} }
} }
//Size //Size
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){
use += 10; energyToUse *= ConfigDoubleValues.DRILL_SIZE_3_COST_MULTIPLIER.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){
use += 30; energyToUse *= ConfigDoubleValues.DRILL_SIZE_5_COST_MULTIPLIER.getValue();
} }
} }
return use; return (int) energyToUse;
} }
/** /**
@ -482,7 +483,7 @@ public class ItemDrill extends ItemEnergy{
} }
return false; return false;
} }
@Override @Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) { public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isItemEqual(oldStack)); return !(newStack.isItemEqual(oldStack));