More null checks
This commit is contained in:
parent
6fff008132
commit
5c33796275
5 changed files with 61 additions and 44 deletions
|
|
@ -7,12 +7,16 @@ import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class BlockCobblegen extends BlockMachineBase
|
||||
{
|
||||
|
|
@ -23,6 +27,7 @@ public class BlockCobblegen extends BlockMachineBase
|
|||
super(unlocName, Material.iron);
|
||||
GameRegistry.registerTileEntity(TileCobblegen.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(this), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "cobblestone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ import com.oitsjustjose.criss_cross.tileentity.TileScribe;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
|
@ -18,6 +21,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class BlockScribe extends BlockMachineBase
|
||||
{
|
||||
|
|
@ -28,6 +32,7 @@ public class BlockScribe extends BlockMachineBase
|
|||
super(unlocName, Material.iron);
|
||||
GameRegistry.registerTileEntity(TileScribe.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(this), "BWB", "FES", "BWB", 'B', Items.book, 'W', "plankWood", 'F', Items.feather, 'S', "dyeBlack", 'E', Blocks.enchanting_table));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -7,12 +7,16 @@ import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class BlockStonegen extends BlockMachineBase
|
||||
{
|
||||
|
|
@ -23,6 +27,7 @@ public class BlockStonegen extends BlockMachineBase
|
|||
super(unlocName, Material.iron);
|
||||
GameRegistry.registerTileEntity(TileStonegen.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(this), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "stone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,17 +4,25 @@ import com.oitsjustjose.criss_cross.CrissCross;
|
|||
import com.oitsjustjose.criss_cross.event.PouchCleanEvent;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
import com.oitsjustjose.criss_cross.recipes.PouchColorRecipes;
|
||||
import com.oitsjustjose.criss_cross.recipes.PouchRollbackRecipes;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
|
||||
public class ItemPouch extends Item
|
||||
{
|
||||
|
|
@ -26,6 +34,11 @@ public class ItemPouch extends Item
|
|||
GameRegistry.registerItem(this, "pouch");
|
||||
MinecraftForge.EVENT_BUS.register(new PouchCleanEvent());
|
||||
Lib.add(this);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(this), "SDS", "LCL", "LLL", 'S', Items.string, 'D', "gemDiamond", 'L', Items.leather, 'C', Blocks.chest));
|
||||
CraftingManager.getInstance().getRecipeList().add(new PouchColorRecipes());
|
||||
CraftingManager.getInstance().getRecipeList().add(new PouchRollbackRecipes());
|
||||
RecipeSorter.register("CrissCross:PouchColorRecipes", PouchColorRecipes.class, Category.SHAPELESS, "");
|
||||
RecipeSorter.register("CrissCross:PouchRollbackRecipes", PouchRollbackRecipes.class, Category.SHAPELESS, "");
|
||||
}
|
||||
|
||||
// Dye specific code below: allows for custom pouch colors, not just your standard 16 colors
|
||||
|
|
|
|||
|
|
@ -8,80 +8,39 @@ import com.oitsjustjose.criss_cross.util.LogHelper;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class CraftingRecipes
|
||||
{
|
||||
public static void init()
|
||||
{
|
||||
initStaticRecipes();
|
||||
initUserRecipes();
|
||||
if (Config.enablePouches)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new PouchColorRecipes());
|
||||
CraftingManager.getInstance().getRecipeList().add(new PouchRollbackRecipes());
|
||||
|
||||
RecipeSorter.register("CrissCross:PouchColorRecipes", PouchColorRecipes.class, Category.SHAPELESS, "");
|
||||
RecipeSorter.register("CrissCross:PouchRollbackRecipes", PouchRollbackRecipes.class, Category.SHAPELESS, "");
|
||||
}
|
||||
}
|
||||
|
||||
static void initStaticRecipes()
|
||||
{
|
||||
if (Config.enableCobblestoneGenerator)
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.cobblegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "cobblestone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
if (Config.enableStoneGenerator)
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.stonegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "stone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
if (Config.enableScribe)
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.scribe), "BWB", "FES", "BWB", 'B', Items.book, 'W', "plankWood", 'F', Items.feather, 'S', "dyeBlack", 'E', Blocks.enchanting_table));
|
||||
if (Config.enableBuckets)
|
||||
if (Config.enableCropomator)
|
||||
cropomatorRecipe();
|
||||
if (Config.enableElectroextractor)
|
||||
electroextractorRecipe();
|
||||
if (Config.enableWoodchipper)
|
||||
woodchipperRecipe();
|
||||
if (Config.enableInfiniapple)
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.infiniApple, 1, 0), "###", "#N#", "###", '#', new ItemStack(Items.golden_apple, 1, 1), 'N', Items.nether_star));
|
||||
if(Config.enableBuckets)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.buckets, 1, 0), "DFD", "WBW", "DFD", 'W', Items.water_bucket, 'B', Items.bucket, 'D', "gemDiamond", 'F', "blockDiamond"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.buckets, 1, 1), "OGO", "GBG", "OGO", 'B', Items.bucket, 'G', "blockGlass", 'O', Blocks.obsidian));
|
||||
}
|
||||
if (Config.enableInfiniapple)
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.infiniApple, 1, 0), "###", "#N#", "###", '#', new ItemStack(Items.golden_apple, 1, 1), 'N', Items.nether_star));
|
||||
if (Config.enableMantlesmashers)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.mantleSmasherMkI), "## ", "#PI", " II", '#', "blockEmerald", 'I', "blockIron", 'P', Items.diamond_pickaxe));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.mantleSmasherMkII), "## ", "#PI", " IN", '#', "blockDiamond", 'I', "blockGold", 'P', LibItems.mantleSmasherMkI, 'N', Items.nether_star));
|
||||
}
|
||||
if (Config.enablePouches)
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.pouch), "SDS", "LCL", "LLL", 'S', Items.string, 'D', "gemDiamond", 'L', Items.leather, 'C', Blocks.chest));
|
||||
}
|
||||
|
||||
static void initUserRecipes()
|
||||
static void electroextractorRecipe()
|
||||
{
|
||||
// Woodchipper Recipe
|
||||
String[] unlocItem = Config.woodchipperRecipeItem.split(":");
|
||||
LogHelper.info(">>Loading Electroextractor Recipe");
|
||||
String[] unlocItem = Config.electroextractorRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = Config.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if (unlocItem.length == 3)
|
||||
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.warn(Config.woodchipperRecipeItem + " could not be implemented into the Woodchipper's Crafting Recipe.");
|
||||
LogHelper.warn("The fallback, " + centerItem.getDisplayName() + ", has been used instead");
|
||||
LogHelper.warn("Please confirm you have the name and formatting correct.");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(LibBlocks.woodchipper), new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem });
|
||||
|
||||
// Electroextractor Recipe
|
||||
unlocItem = Config.electroextractorRecipeItem.split(":");
|
||||
centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = Config.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
|
|
@ -99,10 +58,14 @@ public class CraftingRecipes
|
|||
}
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(LibBlocks.electroextractor), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem });
|
||||
LogHelper.info(">>Electroextractor Recipe Loaded!");
|
||||
}
|
||||
|
||||
// Cropomator Recipe
|
||||
unlocItem = Config.cropomatorRecipeItem.split(":");
|
||||
centerItem = new ItemStack(Blocks.diamond_block);
|
||||
static void cropomatorRecipe()
|
||||
{
|
||||
LogHelper.info(">>Loading Cropomator Recipe");
|
||||
String[] unlocItem = Config.cropomatorRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
|
|
@ -119,7 +82,33 @@ public class CraftingRecipes
|
|||
LogHelper.warn("Please confirm you have the name and formatting correct.");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(LibBlocks.cropomator), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, 'C', centerItem });
|
||||
LogHelper.info(">>Cropomator Recipe Loaded!");
|
||||
}
|
||||
|
||||
static void woodchipperRecipe()
|
||||
{
|
||||
LogHelper.info(">>Loading Woodchipper Recipe");
|
||||
String[] unlocItem = Config.woodchipperRecipeItem.split(":");
|
||||
ItemStack centerItem = new ItemStack(Blocks.diamond_block);
|
||||
|
||||
if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null)
|
||||
{
|
||||
ItemStack newStack = Config.findItemStack(unlocItem[0], unlocItem[1]);
|
||||
if (unlocItem.length == 2)
|
||||
centerItem = newStack;
|
||||
if (unlocItem.length == 3)
|
||||
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.warn(Config.woodchipperRecipeItem + " could not be implemented into the Woodchipper's Crafting Recipe.");
|
||||
LogHelper.warn("The fallback, " + centerItem.getDisplayName() + ", has been used instead");
|
||||
LogHelper.warn("Please confirm you have the name and formatting correct.");
|
||||
System.out.println();
|
||||
}
|
||||
GameRegistry.addRecipe(new ItemStack(LibBlocks.woodchipper), new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem });
|
||||
LogHelper.info(">>Woodchipper Recipe Loaded!");
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue