Added configuration for Drill

This commit is contained in:
OneEyeMaker 2017-09-25 09:39:34 +03:00
parent dcd8f5207b
commit 6f97394fbf
6 changed files with 38 additions and 19 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 Tools"),
OTHER("Other", "Everything else"); OTHER("Other", "Everything else");
public final String name; public final String name;

View file

@ -28,7 +28,7 @@ public final class ConfigValues{
public static void defineConfigValues(Configuration config){ public static void defineConfigValues(Configuration config){
for(ConfigIntValues currConf : ConfigIntValues.values()){ for(ConfigIntValues currConf : ConfigIntValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt(); currConf.currentValue = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
} }
for(ConfigBoolValues currConf : ConfigBoolValues.values()){ for(ConfigBoolValues currConf : ConfigBoolValues.values()){

View file

@ -17,7 +17,9 @@ public enum ConfigIntListValues{
ORE_GEN_DIMENSION_BLACKLIST("OreGen Dimension Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The list of IDs that Actually Additions OreGen (Ex: Black Quartz) is banned in. This also applies for other world gen like lush caves."), ORE_GEN_DIMENSION_BLACKLIST("OreGen Dimension Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The list of IDs that Actually Additions OreGen (Ex: Black Quartz) is banned in. This also applies for other world gen like lush caves."),
PLANT_DIMENSION_BLACKLIST("Plant Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The list of IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in."), PLANT_DIMENSION_BLACKLIST("Plant Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The list of IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in."),
OIL_POWER("Oil Gen: Power Values", ConfigCategories.MACHINE_VALUES, new int[]{40, 80, 100, 120}, "The amount of power that the 4 tiers of oils generate (in order)"), OIL_POWER("Oil Gen: Power Values", ConfigCategories.MACHINE_VALUES, new int[]{40, 80, 100, 120}, "The amount of power that the 4 tiers of oils generate (in order)"),
OIL_TIME("Oil Gen: Time Values", ConfigCategories.MACHINE_VALUES, new int[]{100, 120, 280, 400}, "The amount of time that the 4 tiers of oils work for (in order)"); OIL_TIME("Oil Gen: Time Values", ConfigCategories.MACHINE_VALUES, new int[]{100, 120, 280, 400}, "The amount of time that the 4 tiers of oils work for (in order)"),
DRILL_AUGMENTS_ENERGY_USE("Drill: Energy Use Per Augment", ConfigCategories.TOOL_ENERGY_VALUES, new int[]{50, 75, 175, 100, 40, 80, 10, 30, 0}, "Additional amount of energy Drill Augments use per mined block. Order of augments: Speed I, Speed II, Speed III, Silk Touch, Fortune I, Fortune II, Mining I, Mining II, Block Placing");
public final String name; public final String name;
public final String category; public final String category;

View file

@ -29,7 +29,11 @@ public enum ConfigIntValues{
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 Drill 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, "Amount of energy Drill uses to mine block.");
public final String name; public final String name;
public final String category; public final String category;

View file

@ -13,6 +13,8 @@ package de.ellpeck.actuallyadditions.mod.items;
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.ConfigIntListValues;
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;
@ -49,10 +51,9 @@ 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,47 @@ 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; int energyUse = ConfigIntValues.DRILL_ENERGY_USE.getValue();
int[] augmentsEnergyUse = ConfigIntListValues.DRILL_AUGMENTS_ENERGY_USE.getValue();
//Speed //Speed
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){
use += 50; energyUse += augmentsEnergyUse[0];
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){
use += 75; energyUse += augmentsEnergyUse[1];
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)){
use += 175; energyUse += augmentsEnergyUse[2];
} }
} }
} }
//Silk Touch //Silk Touch
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){
use += 100; energyUse += augmentsEnergyUse[3];
} }
//Fortune //Fortune
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){
use += 40; energyUse += augmentsEnergyUse[4];
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II)){
use += 80; energyUse += augmentsEnergyUse[5];
} }
} }
//Size //Size
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){
use += 10; energyUse += augmentsEnergyUse[6];
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){
use += 30; energyUse += augmentsEnergyUse[7];
} }
} }
return use; //Block Placing
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.PLACER)){
energyUse += augmentsEnergyUse[8];
}
return energyUse;
} }
/** /**

View file

@ -36,9 +36,14 @@ public final class StackUtil{
} }
public static boolean isValid(ItemStack stack){//Stacks are nonnull. If we are making null stacks we're stupid anyway. public static boolean isValid(ItemStack stack){//Stacks are nonnull. If we are making null stacks we're stupid anyway.
if(stack == null) AwfulUtil.callTheFuckinPolice("Oh yeah some idiot somewhere threw a null itemstack at us, might've been us, but whatever"); if(stack == null){
Item i = stack.getItem(); AwfulUtil.callTheFuckinPolice("Oh yeah some idiot somewhere threw a null itemstack at us, might've been us, but whatever");
if(i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled(); return false;
}
Item i = stack.getItem();
if(i instanceof IDisableableItem){
return !((IDisableableItem) i).isDisabled();
}
return !stack.isEmpty(); return !stack.isEmpty();
} }