Remove most deprecated things

This commit is contained in:
mezz committed 2016-02-25 04:45:19 -08:00
1 parent 65436a4e70
commit 78d836bc1f
31 files changed
+53 -475

No files matched your search

@@ -6,7 +6,6 @@
package forestry.api.apiculture;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
@@ -23,17 +22,4 @@ public interface IArmorApiarist {
* @return Whether or not the armor should protect the player from that attack
*/
boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect);
/**
* Called when the apiarist's armor acts as protection against an attack.
*
* @param player Player being attacked
* @param armor Armor item
* @param cause Optional cause of attack, such as a bee effect identifier
* @param doProtect Whether or not to actually do the side effects of protection
* @return Whether or not the armor should protect the player from that attack
* @deprecated since Forestry 4.2. Use protectEntity
*/
@Deprecated
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect);
}
@@ -6,7 +6,6 @@
package forestry.api.apiculture;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
@@ -36,27 +35,4 @@ public interface IArmorApiaristHelper {
* @since Forestry 4.2
*/
int wearsItems(EntityLivingBase entity, String cause, boolean doProtect);
/**
* Called when the apiarist's armor acts as protection against an attack.
* @param stack ItemStack to check
* @param player Player being attacked
* @param cause Optional cause of attack, such as a bee effect identifier
* @param doProtect Whether or not to actually do the side effects of protection
* @return Whether or not the item is valid Apiarist Armor and should protect the player from that attack
* @deprecated since Forestry 4.2. use the EntityLivingBase version
*/
@Deprecated
boolean isArmorApiarist(ItemStack stack, EntityPlayer player, String cause, boolean doProtect);
/**
* Called when the apiarist's armor acts as protection against an attack.
* @param player Player being attacked
* @param cause Optional cause of attack, such as a bee effect identifier
* @param doProtect Whether or not to actually do the side effects of protection
* @return The number of valid Apiarist Armor pieces the player is wearing that are actually protecting
* @deprecated since Forestry 4.2. use the EntityLivingBase version
*/
@Deprecated
int wearsItems(EntityPlayer player, String cause, boolean doProtect);
}
@@ -87,67 +87,4 @@ public interface IAlleleFactory {
* @since Forestry 4.2
*/
IAlleleFlowers createFlowers(String modId, String category, String valueName, IFlowerProvider value, boolean isDominant, IChromosomeType... types);
/**
* @param modId mod prefix for uid and localization (i.e. "forestry")
* @param category allele category for uid and localization (i.e. "height")
* @param valueName allele value name for uid and localization (i.e. "smallest")
* @param value allele float value
* @param isDominant allele dominance
* @return a new IAlleleFloat, registered with the allele registry.
* @deprecated since Forestry 4.2. Use the IChromosomeType version.
*/
@Deprecated
IAlleleFloat createFloat(String modId, String category, String valueName, float value, boolean isDominant);
/**
* @param modId mod prefix for uid and localization (i.e. "forestry")
* @param category allele category for uid and localization (i.e. "territory")
* @param valueName allele value name for uid and localization (i.e. "large")
* @param xDimValue allele area X Size
* @param yDimValue allele area Y Size
* @param zDimValue allele area Z Size
* @param isDominant allele dominance
* @return a new IAlleleArea, registered with the allele registry.
* @deprecated since Forestry 4.2. Use the IChromosomeType version.
*/
@Deprecated
IAlleleArea createArea(String modId, String category, String valueName, int xDimValue, int yDimValue, int zDimValue, boolean isDominant);
/**
* @param modId mod prefix for uid and localization (i.e. "forestry")
* @param category allele category for uid and localization (i.e. "fertility")
* @param valueName allele value name for uid and localization (i.e. "low")
* @param value allele int value
* @param isDominant allele dominance
* @return a new IAlleleInteger, registered with the allele registry.
* @deprecated since Forestry 4.2. Use the IChromosomeType version.
*/
@Deprecated
IAlleleInteger createInteger(String modId, String category, String valueName, int value, boolean isDominant);
/**
* @param modId mod prefix for uid and localization (i.e. "forestry")
* @param category allele category for uid and localization (i.e. "fireproof")
* @param value allele boolean value
* @param isDominant allele dominance
* @return a new IAlleleBoolean, registered with the allele registry.
* Note that valueName will always be "true" or "false"
* @deprecated since Forestry 4.2. Use the IChromosomeType version.
*/
@Deprecated
IAlleleBoolean createBoolean(String modId, String category, boolean value, boolean isDominant);
/**
* @param modId mod prefix for uid (i.e. "forestry")
* @param category allele category for uid (i.e. "flowers")
* @param valueName allele value name for uid (i.e. "vanilla")
* @param value allele IFlowerProvider value
* @param isDominant allele dominance
* @return a new IAlleleFlowers, registered with the allele registry.
* IAlleleFlowers localization is handled by the IFlowerProvider.getDescription(), unlike the other alleles.
* @deprecated since Forestry 4.2. Use the IChromosomeType version.
*/
@Deprecated
IAlleleFlowers createFlowers(String modId, String category, String valueName, IFlowerProvider value, boolean isDominant);
}
@@ -79,15 +79,6 @@ public interface IAlleleRegistry {
*/
Map<String, IAllele> getRegisteredAlleles();
/**
* Registers an allele.
*
* @param allele IAllele to register.
* @deprecated since Forestry 4.2. Use the IChromosomeType-specific version.
*/
@Deprecated
void registerAllele(IAllele allele);
/**
* Registers an allele.
*
@@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.genetics;
import net.minecraft.block.Block;
/**
* @deprecated since Forestry 4.0. Use alternative methods in IFlowerRegistry.
*/
@Deprecated
public interface IFlower extends Comparable<IFlower> {
Block getBlock();
int getMeta();
double getWeight();
void setWeight(double weight);
boolean isPlantable();
}
@@ -5,10 +5,6 @@
******************************************************************************/
package forestry.api.genetics;
import java.util.Collection;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
@@ -69,24 +65,4 @@ public interface IFlowerRegistry {
* Checks a single coordinate to see if it is an accepted flower.
*/
boolean isAcceptedFlower(String flowerType, World world, BlockPos pos);
/**
* For use by IFlowerGrowthRule implementations
* @deprecated since Forestry 4.0.8 This will be accessible to IFlowerGrowthRule via IFlowerGrowthHelper
*/
@Deprecated
IFlower getRandomPlantableFlower(String flowerType, Random rand);
/**
* Returns all known flower types.
* @deprecated since Forestry 4.0.8 This should only be used internally.
*/
@Deprecated
Collection<String> getFlowerTypes();
/**
* @deprecated since Forestry 4.0.8 This should only be used internally.
*/
@Deprecated
Set<IFlower> getAcceptableFlowers(String flowerType);
}
@@ -11,7 +11,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@@ -71,12 +70,6 @@ public interface ISpeciesRoot {
/* BREEDING TRACKER */
IBreedingTracker getBreedingTracker(World world, GameProfile player);
/**
* @deprecated since Forestry 4.2.1. Breeding tracker should be automatically synced.
*/
@Deprecated
void syncBreedingTrackerToPlayer(EntityPlayer player);
/* GENOME MANIPULATION */
IIndividual templateAsIndividual(IAllele[] template);
@@ -6,7 +6,6 @@
package forestry.api.recipes;
import java.util.Collection;
import java.util.Map;
public interface ICraftingProvider<T extends IForestryRecipe> {
/**
@@ -28,13 +27,4 @@ public interface ICraftingProvider<T extends IForestryRecipe> {
* @since Forestry 4.1.0
*/
Collection<T> recipes();
/**
* Access to the full list of recipes contained in the crafting provider.
*
* @return List of the given format where the first array represents inputs and the second outputs. Objects can be either ItemStack or LiquidStack.
* @deprecated since Forestry 4.1.0. Use recipes()
*/
@Deprecated
Map<Object[], Object[]> getRecipes();
}
@@ -5,9 +5,7 @@
******************************************************************************/
package forestry.api.recipes;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
/**
* Extension of IRecipe to give better access to the expected crafting inputs.
@@ -32,18 +30,4 @@ public interface IDescriptiveRecipe extends IRecipe {
*/
Object[] getIngredients();
/**
* @return true if the recipe manager should copy NBT from input items to the output item.
* If true, all input items must have the same NBT for it to succeed.
* @deprecated since Forestry 4.2 wood itemStacks use item damage (meta) instead of NBT
*/
@Deprecated
boolean preserveNBT();
/**
* Used to check if a recipe matches current crafting inventory
* @deprecated Since Forestry 4.1. This is handled by Forestry.
*/
@Deprecated
boolean matches(IInventory inventoryCrafting, World world);
}
@@ -13,10 +13,4 @@ public interface IFabricatorManager extends ICraftingProvider<IFabricatorRecipe>
void addRecipe(ItemStack plan, FluidStack molten, ItemStack result, Object[] pattern);
/**
* @deprecated since Forestry 4.1. Use IFabricatorSmeltingManager
*/
@Deprecated
void addSmelting(ItemStack resource, FluidStack molten, int meltingPoint);
}
@@ -5,20 +5,12 @@
******************************************************************************/
package forestry.api.recipes;
import java.util.Collection;
/**
* Contains all available recipe managers for Forestry machines and items.
*
* @author SirSengir
*/
public class RecipeManagers {
/**
* @deprecated since Forestry 4.1.0. Use the specific recipe managers below instead.
*/
@Deprecated
public static Collection<ICraftingProvider> craftingProviders;
/**
* Allows you to add recipes to the carpenter. See {@link ICarpenterManager} for details.
@@ -11,7 +11,6 @@
package forestry.apiculture;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -32,15 +31,7 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
}
IArmorApiarist armorApiarist = (IArmorApiarist) item;
try {
return armorApiarist.protectEntity(entity, stack, cause, doProtect);
} catch (Throwable ignored) { // protectEntity is new to the API and may not be implemented by the armor
if (entity instanceof EntityPlayer) {
return armorApiarist.protectPlayer((EntityPlayer) entity, stack, cause, doProtect);
} else {
return true; // fallback on assuming IArmorApiarist will protect the entity
}
}
return armorApiarist.protectEntity(entity, stack, cause, doProtect);
}
@Override
@@ -56,14 +47,4 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
return count;
}
@Override
public boolean isArmorApiarist(ItemStack stack, EntityPlayer player, String cause, boolean doProtect) {
return isArmorApiarist(stack, (EntityLivingBase) player, cause, doProtect);
}
@Override
public int wearsItems(EntityPlayer player, String cause, boolean doProtect) {
return wearsItems((EntityLivingBase) player, cause, doProtect);
}
}
@@ -18,9 +18,7 @@ import net.minecraft.block.Block;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.genetics.IFlower;
final class Flower implements IFlower {
public final class Flower {
private final Block block;
private final int meta;
@@ -32,24 +30,22 @@ final class Flower implements IFlower {
this.weight = weight;
}
@Override
public boolean isPlantable() {
return this.weight != 0.0;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof IFlower)) {
if (!(obj instanceof Flower)) {
return false;
}
IFlower flower = (IFlower) obj;
Flower flower = (Flower) obj;
return Block.isEqualTo(this.block, flower.getBlock()) && (this.meta == OreDictionary.WILDCARD_VALUE || flower.getMeta() == OreDictionary.WILDCARD_VALUE || this.meta == flower.getMeta());
}
@Override
public int compareTo(@Nonnull IFlower other) {
public int compareTo(@Nonnull Flower other) {
return this.weight.compareTo(other.getWeight());
}
@@ -58,22 +54,18 @@ final class Flower implements IFlower {
return Objects.hashCode(block);
}
@Override
public Block getBlock() {
return block;
}
@Override
public int getMeta() {
return meta;
}
@Override
public double getWeight() {
return weight;
}
@Override
public void setWeight(double weight) {
this.weight = weight;
}
@@ -40,7 +40,6 @@ import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerAcceptableRule;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
@@ -255,9 +254,8 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
return false;
}
@Override
public Set<IFlower> getAcceptableFlowers(String flowerType) {
return ImmutableSet.<IFlower>copyOf(this.registeredFlowers.get(flowerType));
public Set<Flower> getAcceptableFlowers(String flowerType) {
return ImmutableSet.copyOf(this.registeredFlowers.get(flowerType));
}
@Override
@@ -271,14 +269,12 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
}
}
@Override
public IFlower getRandomPlantableFlower(String flowerType, Random rand) {
public Flower getRandomPlantableFlower(String flowerType, Random rand) {
TreeMap<Double, Flower> chancesMap = getChancesMap(flowerType);
double maxKey = chancesMap.lastKey() + 1.0;
return chancesMap.get(chancesMap.lowerKey(rand.nextDouble() * maxKey));
}
@Override
public Collection<String> getFlowerTypes() {
return new ArrayList<>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
}
@@ -311,7 +307,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
@Override
public boolean plantRandomFlower(String flowerType, World world, BlockPos pos) {
IFlower flower = getRandomPlantableFlower(flowerType, world.rand);
Flower flower = getRandomPlantableFlower(flowerType, world.rand);
return world.setBlockState(pos, flower.getBlock().getStateFromMeta(flower.getMeta()), Constants.FLAG_BLOCK_SYNCH);
}
}
@@ -16,12 +16,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.apiculture.IArmorApiarist;
import forestry.api.core.IArmorNaturalist;
import forestry.api.core.IModelManager;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.Tabs;
import forestry.core.config.Constants;
import forestry.plugins.PluginApiculture;
@@ -64,11 +66,6 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
return true;
}
@Override
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect) {
return true;
}
@Override
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
return armorType == 0;
@@ -40,8 +40,9 @@ import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ForestryAPI;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IFlower;
import forestry.apiculture.blocks.BlockTypeApiculture;
import forestry.apiculture.flowers.Flower;
import forestry.apiculture.flowers.FlowerRegistry;
import forestry.apiculture.inventory.InventoryApiary;
import forestry.apiculture.tiles.TileApiary;
import forestry.arboriculture.worldgen.BlockTypeLog;
@@ -270,7 +271,8 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
continue;
}
IFlower flower = FlowerManager.flowerRegistry.getRandomPlantableFlower(FlowerManager.FlowerTypeVanilla, world.rand);
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
Flower flower = flowerRegistry.getRandomPlantableFlower(FlowerManager.FlowerTypeVanilla, world.rand);
setBlockState(world, flower.getBlock().getStateFromMeta(flower.getMeta()), j, i, k, box);
}
}
@@ -20,7 +20,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IAllele;
@@ -147,10 +146,4 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
return chromosomes;
}
/* BREEDING TRACKER */
@Override
public void syncBreedingTrackerToPlayer(EntityPlayer player) {
getBreedingTracker(player.worldObj, player.getGameProfile()).synchToPlayer(player);
}
}
@@ -57,39 +57,4 @@ public class AlleleFactory implements IAlleleFactory {
AlleleManager.alleleRegistry.registerAllele(alleleFlowers, types);
return alleleFlowers;
}
@Override
public IAlleleFloat createFloat(String modId, String category, String name, float value, boolean isDominant) {
IAlleleFloat alleleFloat = new AlleleFloat(modId, category, name, value, isDominant);
AlleleManager.alleleRegistry.registerAllele(alleleFloat);
return alleleFloat;
}
@Override
public IAlleleArea createArea(String modId, String category, String name, int xDim, int yDim, int zDim, boolean isDominant) {
IAlleleArea alleleArea = new AlleleArea(modId, category, name, new int[]{xDim, yDim, zDim}, isDominant);
AlleleManager.alleleRegistry.registerAllele(alleleArea);
return alleleArea;
}
@Override
public IAlleleInteger createInteger(String modId, String category, String valueName, int value, boolean isDominant) {
IAlleleInteger alleleInteger = new AlleleInteger(modId, category, valueName, value, isDominant);
AlleleManager.alleleRegistry.registerAllele(alleleInteger);
return alleleInteger;
}
@Override
public IAlleleBoolean createBoolean(String modId, String category, boolean value, boolean isDominant) {
IAlleleBoolean alleleBoolean = new AlleleBoolean(modId, category, value, isDominant);
AlleleManager.alleleRegistry.registerAllele(alleleBoolean);
return alleleBoolean;
}
@Override
public IAlleleFlowers createFlowers(String modId, String category, String name, IFlowerProvider flowerProvider, boolean isDominant) {
IAlleleFlowers alleleFlowers = new AlleleFlowers(modId, category, name, flowerProvider, isDominant);
AlleleManager.alleleRegistry.registerAllele(alleleFlowers);
return alleleFlowers;
}
}
@@ -147,20 +147,6 @@ public class AlleleRegistry implements IAlleleRegistry {
return Collections.unmodifiableMap(deprecatedAlleleMap);
}
@Override
public void registerAllele(IAllele allele) {
alleleMap.put(allele.getUID(), allele);
if (allele instanceof IAlleleSpecies) {
IClassification branch = ((IAlleleSpecies) allele).getBranch();
if (branch != null) {
branch.addMemberSpecies((IAlleleSpecies) allele);
}
}
for (IAlleleHandler handler : this.alleleHandlers) {
handler.onRegisterAllele(allele);
}
}
@Override
public void registerAllele(IAllele allele, IChromosomeType... chromosomeTypes) {
for (IChromosomeType chromosomeType : chromosomeTypes) {
@@ -170,7 +156,18 @@ public class AlleleRegistry implements IAlleleRegistry {
allelesByType.put(chromosomeType, allele);
typesByAllele.put(allele, chromosomeType);
}
registerAllele(allele);
alleleMap.put(allele.getUID(), allele);
if (allele instanceof IAlleleSpecies) {
IClassification branch = ((IAlleleSpecies) allele).getBranch();
if (branch != null) {
branch.addMemberSpecies((IAlleleSpecies) allele);
}
}
for (IAlleleHandler handler : this.alleleHandlers) {
handler.onRegisterAllele(allele);
}
}
@Override
@@ -15,7 +15,6 @@ import java.util.HashMap;
import java.util.Iterator;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -127,17 +126,6 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
return getInput();
}
@Override
public boolean preserveNBT() {
return false;
}
@Override
@Deprecated
public boolean matches(IInventory inventoryCrafting, World world) {
return false;
}
@Override
public boolean matches(InventoryCrafting inv, World world) {
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.factory;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Nullable;
@@ -57,11 +56,6 @@ public class DummyManagers {
public Set<T> recipes() {
return ImmutableSet.of();
}
@Override
public Map<Object[], Object[]> getRecipes() {
return ImmutableMap.of();
}
}
public static class DummyCarpenterManager extends DummyCraftingProvider<ICarpenterRecipe> implements ICarpenterManager {
@@ -97,10 +91,6 @@ public class DummyManagers {
}
@Override
public void addSmelting(ItemStack resource, FluidStack molten, int meltingPoint) {
}
}
public static class DummyFabricatorSmeltingManager extends DummyCraftingProvider<IFabricatorSmeltingRecipe> implements IFabricatorSmeltingManager {
@@ -11,9 +11,7 @@
package forestry.factory.recipes;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.inventory.IInventory;
@@ -125,16 +123,4 @@ public class CarpenterRecipeManager implements ICarpenterManager {
public Set<ICarpenterRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (ICarpenterRecipe recipe : recipes) {
recipeList.put(recipe.getCraftingGridRecipe().getIngredients(), new Object[]{recipe.getCraftingGridRecipe().getRecipeOutput()});
}
return recipeList;
}
}
@@ -11,7 +11,6 @@
package forestry.factory.recipes;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -60,17 +59,4 @@ public class CentrifugeRecipeManager implements ICentrifugeManager {
public Set<ICentrifugeRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
@Deprecated
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (ICentrifugeRecipe recipe : recipes) {
Set<ItemStack> productsKeys = recipe.getAllProducts().keySet();
recipeList.put(new Object[]{recipe.getInput()}, productsKeys.toArray(new ItemStack[productsKeys.size()]));
}
return recipeList;
}
}
@@ -11,9 +11,7 @@
package forestry.factory.recipes;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.inventory.IInventory;
@@ -23,7 +21,6 @@ import net.minecraftforge.fluids.FluidStack;
import forestry.api.recipes.IFabricatorManager;
import forestry.api.recipes.IFabricatorRecipe;
import forestry.api.recipes.RecipeManagers;
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.utils.ItemStackUtil;
@@ -38,11 +35,6 @@ public class FabricatorRecipeManager implements IFabricatorManager {
addRecipe(recipe);
}
@Override
public void addSmelting(ItemStack resource, FluidStack molten, int meltingPoint) {
RecipeManagers.fabricatorSmeltingManager.addSmelting(resource, molten, meltingPoint);
}
public static IFabricatorRecipe findMatchingRecipe(ItemStack plan, IInventory resources) {
ItemStack[][] gridResources = RecipeUtil.getResources(resources);
@@ -82,15 +74,4 @@ public class FabricatorRecipeManager implements IFabricatorManager {
public Set<IFabricatorRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (IFabricatorRecipe recipe : recipes) {
recipeList.put(recipe.getIngredients(), new Object[]{recipe.getRecipeOutput()});
}
return recipeList;
}
}
@@ -12,9 +12,7 @@ package forestry.factory.recipes;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.ItemStack;
@@ -64,15 +62,4 @@ public class FabricatorSmeltingRecipeManager implements IFabricatorSmeltingManag
public Collection<IFabricatorSmeltingRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (IFabricatorSmeltingRecipe recipe : recipes) {
recipeList.put(new Object[]{recipe.getResource()}, new Object[]{recipe.getProduct()});
}
return recipeList;
}
}
@@ -11,9 +11,7 @@
package forestry.factory.recipes;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.ItemStack;
@@ -101,15 +99,4 @@ public class FermenterRecipeManager implements IFermenterManager {
public Set<IFermenterRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (IFermenterRecipe recipe : recipes) {
recipeList.put(new Object[]{recipe.getResource(), recipe.getFluidResource()}, new Object[]{recipe.getOutput()});
}
return recipeList;
}
}
@@ -11,9 +11,7 @@
package forestry.factory.recipes;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.ItemStack;
@@ -69,15 +67,4 @@ public class MoistenerRecipeManager implements IMoistenerManager {
public Set<IMoistenerRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (IMoistenerRecipe recipe : recipes) {
recipeList.put(new ItemStack[]{recipe.getResource()}, new ItemStack[]{recipe.getProduct()});
}
return recipeList;
}
}
@@ -12,9 +12,7 @@ package forestry.factory.recipes;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.ItemStack;
@@ -113,15 +111,4 @@ public class SqueezerRecipeManager implements ISqueezerManager {
public Set<ISqueezerRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (ISqueezerRecipe recipe : recipes) {
recipeList.put(recipe.getResources(), new Object[]{recipe.getRemnants(), recipe.getFluidOutput()});
}
return recipeList;
}
}
@@ -11,9 +11,7 @@
package forestry.factory.recipes;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraftforge.fluids.Fluid;
@@ -79,15 +77,4 @@ public class StillRecipeManager implements IStillManager {
public Set<IStillRecipe> recipes() {
return Collections.unmodifiableSet(recipes);
}
@Override
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<>();
for (IStillRecipe recipe : recipes) {
recipeList.put(new Object[]{recipe.getInput()}, new Object[]{recipe.getOutput()});
}
return recipeList;
}
}
@@ -57,8 +57,6 @@ import forestry.api.core.ForestryAPI;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IClassification;
import forestry.api.genetics.IClassification.EnumClassLevel;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
@@ -72,6 +70,7 @@ import forestry.apiculture.blocks.BlockTypeApicultureTesr;
import forestry.apiculture.commands.CommandBee;
import forestry.apiculture.entities.EntityMinecartApiary;
import forestry.apiculture.entities.EntityMinecartBeehouse;
import forestry.apiculture.flowers.Flower;
import forestry.apiculture.flowers.FlowerRegistry;
import forestry.apiculture.genetics.BeeBranchDefinition;
import forestry.apiculture.genetics.BeeDefinition;
@@ -227,7 +226,9 @@ public class PluginApiculture extends BlankForestryPlugin {
String acceptedFlowerMessage = StringUtil.localize("config.beekeeping.flowers.accepted.comment");
String plantableFlowerMessage = StringUtil.localize("config.beekeeping.flowers.plantable.comment");
for (String flowerType : FlowerManager.flowerRegistry.getFlowerTypes()) {
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
for (String flowerType : flowerRegistry.getFlowerTypes()) {
String[] defaultAccepted = defaultAcceptedFlowers.get(flowerType);
if (defaultAccepted == null) {
defaultAccepted = Constants.EMPTY_STRINGS;
@@ -244,7 +245,7 @@ public class PluginApiculture extends BlankForestryPlugin {
property.comment = plantableFlowerMessage;
parsePlantableFlowers(property, flowerType);
Set<IFlower> acceptableFlowers = FlowerManager.flowerRegistry.getAcceptableFlowers(flowerType);
Set<Flower> acceptableFlowers = flowerRegistry.getAcceptableFlowers(flowerType);
if (acceptableFlowers == null || acceptableFlowers.size() == 0) {
Log.severe("Flower type '" + flowerType + "' has no valid flowers set in apiculture.cfg. Add valid flowers or delete the config to set it to default.");
}
@@ -315,7 +316,7 @@ public class PluginApiculture extends BlankForestryPlugin {
private void setDefaultsForConfig() {
IFlowerRegistry flowerRegistry = FlowerManager.flowerRegistry;
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
// Register acceptable plants
flowerRegistry.registerAcceptableFlower(Blocks.dragon_egg, FlowerManager.FlowerTypeEnd);
@@ -342,12 +343,12 @@ public class PluginApiculture extends BlankForestryPlugin {
flowerRegistry.registerPlantableFlower(Blocks.red_mushroom, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
flowerRegistry.registerPlantableFlower(Blocks.cactus, 0, 1.0, FlowerManager.FlowerTypeCacti);
for (String flowerType : FlowerManager.flowerRegistry.getFlowerTypes()) {
Set<IFlower> flowers = FlowerManager.flowerRegistry.getAcceptableFlowers(flowerType);
for (String flowerType : flowerRegistry.getFlowerTypes()) {
Set<Flower> flowers = flowerRegistry.getAcceptableFlowers(flowerType);
List<String> acceptedFlowerNames = new ArrayList<>();
List<String> plantableFlowerNames = new ArrayList<>();
if (flowers != null) {
for (IFlower flower : flowers) {
for (Flower flower : flowers) {
String name = ItemStackUtil.getBlockNameFromRegistryAsSting(flower.getBlock());
if (name == null) {
Log.severe("Could not find name for flower: " + flower + " with type: " + flowerType);
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.plugins;
import com.google.common.collect.ImmutableList;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -29,7 +27,6 @@ import forestry.api.fuels.FermenterFuel;
import forestry.api.fuels.FuelManager;
import forestry.api.fuels.MoistenerFuel;
import forestry.api.fuels.RainSubstrate;
import forestry.api.recipes.ICraftingProvider;
import forestry.api.recipes.RecipeManagers;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.blocks.BlockSoil;
@@ -69,32 +66,28 @@ public class PluginFactory extends BlankForestryPlugin {
@Override
public void setupAPI() {
RecipeManagers.craftingProviders = ImmutableList.<ICraftingProvider>of(
RecipeManagers.carpenterManager = new CarpenterRecipeManager(),
RecipeManagers.centrifugeManager = new CentrifugeRecipeManager(),
RecipeManagers.fabricatorManager = new FabricatorRecipeManager(),
RecipeManagers.fabricatorSmeltingManager = new FabricatorSmeltingRecipeManager(),
RecipeManagers.fermenterManager = new FermenterRecipeManager(),
RecipeManagers.moistenerManager = new MoistenerRecipeManager(),
RecipeManagers.squeezerManager = new SqueezerRecipeManager(),
RecipeManagers.stillManager = new StillRecipeManager()
);
RecipeManagers.carpenterManager = new CarpenterRecipeManager();
RecipeManagers.centrifugeManager = new CentrifugeRecipeManager();
RecipeManagers.fabricatorManager = new FabricatorRecipeManager();
RecipeManagers.fabricatorSmeltingManager = new FabricatorSmeltingRecipeManager();
RecipeManagers.fermenterManager = new FermenterRecipeManager();
RecipeManagers.moistenerManager = new MoistenerRecipeManager();
RecipeManagers.squeezerManager = new SqueezerRecipeManager();
RecipeManagers.stillManager = new StillRecipeManager();
setupFuelManager();
}
@Override
public void disabledSetupAPI() {
RecipeManagers.craftingProviders = ImmutableList.<ICraftingProvider>of(
RecipeManagers.carpenterManager = new DummyManagers.DummyCarpenterManager(),
RecipeManagers.centrifugeManager = new DummyManagers.DummyCentrifugeManager(),
RecipeManagers.fabricatorManager = new DummyManagers.DummyFabricatorManager(),
RecipeManagers.fabricatorSmeltingManager = new DummyManagers.DummyFabricatorSmeltingManager(),
RecipeManagers.fermenterManager = new DummyManagers.DummyFermenterManager(),
RecipeManagers.moistenerManager = new DummyManagers.DummyMoistenerManager(),
RecipeManagers.squeezerManager = new DummyManagers.DummySqueezerManager(),
RecipeManagers.stillManager = new DummyManagers.DummyStillManager()
);
RecipeManagers.carpenterManager = new DummyManagers.DummyCarpenterManager();
RecipeManagers.centrifugeManager = new DummyManagers.DummyCentrifugeManager();
RecipeManagers.fabricatorManager = new DummyManagers.DummyFabricatorManager();
RecipeManagers.fabricatorSmeltingManager = new DummyManagers.DummyFabricatorSmeltingManager();
RecipeManagers.fermenterManager = new DummyManagers.DummyFermenterManager();
RecipeManagers.moistenerManager = new DummyManagers.DummyMoistenerManager();
RecipeManagers.squeezerManager = new DummyManagers.DummySqueezerManager();
RecipeManagers.stillManager = new DummyManagers.DummyStillManager();
setupFuelManager();
}