This commit is contained in:
Mohammad-Ali Minaie
2018-09-15 16:08:14 -04:00
parent 83a3061a99
commit d0026da88a
26 changed files with 705 additions and 596 deletions

View File

@@ -2,8 +2,11 @@ package nmd.primal.forgecraft;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
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 net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
//import nmd.primal.forgecraft.Item.ModItems; //import nmd.primal.forgecraft.Item.ModItems;
@@ -37,4 +40,15 @@ public class ModInfo {
return new ItemStack(ModItems.forgehammer); return new ItemStack(ModItems.forgehammer);
} }
}; };
// ***************************************************************************** //
// PrimalAPI.Registries
// ***************************************************************************** //
public static class Registries
{
// In-World Recipes
public static final IForgeRegistry<CrucibleCrafting> CRUCIBLE_CRAFTINGS = GameRegistry.findRegistry(CrucibleCrafting.class);
}
} }

View File

@@ -20,7 +20,6 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.items.tools.Gallagher; import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.core.common.recipes.inworld.GallagherRecipe;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBreaker; import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler; import nmd.primal.forgecraft.util.BreakerHandler;

View File

@@ -27,7 +27,6 @@ import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.items.casting.CastingPart; import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.tiles.TileCastingBlock; import nmd.primal.forgecraft.tiles.TileCastingBlock;
import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;

View File

