mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 12:59:44 +00:00
Clean up crates code
This commit is contained in:
1 parent
bcaaf251c6
commit
7b93aca1e6
10 files changed
+157
-180
No files matched your search
@@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* 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.config;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.PluginStorage;
|
||||
|
||||
public class ForestryCrate {
|
||||
|
||||
public static ItemCrated registerCrate(Item item, String name) {
|
||||
return registerCrate(new ItemCrated(new ItemStack(item)), name);
|
||||
}
|
||||
|
||||
public static ItemCrated registerCrate(Block block, String name) {
|
||||
return registerCrate(new ItemCrated(new ItemStack(block)), name);
|
||||
}
|
||||
|
||||
public static ItemCrated registerCrate(ItemStack stack, String name) {
|
||||
return registerCrate(new ItemCrated(stack), name);
|
||||
}
|
||||
|
||||
public static ItemCrated registerCrate(ItemCrated crate, String name) {
|
||||
if (!EnumSet.of(PluginManager.Stage.PRE_INIT, PluginManager.Stage.INIT).contains(PluginManager.getStage()))
|
||||
throw new RuntimeException("Tried to register Item outside of Pre-Init or Init");
|
||||
crate.setUnlocalizedName("for." + name);
|
||||
Proxies.common.registerItem(crate);
|
||||
PluginStorage.registerCrate(crate);
|
||||
return crate;
|
||||
}
|
||||
}
|
||||
@@ -10,16 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.config;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.PluginManager.Stage;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.PluginManager.Stage;
|
||||
|
||||
/**
|
||||
* Allows direct access to Forestry's items. Will be populated during
|
||||
* preInit and Init.
|
||||
@@ -194,64 +195,7 @@ public enum ForestryItem {
|
||||
canSeedOil,
|
||||
canHoney,
|
||||
canJuice,
|
||||
canIce,
|
||||
// Crating
|
||||
cratedWood,
|
||||
cratedCobblestone,
|
||||
cratedDirt,
|
||||
cratedStone,
|
||||
cratedBrick,
|
||||
cratedCacti,
|
||||
cratedSand,
|
||||
cratedObsidian,
|
||||
cratedNetherrack,
|
||||
cratedSoulsand,
|
||||
cratedSandstone,
|
||||
cratedBogearth,
|
||||
cratedHumus,
|
||||
cratedNetherbrick,
|
||||
cratedPeat,
|
||||
cratedApatite,
|
||||
cratedFertilizer,
|
||||
cratedTin,
|
||||
cratedCopper,
|
||||
cratedBronze,
|
||||
cratedWheat,
|
||||
cratedMycelium,
|
||||
cratedMulch,
|
||||
cratedSilver,
|
||||
cratedBrass,
|
||||
cratedCookies,
|
||||
cratedHoneycombs,
|
||||
cratedBeeswax,
|
||||
cratedPollen,
|
||||
cratedPropolis,
|
||||
cratedHoneydew,
|
||||
cratedRoyalJelly,
|
||||
cratedCocoaComb,
|
||||
cratedRedstone,
|
||||
cratedLapis,
|
||||
cratedReeds,
|
||||
cratedClay,
|
||||
cratedGlowstone,
|
||||
cratedApples,
|
||||
cratedNetherwart,
|
||||
cratedResin,
|
||||
cratedRubber,
|
||||
cratedScrap,
|
||||
cratedUUM,
|
||||
cratedSimmeringCombs,
|
||||
cratedStringyCombs,
|
||||
cratedFrozenCombs,
|
||||
cratedDrippingCombs,
|
||||
cratedRefractoryWax,
|
||||
cratedPhosphor,
|
||||
cratedAsh,
|
||||
cratedCharcoal,
|
||||
cratedGravel,
|
||||
cratedCoal,
|
||||
cratedSeeds,
|
||||
cratedSaplings;
|
||||
canIce;
|
||||
private Item item;
|
||||
|
||||
public void registerItem(Item item, String name) {
|
||||
|
||||
@@ -26,15 +26,22 @@ import forestry.api.recipes.IGenericCrate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginStorage;
|
||||
|
||||
public class ItemCrated extends Item implements IGenericCrate {
|
||||
|
||||
private ItemStack contained;
|
||||
private boolean usesOreDict = false;
|
||||
|
||||
public ItemCrated(ItemStack contained) {
|
||||
this.contained = contained;
|
||||
PluginStorage.proxy.registerCrate(this);
|
||||
}
|
||||
|
||||
public void setUsesOreDict(boolean usesOreDict) {
|
||||
this.usesOreDict = usesOreDict;
|
||||
}
|
||||
|
||||
public boolean usesOreDict() {
|
||||
return usesOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.factory.gadgets;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.ICarpenterManager;
|
||||
import forestry.api.recipes.IGenericCrate;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
@@ -25,6 +26,7 @@ import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
@@ -51,6 +53,7 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class MachineCarpenter extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -147,6 +150,16 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
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);
|
||||
int[] oreIds = OreDictionary.getOreIDs(uncrated);
|
||||
for (int oreId : oreIds) {
|
||||
String oreName = OreDictionary.getOreName(oreId);
|
||||
addCrating(oreName, uncrated, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrating(String toCrate, ItemStack unpack, ItemStack crated) {
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, Fluids.WATER.getFluid(Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
|
||||
@@ -119,6 +119,7 @@ import forestry.core.config.Config;
|
||||
import forestry.core.config.Configuration;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryCrate;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.Property;
|
||||
import forestry.core.fluids.Fluids;
|
||||
@@ -431,20 +432,20 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
ForestryItem.cratedBeeswax.registerItem(new ItemCrated(ForestryItem.beeswax.getItemStack()), "cratedBeeswax");
|
||||
ForestryItem.cratedPollen.registerItem(new ItemCrated(ForestryItem.pollenCluster.getItemStack()), "cratedPollen");
|
||||
ForestryItem.cratedPropolis.registerItem(new ItemCrated(ForestryItem.propolis.getItemStack()), "cratedPropolis");
|
||||
ForestryItem.cratedHoneydew.registerItem(new ItemCrated(ForestryItem.honeydew.getItemStack()), "cratedHoneydew");
|
||||
ForestryItem.cratedRoyalJelly.registerItem(new ItemCrated(ForestryItem.royalJelly.getItemStack()), "cratedRoyalJelly");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeswax.getItemStack(), "cratedBeeswax");
|
||||
ForestryCrate.registerCrate(ForestryItem.pollenCluster.getItemStack(), "cratedPollen");
|
||||
ForestryCrate.registerCrate(ForestryItem.propolis.getItemStack(), "cratedPropolis");
|
||||
ForestryCrate.registerCrate(ForestryItem.honeydew.getItemStack(), "cratedHoneydew");
|
||||
ForestryCrate.registerCrate(ForestryItem.royalJelly.getItemStack(), "cratedRoyalJelly");
|
||||
|
||||
ForestryItem.cratedHoneycombs.registerItem(new ItemCrated(ForestryItem.beeComb.getItemStack(1, 0)), "cratedHoneycombs");
|
||||
ForestryItem.cratedCocoaComb.registerItem(new ItemCrated(ForestryItem.beeComb.getItemStack(1, 1)), "cratedCocoaComb");
|
||||
ForestryItem.cratedSimmeringCombs.registerItem(new ItemCrated(ForestryItem.beeComb.getItemStack(1, 2)), "cratedSimmeringCombs");
|
||||
ForestryItem.cratedStringyCombs.registerItem(new ItemCrated(ForestryItem.beeComb.getItemStack(1, 3)), "cratedStringyCombs");
|
||||
ForestryItem.cratedFrozenCombs.registerItem(new ItemCrated(ForestryItem.beeComb.getItemStack(1, 4)), "cratedFrozenCombs");
|
||||
ForestryItem.cratedDrippingCombs.registerItem(new ItemCrated(ForestryItem.beeComb.getItemStack(1, 5)), "cratedDrippingCombs");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeComb.getItemStack(1, 0), "cratedHoneycombs");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeComb.getItemStack(1, 1), "cratedCocoaComb");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeComb.getItemStack(1, 2), "cratedSimmeringCombs");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeComb.getItemStack(1, 3), "cratedStringyCombs");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeComb.getItemStack(1, 4), "cratedFrozenCombs");
|
||||
ForestryCrate.registerCrate(ForestryItem.beeComb.getItemStack(1, 5), "cratedDrippingCombs");
|
||||
|
||||
ForestryItem.cratedRefractoryWax.registerItem(new ItemCrated(ForestryItem.refractoryWax.getItemStack()), "cratedRefractoryWax");
|
||||
ForestryCrate.registerCrate(ForestryItem.refractoryWax.getItemStack(), "cratedRefractoryWax");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import forestry.core.commands.RootCommand;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryCrate;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.BlockResource;
|
||||
@@ -275,45 +276,44 @@ public class PluginCore extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
// / CRATES
|
||||
ForestryItem.cratedWood.registerItem(new ItemCrated(new ItemStack(Blocks.log)), "cratedWood");
|
||||
ForestryItem.cratedCobblestone.registerItem(new ItemCrated(new ItemStack(Blocks.cobblestone)), "cratedCobblestone");
|
||||
ForestryItem.cratedDirt.registerItem(new ItemCrated(new ItemStack(Blocks.dirt)), "cratedDirt");
|
||||
ForestryItem.cratedStone.registerItem(new ItemCrated(new ItemStack(Blocks.stone)), "cratedStone");
|
||||
ForestryItem.cratedBrick.registerItem(new ItemCrated(new ItemStack(Blocks.brick_block)), "cratedBrick");
|
||||
ForestryItem.cratedCacti.registerItem(new ItemCrated(new ItemStack(Blocks.cactus)), "cratedCacti");
|
||||
ForestryItem.cratedSand.registerItem(new ItemCrated(new ItemStack(Blocks.sand)), "cratedSand");
|
||||
ForestryItem.cratedObsidian.registerItem(new ItemCrated(new ItemStack(Blocks.obsidian)), "cratedObsidian");
|
||||
ForestryItem.cratedNetherrack.registerItem(new ItemCrated(new ItemStack(Blocks.netherrack)), "cratedNetherrack");
|
||||
ForestryItem.cratedSoulsand.registerItem(new ItemCrated(new ItemStack(Blocks.soul_sand)), "cratedSoulsand");
|
||||
ForestryItem.cratedSandstone.registerItem(new ItemCrated(new ItemStack(Blocks.sandstone)), "cratedSandstone");
|
||||
ForestryItem.cratedBogearth.registerItem(new ItemCrated(ForestryBlock.soil.getItemStack(1, 1)), "cratedBogearth");
|
||||
ForestryItem.cratedHumus.registerItem(new ItemCrated(ForestryBlock.soil.getItemStack(1, 0)), "cratedHumus");
|
||||
ForestryItem.cratedNetherbrick.registerItem(new ItemCrated(new ItemStack(Blocks.nether_brick)), "cratedNetherbrick");
|
||||
ForestryItem.cratedPeat.registerItem(new ItemCrated(ForestryItem.peat.getItemStack()), "cratedPeat");
|
||||
ForestryItem.cratedApatite.registerItem(new ItemCrated(ForestryItem.apatite.getItemStack()), "cratedApatite");
|
||||
ForestryItem.cratedFertilizer.registerItem(new ItemCrated(ForestryItem.fertilizerCompound.getItemStack()), "cratedFertilizer");
|
||||
ForestryItem.cratedTin.registerItem(new ItemCrated(ForestryItem.ingotTin.getItemStack()), "cratedTin");
|
||||
ForestryItem.cratedCopper.registerItem(new ItemCrated(ForestryItem.ingotCopper.getItemStack()), "cratedCopper");
|
||||
ForestryItem.cratedBronze.registerItem(new ItemCrated(ForestryItem.ingotBronze.getItemStack()), "cratedBronze");
|
||||
ForestryItem.cratedWheat.registerItem(new ItemCrated(new ItemStack(Items.wheat)), "cratedWheat");
|
||||
ForestryItem.cratedMycelium.registerItem(new ItemCrated(new ItemStack(Blocks.mycelium)), "cratedMycelium");
|
||||
ForestryItem.cratedMulch.registerItem(new ItemCrated(ForestryItem.mulch.getItemStack()), "cratedMulch");
|
||||
ForestryItem.cratedCookies.registerItem(new ItemCrated(new ItemStack(Items.cookie)), "cratedCookies");
|
||||
ForestryItem.cratedRedstone.registerItem(new ItemCrated(new ItemStack(Items.redstone)), "cratedRedstone");
|
||||
ForestryItem.cratedLapis.registerItem(new ItemCrated(new ItemStack(Items.dye, 1, 4)), "cratedLapis");
|
||||
ForestryItem.cratedReeds.registerItem(new ItemCrated(new ItemStack(Items.reeds)), "cratedReeds");
|
||||
ForestryItem.cratedClay.registerItem(new ItemCrated(new ItemStack(Items.clay_ball)), "cratedClay");
|
||||
ForestryItem.cratedGlowstone.registerItem(new ItemCrated(new ItemStack(Items.glowstone_dust)), "cratedGlowstone");
|
||||
ForestryItem.cratedApples.registerItem(new ItemCrated(new ItemStack(Items.apple)), "cratedApples");
|
||||
ForestryItem.cratedNetherwart.registerItem(new ItemCrated(new ItemStack(Items.nether_wart)), "cratedNetherwart");
|
||||
ForestryItem.cratedPhosphor.registerItem(new ItemCrated(ForestryItem.phosphor.getItemStack()), "cratedPhosphor");
|
||||
ForestryItem.cratedAsh.registerItem(new ItemCrated(ForestryItem.ash.getItemStack()), "cratedAsh");
|
||||
ForestryItem.cratedCharcoal.registerItem(new ItemCrated(new ItemStack(Items.coal, 1, 1)), "cratedCharcoal");
|
||||
ForestryItem.cratedGravel.registerItem(new ItemCrated(new ItemStack(Blocks.gravel)), "cratedGravel");
|
||||
ForestryItem.cratedCoal.registerItem(new ItemCrated(new ItemStack(Items.coal, 1, 0)), "cratedCoal");
|
||||
ForestryItem.cratedSeeds.registerItem(new ItemCrated(new ItemStack(Items.wheat_seeds)), "cratedSeeds");
|
||||
ForestryItem.cratedSaplings.registerItem(new ItemCrated(new ItemStack(Blocks.sapling)), "cratedSaplings");
|
||||
ForestryCrate.registerCrate(Blocks.log, "cratedWood");
|
||||
ForestryCrate.registerCrate(Blocks.cobblestone, "cratedCobblestone");
|
||||
ForestryCrate.registerCrate(Blocks.dirt, "cratedDirt");
|
||||
ForestryCrate.registerCrate(Blocks.stone, "cratedStone");
|
||||
ForestryCrate.registerCrate(Blocks.brick_block, "cratedBrick");
|
||||
ForestryCrate.registerCrate(Blocks.cactus, "cratedCacti");
|
||||
ForestryCrate.registerCrate(Blocks.sand, "cratedSand");
|
||||
ForestryCrate.registerCrate(Blocks.obsidian, "cratedObsidian");
|
||||
ForestryCrate.registerCrate(Blocks.netherrack, "cratedNetherrack");
|
||||
ForestryCrate.registerCrate(Blocks.soul_sand, "cratedSoulsand");
|
||||
ForestryCrate.registerCrate(Blocks.sandstone, "cratedSandstone");
|
||||
ForestryCrate.registerCrate(ForestryBlock.soil.getItemStack(1, 0), "cratedHumus");
|
||||
ForestryCrate.registerCrate(ForestryBlock.soil.getItemStack(1, 1), "cratedBogearth");
|
||||
ForestryCrate.registerCrate(Blocks.nether_brick, "cratedNetherbrick");
|
||||
ForestryCrate.registerCrate(ForestryItem.peat.item(), "cratedPeat");
|
||||
ForestryCrate.registerCrate(ForestryItem.apatite.item(), "cratedApatite");
|
||||
ForestryCrate.registerCrate(ForestryItem.fertilizerCompound.item(), "cratedFertilizer");
|
||||
ForestryCrate.registerCrate(ForestryItem.ingotTin.item(), "cratedTin").setUsesOreDict(true);
|
||||
ForestryCrate.registerCrate(ForestryItem.ingotCopper.item(), "cratedCopper").setUsesOreDict(true);
|
||||
ForestryCrate.registerCrate(ForestryItem.ingotBronze.item(), "cratedBronze").setUsesOreDict(true);
|
||||
ForestryCrate.registerCrate(Items.wheat, "cratedWheat");
|
||||
ForestryCrate.registerCrate(Blocks.mycelium, "cratedMycelium");
|
||||
ForestryCrate.registerCrate(ForestryItem.mulch.item(), "cratedMulch");
|
||||
ForestryCrate.registerCrate(Items.cookie, "cratedCookies");
|
||||
ForestryCrate.registerCrate(Items.redstone, "cratedRedstone");
|
||||
ForestryCrate.registerCrate(new ItemStack(Items.dye, 1, 4), "cratedLapis");
|
||||
ForestryCrate.registerCrate(Items.reeds, "cratedReeds");
|
||||
ForestryCrate.registerCrate(Items.clay_ball, "cratedClay");
|
||||
ForestryCrate.registerCrate(Items.glowstone_dust, "cratedGlowstone");
|
||||
ForestryCrate.registerCrate(Items.apple, "cratedApples");
|
||||
ForestryCrate.registerCrate(new ItemStack(Items.nether_wart), "cratedNetherwart");
|
||||
ForestryCrate.registerCrate(ForestryItem.phosphor.item(), "cratedPhosphor");
|
||||
ForestryCrate.registerCrate(ForestryItem.ash.item(), "cratedAsh");
|
||||
ForestryCrate.registerCrate(new ItemStack(Items.coal, 1, 1), "cratedCharcoal");
|
||||
ForestryCrate.registerCrate(new ItemStack(Items.coal, 1, 0), "cratedCoal");
|
||||
ForestryCrate.registerCrate(Blocks.gravel, "cratedGravel");
|
||||
ForestryCrate.registerCrate(Items.wheat_seeds, "cratedSeeds");
|
||||
ForestryCrate.registerCrate(Blocks.sapling, "cratedSaplings");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -436,63 +436,9 @@ public class PluginFactory extends ForestryPlugin {
|
||||
"#", '#', ForestryItem.brokenBronzePickaxe);
|
||||
RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(), "#", '#', ForestryItem.brokenBronzeShovel);
|
||||
|
||||
// Crating and uncrating condensed
|
||||
// Crating and uncrating
|
||||
if (PluginManager.Module.STORAGE.isEnabled()) {
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedWood.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCobblestone.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedDirt.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedStone.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedBrick.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCacti.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSand.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedObsidian.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedNetherrack.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSoulsand.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSandstone.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedBogearth.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedHumus.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedNetherbrick.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPeat.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedApatite.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedFertilizer.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating("ingotTin", ForestryItem.ingotTin.getItemStack(), ForestryItem.cratedTin.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating("ingotCopper", ForestryItem.ingotCopper.getItemStack(), ForestryItem.cratedCopper.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating("ingotBronze", ForestryItem.ingotBronze.getItemStack(), ForestryItem.cratedBronze.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedWheat.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedMycelium.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedMulch.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCookies.getItemStack());
|
||||
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedRedstone.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedLapis.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedReeds.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedClay.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedGlowstone.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedApples.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedNetherwart.getItemStack());
|
||||
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPhosphor.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedAsh.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCharcoal.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedGravel.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCoal.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSeeds.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSaplings.getItemStack());
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedHoneycombs.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedBeeswax.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPollen.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPropolis.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedHoneydew.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedRoyalJelly.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCocoaComb.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSimmeringCombs.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedStringyCombs.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedFrozenCombs.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedDrippingCombs.getItemStack());
|
||||
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedRefractoryWax.getItemStack());
|
||||
}
|
||||
PluginStorage.createCrateRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import forestry.core.config.Config;
|
||||
import forestry.core.config.Configuration;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryCrate;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
@@ -230,27 +231,27 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
@Optional.Method(modid = "IC2")
|
||||
protected void registerCrates() {
|
||||
if (resin != null) {
|
||||
ForestryItem.cratedResin.registerItem(new ItemCrated(resin), "cratedResin");
|
||||
ForestryCrate.registerCrate(resin, "cratedResin");
|
||||
}
|
||||
|
||||
if (rubber != null) {
|
||||
ForestryItem.cratedRubber.registerItem(new ItemCrated(rubber), "cratedRubber");
|
||||
ForestryCrate.registerCrate(rubber, "cratedRubber");
|
||||
}
|
||||
|
||||
if (scrap != null) {
|
||||
ForestryItem.cratedScrap.registerItem(new ItemCrated(scrap), "cratedScrap");
|
||||
ForestryCrate.registerCrate(scrap, "cratedScrap");
|
||||
}
|
||||
|
||||
if (uuMatter != null) {
|
||||
ForestryItem.cratedUUM.registerItem(new ItemCrated(uuMatter), "cratedUUM");
|
||||
ForestryCrate.registerCrate(uuMatter, "cratedUUM");
|
||||
}
|
||||
|
||||
if (silver != null) {
|
||||
ForestryItem.cratedSilver.registerItem(new ItemCrated(silver), "cratedSilver");
|
||||
ForestryCrate.registerCrate(silver, "cratedSilver").setUsesOreDict(true);
|
||||
}
|
||||
|
||||
if (brass != null) {
|
||||
ForestryItem.cratedBrass.registerItem(new ItemCrated(brass), "cratedBrass");
|
||||
ForestryCrate.registerCrate(brass, "cratedBrass").setUsesOreDict(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.plugins;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -81,6 +82,9 @@ import forestry.storage.proxy.ProxyStorage;
|
||||
@Plugin(pluginID = "Storage", name = "Storage", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.storage.description")
|
||||
public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandler {
|
||||
|
||||
private static final List<ItemCrated> crates = new ArrayList<ItemCrated>();
|
||||
private static final String CONFIG_CATEGORY = "backpacks";
|
||||
|
||||
@SidedProxy(clientSide = "forestry.storage.proxy.ClientProxyStorage", serverSide = "forestry.storage.proxy.ProxyStorage")
|
||||
public static ProxyStorage proxy;
|
||||
private final ArrayList<ItemStack> minerItems = new ArrayList<ItemStack>();
|
||||
@@ -89,8 +93,7 @@ public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandl
|
||||
private final ArrayList<ItemStack> hunterItems = new ArrayList<ItemStack>();
|
||||
private final ArrayList<ItemStack> adventurerItems = new ArrayList<ItemStack>();
|
||||
private final ArrayList<ItemStack> builderItems = new ArrayList<ItemStack>();
|
||||
private final static String CONFIG_CATEGORY = "backpacks";
|
||||
Configuration config;
|
||||
private Configuration config;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked","rawtypes"})
|
||||
@@ -142,6 +145,22 @@ public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandl
|
||||
BackpackManager.definitions.get("builder").addValidItems(builderItems);
|
||||
}
|
||||
|
||||
public static void registerCrate(ItemCrated crate) {
|
||||
proxy.registerCrate(crate);
|
||||
crates.add(crate);
|
||||
}
|
||||
|
||||
public static void createCrateRecipes() {
|
||||
for (ItemCrated crate : crates) {
|
||||
ItemStack itemStack = new ItemStack(crate);
|
||||
if (crate.usesOreDict()) {
|
||||
RecipeManagers.carpenterManager.addCratingWithOreDict(itemStack);
|
||||
} else {
|
||||
RecipeManagers.carpenterManager.addCrating(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addBackpackItem(String pack, ItemStack stack) {
|
||||
if (stack == null)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user