reworking the casting classes
This commit is contained in:
@@ -54,22 +54,6 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
if(randomCheck(4)) {
|
||||
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
|
||||
String[] tempArray = new String[25];
|
||||
for (int i = 0; i < 25; i++) {
|
||||
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
|
||||
}
|
||||
doCraftingformCrafting(tempArray, world, tile, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package nmd.primal.forgecraft.crafting;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -8,19 +9,19 @@ import java.util.Arrays;
|
||||
/**
|
||||
* Created by mminaie on 6/22/17.
|
||||
*/
|
||||
public class CastingformCrafting {
|
||||
public class CastingCrafting {
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Handler AnvilCrafting
|
||||
// ***************************************************************************** //
|
||||
|
||||
private static ArrayList<CastingformCrafting> castingRecipes = new ArrayList<>();
|
||||
private static ArrayList<CastingCrafting> castingRecipes = new ArrayList<>();
|
||||
|
||||
private String[] input = new String[25];
|
||||
private Item[] input = new Item[25];
|
||||
|
||||
private ItemStack output;
|
||||
|
||||
public CastingformCrafting(String[] input, ItemStack output){
|
||||
public CastingCrafting(Item[] input, ItemStack output){
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
@@ -31,14 +32,14 @@ public class CastingformCrafting {
|
||||
// Recipe Methods
|
||||
// ***************************************************************************** //
|
||||
|
||||
public static void addRecipe(String[] input, ItemStack output)
|
||||
public static void addRecipe(Item[] input, ItemStack output)
|
||||
{
|
||||
castingRecipes.add(new CastingformCrafting(input, output));
|
||||
castingRecipes.add(new CastingCrafting(input, output));
|
||||
}
|
||||
|
||||
public static boolean isRecipe(String[] array)
|
||||
public static boolean isRecipe(Item[] array)
|
||||
{
|
||||
for(CastingformCrafting recipe : castingRecipes) {
|
||||
for(CastingCrafting recipe : castingRecipes) {
|
||||
if (Arrays.equals(array, recipe.input))
|
||||
|
||||
return true;
|
||||
@@ -46,16 +47,16 @@ public class CastingformCrafting {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static CastingformCrafting getRecipe(String[] array)
|
||||
public static CastingCrafting getRecipe(Item[] array)
|
||||
{
|
||||
for(CastingformCrafting recipe : castingRecipes) {
|
||||
for(CastingCrafting recipe : castingRecipes) {
|
||||
if (Arrays.equals(array, recipe.input))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getInput() {return this.input;}
|
||||
public Item[] getInput() {return this.input;}
|
||||
|
||||
public ItemStack getOutput() {return this.output;}
|
||||
|
||||
@@ -3,7 +3,6 @@ package nmd.primal.forgecraft.init;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
@@ -13,7 +12,7 @@ import net.minecraftforge.oredict.OreIngredient;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.recipes.irecipe.RecipeHandler;
|
||||
import nmd.primal.forgecraft.crafting.AnvilCrafting;
|
||||
import nmd.primal.forgecraft.crafting.CastingformCrafting;
|
||||
import nmd.primal.forgecraft.crafting.CastingCrafting;
|
||||
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||
import nmd.primal.forgecraft.crafting.ForgeCrafting;
|
||||
|
||||
@@ -722,62 +721,62 @@ public class ModCrafting{
|
||||
CASTING
|
||||
******************************************************************************/
|
||||
|
||||
String empty = ItemStack.EMPTY.getItem().getRegistryName().toString();
|
||||
String muddd = ModItems.castingmud.getRegistryName().toString();
|
||||
Item empty = Items.AIR;
|
||||
Item muddd = ModItems.castingmud;
|
||||
|
||||
//Casting Pickaxe
|
||||
CastingformCrafting.addRecipe(
|
||||
new String[] {
|
||||
CastingCrafting.addRecipe(
|
||||
new Item[] {
|
||||
muddd,muddd,muddd,muddd,muddd,
|
||||
muddd,empty,empty,empty,muddd,
|
||||
empty,muddd,muddd,muddd,empty,
|
||||
muddd,muddd,muddd,muddd,muddd,
|
||||
muddd,muddd,muddd,muddd,muddd },
|
||||
new ItemStack(ModItems.cast_pickaxe, 1)
|
||||
new ItemStack(ModItems.bronzepickaxehead, 1)
|
||||
);
|
||||
|
||||
//Casting Shovel
|
||||
CastingformCrafting.addRecipe(
|
||||
new String[] {
|
||||
CastingCrafting.addRecipe(
|
||||
new Item[] {
|
||||
muddd,muddd,muddd,muddd,muddd,
|
||||
muddd,muddd,empty,muddd,muddd,
|
||||
muddd,empty,empty,empty,muddd,
|
||||
muddd,empty,empty,empty,muddd,
|
||||
muddd,empty,muddd,empty,muddd },
|
||||
new ItemStack(ModItems.cast_shovel, 1)
|
||||
new ItemStack(ModItems.bronzeshovelhead, 1)
|
||||
);
|
||||
|
||||
//Casting Axe
|
||||
CastingformCrafting.addRecipe(
|
||||
new String[] {
|
||||
CastingCrafting.addRecipe(
|
||||
new Item[] {
|
||||
muddd,empty,empty,muddd,muddd,
|
||||
muddd,empty,empty,empty,muddd,
|
||||
muddd,empty,empty,empty,muddd,
|
||||
muddd,empty,muddd,muddd,muddd,
|
||||
muddd,muddd,muddd,muddd,muddd },
|
||||
new ItemStack(ModItems.cast_axe, 1)
|
||||
new ItemStack(ModItems.bronzeaxehead, 1)
|
||||
);
|
||||
|
||||
//Casting Hoe
|
||||
CastingformCrafting.addRecipe(
|
||||
new String[] {
|
||||
CastingCrafting.addRecipe(
|
||||
new Item[] {
|
||||
muddd,muddd,muddd,empty,empty,
|
||||
muddd,muddd,empty,muddd,muddd,
|
||||
muddd,empty,muddd,muddd,muddd,
|
||||
empty,muddd,muddd,muddd,muddd,
|
||||
muddd,muddd,muddd,muddd,muddd },
|
||||
new ItemStack(ModItems.cast_hoe, 1)
|
||||
new ItemStack(ModItems.bronzehoehead, 1)
|
||||
);
|
||||
|
||||
//Casting Gladius
|
||||
CastingformCrafting.addRecipe(
|
||||
new String[] {
|
||||
CastingCrafting.addRecipe(
|
||||
new Item[] {
|
||||
muddd,muddd,muddd,muddd,muddd,
|
||||
muddd,muddd,empty,muddd,muddd,
|
||||
muddd,muddd,empty,muddd,muddd,
|
||||
muddd,empty,empty,empty,muddd,
|
||||
muddd,muddd,empty,muddd,muddd },
|
||||
new ItemStack(ModItems.cast_gladius, 1)
|
||||
new ItemStack(ModItems.bronzegladius, 1)
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -2,13 +2,14 @@ package nmd.primal.forgecraft.util;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.crafting.CastingformCrafting;
|
||||
import nmd.primal.forgecraft.crafting.CastingCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||
|
||||
@@ -188,8 +189,8 @@ public interface CastingFormHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
default void doCraftingformCrafting(String[] tempArray, World world, TileCastingForm tile, BlockPos pos){
|
||||
CastingformCrafting recipe = CastingformCrafting.getRecipe(tempArray);
|
||||
default void doCraftingformCrafting(Item[] tempArray, World world, TileCastingForm tile, BlockPos pos){
|
||||
CastingCrafting recipe = CastingCrafting.getRecipe(tempArray);
|
||||
if (recipe != null) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, recipe.getOutput());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user