fixed the crucible crafting

This commit is contained in:
Mohammad-Ali Minaie
2017-11-24 00:20:41 -05:00
parent 4fd1da1215
commit c32b0be9cc
7 changed files with 25 additions and 42 deletions

View File

@@ -20,7 +20,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleHandler;
import nmd.primal.forgecraft.init.ModBlocks;
import org.apache.commons.lang3.StringUtils;
@@ -51,9 +50,6 @@ public class Crucible extends Block {
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
if(CrucibleHandler.getCrucibleIngredients().apply(pItem)){
System.out.println("true");
}
if(pItem.isEmpty()){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);

View File

@@ -1,14 +1,11 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.ITileEntityProvider;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tileentity.TileEntity;

View File

@@ -1,7 +1,6 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import java.util.ArrayList;

View File

@@ -1,16 +1,10 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.recipes.RecipeHandler;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 11/11/17.
@@ -31,8 +25,10 @@ public class CrucibleCrafting {
private List<Ingredient> ingredientList;
private ItemStack drops;
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4){
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4, ItemStack output){
this.ing0 = i0;
this.ing1 = i1;
@@ -44,29 +40,30 @@ public class CrucibleCrafting {
this.ingredientList.add(2, i2);
this.ingredientList.add(3, i3);
this.ingredientList.add(4, i4);
this.drops = output;
}
public static void addRecipe(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4)
public static void addRecipe(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4, ItemStack drop)
{
crucibleCrafting.add(new CrucibleCrafting(i0, i1, i2, i3, i4));
crucibleCrafting.add(new CrucibleCrafting(i0, i1, i2, i3, i4, drop));
}
//CustomIngredient(String ore, ItemStack... stacks)
/*private Ingredient ingredient;
public CrucibleCrafting(Ingredient input){
this.ingredient = input;
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : crucibleCrafting){
if(recipe.ing0.apply(i0) && recipe.ing1.apply(i1) && recipe.ing2.apply(i2) && recipe.ing3.apply(i3) && recipe.ing4.apply(i4) ){
return true;
}
}
return false;
}
public static void addIngredient(Ingredient input){
crucibleChecking.add(new CrucibleCrafting(input));
}*/
public static CrucibleCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : crucibleCrafting){
if(recipe.ing0.apply(i0) && recipe.ing1.apply(i1) && recipe.ing2.apply(i2) && recipe.ing3.apply(i3) && recipe.ing4.apply(i4) ){
return recipe;
}
}
return null;
}
}

View File

@@ -4,8 +4,6 @@ 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.Ingredient;
import net.minecraftforge.advancements.critereon.OredictItemPredicate;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient;
import nmd.primal.core.api.PrimalAPI;
@@ -13,7 +11,6 @@ import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.recipes.RecipeHandler;
import nmd.primal.forgecraft.crafting.*;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import java.util.Random;
/**
@@ -25,7 +22,8 @@ public class ModCrafting{
Random rand = new Random();
CrucibleCrafting.addRecipe(new OreIngredient("oreIron"), null, null, null, null);
CrucibleCrafting.addRecipe(new OreIngredient("oreIron"), null, null, null, null,
new ItemStack(ModBlocks.ironball, 1));
/***CASTING BLOCK***/
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.castingblock),

View File

@@ -1,6 +1,5 @@
package nmd.primal.forgecraft.items;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

View File

@@ -1,13 +1,10 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import net.minecraft.world.World;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
/**
* Created by mminaie on 11/11/17.