mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 21:09:51 +00:00
Closes #137. Removed @Deprecated
This commit is contained in:
1 parent
2ae2cf8896
commit
73c4754a17
14 files changed
+15
-256
No files matched your search
@@ -11,7 +11,6 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -36,7 +35,6 @@ import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
@@ -234,7 +232,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return EnumErrorCode.NOSKY.ordinal();
|
||||
|
||||
// / And finally biome check
|
||||
if (!checkBiomeHazard(world, housing.getTemperature(), housing.getHumidity(), housing.getXCoord(), housing.getYCoord(), housing.getZCoord()))
|
||||
if (!checkBiomeHazard(biome))
|
||||
return EnumErrorCode.INVALIDBIOME.ordinal();
|
||||
|
||||
return EnumErrorCode.OK.ordinal();
|
||||
@@ -248,8 +246,10 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return !genome.getPrimary().isNocturnal() || genome.getNocturnal();
|
||||
}
|
||||
|
||||
private boolean checkBiomeHazard(World world, EnumTemperature temperature, EnumHumidity humidity, int x, int y, int z) {
|
||||
private boolean checkBiomeHazard(BiomeGenBase biome) {
|
||||
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.temperature);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getFloatRainfall());
|
||||
return AlleleManager.climateHelper.isWithinLimits(temperature, humidity,
|
||||
genome.getPrimary().getTemperature(), genome.getToleranceTemp(),
|
||||
genome.getPrimary().getHumidity(), genome.getToleranceHumid());
|
||||
@@ -315,27 +315,12 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@Override
|
||||
public ArrayList<Integer> getSuitableBiomeIds() {
|
||||
EnumTemperature temperature = genome.getPrimary().getTemperature();
|
||||
EnumTolerance temperatureTolerance = genome.getToleranceTemp();
|
||||
ArrayList<Integer> suitableBiomes = new ArrayList<Integer>();
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray())
|
||||
if (checkBiomeHazard(biome))
|
||||
suitableBiomes.add(biome.biomeID);
|
||||
|
||||
Collection<EnumTemperature> toleratedTemperatures = AlleleManager.climateHelper.getToleratedTemperature(temperature, temperatureTolerance);
|
||||
|
||||
EnumHumidity humidity = genome.getPrimary().getHumidity();
|
||||
EnumTolerance humidityTolerance = genome.getToleranceHumid();
|
||||
|
||||
Collection<EnumHumidity> toleratedHumidities = AlleleManager.climateHelper.getToleratedHumidity(humidity, humidityTolerance);
|
||||
|
||||
ArrayList<Integer> biomeIdsTemp = new ArrayList<Integer>();
|
||||
for (EnumTemperature temp : toleratedTemperatures)
|
||||
biomeIdsTemp.addAll(EnumTemperature.getBiomeIds(temp));
|
||||
|
||||
ArrayList<Integer> biomeIdsHumid = new ArrayList<Integer>();
|
||||
for (EnumHumidity humid : toleratedHumidities)
|
||||
biomeIdsHumid.addAll(EnumHumidity.getBiomeIds(humid));
|
||||
|
||||
biomeIdsTemp.retainAll(biomeIdsHumid);
|
||||
|
||||
return biomeIdsTemp;
|
||||
return suitableBiomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -181,11 +181,6 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
|
||||
return fruits;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGirth() {
|
||||
return girth;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z) {
|
||||
|
||||
@@ -126,10 +126,6 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
|
||||
@Override
|
||||
public int getGirth() {
|
||||
if (getChromosomes()[EnumTreeChromosome.GIRTH.ordinal()] == null)
|
||||
getChromosomes()[EnumTreeChromosome.GIRTH.ordinal()] = new Chromosome(translateGirth(getPrimary().getGirth()),
|
||||
translateGirth(getSecondary().getGirth()));
|
||||
|
||||
return ((IAlleleInteger) getActiveAllele(EnumTreeChromosome.GIRTH.ordinal())).getValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,6 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
|
||||
@@ -239,7 +233,6 @@ public class Config {
|
||||
for (String str : disabledStructures)
|
||||
Proxies.log.finer("Disabled structure '%s'.", str);
|
||||
|
||||
registerClimates();
|
||||
ForestryTrigger.initialize();
|
||||
|
||||
config.save();
|
||||
@@ -310,41 +303,6 @@ public class Config {
|
||||
return list.split("[;]+");
|
||||
}
|
||||
|
||||
private static void registerClimates() {
|
||||
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome == null)
|
||||
continue;
|
||||
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER))
|
||||
EnumTemperature.hellishBiomeIds.add(biome.biomeID);
|
||||
else if (biome.temperature >= 2.0f)
|
||||
EnumTemperature.hotBiomeIds.add(biome.biomeID);
|
||||
else if (biome.temperature >= 1.2f)
|
||||
EnumTemperature.warmBiomeIds.add(biome.biomeID);
|
||||
else if (biome.temperature >= 0.2f)
|
||||
EnumTemperature.normalBiomeIds.add(biome.biomeID);
|
||||
else if (biome.temperature >= 0.15f)
|
||||
EnumTemperature.coldBiomeIds.add(biome.biomeID);
|
||||
else
|
||||
EnumTemperature.icyBiomeIds.add(biome.biomeID);
|
||||
}
|
||||
|
||||
// / HUMIDITY
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome == null)
|
||||
continue;
|
||||
|
||||
if (biome.rainfall >= 0.9f)
|
||||
EnumHumidity.dampBiomeIds.add(biome.biomeID);
|
||||
else if (biome.rainfall >= 0.3f)
|
||||
EnumHumidity.normalBiomeIds.add(biome.biomeID);
|
||||
else
|
||||
EnumHumidity.aridBiomeIds.add(biome.biomeID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean getOrCreateBooleanProperty(String key, String kind, boolean defaults) {
|
||||
return Boolean.parseBoolean(config.get(key, kind, defaults).Value);
|
||||
}
|
||||
|
||||
@@ -15,13 +15,10 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@@ -38,7 +35,6 @@ import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.ItemResearchNote.EnumNoteType;
|
||||
import forestry.core.utils.IDAllocator;
|
||||
|
||||
public class AlleleRegistry implements IAlleleRegistry, ILegacyHandler {
|
||||
|
||||
@@ -171,40 +167,6 @@ public class AlleleRegistry implements IAlleleRegistry, ILegacyHandler {
|
||||
return allele;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadMetaMap(World world) {
|
||||
metaMapToUID.clear();
|
||||
uidMapToMeta.clear();
|
||||
|
||||
Iterator<Entry<String, IAllele>> it = alleleMap.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<String, IAllele> entry = it.next();
|
||||
if (!(entry.getValue() instanceof IAlleleSpecies))
|
||||
continue;
|
||||
|
||||
int meta = IDAllocator.getIDAllocator(world, "speciesMetaMap").getId(entry.getKey());
|
||||
metaMapToUID.put(meta, entry.getKey());
|
||||
uidMapToMeta.put(entry.getKey(), meta);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getFromMetaMap(int meta) {
|
||||
if (!metaMapToUID.containsKey(meta))
|
||||
return null;
|
||||
|
||||
return getAllele(metaMapToUID.get(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFromUIDMap(String uid) {
|
||||
if (!uidMapToMeta.containsKey(uid))
|
||||
return 0;
|
||||
|
||||
return uidMapToMeta.get(uid);
|
||||
}
|
||||
|
||||
/* CLASSIFICATIONS */
|
||||
@Override
|
||||
public void registerClassification(IClassification branch) {
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
@@ -141,12 +140,6 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
|
||||
mutation, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMutation(IAllele allele0, IAllele allele1) {
|
||||
discoveredMutations.add(allele0.getUID() + "-" + allele1.getUID());
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscovered(IMutation mutation) {
|
||||
return discoveredMutations.contains(String.format(MUTATION_FORMAT, mutation.getAllele0().getUID(), mutation.getAllele1().getUID(), mutation.getTemplate()[0].getUID()))
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Properties;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
/**
|
||||
* Simple mod localization class.
|
||||
*
|
||||
* @author Jimeo Wan / modified for Forestry by SirSengir
|
||||
* @license Public domain
|
||||
*
|
||||
* @deprecated Switching to vanilla assets lang system
|
||||
*/
|
||||
@Deprecated
|
||||
public class Localization {
|
||||
|
||||
public static Localization instance = new Localization();
|
||||
|
||||
private static final String DEFAULT_LANGUAGE = "en_US";
|
||||
|
||||
private String loadedLanguage = null;
|
||||
private Properties defaultMappings = new Properties();
|
||||
private Properties mappings = new Properties();
|
||||
private LinkedList<String> modules = new LinkedList<String>();
|
||||
|
||||
/**
|
||||
* Loads the mod's localization files. All language files must be stored in "[modname]/lang/", in .properties files. (ex: for the mod 'invtweaks', the
|
||||
* french translation is in: "invtweaks/lang/fr_FR.properties")
|
||||
*
|
||||
* @param modName
|
||||
* The mod name
|
||||
*/
|
||||
public Localization() {
|
||||
addLocalization("/lang/forestry/core/");
|
||||
}
|
||||
|
||||
public void addLocalization(String path) {
|
||||
modules.add(path);
|
||||
load(path, DEFAULT_LANGUAGE);
|
||||
}
|
||||
|
||||
private void load(String newLanguage) {
|
||||
defaultMappings.clear();
|
||||
mappings.clear();
|
||||
|
||||
for (String path : this.modules)
|
||||
load(path, newLanguage);
|
||||
}
|
||||
|
||||
private void load(String path, String newLanguage) {
|
||||
|
||||
Properties modMappings = new Properties();
|
||||
|
||||
try {
|
||||
InputStream langStream = Localization.class.getResourceAsStream(path + newLanguage + ".properties");
|
||||
InputStream defaultLangStream = Localization.class.getResourceAsStream(path + DEFAULT_LANGUAGE + ".properties");
|
||||
modMappings.load((langStream == null) ? defaultLangStream : langStream);
|
||||
mappings.putAll(modMappings);
|
||||
|
||||
modMappings.clear();
|
||||
modMappings.load(defaultLangStream);
|
||||
defaultMappings.putAll(modMappings);
|
||||
|
||||
if (langStream != null)
|
||||
langStream.close();
|
||||
defaultLangStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
loadedLanguage = newLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a string for the given key, in the currently active translation.
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public synchronized String get(String key) {
|
||||
String currentLanguage = getCurrentLanguage();
|
||||
if (currentLanguage == null || !currentLanguage.equals(loadedLanguage))
|
||||
load(currentLanguage);
|
||||
|
||||
return mappings.getProperty(key, defaultMappings.getProperty(key, key));
|
||||
}
|
||||
|
||||
public boolean hasMapping(String key) {
|
||||
return mappings.containsKey(key) || defaultMappings.containsKey(key);
|
||||
}
|
||||
|
||||
private static String getCurrentLanguage() {
|
||||
return Proxies.common.getCurrentLanguage();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,12 +12,11 @@ package forestry.factory.gadgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -38,7 +37,6 @@ import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.IBottlerManager;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
@@ -88,16 +86,8 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
}
|
||||
|
||||
public static class RecipeManager implements IBottlerManager {
|
||||
public static class RecipeManager implements ICraftingProvider {
|
||||
public static ArrayList<MachineBottler.Recipe> recipes = new ArrayList<MachineBottler.Recipe>();
|
||||
public static HashSet<Fluid> recipeFluids = new HashSet<Fluid>();
|
||||
|
||||
@Override
|
||||
public void addRecipe(int cyclesPerUnit, FluidStack input, ItemStack can, ItemStack bottled) {
|
||||
recipes.add(new MachineBottler.Recipe(cyclesPerUnit, input, can, bottled));
|
||||
if (input != null)
|
||||
recipeFluids.add(input.getFluid());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -233,7 +233,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 8);
|
||||
|
||||
// Init bee interface
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginApiculture.beeInterface = BeeManager.beeInterface = new BeeHelper());
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginApiculture.beeInterface = new BeeHelper());
|
||||
BeeManager.villageBees = new ArrayList[]{new ArrayList<IBeeGenome>(), new ArrayList<IBeeGenome>()};
|
||||
|
||||
// Candles
|
||||
|
||||
Executable → Regular
+1
-2
@@ -35,7 +35,6 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -246,7 +245,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
.setFaces(0, 1, 2, 3, 4, 4, 0, 7));
|
||||
|
||||
// Init tree interface
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginArboriculture.treeInterface = TreeManager.treeInterface = new TreeHelper());
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginArboriculture.treeInterface = new TreeHelper());
|
||||
|
||||
// Init rendering
|
||||
proxy.initializeRendering();
|
||||
|
||||
@@ -72,8 +72,6 @@ public class PluginFactory extends ForestryPlugin {
|
||||
super.preInit();
|
||||
|
||||
RecipeManagers.craftingProviders = new ArrayList<ICraftingProvider>();
|
||||
// Init bottler manager
|
||||
RecipeManagers.craftingProviders.add(RecipeManagers.bottlerManager = new MachineBottler.RecipeManager());
|
||||
// Init carpenter manager
|
||||
RecipeManagers.craftingProviders.add(RecipeManagers.carpenterManager = new MachineCarpenter.RecipeManager());
|
||||
// Init centrifuge manager
|
||||
|
||||
@@ -45,11 +45,6 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Update Forestry!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack backpack) {
|
||||
Item item = backpack.getItem();
|
||||
|
||||
@@ -251,11 +251,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
try {
|
||||
return info.getName(itemstack);
|
||||
} catch (Error er) {
|
||||
return info.getName();
|
||||
}
|
||||
return info.getName(itemstack);
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
|
||||
Reference in new issue
Block a user