@@ -1,195 +0,0 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
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.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
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.api.PrimalAPI;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import org.apache.commons.lang3.StringUtils;
import java.util.Random;
import static nmd.primal.forgecraft.CommonUtils.spawnItemEntityFromWorld;
/**
* Created by mminaie on 1/24/17.
*/
public class Crucible extends Block {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public Crucible(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
if(pItem.isEmpty()){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
if(Block.getBlockFromItem(pItem.getItem()) == this){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
}
return false;
}
/*@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
ret.add(0, new ItemStack(ModBlocks.emptycrucible, 1));
if(this.getUnlocalizedName()=="tile.coolironcrucible"){
ret.add(1, new ItemStack(Items.IRON_INGOT, 1));
}
return ret;
}*/
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
/*if(!world.isRemote){
if(this.getUnlocalizedName().equals("tile.emptycruciblecracked")){} else spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1));
if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) {
if(checkDrops(this.getUnlocalizedName()) != null) {
if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) {
spawnItemEntityFromWorld(world, pos, new ItemStack(getItemFromName(this.getUnlocalizedName()), 1));
}
}
}
}*/
}
private String checkDrops(String name){
String string = null;
if(name.equals("tile.coolironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.emptycruciblecracked")){
string = this.getUnlocalizedName();
}
return string;
}
private Item getItemFromName(String name){
if(name.equals("tile.coolironcrucible")){
//return Item.getItemFromBlock(ModBlocks.ironball);
return null;
} else if (name.equals("tile.rawironcrucible")){
return Item.getItemFromBlock(Blocks.IRON_ORE);
} else if (name.equals("tile.coolcleanironcrucible")){
//return Item.getItemFromBlock(ModBlocks.ironcleanball);
return null;
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalAPI.Items.IRON_DUST;
} else if (name.equals("tile.coolsteelcrucible")){
//return Item.getItemFromBlock(ModBlocks.steelball);
return null;
} else if (name.equals("tile.rawsteelcrucible")){
//return Item.getItemFromBlock(ModBlocks.ironcleanball);
return null;
} else if (name.equals("tile.coolwootzcrucible")){
//return Item.getItemFromBlock(ModBlocks.wootzball);
return null;
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalAPI.Items.IRON_DUST;
}else if (name.equals("tile.emptycruciblecracked")){
return Items.CLAY_BALL;
}
else return Items.AIR;
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,101 +0,0 @@
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.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
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.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import java.util.Random;
/**
* Created by mminaie on 2/4/17.
*/
public class CrucibleHot extends Block implements ITileEntityProvider {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public CrucibleHot(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return false;
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBaseCrucible();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -10,7 +10,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;

View File

@@ -0,0 +1,31 @@
package nmd.primal.forgecraft.compat.JEI;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import nmd.primal.forgecraft.ModInfo;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public abstract class AbstractCategory<T extends IRecipeWrapper> implements IRecipeCategory<T> {
@Override
public String getModName() {
return ModInfo.MOD_NAME;
}
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public IDrawable getIcon() {
// use the default icon
return null;
}
}

View File

@@ -3,59 +3,12 @@ package nmd.primal.forgecraft.compat.JEI;
import mezz.jei.api.*; import mezz.jei.api.*;
import mezz.jei.api.gui.ICraftingGridHelper; import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.recipe.IRecipeCategoryRegistration; import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid; import nmd.primal.forgecraft.compat.JEI.crucible.CrucibleRecipeCategory;
import net.minecraft.init.Blocks; import nmd.primal.forgecraft.compat.JEI.crucible.CrucibleRecipeChecker;
import net.minecraft.item.*; import nmd.primal.forgecraft.compat.JEI.crucible.CrucibleRecipeHandler;
import net.minecraft.nbt.NBTTagCompound; import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.api.interfaces.types.ITypeMud;
import nmd.primal.core.api.interfaces.types.ITypeWood;
import nmd.primal.core.common.compat.jei.CraftingTableTransfer;
import nmd.primal.core.common.compat.jei.cauldron.CauldronRecipeCategory;
import nmd.primal.core.common.compat.jei.cauldron.CauldronRecipeChecker;
import nmd.primal.core.common.compat.jei.cauldron.CauldronRecipeHandler;
import nmd.primal.core.common.compat.jei.drying.DryingRecipeCategory;
import nmd.primal.core.common.compat.jei.drying.DryingRecipeChecker;
import nmd.primal.core.common.compat.jei.drying.DryingRecipeHandler;
import nmd.primal.core.common.compat.jei.flake.FlakeRecipeCategory;
import nmd.primal.core.common.compat.jei.flake.FlakeRecipeChecker;
import nmd.primal.core.common.compat.jei.flake.FlakeRecipeHandler;
import nmd.primal.core.common.compat.jei.hibachi.HibachiRecipeCategory;
import nmd.primal.core.common.compat.jei.hibachi.HibachiRecipeChecker;
import nmd.primal.core.common.compat.jei.hibachi.HibachiRecipeHandler;
import nmd.primal.core.common.compat.jei.smelter.SmelterRecipeCategory;
import nmd.primal.core.common.compat.jei.smelter.SmelterRecipeChecker;
import nmd.primal.core.common.compat.jei.smelter.SmelterRecipeHandler;
import nmd.primal.core.common.compat.jei.tools.axe.AxeRecipeCategory;
import nmd.primal.core.common.compat.jei.tools.axe.AxeRecipeChecker;
import nmd.primal.core.common.compat.jei.tools.axe.AxeRecipeHandler;
import nmd.primal.core.common.compat.jei.tools.blade.BladeRecipeCategory;
import nmd.primal.core.common.compat.jei.tools.blade.BladeRecipeChecker;
import nmd.primal.core.common.compat.jei.tools.blade.BladeRecipeHandler;
import nmd.primal.core.common.compat.jei.tools.gallahger.GallagherRecipeCategory;
import nmd.primal.core.common.compat.jei.tools.gallahger.GallagherRecipeChecker;
import nmd.primal.core.common.compat.jei.tools.gallahger.GallagherRecipeHandler;
import nmd.primal.core.common.compat.jei.tools.hoe.HoeRecipeCategory;
import nmd.primal.core.common.compat.jei.tools.hoe.HoeRecipeChecker;
import nmd.primal.core.common.compat.jei.tools.hoe.HoeRecipeHandler;
import nmd.primal.core.common.compat.jei.tools.shovel.ShovelRecipeCategory;
import nmd.primal.core.common.compat.jei.tools.shovel.ShovelRecipeChecker;
import nmd.primal.core.common.compat.jei.tools.shovel.ShovelRecipeHandler;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.core.common.recipes.inworld.*;
import nmd.primal.core.common.recipes.tile.CauldronRecipe;
import nmd.primal.core.common.recipes.tile.DryingRecipe;
import nmd.primal.core.common.recipes.tile.HibachiRecipe;
import nmd.primal.core.common.recipes.tile.SmelterRecipe;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by mminaie on 9/11/18. * Created by mminaie on 9/11/18.
@@ -68,11 +21,11 @@ public class ModJEI implements IModPlugin {
public static IGuiHelper guiHelper; public static IGuiHelper guiHelper;
private static final int craftOutputSlot = 0; private static final int craftOutputSlot = 0;
private static final int craftInputSlot1 = 1; private static final int craftInputSlot1 = 1;
private static List<ItemStack> gallaghers = new ArrayList<>(); //private static List<ItemStack> gallaghers = new ArrayList<>();
private static List<ItemStack> blades = new ArrayList<>(); //private static List<ItemStack> blades = new ArrayList<>();
private static List<ItemStack> axes = new ArrayList<>(); //private static List<ItemStack> axes = new ArrayList<>();
private static List<ItemStack> shovels = new ArrayList<>(); //private static List<ItemStack> shovels = new ArrayList<>();
private static List<ItemStack> hoes = new ArrayList<>(); //private static List<ItemStack> hoes = new ArrayList<>();
@Override @Override
public void registerCategories(IRecipeCategoryRegistration registry) { public void registerCategories(IRecipeCategoryRegistration registry) {
@@ -82,20 +35,20 @@ public class ModJEI implements IModPlugin {
// //
// In-World // In-World
// //
registry.addRecipeCategories(new FlakeRecipeCategory(guiHelper)); //registry.addRecipeCategories(new FlakeRecipeCategory(guiHelper));
registry.addRecipeCategories(new GallagherRecipeCategory(guiHelper)); //registry.addRecipeCategories(new GallagherRecipeCategory(guiHelper));
registry.addRecipeCategories(new BladeRecipeCategory(guiHelper)); //registry.addRecipeCategories(new BladeRecipeCategory(guiHelper));
registry.addRecipeCategories(new AxeRecipeCategory(guiHelper)); //registry.addRecipeCategories(new AxeRecipeCategory(guiHelper));
registry.addRecipeCategories(new ShovelRecipeCategory(guiHelper)); //registry.addRecipeCategories(new ShovelRecipeCategory(guiHelper));
registry.addRecipeCategories(new HoeRecipeCategory(guiHelper)); //registry.addRecipeCategories(new HoeRecipeCategory(guiHelper));
// //
// Tiles // Tiles
// //
registry.addRecipeCategories(new DryingRecipeCategory(guiHelper)); //registry.addRecipeCategories(new DryingRecipeCategory(guiHelper));
registry.addRecipeCategories(new HibachiRecipeCategory(guiHelper)); //registry.addRecipeCategories(new HibachiRecipeCategory(guiHelper));
registry.addRecipeCategories(new SmelterRecipeCategory(guiHelper)); //registry.addRecipeCategories(new SmelterRecipeCategory(guiHelper));
registry.addRecipeCategories(new CauldronRecipeCategory(guiHelper)); registry.addRecipeCategories(new CrucibleRecipeCategory(guiHelper));
} }
@Override @Override
@@ -104,15 +57,15 @@ public class ModJEI implements IModPlugin {
guiHelper = jeiHelper.getGuiHelper(); guiHelper = jeiHelper.getGuiHelper();
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot); craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot);
this.buildToolLists(); //this.buildToolLists();
// //
// Crafting Tables // Crafting Tables
// //
//registry.handleRecipes(TableRecipe.class, new TableRecipeHandler(), VanillaRecipeCategoryUid.CRAFTING); //registry.handleRecipes(TableRecipe.class, new TableRecipeHandler(), VanillaRecipeCategoryUid.CRAFTING);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(new CraftingTableTransfer()); //registry.getRecipeTransferRegistry().addRecipeTransferHandler(new CraftingTableTransfer());
registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.WORKTABLE_SHELF, 1, OreDictionary.WILDCARD_VALUE), VanillaRecipeCategoryUid.CRAFTING); //registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.WORKTABLE_SHELF, 1, OreDictionary.WILDCARD_VALUE), VanillaRecipeCategoryUid.CRAFTING);
registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.WORKTABLE_SLAB, 1, OreDictionary.WILDCARD_VALUE), VanillaRecipeCategoryUid.CRAFTING); //registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.WORKTABLE_SLAB, 1, OreDictionary.WILDCARD_VALUE), VanillaRecipeCategoryUid.CRAFTING);
// ***************************************************************************** // // ***************************************************************************** //
// Tile Recipes // Tile Recipes
@@ -120,40 +73,40 @@ public class ModJEI implements IModPlugin {
// //
// Drying Racks // Drying Racks
// //
registry.handleRecipes(DryingRecipe.class, new DryingRecipeHandler(), DryingRecipeCategory.CATEGORY); //registry.handleRecipes(DryingRecipe.class, new DryingRecipeHandler(), DryingRecipeCategory.CATEGORY);
registry.addRecipes(DryingRecipeChecker.getRecipes(), DryingRecipeCategory.CATEGORY); //registry.addRecipes(DryingRecipeChecker.getRecipes(), DryingRecipeCategory.CATEGORY);
// TODO: report to JEI? wildcard does not work for the tab icon // TODO: report to JEI? wildcard does not work for the tab icon
//registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, OreDictionary.WILDCARD_VALUE), DryingRecipeCategory.CATEGORY); //registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, OreDictionary.WILDCARD_VALUE), DryingRecipeCategory.CATEGORY);
for (ITypeWood.EnumType type : ITypeWood.EnumType.values()) //for (ITypeWood.EnumType type : ITypeWood.EnumType.values())
registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, type.getMetadata()), DryingRecipeCategory.CATEGORY); // registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, type.getMetadata()), DryingRecipeCategory.CATEGORY);
// //
// Hibachi // Hibachi
// //
registry.handleRecipes(HibachiRecipe.class, new HibachiRecipeHandler(), HibachiRecipeCategory.CATEGORY); //registry.handleRecipes(HibachiRecipe.class, new HibachiRecipeHandler(), HibachiRecipeCategory.CATEGORY);
registry.addRecipes(HibachiRecipeChecker.getRecipes(), HibachiRecipeCategory.CATEGORY); //registry.addRecipes(HibachiRecipeChecker.getRecipes(), HibachiRecipeCategory.CATEGORY);
for (ITypeMud.EnumType type : ITypeMud.EnumType.values()) //for (ITypeMud.EnumType type : ITypeMud.EnumType.values())
registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.HIBACHI, 1, type.getMetadata()), HibachiRecipeCategory.CATEGORY); // registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.HIBACHI, 1, type.getMetadata()), HibachiRecipeCategory.CATEGORY);
// //
// Smelter // Smelter
// //
registry.handleRecipes(SmelterRecipe.class, new SmelterRecipeHandler(), SmelterRecipeCategory.CATEGORY); //registry.handleRecipes(SmelterRecipe.class, new SmelterRecipeHandler(), SmelterRecipeCategory.CATEGORY);
registry.addRecipes(SmelterRecipeChecker.getRecipes(), SmelterRecipeCategory.CATEGORY); //registry.addRecipes(SmelterRecipeChecker.getRecipes(), SmelterRecipeCategory.CATEGORY);
for (ITypeMud.EnumType type : ITypeMud.EnumType.values()) { //for (ITypeMud.EnumType type : ITypeMud.EnumType.values()) {
ItemStack stack = new ItemStack(PrimalAPI.Blocks.SMELTER, 1, type.getMetadata()); // ItemStack stack = new ItemStack(PrimalAPI.Blocks.SMELTER, 1, type.getMetadata());
NBTTagCompound nbt = new NBTTagCompound(); // NBTTagCompound nbt = new NBTTagCompound();
stack.setTagInfo("BlockEntityTag", nbt); // stack.setTagInfo("BlockEntityTag", nbt);
nbt.setBoolean("covered", true); // nbt.setBoolean("covered", true);
registry.addRecipeCatalyst(stack, SmelterRecipeCategory.CATEGORY); // registry.addRecipeCatalyst(stack, SmelterRecipeCategory.CATEGORY);
} //}
// //
// Cauldron // Cauldron
// //
registry.handleRecipes(CauldronRecipe.class, new CauldronRecipeHandler(), CauldronRecipeCategory.CATEGORY); registry.handleRecipes(CrucibleCrafting.class, new CrucibleRecipeHandler(), CrucibleRecipeCategory.CATEGORY);
registry.addRecipes(CauldronRecipeChecker.getRecipes(), CauldronRecipeCategory.CATEGORY); registry.addRecipes(CrucibleRecipeChecker.getRecipes(), CrucibleRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.CAULDRON), CauldronRecipeCategory.CATEGORY); //registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.CAULDRON), CrucibleRecipeCategory.CATEGORY);
// ***************************************************************************** // // ***************************************************************************** //
// In-World Tools // In-World Tools
@@ -161,7 +114,7 @@ public class ModJEI implements IModPlugin {
// //
// Flaking // Flaking
// //
registry.handleRecipes(FlakeRecipe.class, new FlakeRecipeHandler(), FlakeRecipeCategory.CATEGORY); /*registry.handleRecipes(FlakeRecipe.class, new FlakeRecipeHandler(), FlakeRecipeCategory.CATEGORY);
registry.addRecipes(FlakeRecipeChecker.getRecipes(), FlakeRecipeCategory.CATEGORY); registry.addRecipes(FlakeRecipeChecker.getRecipes(), FlakeRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(Blocks.STONE), FlakeRecipeCategory.CATEGORY); registry.addRecipeCatalyst(new ItemStack(Blocks.STONE), FlakeRecipeCategory.CATEGORY);
@@ -204,10 +157,11 @@ public class ModJEI implements IModPlugin {
registry.addRecipes(HoeRecipeChecker.getRecipes(), HoeRecipeCategory.CATEGORY); registry.addRecipes(HoeRecipeChecker.getRecipes(), HoeRecipeCategory.CATEGORY);
for (ItemStack stack : hoes) for (ItemStack stack : hoes)
registry.addRecipeCatalyst(stack, HoeRecipeCategory.CATEGORY); registry.addRecipeCatalyst(stack, HoeRecipeCategory.CATEGORY);
*/
// ***************************************************************************** // // ***************************************************************************** //
// Info // Info
// ***************************************************************************** // // ***************************************************************************** //
/*
registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.FISH_TRAP, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.fish_trap"); registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.FISH_TRAP, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.fish_trap");
registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.drying_rack"); registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.drying_rack");
registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.HIBACHI, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.hibachi"); registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.HIBACHI, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.hibachi");
@@ -246,10 +200,11 @@ public class ModJEI implements IModPlugin {
//registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.NETHER_GROWTH),ItemStack.class,"jei.info.primal.nethergrowth"); //registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.NETHER_GROWTH),ItemStack.class,"jei.info.primal.nethergrowth");
registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.DIRT_STICK), ItemStack.class, "jei.info.primal.debug_dirt_stick"); registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.DIRT_STICK), ItemStack.class, "jei.info.primal.debug_dirt_stick");
*/
this.cleanLists(); //this.cleanLists();
} }
/*
private void buildToolLists() { private void buildToolLists() {
for (Item item : ForgeRegistries.ITEMS.getValuesCollection()) { for (Item item : ForgeRegistries.ITEMS.getValuesCollection()) {
if (item != null) { if (item != null) {
@@ -281,4 +236,5 @@ public class ModJEI implements IModPlugin {
blades.clear(); blades.clear();
gallaghers.clear(); gallaghers.clear();
} }
*/
} }

View File

@@ -0,0 +1,103 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.*;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.compat.jei.AbstractCategory;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.init.ModInfo;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeCategory extends AbstractCategory<CrucibleRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("cauldron");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/cauldron.png");
private static ResourceLocation gui_progress = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/cauldron_progress.png");
private final IDrawable background;
private final IDrawableAnimated progress;
public CrucibleRecipeCategory(IGuiHelper guiHelper)
{
background = guiHelper.createDrawable(gui_background, 0, 0, 160, 60, 0, 0, 0, 0);
IDrawableStatic progressDrawable = guiHelper.createDrawable(gui_progress, -14, -1, 24, 52);
progress = guiHelper.createAnimatedDrawable(progressDrawable, 200, IDrawableAnimated.StartDirection.BOTTOM, false);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.primal.cauldron");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, CrucibleRecipeWrapper recipe, IIngredients ingredients)
{
IGuiFluidStackGroup fluids = layout.getFluidStacks();
IGuiItemStackGroup items = layout.getItemStacks();
// input fluid
fluids.init(0, true, 6, 8, 13, 48, 4000, true, null);
fluids.set(ingredients);
// output_items fluid
//if (recipe.output_fluid != null) {
fluids.init(1, false, 135, 8, 13, 48, 4000, true, null);
fluids.set(ingredients);
//}
// input items
items.init(0, true, 31, 18);
items.init(1, true, 50, 18);
items.init(2, true, 31, 37);
items.init(3, true, 50, 37);
//items.set(0, recipe.item_input_1);
//items.set(1, recipe.item_input_2);
//items.set(2, recipe.item_input_3);
//items.set(3, recipe.item_input_4);
//items.set(0, RecipeHelper.getSlotList(recipe.input_slots, 0));
//items.set(1, RecipeHelper.getSlotList(recipe.input_slots, 1));
//items.set(2, RecipeHelper.getSlotList(recipe.input_slots, 2));
//items.set(3, RecipeHelper.getSlotList(recipe.input_slots, 3));
// output_items items
//if (recipe.output_items != null) {
items.init(4, false, 104, 18);
items.set(ingredients);
items.init(5, false, 104, 37);
items.set(ingredients);
//}
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeChecker {
public static List<CrucibleCrafting> getRecipes() {
List<CrucibleCrafting> recipes = new ArrayList<>();
for (CrucibleCrafting recipe : CrucibleCrafting.RECIPES) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeHandler implements IRecipeWrapperFactory<CrucibleCrafting>
{
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CrucibleCrafting recipe)
{
return new CrucibleRecipeWrapper(recipe);
}
}

View File

@@ -0,0 +1,70 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeWrapper implements IRecipeWrapper
{
protected final CrucibleCrafting recipe;
//protected final List<Ingredient> ;
protected final int cookTemp;
protected final int cookTime;
protected final int coolTime;
protected final ItemStack dropsCooked;
protected final ItemStack dropsRaw;
protected Ingredient ing0;
protected Ingredient ing1;
protected Ingredient ing2;
protected Ingredient ing3;
protected Ingredient ing4;
protected List crucibleCrafting;
public CrucibleRecipeWrapper(CrucibleCrafting recipe)
{
this.recipe = recipe;
this.cookTemp = recipe.getCookTemp();
this.cookTime = recipe.getCookTime();
this.coolTime = recipe.getCoolTime();
this.dropsCooked = recipe.getDropsCooked();
this.dropsRaw = recipe.getDropsRaw();
this.ing0 = recipe.getIng0();
this.ing1 = recipe.getIng1();
this.ing2 = recipe.getIng2();
this.ing3 = recipe.getIng3();
this.ing4 = recipe.getIng4();
this.crucibleCrafting = recipe.getIngredientList();
}
@Override
public void getIngredients(IIngredients ingredients)
{
ingredients.setInput(Ingredient.class, this.crucibleCrafting);
//ingredients.setOutputs(ItemStack.class, this.dropsCooked);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
minecraft.fontRenderer.drawString(String.valueOf(cookTime), 80, 48, Color.gray.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(cookTemp), 80, 38, Color.gray.getRGB());
}
}

View File

@@ -0,0 +1,70 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistryEntry;
import nmd.primal.core.api.interfaces.ICustomRecipe;
import nmd.primal.forgecraft.ModInfo;
import java.util.Collection;
/**
* Created by mminaie on 9/15/18.
*/
public abstract class AbstractCrafting <RECIPE extends IForgeRegistryEntry.Impl<RECIPE>> extends IForgeRegistryEntry.Impl<RECIPE> implements ICustomRecipe<RECIPE>
{
private boolean is_disabled, is_hidden;
public AbstractCrafting()
{
this.is_disabled = false;
this.is_hidden = false;
}
abstract public Collection<RECIPE> getRecipes();
// ***************************************************************************** //
// Disable/Hidden Recipe controls
// ***************************************************************************** //
@Override
public RECIPE setDisabled(boolean is_disabled)
{
this.is_disabled = is_disabled;
return (RECIPE) this;
}
@Override
public RECIPE setHidden(boolean is_hidden)
{
this.is_hidden = is_hidden;
return (RECIPE) this;
}
@Override
public boolean isDisabled()
{
return this.is_disabled;
}
@Override
public boolean isHidden()
{
return this.is_hidden;
}
// ***************************************************************************** //
// Helper Methods
// ***************************************************************************** //
public static ResourceLocation getFullRecipeName(String prefix, String name)
{
return getFullRecipeName(ModInfo.MOD_ID, prefix, name);
}
public static ResourceLocation getFullRecipeName(String id, String prefix, String name)
{
return new ResourceLocation(id, prefix + "_" + name);
}
// ***************************************************************************** //
// ..
// ***************************************************************************** //
}

View File

@@ -1,138 +0,0 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
/**
* Created by mminaie on 1/24/17.
*/
public class BloomeryCrafting {
// ***************************************************************************** //
// Recipe Handler Bloomery
// ***************************************************************************** //
private static ArrayList<BloomeryCrafting> bloomeryRecipes = new ArrayList<>();
private ItemStack input;
private ItemStack output;
private ItemStack output_failed;
private ItemStack cool_output;
private int heat_threshold;
private int ideal_time;
private int cooldown;
private float heat_variance;
private float time_variance;
public BloomeryCrafting(ItemStack input, ItemStack output, ItemStack output_failed, ItemStack cool_output, int heat_threshold, int ideal_time, int cooldown,float heat_variance, float time_variance)
{
this.input = input;
this.output = output;
this.output_failed = output_failed;
this.cool_output = cool_output;
this.heat_threshold = heat_threshold;
this.ideal_time = ideal_time;
this.cooldown = cooldown;
this.heat_variance = heat_variance;
this.time_variance = time_variance;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(ItemStack input, ItemStack output, ItemStack failed, ItemStack cool, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
{
bloomeryRecipes.add(new BloomeryCrafting(input, output, failed, cool, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
}
public static boolean isRecipeItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return true;
}
return false;
}
public static boolean isOutputItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return true;
}
return false;
}
public static boolean isCoolItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.cool_output))
return true;
}
return false;
}
public static BloomeryCrafting getRecipe(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return recipe;
}
return null;
}
public static BloomeryCrafting getRecipeFromOutput(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return recipe;
}
return null;
}
public ItemStack getInput()
{
return this.input;
}
public ItemStack getOutput()
{
return this.output;
}
public ItemStack getOutputFailed()
{
return this.output_failed;
}
public ItemStack getCoolOutput()
{
return this.cool_output;
}
public int getHeatThreshold()
{
return this.heat_threshold;
}
public int getIdealTime()
{
return this.ideal_time;
}
public int getCooldown(){ return this.cooldown;}
public float getHeatVariance(){return this.heat_variance; }
public float getTimeVariance(){return this.time_variance; }
///
// end
///
}

