mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 19:49:54 +00:00
Remove old deprecated and legacy methods
This commit is contained in:
1 parent
cb6e4620fa
commit
8dedba4f16
33 files changed
+67
-383
No files matched your search
@@ -117,7 +117,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
if (tryBreedingPrincess() || !hasHealthyQueen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!queenCanWork()) {
|
||||
return;
|
||||
}
|
||||
@@ -136,10 +136,10 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
// Need a flower
|
||||
if (queen.hasFlower(housing)) {
|
||||
housing.setErrorState(EnumErrorCode.OK.ordinal());
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
doQueenWorkCycle();
|
||||
} else {
|
||||
housing.setErrorState(EnumErrorCode.NOFLOWER.ordinal());
|
||||
housing.setErrorState(EnumErrorCode.NOFLOWER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,11 +203,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
if (housingErrorState != null) {
|
||||
try {
|
||||
housing.setErrorState(housingErrorState);
|
||||
} catch (Error e) {
|
||||
housing.setErrorState(housingErrorState.ordinal());
|
||||
}
|
||||
housing.setErrorState(housingErrorState);
|
||||
}
|
||||
|
||||
return housingErrorState != EnumErrorCode.NOSPACE;
|
||||
@@ -232,11 +228,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
}
|
||||
if (housingErrorState != null) {
|
||||
try {
|
||||
housing.setErrorState(housingErrorState);
|
||||
} catch (Error e) {
|
||||
housing.setErrorState(housingErrorState.ordinal());
|
||||
}
|
||||
housing.setErrorState(housingErrorState);
|
||||
}
|
||||
return hasQueen;
|
||||
}
|
||||
@@ -247,9 +239,9 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
// Princess available? Try to breed!
|
||||
if (ForestryItem.beePrincessGE.isItemEqual(housing.getQueen())) {
|
||||
if (ForestryItem.beeDroneGE.isItemEqual(housing.getDrone())) {
|
||||
housing.setErrorState(EnumErrorCode.OK.ordinal());
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
} else {
|
||||
housing.setErrorState(EnumErrorCode.NODRONE.ordinal());
|
||||
housing.setErrorState(EnumErrorCode.NODRONE);
|
||||
}
|
||||
tickBreed();
|
||||
isBreedingPrincess = true;
|
||||
@@ -259,35 +251,16 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
private boolean queenCanWork() {
|
||||
try {
|
||||
boolean canWork = true;
|
||||
// Not while raining, at night or without light
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
canWork = false;
|
||||
} else if (housing.getErrorState() != EnumErrorCode.NOFLOWER) {
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
}
|
||||
return canWork;
|
||||
} catch (Error e) {
|
||||
Proxies.log.logErrorAPI("Forestry", e, IBee.class);
|
||||
return queenCanWorkDeprecated();
|
||||
}
|
||||
}
|
||||
|
||||
// fallback for outdated APIs
|
||||
private boolean queenCanWorkDeprecated() {
|
||||
boolean canWork = true;
|
||||
// Not while raining, at night or without light
|
||||
EnumErrorCode state = EnumErrorCode.values()[queen.isWorking(housing)];
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state.ordinal());
|
||||
canWork = false;
|
||||
} else if (housing.getErrorOrdinal() != EnumErrorCode.NOFLOWER.ordinal()) {
|
||||
housing.setErrorState(EnumErrorCode.OK.ordinal());
|
||||
housing.setErrorState(state);
|
||||
return false;
|
||||
}
|
||||
return canWork;
|
||||
|
||||
if (housing.getErrorState() != EnumErrorCode.NOFLOWER) {
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// / BREEDING
|
||||
|
||||
@@ -229,11 +229,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
return isMaster || masterY >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IInventoryAdapter getInventory() {
|
||||
return getStructureInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventoryAdapter getStructureInventory() {
|
||||
return getInternalInventory();
|
||||
|
||||
@@ -367,11 +367,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
setInventorySlotContents(SLOT_DRONE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
@@ -450,16 +445,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
setErrorState(EnumErrorCode.values()[state]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
|
||||
@@ -78,8 +78,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
public static final int SLOT_PRODUCT_1 = 2;
|
||||
public static final int SLOT_PRODUCT_COUNT = 7;
|
||||
public static final int SLOT_FRAMES_1 = 9;
|
||||
public static final int SLOT_FRAMES_2 = 10;
|
||||
public static final int SLOT_FRAMES_3 = 11;
|
||||
public static final int SLOT_FRAMES_COUNT = 3;
|
||||
private final IBeekeepingLogic logic;
|
||||
private BiomeGenBase biome;
|
||||
@@ -249,14 +247,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return (getHealthDisplay() * i) / getMaxHealthDisplay();
|
||||
}
|
||||
|
||||
public int getTemperatureScaled(int i) {
|
||||
return Math.round(i * (getExactTemperature() / 2));
|
||||
}
|
||||
|
||||
public int getHumidityScaled(int i) {
|
||||
return Math.round(i * getExactHumidity());
|
||||
}
|
||||
|
||||
public void updateBiome() {
|
||||
if (worldObj != null) {
|
||||
BiomeGenBase biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
|
||||
@@ -310,11 +300,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
@@ -345,16 +330,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
setErrorState(EnumErrorCode.values()[state]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
|
||||
@@ -37,7 +37,8 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
EnumTemperature temp = EnumTemperature.getFromValue(BiomeGenBase.getBiome(housing.getBiomeId()).temperature);
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
EnumTemperature temp = EnumTemperature.getFromBiome(biome);
|
||||
|
||||
switch (temp) {
|
||||
case HELLISH:
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -37,10 +35,6 @@ public class AlleleEffectNone extends Allele implements IAlleleBeeEffect {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
return doEffect(genome, storedData, housing.getWorld(), housing.getBiomeId(), housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
}
|
||||
|
||||
protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, World world, int biomeid, int x, int y, int z) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
EnumTemperature temp = EnumTemperature.getFromValue(BiomeGenBase.getBiome(housing.getBiomeId()).temperature);
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
EnumTemperature temp = EnumTemperature.getFromBiome(biome);
|
||||
|
||||
switch (temp) {
|
||||
case HELLISH:
|
||||
|
||||
@@ -137,11 +137,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
this.isNatural = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIrregularMating() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNatural() {
|
||||
return this.isNatural;
|
||||
}
|
||||
@@ -244,17 +239,14 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return mate != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isWorking(IBeeHousing housing) {
|
||||
return canWork(housing).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode canWork(IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
|
||||
// / Rain needs tolerant flyers
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(housing.getBiomeId()) && !housing.isSealed()) {
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(biome) && !housing.isSealed()) {
|
||||
return EnumErrorCode.ISRAINING;
|
||||
}
|
||||
|
||||
@@ -276,7 +268,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// / No sky, except if in hell
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(housing.getBiomeId());
|
||||
if (biome == null) {
|
||||
return EnumErrorCode.NOSKY;
|
||||
}
|
||||
@@ -343,18 +334,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return hasFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Integer> getSuitableBiomeIds() {
|
||||
ArrayList<Integer> suitableBiomes = new ArrayList<Integer>();
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (isSuitableBiome(biome)) {
|
||||
suitableBiomes.add(biome.biomeID);
|
||||
}
|
||||
}
|
||||
|
||||
return suitableBiomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<BiomeGenBase> getSuitableBiomes() {
|
||||
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<BiomeGenBase>();
|
||||
|
||||
@@ -90,7 +90,7 @@ public class BeeMutation extends Mutation implements IBeeMutation {
|
||||
if (restrictBiomeTypes.size() > 0) {
|
||||
boolean noneMatched = true;
|
||||
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(housing.getBiomeId());
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
if (strictBiomeCheck) {
|
||||
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
|
||||
if (types.length == 1 && restrictBiomeTypes.contains(types[0])) {
|
||||
|
||||
@@ -24,17 +24,16 @@ public class JubilanceDefault implements IJubilanceProvider {
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(housing.getBiomeId());
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != species.getTemperature() ||
|
||||
EnumHumidity.getFromValue(biome.rainfall) != species.getHumidity()) {
|
||||
return false;
|
||||
}
|
||||
EnumTemperature temperature = EnumTemperature.getFromBiome(biome);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
|
||||
|
||||
return temperature == species.getTemperature() && humidity == species.getHumidity();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing, float modifier) {
|
||||
protected static AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing, float modifier) {
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(modifier);
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
|
||||
|
||||
@@ -490,11 +490,6 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
@@ -510,19 +505,10 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(IErrorState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
return null;
|
||||
|
||||
@@ -93,51 +93,19 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
// FIXME: Legacy handling.
|
||||
if (getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] == null) {
|
||||
getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] = new Chromosome(Allele.sappinessLowest);
|
||||
}
|
||||
|
||||
IAllele allele = getActiveAllele(EnumTreeChromosome.SAPPINESS);
|
||||
// FIXME: More legacy handling
|
||||
if (allele instanceof IAlleleFloat) {
|
||||
return ((IAlleleFloat) allele).getValue();
|
||||
} else {
|
||||
getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] = new Chromosome(Allele.sappinessLowest);
|
||||
return 0.1f;
|
||||
}
|
||||
return ((IAlleleFloat) getActiveAllele(EnumTreeChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<EnumPlantType> getPlantTypes() {
|
||||
// / FIXME: Needs some legacy handling.
|
||||
if (!(getActiveAllele(EnumTreeChromosome.PLANT) instanceof AllelePlantType)) {
|
||||
getChromosomes()[EnumTreeChromosome.PLANT.ordinal()] = new Chromosome(Allele.plantTypeNone);
|
||||
}
|
||||
|
||||
return ((AllelePlantType) getActiveAllele(EnumTreeChromosome.PLANT)).getPlantTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaturationTime() {
|
||||
if (getChromosomes()[EnumTreeChromosome.MATURATION.ordinal()] == null) {
|
||||
getChromosomes()[EnumTreeChromosome.MATURATION.ordinal()] = new Chromosome(Allele.maturationSlowest);
|
||||
}
|
||||
|
||||
return ((IAlleleInteger) getActiveAllele(EnumTreeChromosome.MATURATION)).getValue();
|
||||
}
|
||||
|
||||
private IAllele translateGirth(int girth) {
|
||||
switch (girth) {
|
||||
case 2:
|
||||
return Allele.int2;
|
||||
case 3:
|
||||
return Allele.int3;
|
||||
default:
|
||||
return Allele.int1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGirth() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumTreeChromosome.GIRTH)).getValue();
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@@ -86,33 +85,6 @@ public class CircuitBoard implements ICircuitBoard {
|
||||
|
||||
ArrayList<ICircuit> readcircuits = new ArrayList<ICircuit>();
|
||||
|
||||
// FIXME: Legacy I
|
||||
if (nbttagcompound.hasKey("CS")) {
|
||||
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("CS", 10);
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
readcircuits.add(ChipsetManager.circuitRegistry.getFromLegacyMap(nbttagcompound1.getInteger("I")));
|
||||
}
|
||||
|
||||
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// FIXME: Legacy II
|
||||
if (nbttagcompound.hasKey("CL")) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("CL", 10);
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
readcircuits.add(ChipsetManager.circuitRegistry.getCircuit(nbttagcompound1.getString("I")));
|
||||
}
|
||||
|
||||
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
|
||||
return;
|
||||
}
|
||||
|
||||
// New
|
||||
if (circuits != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.circuits;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -31,7 +30,6 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
public static final Map<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final Map<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final Map<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
|
||||
private final Map<Integer, String> legacyMap = new HashMap<Integer, String>();
|
||||
|
||||
static {
|
||||
DUMMY_MAP.put("dummy", DUMMY_LAYOUT);
|
||||
@@ -99,23 +97,6 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
return circuitMap.get(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLegacyMapping(int id, String uid) {
|
||||
this.legacyMap.put(id, uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuit getFromLegacyMap(int id) {
|
||||
if (!legacyMap.containsKey(id)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getCircuit(legacyMap.get(id));
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChipset(ItemStack itemstack) {
|
||||
return ForestryItem.circuitboards.isItemEqual(itemstack);
|
||||
|
||||
@@ -164,14 +164,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
|
||||
@Override
|
||||
public boolean isDiscovered(IMutation mutation) {
|
||||
String mutationString = getMutationString(mutation);
|
||||
if (discoveredMutations.contains(mutationString)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: remove legacy handling
|
||||
String species0 = mutation.getAllele0().getUID();
|
||||
String species1 = mutation.getAllele1().getUID();
|
||||
return discoveredMutations.contains(species0 + '-' + species1);
|
||||
return discoveredMutations.contains(mutationString);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -152,21 +152,11 @@ public abstract class Genome implements IGenome {
|
||||
return chromosomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getActiveAllele(int chromosome) {
|
||||
return chromosomes[chromosome].getActiveAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getActiveAllele(IChromosomeType chromosomeType) {
|
||||
return chromosomes[chromosomeType.ordinal()].getActiveAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getInactiveAllele(int chromosome) {
|
||||
return chromosomes[chromosome].getInactiveAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getInactiveAllele(IChromosomeType chromosomeType) {
|
||||
return chromosomes[chromosomeType.ordinal()].getInactiveAllele();
|
||||
|
||||
@@ -76,12 +76,6 @@ public abstract class Individual implements IIndividual {
|
||||
return getGenome().isGeneticEqual(other.getGenome());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecated")
|
||||
public boolean isPureBred(int chromosomeOrdinal) {
|
||||
return getGenome().getActiveAllele(chromosomeOrdinal).getUID().equals(getGenome().getInactiveAllele(chromosomeOrdinal).getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPureBred(IChromosomeType chromosomeType) {
|
||||
return getGenome().getActiveAllele(chromosomeType).getUID().equals(getGenome().getInactiveAllele(chromosomeType).getUID());
|
||||
|
||||
@@ -82,19 +82,6 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
|
||||
return combinations;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Collection<? extends IMutation> getPaths(IAllele result, int chromosomeOrdinal) {
|
||||
ArrayList<IMutation> paths = new ArrayList<IMutation>();
|
||||
for (IMutation mutation : getMutations(false)) {
|
||||
if (mutation.getTemplate()[chromosomeOrdinal] == result) {
|
||||
paths.add(mutation);
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends IMutation> getPaths(IAllele result, IChromosomeType chromosomeType) {
|
||||
ArrayList<IMutation> paths = new ArrayList<IMutation>();
|
||||
|
||||
@@ -31,6 +31,6 @@ public class ItemInventoryBackpack extends ItemInventory {
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return backpackDefinition.isValidItem(null, itemStack);
|
||||
return backpackDefinition.isValidItem(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,11 @@ import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.recipes.IGenericCrate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class ItemCrated extends Item implements IGenericCrate {
|
||||
public class ItemCrated extends Item {
|
||||
|
||||
private final ItemStack contained;
|
||||
private final boolean usesOreDict;
|
||||
@@ -41,12 +40,7 @@ public class ItemCrated extends Item implements IGenericCrate {
|
||||
return usesOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContained(ItemStack crated, ItemStack contained) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContained(ItemStack crate) {
|
||||
public ItemStack getContained() {
|
||||
return contained;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.api.recipes.IGenericCrate;
|
||||
import forestry.core.items.ItemCrated;
|
||||
|
||||
/**
|
||||
* Adapted from RenderTankCartItem by CovertJaguar <http://www.railcraft.info>
|
||||
@@ -334,8 +334,8 @@ public class CrateRenderingHandler implements IItemRenderer {
|
||||
}
|
||||
|
||||
Item crateItem = crate.getItem();
|
||||
if (crateItem instanceof IGenericCrate) {
|
||||
return ((IGenericCrate) crateItem).getContained(crate);
|
||||
if (crateItem instanceof ItemCrated) {
|
||||
return ((ItemCrated) crateItem).getContained();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -56,7 +56,7 @@ public class Utils {
|
||||
// Release inventory
|
||||
if (tile instanceof ITileStructure) {
|
||||
|
||||
IInventory inventory = ((ITileStructure) tile).getInventory();
|
||||
ISidedInventory inventory = ((ITileStructure) tile).getStructureInventory();
|
||||
if (inventory != null) {
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
if (inventory.getStackInSlot(i) == null) {
|
||||
@@ -216,12 +216,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
Entity entity = EntityList.createEntityByName(entityString, world);
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
return (E) entity;
|
||||
return entityClass.cast(entity);
|
||||
}
|
||||
|
||||
public static <E extends EntityLiving> E spawnEntity(World world, Class<E> entityClass, double x, double y, double z) {
|
||||
|
||||
@@ -34,21 +34,6 @@ public class DummyManagers {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrating(String toCrate, ItemStack unpack, ItemStack crated) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrating(ItemStack itemStack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCratingWithOreDict(ItemStack itemStack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Object[], Object[]> getRecipes() {
|
||||
return null;
|
||||
|
||||
@@ -128,17 +128,15 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
private static final Set<Fluid> recipeFluids = new HashSet<Fluid>();
|
||||
private static final List<ItemStack> boxes = new ArrayList<ItemStack>();
|
||||
|
||||
@Override
|
||||
public void addCrating(ItemStack itemStack) {
|
||||
ItemStack uncrated = ((forestry.core.items.ItemCrated) itemStack.getItem()).getContained(itemStack);
|
||||
ItemStack uncrated = ((forestry.core.items.ItemCrated) itemStack.getItem()).getContained();
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, Fluids.WATER.getFluid(Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
ForestryItem.crate.getItemStack(), itemStack, new Object[]{"###", "###", "###", '#', uncrated});
|
||||
addRecipe(null, new ItemStack(uncrated.getItem(), 9, uncrated.getItemDamage()), new Object[]{"#", '#', itemStack});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCratingWithOreDict(ItemStack itemStack) {
|
||||
ItemStack uncrated = ((forestry.core.items.ItemCrated) itemStack.getItem()).getContained(itemStack);
|
||||
ItemStack uncrated = ((forestry.core.items.ItemCrated) itemStack.getItem()).getContained();
|
||||
int[] oreIds = OreDictionary.getOreIDs(uncrated);
|
||||
for (int oreId : oreIds) {
|
||||
String oreName = OreDictionary.getOreName(oreId);
|
||||
@@ -146,7 +144,6 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrating(String toCrate, ItemStack unpack, ItemStack crated) {
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, Fluids.WATER.getFluid(Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
ForestryItem.crate.getItemStack(), crated, new Object[]{"###", "###", "###", '#', toCrate});
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package forestry.farming.gadgets;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -260,11 +259,6 @@ public abstract class TileFarm extends TileForestry implements IFarmComponent {
|
||||
return this.masterY >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IInventory getInventory() {
|
||||
return getStructureInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventoryAdapter getStructureInventory() {
|
||||
return getInternalInventory();
|
||||
|
||||
@@ -169,14 +169,14 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
public static int ticksPerBeeWorkCycle = 550;
|
||||
public static boolean apiarySideSensitive = false;
|
||||
public static boolean fancyRenderedBees = false;
|
||||
private ArrayList<IHiveDrop> forestDrops;
|
||||
private ArrayList<IHiveDrop> meadowsDrops;
|
||||
private ArrayList<IHiveDrop> desertDrops;
|
||||
private ArrayList<IHiveDrop> jungleDrops;
|
||||
private ArrayList<IHiveDrop> endDrops;
|
||||
private ArrayList<IHiveDrop> snowDrops;
|
||||
private ArrayList<IHiveDrop> swampDrops;
|
||||
private ArrayList<IHiveDrop> swarmDrops;
|
||||
private final List<IHiveDrop> forestDrops = new ArrayList<IHiveDrop>();
|
||||
private final List<IHiveDrop> meadowsDrops = new ArrayList<IHiveDrop>();
|
||||
private final List<IHiveDrop> desertDrops = new ArrayList<IHiveDrop>();
|
||||
private final List<IHiveDrop> jungleDrops = new ArrayList<IHiveDrop>();
|
||||
private final List<IHiveDrop> endDrops = new ArrayList<IHiveDrop>();
|
||||
private final List<IHiveDrop> snowDrops = new ArrayList<IHiveDrop>();
|
||||
private final List<IHiveDrop> swampDrops = new ArrayList<IHiveDrop>();
|
||||
|
||||
/**
|
||||
* See {@link IBeeRoot} for details
|
||||
*/
|
||||
@@ -195,7 +195,6 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
|
||||
HiveManager.hiveRegistry = hiveRegistry = new HiveRegistry();
|
||||
HiveManager.genHelper = new HiveGenHelper();
|
||||
createHiveDropArrays();
|
||||
|
||||
FlowerManager.flowerRegistry = new FlowerRegistry();
|
||||
|
||||
@@ -781,37 +780,6 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
return beeItem;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Deprecated // deprecated since 3.1. remove when BeeManager.hiveDrops is removed
|
||||
private void createHiveDropArrays() {
|
||||
|
||||
BeeManager.hiveDrops = new ArrayList[8];
|
||||
|
||||
forestDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[0] = forestDrops;
|
||||
|
||||
meadowsDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[1] = meadowsDrops;
|
||||
|
||||
desertDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[2] = desertDrops;
|
||||
|
||||
jungleDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[3] = jungleDrops;
|
||||
|
||||
endDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[4] = endDrops;
|
||||
|
||||
snowDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[5] = snowDrops;
|
||||
|
||||
swampDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[6] = swampDrops;
|
||||
|
||||
swarmDrops = new ArrayList<IHiveDrop>();
|
||||
BeeManager.hiveDrops[7] = swarmDrops;
|
||||
}
|
||||
|
||||
private static void createHives() {
|
||||
hiveRegistry.registerHive(HiveRegistry.forest, HiveDescription.FOREST);
|
||||
hiveRegistry.registerHive(HiveRegistry.meadows, HiveDescription.MEADOWS);
|
||||
|
||||
@@ -89,9 +89,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
|
||||
ChipsetManager.solderManager = new ItemSolderingIron.SolderManager();
|
||||
|
||||
CircuitRegistry circuitRegistry = new CircuitRegistry();
|
||||
ChipsetManager.circuitRegistry = circuitRegistry;
|
||||
circuitRegistry.initialize();
|
||||
ChipsetManager.circuitRegistry = new CircuitRegistry();
|
||||
|
||||
AlleleRegistry alleleRegistry = new AlleleRegistry();
|
||||
AlleleManager.alleleRegistry = alleleRegistry;
|
||||
|
||||
@@ -32,7 +32,6 @@ import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.circuits.Circuit;
|
||||
import forestry.core.circuits.CircuitId;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Configuration;
|
||||
@@ -174,12 +173,6 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
|
||||
ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin");
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
|
||||
|
||||
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_CHOKE_I, "forestry.energyChoke1");
|
||||
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.FIRE_DAMPENER_I, "forestry.energyDampener1");
|
||||
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_EFFICIENCY_I, "forestry.energyEfficiency1");
|
||||
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_BOOST_I, "forestry.energyBoost1");
|
||||
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_BOOST_II, "forestry.energyBoost2");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,6 +68,7 @@ import forestry.core.items.ItemCrated;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
import forestry.storage.BackpackDefinition;
|
||||
import forestry.storage.BackpackHelper;
|
||||
import forestry.storage.CrateRegistry;
|
||||
@@ -185,12 +186,13 @@ public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandl
|
||||
}
|
||||
|
||||
public static void createCrateRecipes() {
|
||||
MachineCarpenter.RecipeManager carpenterManager = (MachineCarpenter.RecipeManager) RecipeManagers.carpenterManager;
|
||||
for (ItemCrated crate : crates) {
|
||||
ItemStack itemStack = new ItemStack(crate);
|
||||
if (crate.usesOreDict()) {
|
||||
RecipeManagers.carpenterManager.addCratingWithOreDict(itemStack);
|
||||
carpenterManager.addCratingWithOreDict(itemStack);
|
||||
} else {
|
||||
RecipeManagers.carpenterManager.addCrating(itemStack);
|
||||
carpenterManager.addCrating(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -48,11 +47,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();
|
||||
@@ -101,11 +95,6 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
// It is a slow call, so we need a cache to make it fast
|
||||
private final Map<ItemStack, Boolean> isValidItemCache = new ValidItemCache();
|
||||
|
||||
@Override
|
||||
public boolean isValidItem(EntityPlayer player, ItemStack itemstack) {
|
||||
return isValidItem(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidItem(ItemStack itemstack) {
|
||||
Boolean cached = isValidItemCache.get(itemstack);
|
||||
|
||||
@@ -52,8 +52,8 @@ public class PickupHandlerStorage implements IPickupHandler {
|
||||
}
|
||||
|
||||
ItemBackpack backpack = ((ItemBackpack) pack.getItem());
|
||||
if (backpack.getDefinition().isValidItem(player, itemstack)) {
|
||||
backpack.tryStowing(player, pack, itemstack);
|
||||
if (backpack.getDefinition().isValidItem(itemstack)) {
|
||||
ItemBackpack.tryStowing(player, pack, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class PickupHandlerStorage implements IPickupHandler {
|
||||
* This tops off existing stacks in the player's inventory. That way you can keep f.e. a stack of dirt or cobblestone in your inventory which gets refreshed
|
||||
* constantly by picked up items.
|
||||
*/
|
||||
private void topOffPlayerInventory(EntityPlayer player, ItemStack itemstack) {
|
||||
private static void topOffPlayerInventory(EntityPlayer player, ItemStack itemstack) {
|
||||
|
||||
// Add to player inventory first, if there is an incomplete stack in
|
||||
// there.
|
||||
|
||||
@@ -107,7 +107,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
return evaluateTileHit(itemstack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
public ItemStack tryStowing(EntityPlayer player, ItemStack backpackStack, ItemStack stack) {
|
||||
public static ItemStack tryStowing(EntityPlayer player, ItemStack backpackStack, ItemStack stack) {
|
||||
|
||||
ItemBackpack backpack = ((ItemBackpack) backpackStack.getItem());
|
||||
ItemInventory inventory = new ItemInventoryBackpack(ItemBackpack.class, backpack.getBackpackSize(), backpackStack);
|
||||
@@ -131,7 +131,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void switchMode(ItemStack itemstack) {
|
||||
private static void switchMode(ItemStack itemstack) {
|
||||
BackpackMode mode = getMode(itemstack);
|
||||
int nextMode = mode.ordinal() + 1;
|
||||
if (!Config.enableBackpackResupply && nextMode == BackpackMode.RESUPPLY.ordinal()) {
|
||||
@@ -141,7 +141,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
itemstack.setItemDamage(nextMode);
|
||||
}
|
||||
|
||||
private IInventory getInventoryHit(World world, int x, int y, int z, int side) {
|
||||
private static IInventory getInventoryHit(World world, int x, int y, int z, int side) {
|
||||
TileEntity targeted = world.getTileEntity(x, y, z);
|
||||
return InvTools.getInventoryFromTile(targeted, ForgeDirection.getOrientation(side));
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
|
||||
BackpackMode mode = getMode(stack);
|
||||
if (mode == BackpackMode.RECEIVE) {
|
||||
tryChestReceive(player, backpackInventory, inventory);
|
||||
tryChestReceive(backpackInventory, inventory);
|
||||
} else {
|
||||
tryChestTransfer(backpackInventory, inventory);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void tryChestTransfer(ItemInventoryBackpack backpackInventory, IInventory target) {
|
||||
private static void tryChestTransfer(ItemInventoryBackpack backpackInventory, IInventory target) {
|
||||
|
||||
for (IInvSlot slot : InventoryIterator.getIterable(backpackInventory)) {
|
||||
ItemStack packStack = slot.getStackInSlot();
|
||||
@@ -190,7 +190,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
}
|
||||
}
|
||||
|
||||
private void tryChestReceive(EntityPlayer player, ItemInventoryBackpack backpackInventory, IInventory target) {
|
||||
private void tryChestReceive(ItemInventoryBackpack backpackInventory, IInventory target) {
|
||||
|
||||
for (IInvSlot slot : InventoryIterator.getIterable(target)) {
|
||||
ItemStack targetStack = slot.getStackInSlot();
|
||||
@@ -198,7 +198,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!definition.isValidItem(player, targetStack)) {
|
||||
if (!definition.isValidItem(targetStack)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -249,11 +249,7 @@ public class ItemBackpack extends ItemInventoried {
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
try {
|
||||
return definition.getName(itemstack);
|
||||
} catch (Error e) {
|
||||
return definition.getName();
|
||||
}
|
||||
return definition.getName(itemstack);
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
|
||||
Reference in new issue
Block a user