casting crafting, say that 5 times fast
This commit is contained in:
@@ -17,7 +17,9 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.common.items.tools.WorkMallet;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||||
import nmd.primal.forgecraft.util.CastingFormHandler;
|
import nmd.primal.forgecraft.util.CastingFormHandler;
|
||||||
|
|
||||||
@@ -44,7 +46,13 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan
|
|||||||
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
|
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
|
||||||
ItemStack pItem = player.inventory.getCurrentItem();
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
|
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
|
||||||
return true;
|
String[] tempArray = new String[25];
|
||||||
|
for (int i = 0; i < 25; i++) {
|
||||||
|
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
|
||||||
|
}
|
||||||
|
doCraftingformCrafting(pItem, tempArray, world, tile, pos, player);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package nmd.primal.forgecraft.crafting;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mminaie on 6/22/17.
|
||||||
|
*/
|
||||||
|
public class CastingformCrafting {
|
||||||
|
|
||||||
|
// ***************************************************************************** //
|
||||||
|
// Recipe Handler AnvilCrafting
|
||||||
|
// ***************************************************************************** //
|
||||||
|
|
||||||
|
private static ArrayList<CastingformCrafting> castingRecipes = new ArrayList<>();
|
||||||
|
|
||||||
|
private String[] input = new String[25];
|
||||||
|
|
||||||
|
private ItemStack output;
|
||||||
|
|
||||||
|
public CastingformCrafting(String[] input, ItemStack output, String upgrade){
|
||||||
|
|
||||||
|
this.input = input;
|
||||||
|
this.output = output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************** //
|
||||||
|
// Recipe Methods
|
||||||
|
// ***************************************************************************** //
|
||||||
|
|
||||||
|
public static void addRecipe(String[] input, ItemStack output, String upgrade)
|
||||||
|
{
|
||||||
|
castingRecipes.add(new CastingformCrafting(input, output, upgrade));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRecipe(String[] array)
|
||||||
|
{
|
||||||
|
for(CastingformCrafting recipe : castingRecipes) {
|
||||||
|
if (Arrays.equals(array, recipe.input))
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CastingformCrafting getRecipe(String[] array)
|
||||||
|
{
|
||||||
|
for(CastingformCrafting recipe : castingRecipes) {
|
||||||
|
if (Arrays.equals(array, recipe.input))
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getInput() {return this.input;}
|
||||||
|
|
||||||
|
public ItemStack getOutput() {return this.output;}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
|||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import nmd.primal.core.api.PrimalItems;
|
import nmd.primal.core.api.PrimalItems;
|
||||||
|
import nmd.primal.core.common.helper.CommonUtils;
|
||||||
import nmd.primal.forgecraft.crafting.AnvilCrafting;
|
import nmd.primal.forgecraft.crafting.AnvilCrafting;
|
||||||
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
|
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
|
||||||
import nmd.primal.forgecraft.crafting.ForgeCrafting;
|
import nmd.primal.forgecraft.crafting.ForgeCrafting;
|
||||||
@@ -628,7 +629,7 @@ public class ModCrafting {
|
|||||||
empty,empty,diamond,empty,empty,
|
empty,empty,diamond,empty,empty,
|
||||||
empty,empty,empty,empty,empty,
|
empty,empty,empty,empty,empty,
|
||||||
empty,empty,empty,empty,empty },
|
empty,empty,empty,empty,empty },
|
||||||
new ItemStack(PrimalItems.DIAMOND_KNAPP, 1),
|
new ItemStack(PrimalItems.DIAMOND_KNAPP, CommonUtils.randomChanceReturn(2, 1, 2)),
|
||||||
"null"
|
"null"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -674,7 +675,7 @@ public class ModCrafting {
|
|||||||
empty,empty,emerald,empty,empty,
|
empty,empty,emerald,empty,empty,
|
||||||
empty,empty,empty,empty,empty,
|
empty,empty,empty,empty,empty,
|
||||||
empty,empty,empty,empty,empty },
|
empty,empty,empty,empty,empty },
|
||||||
new ItemStack(PrimalItems.EMERALD_KNAPP, 1),
|
new ItemStack(PrimalItems.EMERALD_KNAPP, CommonUtils.randomChanceReturn(3, 1, 3)),
|
||||||
"null"
|
"null"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -198,5 +198,9 @@ public interface CastingFormHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default boolean doCraftingformCrafting(ItemStack pItem, String[] tempArray, World world, TileCastingForm tile, BlockPos pos, EntityPlayer player){
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user