编辑代码

/*    */ package slimeknights.toolleveling.config;
/*    */ 
/*    */ import com.google.common.collect.Sets;
/*    */ import java.io.File;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import java.util.Set;
/*    */ import net.minecraft.item.Item;
/*    */ import slimeknights.mantle.config.AbstractConfigFile;
/*    */ import slimeknights.mantle.configurate.objectmapping.Setting;
/*    */ import slimeknights.mantle.configurate.objectmapping.serialize.ConfigSerializable;
/*    */ import slimeknights.tconstruct.library.TinkerRegistry;
/*    */ import slimeknights.tconstruct.library.tools.ToolCore;
/*    */ import slimeknights.tconstruct.tools.harvest.TinkerHarvestTools;
/*    */ 
/*    */ @ConfigSerializable
/*    */ public class ConfigFile extends AbstractConfigFile {
/*    */   private static final int CONFIG_VERSION = 1;
/*    */   
/*    */   @Setting
/* 27 */   General general = new General();
/*    */   
/*    */   @Setting
/* 29 */   ToolXP toolxp = new ToolXP();
/*    */   
/*    */   public ConfigFile(File file) {
/* 36 */     super(file);
/*    */   }
/*    */   
/*    */   public int getConfigVersion() {
/* 41 */     return 1;
/*    */   }
/*    */   
/*    */   public void insertDefaults() {
/* 46 */     clearNeedsSaving();
/* 48 */     TinkerRegistry.getTools().stream()
/* 49 */       .filter(tool -> !this.toolxp.baseXpForTool.containsKey(tool))
/* 50 */       .forEach(tool -> {
/*    */           this.toolxp.baseXpForTool.put(tool, Integer.valueOf(getDefaultXp((Item)tool)));
/*    */           setNeedsSaving();
/*    */         });
/*    */   }
/*    */   
/*    */   private int getDefaultXp(Item item) {
/* 57 */     Set<Item> aoeTools = Sets.newHashSet((Object[])new Item[] { (Item)TinkerHarvestTools.hammer, (Item)TinkerHarvestTools.excavator, (Item)TinkerHarvestTools.lumberAxe });
/* 58 */     if (TinkerHarvestTools.scythe != null)
/* 59 */       aoeTools.add(TinkerHarvestTools.scythe); 
/* 62 */     if (aoeTools.contains(item))
/* 63 */       return 9 * this.toolxp.defaultBaseXP; 
/* 65 */     return this.toolxp.defaultBaseXP;
/*    */   }
/*    */   
/*    */   public ConfigFile() {}
/*    */   
/*    */   @ConfigSerializable
/*    */   static class General {
/*    */     @Setting(comment = "Reduces the amount of modifiers a newly build tool gets if the value is lower than the regular amount of modifiers the tool would have")
/* 73 */     public int newToolMinModifiers = 3;
/*    */     
/*    */     @Setting(comment = "Maximum achievable levels. If set to 0 or lower there is no upper limit")
/* 76 */     public int maximumLevels = 5;
/*    */   }
/*    */   
/*    */   @ConfigSerializable
/*    */   static class ToolXP {
/*    */     @Setting(comment = "Base XP used when no more specific entry is present for the tool")
/* 82 */     public int defaultBaseXP = 500;
/*    */     
/*    */     @Setting(comment = "Base XP for each of the listed tools")
/* 85 */     public Map<Item, Integer> baseXpForTool = new HashMap<>();
/*    */     
/*    */     @Setting(comment = "How much the XP cost will multiply per level, minimum 2.")
/* 88 */     public float levelMultiplier = 2.0F;
/*    */   }
/*    */ }


/* Location:              C:\Users\14934\Desktop\TinkerToolLeveling-1.12.2-1.1.0.jar!\slimeknights\toolleveling\config\ConfigFile.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */