Package net.minecraftforge.common

Examples of net.minecraftforge.common.Property


    ENABLE_MANIPULATOR = configuration.get(Configuration.CATEGORY_GENERAL, "Enable Force Manipulator", ENABLE_MANIPULATOR).getBoolean(ENABLE_MANIPULATOR);

    FORTRON_PRODUCTION_MULTIPLIER = configuration.get(Configuration.CATEGORY_GENERAL, "Fortron Production Multiplier", FORTRON_PRODUCTION_MULTIPLIER).getDouble(FORTRON_PRODUCTION_MULTIPLIER);

    Property propFieldScale = configuration.get(Configuration.CATEGORY_GENERAL, "Max Force Field Scale", MAX_FORCE_FIELD_SCALE);
    MAX_FORCE_FIELD_SCALE = propFieldScale.getInt(MAX_FORCE_FIELD_SCALE);

    Property propInterdiction = configuration.get(Configuration.CATEGORY_GENERAL, "Interdiction Murder Fortron Consumption", INTERDICTION_MURDER_ENERGY);
    INTERDICTION_MURDER_ENERGY = propInterdiction.getInt(INTERDICTION_MURDER_ENERGY);

    Property propCreative = configuration.get(Configuration.CATEGORY_GENERAL, "Effect Creative Players", INTERACT_CREATIVE);
    propCreative.comment = "Should the interdiction matrix interact with creative players?.";
    INTERACT_CREATIVE = propCreative.getBoolean(INTERACT_CREATIVE);

    Property propChunkLoading = configuration.get(Configuration.CATEGORY_GENERAL, "Load Chunks", LOAD_CHUNKS);
    propChunkLoading.comment = "Set this to false to turn off the MFFS Chunkloading capabilities.";
    LOAD_CHUNKS = propChunkLoading.getBoolean(LOAD_CHUNKS);

    Property propOpOverride = configuration.get(Configuration.CATEGORY_GENERAL, "Op Override", OP_OVERRIDE);
    propOpOverride.comment = "Allow the operator(s) to override security measures created by MFFS?";
    OP_OVERRIDE = propOpOverride.getBoolean(OP_OVERRIDE);

    Property propUseCache = configuration.get(Configuration.CATEGORY_GENERAL, "Use Cache", USE_CACHE);
    propUseCache.comment = "Cache allows temporary data saving to decrease calculations required.";
    USE_CACHE = propUseCache.getBoolean(USE_CACHE);

    Property maxFFGenPerTick = configuration.get(Configuration.CATEGORY_GENERAL, "Field Calculation Per Tick", MAX_FORCE_FIELDS_PER_TICK);
    maxFFGenPerTick.comment = "How many force field blocks can be generated per tick? Less reduces lag.";
    MAX_FORCE_FIELDS_PER_TICK = maxFFGenPerTick.getInt(MAX_FORCE_FIELDS_PER_TICK);

    Property interdictionRange = configuration.get(Configuration.CATEGORY_GENERAL, "Field Calculation Per Tick", INTERDICTION_MAX_RANGE);
    interdictionRange.comment = "The maximum range for the interdiction matrix.";
    INTERDICTION_MAX_RANGE = interdictionRange.getInt(INTERDICTION_MAX_RANGE);

    Property useElectricity = configuration.get(Configuration.CATEGORY_GENERAL, "Require Electricity?", ENABLE_ELECTRICITY);
    useElectricity.comment = "Turning this to false will make MFFS run without electricity or energy systems required. Great for vanilla!";
    ENABLE_ELECTRICITY = useElectricity.getBoolean(ENABLE_ELECTRICITY);

    Property conservePackets = configuration.get(Configuration.CATEGORY_GENERAL, "Conserve Packets?", CONSERVE_PACKETS);
    conservePackets.comment = "Turning this to false will enable better client side packet and updates but in the cost of more packets sent.";
    CONSERVE_PACKETS = conservePackets.getBoolean(CONSERVE_PACKETS);

    Property highGraphics = configuration.get(Configuration.CATEGORY_GENERAL, "High Graphics", HIGH_GRAPHICS);
    highGraphics.comment = "Turning this to false will reduce rendering and client side packet graphical packets.";
    CONSERVE_PACKETS = highGraphics.getBoolean(HIGH_GRAPHICS);

    Property forceManipulatorBlacklist = configuration.get(Configuration.CATEGORY_GENERAL, "Force Manipulator Blacklist", "");
    forceManipulatorBlacklist.comment = "Put a list of block IDs to be not-moved by the force manipulator. Separate by commas, no space.";
    String blackListManipulate = forceManipulatorBlacklist.getString();
    Blacklist.forceManipulationBlacklist.addAll(LanguageUtility.decodeIDSplitByComma(blackListManipulate));

    Property blacklist1 = configuration.get(Configuration.CATEGORY_GENERAL, "Stabilization Blacklist", "");
    String blackListStabilize = blacklist1.getString();
    Blacklist.stabilizationBlacklist.addAll(LanguageUtility.decodeIDSplitByComma(blackListStabilize));

    Property blacklist2 = configuration.get(Configuration.CATEGORY_GENERAL, "Disintegration Blacklist", "");
    String blackListDisintegrate = blacklist1.getString();
    Blacklist.disintegrationBlacklist.addAll(LanguageUtility.decodeIDSplitByComma(blackListDisintegrate));

    configuration.save();
  }
