Move butterfly blocks to PluginLepidopterology.blocks

remove custom shaped and shapeless recipes
This commit is contained in:
mezz committed 2015-11-19 01:04:39 -08:00
1 parent ce2a2ec8ed
commit 167e493160
23 files changed
+146 -563

No files matched your search

@@ -20,7 +20,6 @@ import forestry.core.tiles.TileForestry;
public enum BlockArboricultureType implements IMachinePropertiesTESR {
ARBCHEST(TileArboristChest.class, "ArbChest") {
@Nullable
@Override
public IBlockRenderer getRenderer() {
return Proxies.render.getRenderChest("arbchest");
@@ -248,7 +248,9 @@ public class BlockBase<T extends IMachineProperties> extends BlockForestry {
public void init() {
for (MachineDefinition def : definitions) {
def.register();
if (def != null) {
def.register();
}
}
}
@@ -48,8 +48,6 @@ public class Constants implements IForestryConstants {
// Village Chest Gen hook
public static final String CHEST_GEN_HOOK_NATURALIST_CHEST = "naturalistChest";
public static final int DEFINITION_LEPICHEST_META = 0;
// Item Ids
public static final int SLOTS_BACKPACK_DEFAULT = 15;
@@ -1,91 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.config;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.core.utils.StringUtil;
import forestry.plugins.PluginManager;
import forestry.plugins.PluginManager.Stage;
/**
* Allows direct access to Forestry's blocks. Will be populated during BaseMod.load().
*
* All of this stuff is metadata sensitive which is not reflected here!
*
* Make sure to only reference it in modsLoaded() or later.
*
* @author SirSengir
*/
public enum ForestryBlock {
lepidopterology;
private Block block;
public void registerBlock(Block block, Class<? extends ItemBlock> itemClass, String name) {
if (PluginManager.getStage() != Stage.SETUP) {
throw new RuntimeException("Tried to register Block outside of Setup");
}
this.block = block;
block.setBlockName("for." + name);
GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block));
}
public boolean isItemEqual(ItemStack stack) {
return stack != null && isBlockEqual(Block.getBlockFromItem(stack.getItem()));
}
public boolean isBlockEqual(Block i) {
return i != null && Block.isEqualTo(block, i);
}
public boolean isBlockEqual(World world, int x, int y, int z) {
return isBlockEqual(world.getBlock(x, y, z));
}
public Item item() {
return Item.getItemFromBlock(block);
}
public Block block() {
return block;
}
public ItemStack getWildcard() {
return getItemStack(1, OreDictionary.WILDCARD_VALUE);
}
public ItemStack getItemStack() {
return getItemStack(1, 0);
}
public ItemStack getItemStack(int qty) {
return getItemStack(qty, 0);
}
public ItemStack getItemStack(int qty, int meta) {
if (block == null) {
return null;
}
return new ItemStack(block, qty, meta);
}
public boolean setBlock(World world, int x, int y, int z, int meta) {
return world.setBlock(x, y, z, block, meta, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
}
}
@@ -33,11 +33,11 @@ public enum EnumElectronTube implements ItemOverlay.IOverlayInfo {
private final int primaryColor;
private final int secondaryColor;
EnumElectronTube(Color primaryColor) {
this(primaryColor, Color.WHITE);
EnumElectronTube(Color secondaryColor) {
this(secondaryColor, Color.WHITE);
}
EnumElectronTube(Color primaryColor, Color secondaryColor) {
EnumElectronTube(Color secondaryColor, Color primaryColor) {
this.name = "ex-" + ordinal();
this.primaryColor = primaryColor.getRGB();
this.secondaryColor = secondaryColor.getRGB();
@@ -31,7 +31,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.ForestryBlock;
import forestry.core.fluids.Fluids;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
@@ -210,31 +209,26 @@ public abstract class RecipeUtil {
return null;
}
private static void cleanRecipe(Object... obj) {
for (int i = 0; i < obj.length; i++) {
if (obj[i] instanceof ForestryBlock) {
obj[i] = ((ForestryBlock) obj[i]).block();
}
}
}
public static void addRecipe(Item item, Object... obj) {
addRecipe(new ItemStack(item), obj);
}
@SuppressWarnings("unchecked")
public static void addRecipe(ItemStack itemstack, Object... obj) {
cleanRecipe(obj);
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(itemstack, obj));
}
@SuppressWarnings("unchecked")
public static void addPriorityRecipe(ItemStack itemStack, Object... obj) {
CraftingManager.getInstance().getRecipeList().add(0, new ShapedOreRecipe(itemStack, obj));
}
public static void addShapelessRecipe(Item item, Object... obj) {
addShapelessRecipe(new ItemStack(item), obj);
}
@SuppressWarnings("unchecked")
public static void addShapelessRecipe(ItemStack itemstack, Object... obj) {
cleanRecipe(obj);
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(itemstack, obj));
}
@@ -10,34 +10,22 @@
******************************************************************************/
package forestry.core.recipes;
import java.util.HashMap;
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;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.core.config.ForestryBlock;
public class ShapedRecipeCustom implements IDescriptiveRecipe {
public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveRecipe {
private final int width;
private final int height;
private final Object[] ingredients;
private final ItemStack product;
public ShapedRecipeCustom(int width, int height, Object[] ingredients, ItemStack product) {
public ShapedRecipeCustom(int width, int height, ItemStack product, Object... ingredients) {
super(product, ingredients);
this.width = width;
this.height = height;
this.ingredients = ingredients;
this.product = product;
}
@Override
@@ -50,14 +38,9 @@ public class ShapedRecipeCustom implements IDescriptiveRecipe {
return height;
}
@Override
public ItemStack getRecipeOutput() {
return product.copy();
}
@Override
public Object[] getIngredients() {
return ingredients;
return getInput();
}
@Override
@@ -65,96 +48,30 @@ public class ShapedRecipeCustom implements IDescriptiveRecipe {
return false;
}
@Override
public boolean matches(InventoryCrafting inventoryCrafting, World world) {
return RecipeUtil.matches(this, inventoryCrafting);
}
@Override
@Deprecated
public boolean matches(IInventory inventoryCrafting, World world) {
return RecipeUtil.matches(this, inventoryCrafting);
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
return getRecipeOutput().copy();
}
@Override
public int getRecipeSize() {
return width * height;
return false;
}
public static ShapedRecipeCustom createShapedRecipe(ItemStack product, Object... materials) {
String s = "";
int index = 0;
int columns = 0;
int rows = 0;
if (materials[index] instanceof String[]) {
String as[] = (String[]) materials[index++];
String as[] = (String[]) materials[index];
for (String pattern : as) {
rows++;
columns = pattern.length();
s = (new StringBuilder()).append(s).append(pattern).toString();
}
} else {
while (materials[index] instanceof String) {
String pattern = (String) materials[index++];
rows++;
columns = pattern.length();
s = (new StringBuilder()).append(s).append(pattern).toString();
}
}
HashMap<Character, Object> hashmap = new HashMap<>();
for (; index < materials.length; index += 2) {
Character character = (Character) materials[index];
// Item
if (materials[index + 1] instanceof Item) {
hashmap.put(character, new ItemStack((Item) materials[index + 1]));
} else if (materials[index + 1] instanceof ForestryBlock) {
hashmap.put(character, ((ForestryBlock) materials[index + 1]).getItemStack());
} else if (materials[index + 1] instanceof Block) {
hashmap.put(character, new ItemStack((Block) materials[index + 1], 1, OreDictionary.WILDCARD_VALUE));
} else if (materials[index + 1] instanceof ItemStack) {
hashmap.put(character, materials[index + 1]);
} else if (materials[index + 1] instanceof String) {
hashmap.put(character, OreDictionary.getOres((String) materials[index + 1]));
} else {
throw new RuntimeException("Invalid Recipe Defined!");
}
}
Object ingredients[] = new Object[columns * rows];
for (int l = 0; l < columns * rows; l++) {
char c = s.charAt(l);
if (hashmap.containsKey(c)) {
ingredients[l] = hashmap.get(c);
} else {
ingredients[l] = null;
}
}
return new ShapedRecipeCustom(columns, rows, ingredients, product);
}
@SuppressWarnings("unchecked")
public static ShapedRecipeCustom buildRecipe(ItemStack product, Object... materials) {
ShapedRecipeCustom recipe = createShapedRecipe(product, materials);
CraftingManager.getInstance().getRecipeList().add(recipe);
return recipe;
}
@SuppressWarnings("unchecked")
public static ShapedRecipeCustom buildPriorityRecipe(ItemStack product, Object... materials) {
ShapedRecipeCustom recipe = createShapedRecipe(product, materials);
CraftingManager.getInstance().getRecipeList().add(0, recipe);
return recipe;
return new ShapedRecipeCustom(columns, rows, product, materials);
}
}
@@ -1,87 +0,0 @@
package forestry.core.recipes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public class ShapelessRecipeCustom implements IRecipe {
@SuppressWarnings("unchecked")
public static ShapelessRecipeCustom buildRecipe(ItemStack product, ItemStack... ingredients) {
ShapelessRecipeCustom recipe = new ShapelessRecipeCustom(product, ingredients);
CraftingManager.getInstance().getRecipeList().add(recipe);
return recipe;
}
@SuppressWarnings("unchecked")
public static ShapelessRecipeCustom buildPriorityRecipe(ItemStack product, ItemStack... ingredients) {
ShapelessRecipeCustom recipe = new ShapelessRecipeCustom(product, ingredients);
CraftingManager.getInstance().getRecipeList().add(0, recipe);
return recipe;
}
private final List<ItemStack> ingredients;
private final ItemStack product;
private ShapelessRecipeCustom(ItemStack product, ItemStack... ingredients) {
this.ingredients = Arrays.asList(ingredients);
this.product = product;
}
@Override
public boolean matches(InventoryCrafting inventoryCrafting, World world) {
ArrayList<ItemStack> arraylist = new ArrayList<>(this.ingredients);
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
ItemStack itemstack = inventoryCrafting.getStackInRowAndColumn(j, i);
if (itemstack != null) {
boolean flag = false;
for (ItemStack itemstack1 : arraylist) {
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == OreDictionary.WILDCARD_VALUE || itemstack.getItemDamage() == itemstack1.getItemDamage())) {
flag = true;
arraylist.remove(itemstack1);
break;
}
}
if (!flag) {
return false;
}
}
}
}
return arraylist.isEmpty();
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
return product.copy();
}
@Override
public int getRecipeSize() {
return ingredients.size();
}
public List<ItemStack> getIngredients() {
return ingredients;
}
@Override
public ItemStack getRecipeOutput() {
return product.copy();
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.recipes.nei;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import forestry.core.recipes.ShapedRecipeCustom;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
public class NEIHandlerShapedCustom extends RecipeHandlerBase {
public class CachedShapedCustomRecipe extends CachedBaseRecipe {
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public CachedShapedCustomRecipe(ShapedRecipeCustom recipe) {
if (recipe.getIngredients() != null && recipe.getIngredients().length > 0) {
this.setIngredients(recipe.getWidth(), recipe.getHeight(), recipe.getIngredients());
}
if (recipe.getRecipeOutput() != null) {
ItemStack output = recipe.getRecipeOutput();
this.output = new PositionedStack(output, 119, 24);
}
}
public void setIngredients(int width, int height, Object[] items) {
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (items.length <= y * width + x) {
continue;
}
Object item = items[y * width + x];
if (item == null) {
continue;
} else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
continue;
} else if (item instanceof List && ((List) item).size() == 0) {
continue;
}
PositionedStack stack = new PositionedStack(item, 25 + x * 18, 6 + y * 18);
stack.setMaxSize(1);
this.inputs.add(stack);
}
}
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(NEIHandlerShapedCustom.this.cycleticks / 20, this.inputs);
}
@Override
public PositionedStack getResult() {
return this.output;
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
if (recipe instanceof ShapedRecipeCustom && NEIServerUtils.areStacksSameTypeCrafting(((ShapedRecipeCustom) recipe).getRecipeOutput(), result)) {
CachedShapedCustomRecipe crecipe = new CachedShapedCustomRecipe((ShapedRecipeCustom) recipe);
this.arecipes.add(crecipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
if (recipe instanceof ShapedRecipeCustom) {
CachedShapedCustomRecipe crecipe = new CachedShapedCustomRecipe((ShapedRecipeCustom) recipe);
if (crecipe.inputs != null && crecipe.contains(crecipe.inputs, ingredient)) {
this.arecipes.add(crecipe);
}
}
}
}
@Override
public String getRecipeID() {
return "crafting";
}
@Override
public String getOverlayIdentifier() {
return "crafting";
}
@Override
public String getRecipeName() {
return NEIUtils.translate("handler.forestry.shaped");
}
@Override
public String getGuiTexture() {
return "minecraft:textures/gui/container/crafting_table.png";
}
}
@@ -1,107 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.recipes.nei;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import forestry.core.recipes.ShapelessRecipeCustom;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
public class NEIHandlerShapelessCustom extends RecipeHandlerBase {
private static final int[][] OUTPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
public class CachedShapelessCustomRecipe extends CachedBaseRecipe {
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public CachedShapelessCustomRecipe(ShapelessRecipeCustom recipe) {
if (recipe.getIngredients() != null && recipe.getIngredients().size() > 0) {
this.setIngredients(recipe.getIngredients());
}
if (recipe.getRecipeOutput() != null) {
ItemStack output = recipe.getRecipeOutput();
this.output = new PositionedStack(output, 119, 24);
}
}
public void setIngredients(List<ItemStack> items) {
for (int i = 0; i < items.size(); i++) {
ItemStack item = items.get(i);
if (item == null) {
continue;
}
PositionedStack stack = new PositionedStack(item, 25 + OUTPUTS[i][0] * 18, 6 + OUTPUTS[i][1] * 18);
stack.setMaxSize(1);
this.inputs.add(stack);
}
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(NEIHandlerShapelessCustom.this.cycleticks / 20, this.inputs);
}
@Override
public PositionedStack getResult() {
return this.output;
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
if (recipe instanceof ShapelessRecipeCustom && NEIServerUtils.areStacksSameTypeCrafting(((ShapelessRecipeCustom) recipe).getRecipeOutput(), result)) {
CachedShapelessCustomRecipe crecipe = new CachedShapelessCustomRecipe((ShapelessRecipeCustom) recipe);
this.arecipes.add(crecipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
if (recipe instanceof ShapelessRecipeCustom) {
CachedShapelessCustomRecipe crecipe = new CachedShapelessCustomRecipe((ShapelessRecipeCustom) recipe);
if (crecipe.inputs != null && crecipe.contains(crecipe.inputs, ingredient)) {
this.arecipes.add(crecipe);
}
}
}
}
@Override
public String getRecipeID() {
return "crafting";
}
@Override
public String getOverlayIdentifier() {
return "crafting";
}
@Override
public String getRecipeName() {
return NEIUtils.translate("handler.forestry.shapeless");
}
@Override
public String getGuiTexture() {
return "minecraft:textures/gui/container/crafting_table.png";
}
}
@@ -38,8 +38,6 @@ public class NEIIntegrationConfig implements IConfigureNEI {
public void loadConfig() {
Log.info("Loading: " + getName());
registerHandler(new NEIHandlerShapedCustom());
registerHandler(new NEIHandlerShapelessCustom());
registerHandler(new NEIHandlerBottler());
registerHandler(new NEIHandlerCarpenter());
registerHandler(new NEIHandlerCentrifuge());
@@ -52,10 +52,6 @@ public class MachineDefinition {
private float minX, minY, minZ, maxX, maxY, maxZ;
public MachineDefinition(int meta, String teIdent, Class<? extends TileForestry> teClass) {
this(meta, teIdent, teClass, null);
}
public MachineDefinition(IMachineProperties properties) {
this(properties.getMeta(), properties.getTeIdent(), properties.getTeClass(), null);
}
@@ -17,7 +17,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.core.config.Constants;
import forestry.core.config.ForestryBlock;
import forestry.core.tiles.TileForestry;
public class BlockTypeTileForestry implements IBlockType {
@@ -25,10 +24,6 @@ public class BlockTypeTileForestry implements IBlockType {
private final int meta;
private ForgeDirection direction;
public BlockTypeTileForestry(ForestryBlock forestryBlock, int meta) {
this(forestryBlock.block(), meta);
}
public BlockTypeTileForestry(Block block, int meta) {
this.block = block;
this.meta = meta;
@@ -13,6 +13,7 @@ package forestry.energy.tiles;
import net.minecraft.world.IBlockAccess;
import forestry.core.blocks.IMachineProperties;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.MachineDefinition;
import forestry.core.tiles.TileEngine;
@@ -21,14 +22,10 @@ import forestry.core.tiles.TileUtil;
public class EngineDefinition extends MachineDefinition {
public EngineDefinition(IMachineProperties properties) {
public EngineDefinition(IMachinePropertiesTESR properties) {
super(properties);
}
public EngineDefinition(int meta, String teIdent, Class<? extends TileForestry> teClass, IBlockRenderer renderer) {
super(meta, teIdent, teClass, renderer);
}
@Override
public boolean isSolidOnSide(IBlockAccess world, int x, int y, int z, int side) {
TileEngine tile = TileUtil.getTile(world, x, y, z, TileEngine.class);
@@ -36,19 +36,24 @@ public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
MOISTENER(TileMoistener.class),
SQUEEZER(TileSqueezer.class),
STILL(TileStill.class),
RAINMAKER(TileMillRainmaker.class);
RAINMAKER(TileMillRainmaker.class) {
@Override
public IBlockRenderer getRenderer() {
return Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_");
}
};
public static final BlockFactoryTesrType[] VALUES = values();
private final String teIdent;
private final Class<? extends TileForestry> teClass;
private final IBlockRenderer renderer;
private final String name;
BlockFactoryTesrType(Class<? extends TileForestry> teClass) {
String name = toString().toLowerCase(Locale.ENGLISH);
this.teIdent = "forestry." + WordUtils.capitalize(name);
this.teClass = teClass;
this.renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
this.name = name;
}
@Override
@@ -68,6 +73,6 @@ public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
@Override
public IBlockRenderer getRenderer() {
return renderer;
return Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
}
}
@@ -0,0 +1,21 @@
/*******************************************************************************
* 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.lepidopterology.blocks;
import forestry.api.core.Tabs;
import forestry.core.blocks.BlockBase;
public class BlockLepidopterology extends BlockBase<BlockLepidopterologyType> {
public BlockLepidopterology() {
super(true);
setCreativeTab(Tabs.tabLepidopterology);
}
}
@@ -0,0 +1,51 @@
/*******************************************************************************
* 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.lepidopterology.blocks;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.proxy.Proxies;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.TileForestry;
import forestry.lepidopterology.tiles.TileLepidopteristChest;
public enum BlockLepidopterologyType implements IMachinePropertiesTESR {
LEPICHEST(TileLepidopteristChest.class, "LepiChest") {
@Override
public IBlockRenderer getRenderer() {
return Proxies.render.getRenderChest("lepichest");
}
};
public static final BlockLepidopterologyType[] VALUES = values();
private final String teIdent;
private final Class<? extends TileForestry> teClass;
BlockLepidopterologyType(Class<? extends TileForestry> teClass, String teName) {
this.teIdent = "forestry." + teName;
this.teClass = teClass;
}
@Override
public int getMeta() {
return ordinal();
}
@Override
public String getTeIdent() {
return teIdent;
}
@Override
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
}
@@ -0,0 +1,22 @@
/*******************************************************************************
* 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.lepidopterology.blocks;
import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
public class BlockRegistryLepidopterology extends BlockRegistry {
public final BlockLepidopterology lepidopterology;
public BlockRegistryLepidopterology() {
lepidopterology = registerBlock(new BlockLepidopterology(), ItemBlockForestry.class, "lepidopterology");
}
}
@@ -71,8 +71,6 @@ import forestry.core.items.ItemFruit.EnumFruit;
import forestry.core.network.IPacketRegistry;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.recipes.ShapelessRecipeCustom;
import forestry.core.tiles.MachineDefinition;
import forestry.factory.recipes.FabricatorRecipe;
@@ -217,41 +215,41 @@ public class PluginArboriculture extends ForestryPlugin {
planks.stackSize = 4;
logs.stackSize = 1;
ShapelessRecipeCustom.buildRecipe(planks.copy(), logs.copy());
RecipeUtil.addShapelessRecipe(planks.copy(), logs.copy());
fireproofPlanks.stackSize = 4;
fireproofLogs.stackSize = 1;
ShapelessRecipeCustom.buildRecipe(fireproofPlanks.copy(), fireproofLogs.copy());
RecipeUtil.addShapelessRecipe(fireproofPlanks.copy(), fireproofLogs.copy());
slabs.stackSize = 6;
planks.stackSize = 1;
ShapedRecipeCustom.buildPriorityRecipe(slabs.copy(),
RecipeUtil.addPriorityRecipe(slabs.copy(),
"###",
'#', planks.copy());
fireproofSlabs.stackSize = 6;
fireproofPlanks.stackSize = 1;
ShapedRecipeCustom.buildPriorityRecipe(fireproofSlabs.copy(),
RecipeUtil.addPriorityRecipe(fireproofSlabs.copy(),
"###",
'#', fireproofPlanks.copy());
fences.stackSize = 3;
planks.stackSize = 1;
ShapedRecipeCustom.buildRecipe(fences.copy(),
RecipeUtil.addRecipe(fences.copy(),
"#X#",
"#X#",
'#', planks.copy(), 'X', "stickWood");
fireproofFences.stackSize = 3;
fireproofPlanks.stackSize = 1;
ShapedRecipeCustom.buildRecipe(fireproofFences.copy(),
RecipeUtil.addRecipe(fireproofFences.copy(),
"#X#",
"#X#",
'#', fireproofPlanks.copy(), 'X', "stickWood");
stairs.stackSize = 4;
planks.stackSize = 1;
ShapedRecipeCustom.buildPriorityRecipe(stairs.copy(),
RecipeUtil.addPriorityRecipe(stairs.copy(),
"# ",
"## ",
"###",
@@ -259,7 +257,7 @@ public class PluginArboriculture extends ForestryPlugin {
fireproofStairs.stackSize = 4;
fireproofPlanks.stackSize = 1;
ShapedRecipeCustom.buildPriorityRecipe(fireproofStairs.copy(),
RecipeUtil.addPriorityRecipe(fireproofStairs.copy(),
"# ",
"## ",
"###",
@@ -57,7 +57,6 @@ import forestry.core.network.PacketRegistryCore;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.recipes.ShapelessRecipeCustom;
import forestry.core.tiles.MachineDefinition;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.ForestryModEnvWarningCallable;
@@ -117,9 +116,6 @@ public class PluginCore extends ForestryPlugin {
ForestryModEnvWarningCallable.register();
AlleleHelper.instance.init();
RecipeSorter.register("forestry:shapedrecipecustom", ShapedRecipeCustom.class, RecipeSorter.Category.SHAPED, "before:minecraft:shaped");
RecipeSorter.register("forestry:shapelessrecipecustom", ShapelessRecipeCustom.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless");
}
@Override
@@ -289,7 +289,7 @@ public class PluginFarming extends ForestryPlugin {
block.saveToCompound(compound);
basic.setTagCompound((NBTTagCompound) compound.copy());
ShapedRecipeCustom.buildRecipe(basic.copy(),
RecipeUtil.addRecipe(basic.copy(),
"I#I",
"WCW",
'#', block.getBase(),
@@ -23,23 +23,20 @@ import cpw.mods.fml.common.SidedProxy;
import forestry.Forestry;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.Tabs;
import forestry.api.genetics.AlleleManager;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.recipes.RecipeManagers;
import forestry.core.GuiHandlerBase;
import forestry.core.blocks.BlockBase;
import forestry.core.config.Constants;
import forestry.core.config.ForestryBlock;
import forestry.core.config.LocalizedConfiguration;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemBlockForestry;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.tiles.MachineDefinition;
import forestry.core.utils.EntityUtil;
import forestry.lepidopterology.ButterflySpawner;
import forestry.lepidopterology.GuiHandlerLepidopterology;
import forestry.lepidopterology.blocks.BlockLepidopterologyType;
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
import forestry.lepidopterology.commands.CommandButterfly;
import forestry.lepidopterology.entities.EntityButterfly;
import forestry.lepidopterology.genetics.AlleleButterflyEffect;
@@ -51,7 +48,6 @@ import forestry.lepidopterology.genetics.MothDefinition;
import forestry.lepidopterology.items.ItemRegistryLepidopterology;
import forestry.lepidopterology.proxy.ProxyLepidopterology;
import forestry.lepidopterology.recipes.MatingRecipe;
import forestry.lepidopterology.tiles.TileLepidopteristChest;
@Plugin(pluginID = "Lepidopterology", name = "Lepidopterology", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.lepidopterology.description")
public class PluginLepidopterology extends ForestryPlugin {
@@ -64,6 +60,7 @@ public class PluginLepidopterology extends ForestryPlugin {
private static boolean allowPollination = true;
public static ItemRegistryLepidopterology items;
public static BlockRegistryLepidopterology blocks;
@Override
protected void setupAPI() {
@@ -78,9 +75,7 @@ public class PluginLepidopterology extends ForestryPlugin {
@Override
protected void registerItemsAndBlocks() {
items = new ItemRegistryLepidopterology();
ForestryBlock.lepidopterology.registerBlock(new BlockBase(true), ItemBlockForestry.class, "lepidopterology");
ForestryBlock.lepidopterology.block().setCreativeTab(Tabs.tabLepidopterology);
blocks = new BlockRegistryLepidopterology();
}
@Override
@@ -88,10 +83,9 @@ public class PluginLepidopterology extends ForestryPlugin {
ButterflyBranchDefinition.createAlleles();
AlleleButterflyEffect.createAlleles();
BlockBase lepidopterology = ((BlockBase) ForestryBlock.lepidopterology.block());
MachineDefinition definitionChest = new MachineDefinition(Constants.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, Proxies.render.getRenderChest("lepichest"))
MachineDefinition definitionChest = new MachineDefinition(BlockLepidopterologyType.LEPICHEST)
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
lepidopterology.addDefinition(definitionChest);
blocks.lepidopterology.addDefinition(definitionChest);
}
@Override
@@ -114,7 +108,7 @@ public class PluginLepidopterology extends ForestryPlugin {
MothDefinition.initMoths();
ButterflyDefinition.initButterflies();
((BlockBase) ForestryBlock.lepidopterology.block()).init();
blocks.lepidopterology.init();
TreeManager.treeRoot.registerLeafTickHandler(new ButterflySpawner());
@@ -140,7 +134,7 @@ public class PluginLepidopterology extends ForestryPlugin {
"X#X", "X#X", "RDR", '#', "paneGlass", 'X', "ingotBronze", 'R',
"dustRedstone", 'D', "gemDiamond");
RecipeUtil.addRecipe(ForestryBlock.lepidopterology.getItemStack(1, Constants.DEFINITION_LEPICHEST_META),
RecipeUtil.addRecipe(blocks.lepidopterology.get(BlockLepidopterologyType.LEPICHEST),
" # ",
"XYX",
"XXX",
@@ -60,7 +60,6 @@ import forestry.core.GuiHandlerBase;
import forestry.core.IPickupHandler;
import forestry.core.IResupplyHandler;
import forestry.core.config.Constants;
import forestry.core.config.ForestryBlock;
import forestry.core.config.LocalizedConfiguration;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemCrated;
@@ -68,6 +67,8 @@ import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.StringUtil;
import forestry.lepidopterology.blocks.BlockLepidopterologyType;
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
import forestry.storage.BackpackDefinition;
import forestry.storage.BackpackDefinition.BackpackDefinitionApiarist;
import forestry.storage.BackpackDefinition.BackpackDefinitionLepidopterist;
@@ -502,8 +503,9 @@ public class PluginStorage extends ForestryPlugin {
addBackpackRecipe(items.apiaristBackpack, "stickWood", beeBlocks.apicultureChest);
}
if (items.lepidopteristBackpack != null) {
ItemStack chest = ForestryBlock.lepidopterology.getItemStack(1, Constants.DEFINITION_LEPICHEST_META);
BlockRegistryLepidopterology butterflyBlocks = PluginLepidopterology.blocks;
if (items.lepidopteristBackpack != null && butterflyBlocks != null) {
ItemStack chest = butterflyBlocks.lepidopterology.get(BlockLepidopterologyType.LEPICHEST);
addBackpackRecipe(items.lepidopteristBackpack, "stickWood", chest);
}