View File

@@ -2,24 +2,71 @@ package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable;
import java.util.*; import java.util.*;
/** /**
* Created by mminaie on 11/11/17. * Created by mminaie on 11/11/17.
*/ */
public class CrucibleCrafting { public class CrucibleCrafting { //extends AbstractCrafting<CrucibleCrafting> {
// ***************************************************************************** // // ***************************************************************************** //
// Recipe Handler CrucibleHandler // Recipe Handler CrucibleHandler
// ***************************************************************************** // // ***************************************************************************** //
//public static final String RECIPE_PREFIX = "crucible";
//public static final IForgeRegistry<CrucibleCrafting> REGISTRY = ModInfo.Registries.CRUCIBLE_CRAFTINGS;
//public static final Collection<CrucibleCrafting> RECIPES = REGISTRY.getValuesCollection();
private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>(); private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>();
private int cookTemp; private int cookTemp;
private int cookTime; private int cookTime;
private int coolTime; private int coolTime;
public Ingredient getIng0() {
return ing0;
}
public void setIng0(Ingredient ing0) {
this.ing0 = ing0;
}
public Ingredient getIng1() {
return ing1;
}
public void setIng1(Ingredient ing1) {
this.ing1 = ing1;
}
public Ingredient getIng2() {
return ing2;
}
public void setIng2(Ingredient ing2) {
this.ing2 = ing2;
}
public Ingredient getIng3() {
return ing3;
}
public void setIng3(Ingredient ing3) {
this.ing3 = ing3;
}
public Ingredient getIng4() {
return ing4;
}
public void setIng4(Ingredient ing4) {
this.ing4 = ing4;
}
private Ingredient ing0; private Ingredient ing0;
private Ingredient ing1; private Ingredient ing1;
private Ingredient ing2; private Ingredient ing2;
@@ -29,6 +76,14 @@ public class CrucibleCrafting {
private ItemStack dropsCooked; private ItemStack dropsCooked;
private ItemStack dropsRaw; private ItemStack dropsRaw;
public List<Ingredient> getIngredientList() {
return ingredientList;
}
public void setIngredientList(List<Ingredient> ingredientList) {
this.ingredientList = ingredientList;
}
private List<Ingredient> ingredientList = new List<Ingredient>() { private List<Ingredient> ingredientList = new List<Ingredient>() {
@Override @Override
public int size() { public int size() {
@@ -152,7 +207,7 @@ public class CrucibleCrafting {
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 outputRaw, ItemStack outputCooked, ItemStack outputRaw, ItemStack outputCooked,
Integer temp, Integer cookTime, Integer coolTime){ Integer temp, Integer cookTime, Integer coolTime){
//super();
this.ing0 = i0; this.ing0 = i0;
this.ing1 = i1; this.ing1 = i1;
this.ing2 = i2; this.ing2 = i2;
@@ -227,4 +282,32 @@ public class CrucibleCrafting {
public ItemStack getDropsRaw() { public ItemStack getDropsRaw() {
return dropsRaw; return dropsRaw;
} }
/*
/// forge registries require a unique REGISTRY_NAME ///
@Override
public String getRecipePrefix()
{
return RECIPE_PREFIX;
}
@Override
public Collection<CrucibleCrafting> getRecipes()
{
return RECIPES;
}
/**
* Shim for getting a recipe directly from correctly formatted name
* @param recipe_name basic recipe name, no prefix or mod id
* @return Recipe object
*/
/*
@Nullable
public static CrucibleCrafting getRecipe(String recipe_name)
{
return REGISTRY.getValue(getFullRecipeName(RECIPE_PREFIX, recipe_name));
}
*/
} }

View File

@@ -13,8 +13,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.blocks.Anvil.AnvilIron; import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone; import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.*; import nmd.primal.forgecraft.blocks.*;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible; import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
/** /**

View File

@@ -9,9 +9,11 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.OreIngredient;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.recipes.irecipe.RecipeHandler; import nmd.primal.core.common.recipes.irecipe.RecipeHandler;
import nmd.primal.forgecraft.crafting.*; import nmd.primal.forgecraft.crafting.AnvilCrafting;
import nmd.primal.forgecraft.crafting.CastingformCrafting;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
/** /**
@@ -29,6 +31,7 @@ public class ModCrafting{
/***CRUCIBLE CRAFTING***/ /***CRUCIBLE CRAFTING***/
/***********************/ /***********************/
CrucibleCrafting.addRecipe( CrucibleCrafting.addRecipe(
new OreIngredient("oreIron"), new OreIngredient("oreIron"),
Ingredient.EMPTY, Ingredient.EMPTY,

View File

@@ -13,7 +13,6 @@ public class ModTiles {
registerTileEntity(TileForge.class, "firebox"); registerTileEntity(TileForge.class, "firebox");
registerTileEntity(TilePistonBellows.class, "pistonbellows"); registerTileEntity(TilePistonBellows.class, "pistonbellows");
registerTileEntity(TileBloomery.class, "bloomery"); registerTileEntity(TileBloomery.class, "bloomery");
registerTileEntity(TileBaseCrucible.class, "basecrucible");
registerTileEntity(TileAnvil.class, "anvil"); registerTileEntity(TileAnvil.class, "anvil");
registerTileEntity(TileBreaker.class, "breaker"); registerTileEntity(TileBreaker.class, "breaker");
registerTileEntity(TileCastingForm.class, "castingform"); registerTileEntity(TileCastingForm.class, "castingform");

View File

@@ -0,0 +1,202 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreIngredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.recipes.tile.CauldronRecipe;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModItems;
/**
* Created by mminaie on 9/15/18.
*/
/*
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public final class CrucibleRecipes {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<CrucibleCrafting> event)
{
final IForgeRegistry<CrucibleCrafting> registry = event.getRegistry();
/***Default Recipe***/
/**
registry.register(new CrucibleCrafting(
).setRecipeName(""));
***/
/*
registry.register(new CrucibleCrafting(
new OreIngredient("oreIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(Blocks.IRON_ORE, 1),
new ItemStack(ModItems.ironingotball, 1),
100,
100,
1000).setRecipeName("wroughtiron"));
registry.register(new CrucibleCrafting(
new OreIngredient("dustIron"),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CARBONATE_SLACK, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.IRON_DUST, 1),
new ItemStack(ModItems.ironcleaningotball, 1),
100,
100,
1000).setRecipeName("cleaniron"));
registry.register(new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.ironcleaningotball, 1)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_HIGH, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(ModItems.ironcleaningotball, 1),
new ItemStack(ModItems.steelingotball, 1),
100,
100,
1000
).setRecipeName("steel"));
registry.register(new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
new OreIngredient("dustMagnetite"),
new ItemStack(PrimalAPI.Blocks.ORE_MAGNETITE, 1),
new ItemStack(ModItems.wootzingotball, 1),
100,
100,
1000
).setRecipeName("damascus"));
registry.register(new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
new OreIngredient("magnetite"),
new ItemStack(PrimalAPI.Blocks.ORE_MAGNETITE, 1),
new ItemStack(ModItems.wootzingotball, 1),
100,
100,
1000
).setRecipeName("damascus"));
registry.register(new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.bronzeingotball, 1),
100,
100,
1000
).setRecipeName("bronzebasic"));
NBTTagCompound tagBronzeDefault = new NBTTagCompound();
tagBronzeDefault.setString("upgrades", "");
ItemStack defaultBronze = new ItemStack(ModItems.bronzeingotball, 1);
defaultBronze.setTagCompound(tagBronzeDefault.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("oreBronze"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultBronze,
100,
100,
1000
).setRecipeName("defaultbronze"));
NBTTagCompound tag = new NBTTagCompound();
tag.setString("upgrades", "redstone");
ItemStack redBronze = new ItemStack(ModItems.bronzeingotball, 1);
registry.register(new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redBronze,
100,
100,
100
).setRecipeName("redbronze"));
NBTTagCompound diamondBronzeTag = new NBTTagCompound();
tag.setString("upgrades", "diamond");
ItemStack diamondBronze = new ItemStack(ModItems.bronzeingotball, 1);
diamondBronze.setTagCompound(diamondBronzeTag.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
100,
100,
100
).setRecipeName("diamondbronze"));
NBTTagCompound emeraldBronzeTag = new NBTTagCompound();
tag.setString("upgrades", "emerald");
ItemStack emeraldBronze = new ItemStack(ModItems.bronzeingotball, 1);
emeraldBronze.setTagCompound(emeraldBronzeTag.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
100,
100,
100
).setRecipeName("emeraldbronze"));
NBTTagCompound tagBronzeLapis = new NBTTagCompound();
tagBronzeDefault.setString("upgrades", "lapis");
ItemStack lapisBronze = new ItemStack(ModItems.bronzeingotball, 1);
lapisBronze.setTagCompound(tagBronzeLapis.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("oreBronze"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisBronze,
100,
100,
1000
).setRecipeName("lapisbronze"));
}
}

View File

@@ -4,7 +4,6 @@ import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.IItemPropertyGetter;

View File

@@ -15,15 +15,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
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.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.api.interfaces.IPickup; import nmd.primal.core.api.interfaces.IPickup;
import nmd.primal.core.common.PrimalCore;
import nmd.primal.core.common.helper.FluidHelper;
import nmd.primal.core.common.helper.NBTHelper; import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.tiles.AbstractTileTank; import nmd.primal.core.common.tiles.AbstractTileTank;

View File

@@ -1,39 +0,0 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ITickable;
import net.minecraft.world.World;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
/**
* Created by mminaie on 2/4/17.
*/
public class TileBaseCrucible extends BaseTile implements ITickable {
private int iteration = 0;
public int countdown = 0;
@Override
public void update () {
if (!world.isRemote) {
World world = this.getWorld();
IBlockState state = world.getBlockState(this.pos);
iteration++;
//System.out.println(iteration);
if(iteration == 100 ){
iteration = 0;
countdown += 100;
//System.out.println(countdown);
BloomeryCrafting recipe = BloomeryCrafting.getRecipeFromOutput(new ItemStack(state.getBlock(), 1));
if(recipe != null){
if (countdown > recipe.getCooldown()){
world.setBlockState(this.pos, Block.getBlockFromItem(recipe.getCoolOutput().getItem()).getDefaultState(), 3);
countdown = 0;
}
}
}
}
}
}

View File

@@ -15,7 +15,6 @@ import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.FireHelper; import nmd.primal.core.common.helper.FireHelper;
import nmd.primal.core.common.helper.RecipeHelper; import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.blocks.BloomeryBase; import nmd.primal.forgecraft.blocks.BloomeryBase;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible; import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
import nmd.primal.forgecraft.crafting.CrucibleCrafting; import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
@@ -284,9 +283,6 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
if (stack.getItem() == ModItems.softcrucible) { if (stack.getItem() == ModItems.softcrucible) {
return true; return true;
} }
if(Block.getBlockFromItem(stack.getItem()) instanceof Crucible ){
return true;
}
if(Block.getBlockFromItem(stack.getItem()) instanceof NBTCrucible ){ if(Block.getBlockFromItem(stack.getItem()) instanceof NBTCrucible ){
return true; return true;
} }

View File

@@ -9,12 +9,16 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.api.interfaces.IRecipeCache;
import nmd.primal.forgecraft.crafting.CrucibleCrafting; import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by mminaie on 11/11/17. * Created by mminaie on 11/11/17.
*/ */
public class TileNBTCrucible extends BaseTile implements ITickable { public class TileNBTCrucible extends BaseTile implements ITickable, IRecipeCache<CrucibleCrafting> {
private ItemStack drops; private ItemStack drops;
private int heat; private int heat;
@@ -126,6 +130,36 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
return nbt; return nbt;
} }
// ***************************************************************************** //
// IRecipeCache
// ***************************************************************************** //
private List<CrucibleCrafting> recipe_cache = new ArrayList<>();
@Override
public List<CrucibleCrafting> getRecipeCache()
{
return recipe_cache;
}
@Override
public CrucibleCrafting matchRecipe()
{
for (CrucibleCrafting recipe : this.getRecipeCache()) {
if (recipe.isRecipe(this.ingList.get(0), this.ingList.get(1), this.ingList.get(2), this.ingList.get(3), this.ingList.get(4))) {
return recipe;
}
}
for (CrucibleCrafting recipe : CrucibleCrafting.RECIPES) {
if (recipe.isRecipe(this.ingList.get(0), this.ingList.get(1), this.ingList.get(2), this.ingList.get(3), this.ingList.get(4))) {
this.addRecipeCache(recipe);
return recipe;
}
}
return null;
}
} }
/* /*

View File

@@ -1,6 +1,5 @@
package nmd.primal.forgecraft.util; package nmd.primal.forgecraft.util;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -14,7 +13,6 @@ import net.minecraft.world.World;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.items.tools.Gallagher; import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.crafting.AnvilCrafting; import nmd.primal.forgecraft.crafting.AnvilCrafting;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem; import nmd.primal.forgecraft.items.BaseMultiItem;

View File

@@ -1,22 +1,15 @@
package nmd.primal.forgecraft.util; package nmd.primal.forgecraft.util;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.ItemStackHandler;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.PrimalCore;
import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.helper.RecipeHelper; import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.core.common.init.recipes.custom.RecipesGallagher;
import nmd.primal.core.common.recipes.AbstractToolRecipe;
import nmd.primal.core.common.recipes.inworld.GallagherRecipe; import nmd.primal.core.common.recipes.inworld.GallagherRecipe;
import nmd.primal.forgecraft.blocks.CustomContainerFacing; import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileBreaker; import nmd.primal.forgecraft.tiles.TileBreaker;