diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/CastingForm.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/CastingForm.java index e8afd2b2..ce8c6d49 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/CastingForm.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/CastingForm.java @@ -17,6 +17,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import nmd.primal.core.common.helper.CommonUtils; import nmd.primal.core.common.items.tools.WorkMallet; import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.init.ModItems; @@ -24,6 +25,7 @@ import nmd.primal.forgecraft.tiles.TileCastingForm; import nmd.primal.forgecraft.util.CastingFormHandler; import javax.annotation.Nullable; +import java.util.Random; /** * Created by mminaie on 6/19/17. @@ -36,6 +38,7 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan super(material, registryName); setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); setCreativeTab(ModInfo.TAB_FORGECRAFT); + this.setTickRandomly(true); } @@ -46,11 +49,6 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos); ItemStack pItem = player.inventory.getCurrentItem(); doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player); - 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; } @@ -58,7 +56,20 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan } - + @Override + public void updateTick(World world, BlockPos pos, IBlockState state, Random random) + { + if (!world.isRemote) { + if(CommonUtils.randomCheck(10)) { + 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 diff --git a/1.11/src/main/java/nmd/primal/forgecraft/crafting/CastingformCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/crafting/CastingformCrafting.java index ebacffc4..3f3c329a 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/crafting/CastingformCrafting.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/crafting/CastingformCrafting.java @@ -20,7 +20,7 @@ public class CastingformCrafting { private ItemStack output; - public CastingformCrafting(String[] input, ItemStack output, String upgrade){ + public CastingformCrafting(String[] input, ItemStack output){ this.input = input; this.output = output; @@ -31,9 +31,9 @@ public class CastingformCrafting { // Recipe Methods // ***************************************************************************** // - public static void addRecipe(String[] input, ItemStack output, String upgrade) + public static void addRecipe(String[] input, ItemStack output) { - castingRecipes.add(new CastingformCrafting(input, output, upgrade)); + castingRecipes.add(new CastingformCrafting(input, output)); } public static boolean isRecipe(String[] array) diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java index 6cfee3c0..0b2ca94a 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java @@ -11,6 +11,7 @@ import nmd.primal.core.api.PrimalItems; import nmd.primal.core.common.helper.CommonUtils; import nmd.primal.forgecraft.crafting.AnvilCrafting; import nmd.primal.forgecraft.crafting.BloomeryCrafting; +import nmd.primal.forgecraft.crafting.CastingformCrafting; import nmd.primal.forgecraft.crafting.ForgeCrafting; import java.util.Random; @@ -321,6 +322,22 @@ public class ModCrafting { //TODO PLACE HOLDER FOR WOOTZ + /****************************************************************************** + CASTING + ******************************************************************************/ + + String empty = ItemStack.EMPTY.getItem().getRegistryName().toString(); + String muddd = ModItems.castingmud.getRegistryName().toString(); + + CastingformCrafting.addRecipe( + new String[] { + 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(Items.STICK, 1) + ); /****************************************************************************** FORGING @@ -534,7 +551,7 @@ public class ModCrafting { ANVILING ******************************************************************************/ - String empty = ItemStack.EMPTY.getItem().getRegistryName().toString(); + //String empty = ItemStack.EMPTY.getItem().getRegistryName().toString(); String hotChunk = ModItems.ironchunkhot.getRegistryName().toString(); String hotCleanChunk = ModItems.ironcleanchunkhot.getRegistryName().toString(); String hotSteelChunk = ModItems.steelchunkhot.getRegistryName().toString(); diff --git a/1.11/src/main/java/nmd/primal/forgecraft/util/CastingFormHandler.java b/1.11/src/main/java/nmd/primal/forgecraft/util/CastingFormHandler.java index 5e5e800f..fc329998 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/util/CastingFormHandler.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/util/CastingFormHandler.java @@ -7,6 +7,8 @@ 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.init.ModItems; import nmd.primal.forgecraft.tiles.TileCastingForm; @@ -198,9 +200,17 @@ public interface CastingFormHandler { return false; } - default boolean doCraftingformCrafting(ItemStack pItem, String[] tempArray, World world, TileCastingForm tile, BlockPos pos, EntityPlayer player){ - - return false; + default void doCraftingformCrafting(String[] tempArray, World world, TileCastingForm tile, BlockPos pos){ + CastingformCrafting recipe = CastingformCrafting.getRecipe(tempArray); + if (recipe != null) { + CommonUtils.spawnItemEntityFromWorld(world, pos, recipe.getOutput()); + } + //world.playEvent(1031, pos, 0); + for (int i = 0; i < tile.getSlotListSize(); i++) { + if (!tile.getSlotStack(i).isEmpty()) { + tile.setSlotStack(i, ItemStack.EMPTY); + } + } } } diff --git a/1.11/src/main/resources/assets/forgecraft/models/item/cast_pickaxe.json b/1.11/src/main/resources/assets/forgecraft/models/item/cast_pickaxe.json new file mode 100644 index 00000000..f1251f70 --- /dev/null +++ b/1.11/src/main/resources/assets/forgecraft/models/item/cast_pickaxe.json @@ -0,0 +1,238 @@ +{ + "__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio", + "textures": { + "particle": "blocks/e_particle", + "texture": "blocks/castingmud" + }, + "elements": [ + { + "__comment": "Box29", + "from": [ 0, 0, 0 ], + "to": [ 16, 2, 3 ], + "faces": { + "down": { "uv": [ 0, 13, 16, 16 ], "texture": "#texture" }, + "up": { "uv": [ 0, 0, 16, 3 ], "texture": "#texture" }, + "north": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" }, + "south": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" }, + "west": { "uv": [ 0, 14, 3, 16 ], "texture": "#texture" }, + "east": { "uv": [ 13, 14, 16, 16 ], "texture": "#texture" } + } + }, + { + "__comment": "Box29", + "from": [ 0, 0, 13 ], + "to": [ 16, 2, 16 ], + "faces": { + "down": { "uv": [ 0, 0, 16, 3 ], "texture": "#texture" }, + "up": { "uv": [ 0, 13, 16, 16 ], "texture": "#texture" }, + "north": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" }, + "south": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" }, + "west": { "uv": [ 13, 14, 16, 16 ], "texture": "#texture" }, + "east": { "uv": [ 0, 14, 3, 16 ], "texture": "#texture" } + } + }, + { + "__comment": "Box31", + "from": [ 0, 0, 3 ], + "to": [ 3, 2, 13 ], + "faces": { + "down": { "uv": [ 0, 3, 3, 13 ], "texture": "#texture" }, + "up": { "uv": [ 0, 3, 3, 13 ], "texture": "#texture" }, + "west": { "uv": [ 3, 14, 13, 16 ], "texture": "#texture" }, + "east": { "uv": [ 3, 14, 13, 16 ], "texture": "#texture" } + } + }, + { + "__comment": "Box31", + "from": [ 13, 0, 3 ], + "to": [ 16, 2, 13 ], + "faces": { + "down": { "uv": [ 13, 3, 16, 13 ], "texture": "#texture" }, + "up": { "uv": [ 13, 3, 16, 13 ], "texture": "#texture" }, + "west": { "uv": [ 3, 14, 13, 16 ], "texture": "#texture" }, + "east": { "uv": [ 3, 14, 13, 16 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 5, 0, 3 ], + "to": [ 7, 2, 5 ], + "faces": { + "down": { "uv": [ 5, 11, 7, 13 ], "texture": "#texture" }, + "up": { "uv": [ 5, 3, 7, 5 ], "texture": "#texture" }, + "south": { "uv": [ 5, 14, 7, 16 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 3, 0, 3 ], + "to": [ 5, 2, 5 ], + "faces": { + "down": { "uv": [ 3, 11, 5, 13 ], "texture": "#texture" }, + "up": { "uv": [ 3, 3, 5, 5 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 7, 0, 3 ], + "to": [ 9, 2, 5 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 9, 0, 3 ], + "to": [ 11, 2, 5 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 11, 0, 3 ], + "to": [ 13, 2, 5 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 5, 0, 7 ], + "to": [ 7, 2, 9 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 3, 0, 5 ], + "to": [ 5, 2, 7 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 7, 0, 7 ], + "to": [ 9, 2, 9 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 9, 0, 7 ], + "to": [ 11, 2, 9 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 11, 0, 5 ], + "to": [ 13, 2, 7 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 3, 0, 9 ], + "to": [ 5, 2, 11 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 5, 0, 9 ], + "to": [ 7, 2, 11 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 7, 0, 9 ], + "to": [ 9, 2, 11 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 9, 0, 9 ], + "to": [ 11, 2, 11 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 11, 0, 9 ], + "to": [ 13, 2, 11 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 3, 0, 11 ], + "to": [ 5, 2, 13 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 5, 0, 11 ], + "to": [ 7, 2, 13 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 7, 0, 11 ], + "to": [ 9, 2, 13 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 9, 0, 11 ], + "to": [ 11, 2, 13 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + }, + { + "__comment": "Box33", + "from": [ 11, 0, 11 ], + "to": [ 13, 2, 13 ], + "faces": { + "down": { "uv": [ 11, 3, 13, 5 ], "texture": "#texture" }, + "up": { "uv": [ 11, 11, 13, 13 ], "texture": "#texture" } + } + } + ] +} \ No newline at end of file diff --git a/1.11/src/main/resources/assets/forgecraft/models/item/e_particle.png b/1.11/src/main/resources/assets/forgecraft/models/item/e_particle.png new file mode 100644 index 00000000..e557878f Binary files /dev/null and b/1.11/src/main/resources/assets/forgecraft/models/item/e_particle.png differ diff --git a/1.11/src/main/resources/assets/forgecraft/textures/blocks/castingmud.png b/1.11/src/main/resources/assets/forgecraft/textures/blocks/castingmud.png new file mode 100644 index 00000000..05117cd2 Binary files /dev/null and b/1.11/src/main/resources/assets/forgecraft/textures/blocks/castingmud.png differ