View Full Code Here


  private static LinkedList<ABORecipe> aboRecipes = new LinkedList<ABORecipe>();

  private static Item createItem(int defaultID, Class<? extends ABOItem> clazz, String descr, Object ingredient1, Object ingredient2, Object ingredient3) {
    String name = Character.toLowerCase(clazz.getSimpleName().charAt(0)) + clazz.getSimpleName().substring(1);

    Property prop = aboConfiguration.getItem(name + ".id", defaultID);

    int id = prop.getInt(defaultID);

    while (id < Item.itemsList.length && Item.itemsList[id] != null)
      id++;

    if (id >= Item.itemsList.length) {
      aboLog.log(Level.SEVERE, "Cannot find free ID for Item + " + name + " starting from " + defaultID);
      return null;
    }

    prop.set(id);

    Item item = null;
    try {
      item = clazz.getConstructor(int.class).newInstance(id);
    } catch (Throwable t) {
View Full Code Here

  }

  private static ItemPipe createPipe(int defaultID, Class<? extends Pipe> clazz, String descr) {
    String name = Character.toLowerCase(clazz.getSimpleName().charAt(0)) + clazz.getSimpleName().substring(1);

    Property prop = aboConfiguration.getItem(name + ".id", defaultID);

    int id = prop.getInt(defaultID);

    try {
      // search for free id
      while (BlockGenericPipe.isPipeRegistered(id))
        ++id;

      prop.set(id);
    } catch (NoSuchMethodError e) {
      // e.printStackTrace();
    }

    ItemPipe pipe = BlockGenericPipe.registerPipe(id, clazz);
View Full Code Here

    super(file);
  }

  @Override
  public void save() {
    Property versionProp = null;

    get(CATEGORY_GENERAL, "version", ABO.VERSION);

    super.save();
  }
View Full Code Here

  public static float getFloat(Configuration config, String name, String category, float defaultValue, float minValue, float maxValue, String comment) {
    return Float.parseFloat(get(config, name, category, defaultValue, minValue, maxValue, comment).value);
  }

  public static Property get(Configuration config, String name, String category, String defaultValue, String comment) {
    Property prop = config.get(category, name, defaultValue);
    prop.comment = comment + " [default: " + defaultValue + "]";
    return prop;
  }
View Full Code Here

    prop.comment = comment + " [default: " + defaultValue + "]";
    return prop;
  }

  public static Property get(Configuration config, String name, String category, boolean defaultValue, String comment) {
    Property prop = config.get(category, name, defaultValue);
    prop.comment = comment + " [default: " + defaultValue + "]";
    return prop;
  }
View Full Code Here

    prop.comment = comment + " [default: " + defaultValue + "]";
    return prop;
  }

  public static Property get(Configuration config, String name, String category, int defaultValue, int minValue, int maxValue, String comment) {
    Property prop = config.get(category, name, defaultValue);
    prop.comment = comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]";
    prop.value = Integer.toString(prop.getInt(defaultValue) < minValue ? minValue : (prop.getInt(defaultValue) > maxValue ? maxValue : prop.getInt(defaultValue)));
    return prop;
  }
View Full Code Here

    prop.value = Integer.toString(prop.getInt(defaultValue) < minValue ? minValue : (prop.getInt(defaultValue) > maxValue ? maxValue : prop.getInt(defaultValue)));
    return prop;
  }

  public static Property get(Configuration config, String name, String category, float defaultValue, float minValue, float maxValue, String comment) {
    Property prop = config.get(category, name, Float.toString(defaultValue));
    prop.comment = comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]";
    try {
      prop.value = Float.toString(Float.parseFloat(prop.value) < minValue ? minValue : (Float.parseFloat(prop.value) > maxValue ? maxValue : Float.parseFloat(prop.value)));
    } catch (Exception e) {
      prop.value = "0";
View Full Code Here

                    Tunable t = (Tunable) b;
                    String cat = t.category();
                    Field[] g = a.getDeclaredFields();
                    for (Field h : g) {
                        if (config1 != null) {
                            Property p;
                            if (t.category().contains("items")) {
                                p = config1.getItem(cat, h.getName(), Integer.valueOf(denLib.ReflectionHelper.getStaticField(h).toString()));
                            } else {
                                p = config1.get(cat, h.getName(), denLib.ReflectionHelper.getStaticField(h).toString());
                            }

                            denLib.ReflectionHelper.setStaticField(h, p.getString());
                            ConfigCategory a123 = config1.getCategory(cat);
                            if (!t.comment().equals("Tunable Values")) {
                                a123.setComment(t.comment());
                            }
                            Annotation[] fAnno = h.getDeclaredAnnotations();
View Full Code Here

        return config;
    }

    private void getAndSet(ConfigField annotation, Field f, Configuration config) {
        Object o = null;
        Property p = null;
        boolean isBlock = annotation.category().contains("block.");
        try {
            o = f.get(null);
            if (f.getType().equals(int.class)) {
                if (isBlock) {
                    p = config.getBlock(annotation.category(), f.getName(), (Integer) o);
                } else {
                    p = config.get(annotation.category(), f.getName(), (Integer) o);
                }
                f.set(null, p.getInt());
            } else if (f.getType().equals(String.class)) {
                p = config.get(annotation.category(), f.getName(), (String) o);
                f.set(null, p.getString());
            } else if (f.getType().equals(float.class)) {
                p = config.get(annotation.category(), f.getName(), String.valueOf((Float) o));
                f.set(null, Float.valueOf(p.getString()));
            } else if (f.getType().equals(String[].class)) {
                p = config.get(annotation.category(), f.getName(), (String[]) o);
                f.set(null, p.getStringList());
            } else if (f.getType().equals((boolean.class))) {
                p = config.get(annotation.category(), f.getName(), (Boolean) o);
                f.set(null, p.getBoolean((Boolean) o));
            }
            if (!annotation.comment().equals(ConfigField.DEFAULT_COMMENT)) {
                p.comment = annotation.comment();
            }
            config.save();
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.