diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java index 396100c..6519111 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java @@ -1,24 +1,17 @@ package iguanaman.iguanatweakstconstruct.leveling; -import iguanaman.iguanatweakstconstruct.old.modifiers.*; import iguanaman.iguanatweakstconstruct.reference.Config; import iguanaman.iguanatweakstconstruct.reference.Reference; import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import tconstruct.items.tools.*; import tconstruct.library.TConstructRegistry; -import tconstruct.library.modifier.ItemModifier; import tconstruct.library.tools.HarvestTool; import tconstruct.library.tools.Weapon; -import tconstruct.modifiers.tools.ModAntiSpider; -import tconstruct.modifiers.tools.ModInteger; -import tconstruct.modifiers.tools.ModReinforced; -import tconstruct.modifiers.tools.ModSmite; /** * Utility class that takes care of all the Tool XP related things. @@ -298,7 +291,7 @@ public abstract class LevelingLogic { // Add random bonuses on leveling up? if (Config.toolLevelingRandomBonuses) { - RandomBonusses.tryModifying(player, stack); + RandomBonuses.tryModifying(player, stack); } } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/RandomBonusses.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/RandomBonuses.java similarity index 95% rename from src/main/java/iguanaman/iguanatweakstconstruct/leveling/RandomBonusses.java rename to src/main/java/iguanaman/iguanatweakstconstruct/leveling/RandomBonuses.java index d130132..7c5d9b2 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/RandomBonusses.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/RandomBonuses.java @@ -43,7 +43,7 @@ todo: maybe.. add a critical strike modifier, only obtainable through levelup :> */ -public class RandomBonusses { +public class RandomBonuses { private static Map modCache = new HashMap(); public static Modifier tryModifying(EntityPlayer player, ItemStack tool) @@ -309,6 +309,7 @@ public class RandomBonusses { /* Modifier weights */ private static int getToolModifierWeight(Modifier mod) { + // useful bonuses switch(mod) { // mining mods @@ -321,6 +322,14 @@ public class RandomBonusses { case EMERALD: return 35; case REPAIR: return 50; case REINFORCED:return 50; + } + + // less useful bonuses + if(Config.randomBonusesAreUseful) + return 0; + + switch(mod) + { // combat modifiers case ATTACK: return 15; case BLAZE: return 5; @@ -337,16 +346,8 @@ public class RandomBonusses { { switch(mod) { - // mining mods - case REDSTONE: return 0; case LAPIS: return 75; - case AUTOSMELT: return 15; - case SILKTOUCH: return 5; - // general modifiers - case DIAMOND: return 15; - case EMERALD: return 30; case REPAIR: return 55; - case REINFORCED:return 35; // combat modifiers case ATTACK: return 110; case BLAZE: return 45; @@ -355,6 +356,21 @@ public class RandomBonusses { case BEHEADING: return 50; case LIFESTEAL: return 30; case KNOCKBACK: return 50; + } + + if(Config.randomBonusesAreUseful) + return 0; + + switch(mod) + { + // mining mods + case REDSTONE: return 0; + case AUTOSMELT: return 15; + case SILKTOUCH: return 5; + // general modifiers + case DIAMOND: return 15; + case EMERALD: return 30; + case REINFORCED:return 35; default: return 0; } } @@ -363,15 +379,29 @@ public class RandomBonusses { { switch(mod) { - // mining mods case REDSTONE: return 100; case LAPIS: return 75; + case REPAIR: return 40; + // combat modifiers + case ATTACK: return 100; + case BLAZE: return 55; + case SMITE: return 40; + case BANE: return 40; + case BEHEADING: return 20; + case LIFESTEAL: return 40; + case KNOCKBACK: return 20; + } + + if(Config.randomBonusesAreUseful) + return 0; + + switch(mod) + { case AUTOSMELT: return 1; case SILKTOUCH: return 1; // general modifiers case DIAMOND: return 15; case EMERALD: return 30; - case REPAIR: return 50; case REINFORCED:return 40; // combat modifiers case ATTACK: return 100; diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/commands/debug.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/commands/debug.java index c2bc684..26883dd 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/commands/debug.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/commands/debug.java @@ -1,14 +1,11 @@ package iguanaman.iguanatweakstconstruct.leveling.commands; -import iguanaman.iguanatweakstconstruct.leveling.RandomBonusses; -import iguanaman.iguanatweakstconstruct.util.Log; +import iguanaman.iguanatweakstconstruct.leveling.RandomBonuses; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; -import scala.Int; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.tools.ToolCore; import tconstruct.tools.TinkerTools; @@ -38,7 +35,7 @@ public class debug extends CommandBase { EntityPlayerMP entityplayermp = astring.length >= 1 ? getPlayer(icommandsender, astring[0]) : getCommandSenderAsPlayer(icommandsender); ItemStack equipped = entityplayermp.getCurrentEquippedItem(); if (equipped != null && equipped.getItem() instanceof ToolCore) { - HashMap foo = new HashMap(); + HashMap foo = new HashMap(); for(int i = 0; i < 1000; i++) { { //ItemStack head = new ItemStack(TinkerTools.swordBlade, 0, 2); @@ -49,7 +46,7 @@ public class debug extends CommandBase { ItemStack accessory = new ItemStack(TinkerTools.toolRod, 0, 4); ItemStack tool = ToolBuilder.instance.buildTool(head, handle, accessory, "testtool"); for(int j = 0; j < 5; j++) { - RandomBonusses.Modifier mod = RandomBonusses.tryModifying(entityplayermp, tool); + RandomBonuses.Modifier mod = RandomBonuses.tryModifying(entityplayermp, tool); if (!foo.containsKey(mod)) foo.put(mod, 1); else @@ -58,7 +55,7 @@ public class debug extends CommandBase { } } - for(Map.Entry bar : foo.entrySet()) + for(Map.Entry bar : foo.entrySet()) icommandsender.addChatMessage(new ChatComponentText(bar.getKey().toString() + ": " + bar.getValue())); /* NBTTagCompound tags = equipped.getTagCompound().getCompoundTag("InfiTool"); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java b/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java index f422fb6..7f3a3dd 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java @@ -26,7 +26,7 @@ public class Config { public static boolean toolLevelingExtraModifiers; public static int[] toolModifiersAtLevels; public static boolean toolLevelingRandomBonuses; - //public static boolean randomBonusesAreUseful; + public static boolean randomBonusesAreUseful; public static boolean randomBonusesAreRandom; // pick boost @@ -99,7 +99,7 @@ public class Config { toolLevelingExtraModifiers = configfile.getBoolean("ExtraModifiers", CATEGORY_Leveling, true, "Removes modifiers on new tools and gives them through leveling (requires 'toolLeveling=true')"); toolLevelingRandomBonuses = configfile.getBoolean("RandomBonuses", CATEGORY_Leveling, true, "Gives a random bonus every level, if false and levelling is on modifiers are given at levels 2 and 4 (requires 'toolLeveling=true')"); toolModifiersAtLevels = configfile.get(CATEGORY_Leveling, "ModifiersAtLevels", new int[]{2,4,6}, "Adds an extra modifier on these levleups if 'toolLevelingExtraModifiers' is enabled").getIntList(); - //randomBonusesAreUseful = configfile.getBoolean("UsefulBonuses", CATEGORY_Leveling, true, "Increases chance of getting a useful modifier for the tool drastically (compared to completely random)"); + randomBonusesAreUseful = configfile.getBoolean("UsefulBonuses", CATEGORY_Leveling, true, "Disables less-useful modifiers on levelups. Like a sword with silktouch, or a pickaxe with beheading."); randomBonusesAreRandom = configfile.getBoolean("CompletelyRandomBonuses", CATEGORY_Leveling, false, "Each modifier is equally likely on levelup. Disables useful bonuses."); @@ -127,7 +127,6 @@ public class Config { partReplacementBoostXpPenality = configfile.getInt("PickBoostXpPenality", CATEGORY_PartReplacement, 5, 0, 100, "How much of the current XP% to the next mining level shall be removed when replacing the pickaxe head. Useful to remove the mining level boost on part replacement."); /** MobHeads **/ - // todo: implement configfile.setCategoryComment(CATEGORY_Heads, "Mob Head Module: Adds additional Mob heads and drops"); // drop behaviour