Reworked Forge to use slots instead of on top blocks, need to create forging recipe for hot toolhead and create anvil recipe for modified toolheads
This commit is contained in:
@@ -3,15 +3,16 @@ To-Dos
|
|||||||
*** Priority ***
|
*** Priority ***
|
||||||
|
|
||||||
- [ ] Allow redstone, lapis, and shards in the anvil
|
- [ ] Allow redstone, lapis, and shards in the anvil
|
||||||
- [ ] Fix renderings in the anvil
|
- [ ] Fix renderings in the Anvil
|
||||||
|
- [ ] Fix Renderings in the Forge
|
||||||
- [ ] Create toolHead Item
|
- [ ] Create toolHead Item
|
||||||
- [ ] Give toolHead item NBT
|
- [ ] Give toolHead item NBT
|
||||||
- [x] Create pickaxehead Item
|
- [x] Create pickaxehead Item
|
||||||
- [ ] Create pickaxehead SubNBTs
|
- [x] Create pickaxehead SubNBTs
|
||||||
- [ ] Create Forging Recipe for toolHeads
|
- [ ] Create Forging Recipe for toolHeads
|
||||||
- [ ] Create Anvil recipe for toolHeads
|
- [ ] Create Anvil recipe for toolHeads
|
||||||
|
|
||||||
- [ ] Create Slot for Firebox to accept toolheads
|
- [ ] Create Slot for Forge to accept toolheads in slot 4
|
||||||
|
|
||||||
- [ ] Add forgehammer to oreDict
|
- [ ] Add forgehammer to oreDict
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ 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.api.PrimalBlocks;
|
//import nmd.primal.core.api.PrimalBlocks;
|
||||||
|
import nmd.primal.core.api.PrimalItems;
|
||||||
import nmd.primal.forgecraft.CommonUtils;
|
import nmd.primal.forgecraft.CommonUtils;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModBlocks;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
|
import nmd.primal.forgecraft.items.toolparts.ToolPart;
|
||||||
import nmd.primal.forgecraft.tiles.TileForge;
|
import nmd.primal.forgecraft.tiles.TileForge;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -78,10 +82,25 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
|
|||||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
ItemStack pItem = player.inventory.getCurrentItem();
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
ItemStack tileItem = tile.getSlotStack(0);
|
ItemStack fuelItem = tile.getSlotStack(0);
|
||||||
|
/*
|
||||||
|
System.out.println(tile.getSlotStack(0));
|
||||||
|
System.out.println(tile.getSlotStack(1));
|
||||||
|
System.out.println(tile.getSlotStack(2));
|
||||||
|
System.out.println(tile.getSlotStack(3));
|
||||||
|
System.out.println(tile.getSlotStack(4));
|
||||||
|
System.out.println(tile.getSlotStack(5));
|
||||||
|
System.out.println(tile.getSlotStack(6));
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
FUEL SLOT CODE
|
||||||
|
***********************/
|
||||||
if(pItem.isEmpty()) {
|
if(pItem.isEmpty()) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (!tileItem.isEmpty()) {
|
if (!fuelItem.isEmpty()) {
|
||||||
|
if(facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH || facing == EnumFacing.EAST || facing == EnumFacing.WEST ) {
|
||||||
|
//System.out.println();
|
||||||
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(0));
|
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(0));
|
||||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
@@ -89,6 +108,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(!player.isSneaking()){
|
if(!player.isSneaking()){
|
||||||
if(world.getBlockState(pos).getValue(ACTIVE) == true){
|
if(world.getBlockState(pos).getValue(ACTIVE) == true){
|
||||||
Integer tempInt = tile.getHeat();
|
Integer tempInt = tile.getHeat();
|
||||||
@@ -100,7 +120,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((pItem.getItem() == Items.FLINT_AND_STEEL) /*|| (pItem.getItem() == PrimalItems.FIRE_BOW)*/ || pItem.getItem() == Item.getItemFromBlock(Blocks.TORCH)) {
|
if((pItem.getItem() == Items.FLINT_AND_STEEL) || (pItem.getItem() == PrimalItems.FIRE_BOW) || pItem.getItem() == Item.getItemFromBlock(Blocks.TORCH)) {
|
||||||
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
|
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
|
||||||
tile.setHeat(100);
|
tile.setHeat(100);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
@@ -108,19 +128,19 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
||||||
if (!tileItem.isEmpty()){
|
if (!fuelItem.isEmpty()){
|
||||||
if(pItem.getItem() == tileItem.getItem()){
|
if(pItem.getItem() == fuelItem.getItem()){
|
||||||
if(tileItem.getCount() < 64){
|
if(fuelItem.getCount() < 64){
|
||||||
if(tileItem.getCount() + pItem.getCount() <= 64){
|
if(fuelItem.getCount() + pItem.getCount() <= 64){
|
||||||
tileItem.grow(pItem.getCount());
|
fuelItem.grow(pItem.getCount());
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.updateBlock();
|
tile.updateBlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(tileItem.getCount() + pItem.getCount() > 64){
|
if(fuelItem.getCount() + pItem.getCount() > 64){
|
||||||
pItem.setCount(64-pItem.getCount());
|
pItem.setCount(64-pItem.getCount());
|
||||||
tileItem.setCount(64);
|
fuelItem.setCount(64);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.updateBlock();
|
tile.updateBlock();
|
||||||
return true;
|
return true;
|
||||||
@@ -128,12 +148,95 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tileItem.isEmpty()) {
|
if(fuelItem.isEmpty()) {
|
||||||
tile.setSlotStack(0, pItem);
|
tile.setSlotStack(0, pItem);
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/***********************
|
||||||
|
FORGING SLOTS CODE
|
||||||
|
***********************/
|
||||||
|
//REMOVE COOL INGOT
|
||||||
|
if(facing == EnumFacing.UP ) {
|
||||||
|
if (pItem.isEmpty()) {
|
||||||
|
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||||
|
System.out.println(i);
|
||||||
|
if (!tile.getSlotStack(i).isEmpty()) {
|
||||||
|
if (tile.getSlotStack(i).getItem().equals(new ItemStack(ModBlocks.ironchunk).getItem())) {
|
||||||
|
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||||
|
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (tile.getSlotStack(i).getItem().equals(new ItemStack(ModBlocks.ironball).getItem())) {
|
||||||
|
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||||
|
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(tile.getSlotStack(i).hasTagCompound() == true){
|
||||||
|
if (tile.getSlotStack(i).getTagCompound().getBoolean("hot") == false) {
|
||||||
|
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||||
|
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (pItem.getItem().equals(new ItemStack(ModBlocks.ironchunk).getItem())) {
|
||||||
|
//System.out.println("Activating");
|
||||||
|
for (int i = 2; i <= tile.getSlotListSize(); i++) {
|
||||||
|
if (tile.getSlotStack(i).isEmpty()) {
|
||||||
|
tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1));
|
||||||
|
pItem.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pItem.getItem().equals(new ItemStack(ModBlocks.ironball).getItem())) {
|
||||||
|
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||||
|
if (tile.getSlotStack(i).isEmpty()) {
|
||||||
|
tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1));
|
||||||
|
pItem.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (pItem.getItem().equals(ModItems.stonetongs)) {
|
||||||
|
if (pItem.getTagCompound().getInteger("type") == 0) {
|
||||||
|
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||||
|
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
|
||||||
|
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||||
|
pItem.getTagCompound().setInteger("type", 7);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
|
||||||
|
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||||
|
pItem.getTagCompound().setInteger("type", 6);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
To-Do
|
||||||
|
Insert StoneTongs Code for ToolPart Hot
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pItem.getItem() instanceof ToolPart){
|
||||||
|
if(tile.getSlotStack(4).isEmpty()){
|
||||||
|
tile.setSlotStack(4, pItem);
|
||||||
|
pItem.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package nmd.primal.forgecraft.crafting;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -16,24 +17,18 @@ public class ForgeCrafting {
|
|||||||
// ***************************************************************************** //
|
// ***************************************************************************** //
|
||||||
private static ArrayList<ForgeCrafting> forgeRecipes = new ArrayList<>();
|
private static ArrayList<ForgeCrafting> forgeRecipes = new ArrayList<>();
|
||||||
|
|
||||||
private Block input;
|
private Item input;
|
||||||
private IBlockState start_state;
|
private Item output;
|
||||||
private IBlockState end_state;
|
|
||||||
private ItemStack output_failed;
|
|
||||||
private IBlockState cool_state;
|
|
||||||
|
|
||||||
private int heat_threshold;
|
private int heat_threshold;
|
||||||
private int ideal_time;
|
private int ideal_time;
|
||||||
private int cooldown;
|
private int cooldown;
|
||||||
|
|
||||||
|
|
||||||
public ForgeCrafting(Block input, IBlockState startState, IBlockState endState, ItemStack output_failed, IBlockState coolState, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
public ForgeCrafting(Item input, Item output, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
||||||
{
|
{
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.start_state = startState;
|
this.output = output;
|
||||||
this.end_state = endState;
|
|
||||||
this.output_failed = output_failed;
|
|
||||||
this.cool_state = coolState;
|
|
||||||
this.heat_threshold = heat_threshold;
|
this.heat_threshold = heat_threshold;
|
||||||
this.ideal_time = ideal_time;
|
this.ideal_time = ideal_time;
|
||||||
this.cooldown = cooldown;
|
this.cooldown = cooldown;
|
||||||
@@ -43,77 +38,44 @@ public class ForgeCrafting {
|
|||||||
// ***************************************************************************** //
|
// ***************************************************************************** //
|
||||||
// Recipe Methods
|
// Recipe Methods
|
||||||
// ***************************************************************************** //
|
// ***************************************************************************** //
|
||||||
public static void addRecipe(Block input, IBlockState startState, IBlockState endState, ItemStack output_failed, IBlockState coolState, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
public static void addRecipe(Item input, Item output, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
||||||
{
|
{
|
||||||
forgeRecipes.add(new ForgeCrafting(input, startState, endState, output_failed, coolState, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
|
forgeRecipes.add(new ForgeCrafting(input, output, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRecipeItem(Block block)
|
public static boolean isRecipeItem(Item item)
|
||||||
{
|
{
|
||||||
for(ForgeCrafting recipe : forgeRecipes) {
|
for(ForgeCrafting recipe : forgeRecipes) {
|
||||||
if (block.equals(recipe.input))
|
if (item.equals(recipe.input))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOutputState(IBlockState state)
|
public static ForgeCrafting getRecipe(Item item)
|
||||||
{
|
{
|
||||||
for(ForgeCrafting recipe : forgeRecipes) {
|
for(ForgeCrafting recipe : forgeRecipes) {
|
||||||
if (state.equals(recipe.end_state))
|
if (item.equals(recipe.input))
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isCoolState(IBlockState coolState)
|
|
||||||
{
|
|
||||||
for(ForgeCrafting recipe : forgeRecipes) {
|
|
||||||
if (coolState.equals(recipe.cool_state))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ForgeCrafting getRecipe(Block block)
|
|
||||||
{
|
|
||||||
for(ForgeCrafting recipe : forgeRecipes) {
|
|
||||||
if (block.equals(recipe.input))
|
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ForgeCrafting getRecipeFromOutput(Block block, IBlockState state)
|
public static ForgeCrafting getRecipeFromOutput(Item item)
|
||||||
{
|
{
|
||||||
for(ForgeCrafting recipe : forgeRecipes) {
|
for(ForgeCrafting recipe : forgeRecipes) {
|
||||||
if (block.equals(recipe.input) && state.equals(recipe.end_state))
|
if (item.equals(recipe.output))
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getInput()
|
public Item getInput()
|
||||||
{
|
{
|
||||||
return this.input;
|
return this.input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBlockState getStartState() {return this.start_state;}
|
public Item getOutput() {return this.output; }
|
||||||
|
|
||||||
public IBlockState getOutput()
|
|
||||||
{
|
|
||||||
return this.end_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getOutputFailed()
|
|
||||||
{
|
|
||||||
return this.output_failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBlockState getCoolOutput()
|
|
||||||
{
|
|
||||||
return this.cool_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeatThreshold()
|
public int getHeatThreshold()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -143,11 +143,8 @@ public class ModCrafting {
|
|||||||
|
|
||||||
//Makes a Hot Iron Ingot
|
//Makes a Hot Iron Ingot
|
||||||
ForgeCrafting.addRecipe(
|
ForgeCrafting.addRecipe(
|
||||||
ModBlocks.ironball,
|
Item.getItemFromBlock(ModBlocks.ironball),
|
||||||
ModBlocks.ironball.getDefaultState().withProperty(IngotBall.ACTIVE, false),
|
ModItems.ironingotballhot,
|
||||||
ModBlocks.ironball.getDefaultState().withProperty(IngotBall.ACTIVE, true),
|
|
||||||
new ItemStack(ModBlocks.ironball, 1),
|
|
||||||
ModBlocks.ironball.getDefaultState().withProperty(IngotBall.ACTIVE, false),
|
|
||||||
800,
|
800,
|
||||||
200,
|
200,
|
||||||
500,
|
500,
|
||||||
@@ -157,13 +154,10 @@ public class ModCrafting {
|
|||||||
|
|
||||||
//Makes a Hot Iron Chunk
|
//Makes a Hot Iron Chunk
|
||||||
ForgeCrafting.addRecipe(
|
ForgeCrafting.addRecipe(
|
||||||
ModBlocks.ironchunk,
|
Item.getItemFromBlock(ModBlocks.ironchunk),
|
||||||
ModBlocks.ironchunk.getDefaultState().withProperty(IngotBall.ACTIVE, false),
|
ModItems.ironchunkhot,
|
||||||
ModBlocks.ironchunk.getDefaultState().withProperty(IngotBall.ACTIVE, true),
|
|
||||||
new ItemStack(ModBlocks.ironchunk, 1),
|
|
||||||
ModBlocks.ironchunk.getDefaultState().withProperty(IngotBall.ACTIVE, false),
|
|
||||||
800,
|
800,
|
||||||
170,
|
160,
|
||||||
400,
|
400,
|
||||||
1.0f,
|
1.0f,
|
||||||
1.0f
|
1.0f
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.block.BlockFurnace;
|
|||||||
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.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntityFurnace;
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
@@ -24,12 +25,12 @@ import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime;
|
|||||||
*/
|
*/
|
||||||
public class TileForge extends TileBaseSlot implements ITickable {
|
public class TileForge extends TileBaseSlot implements ITickable {
|
||||||
|
|
||||||
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(7, ItemStack.EMPTY);
|
||||||
//private ItemStack[] inventory = new ItemStack [0];
|
//private ItemStack[] inventory = new ItemStack [0];
|
||||||
//private String customName;
|
//private String customName;
|
||||||
private int iteration = 0;
|
private int iteration = 0;
|
||||||
private int heat;
|
private int heat;
|
||||||
private int cookCounter;
|
private int cookCounter2, cookCounter3, cookCounter4, cookCounter5, cookCounter6;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update () {
|
public void update () {
|
||||||
@@ -40,6 +41,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
|||||||
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ());
|
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ());
|
||||||
IBlockState aboveState = world.getBlockState(abovePos);
|
IBlockState aboveState = world.getBlockState(abovePos);
|
||||||
Block block = world.getBlockState(abovePos).getBlock();
|
Block block = world.getBlockState(abovePos).getBlock();
|
||||||
|
|
||||||
if(this.iteration == 300 ) {
|
if(this.iteration == 300 ) {
|
||||||
this.iteration = 0;
|
this.iteration = 0;
|
||||||
|
|
||||||
@@ -60,25 +62,11 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
|||||||
this.markDirty();
|
this.markDirty();
|
||||||
this.updateBlock();
|
this.updateBlock();
|
||||||
}
|
}
|
||||||
this.furnaceManager(abovePos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
||||||
}
|
}
|
||||||
craftingManager(block, world, abovePos, aboveState);
|
craftingManager();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void furnaceManager(BlockPos abovePos){
|
|
||||||
if(world.getBlockState(abovePos).getBlock() instanceof BlockFurnace){
|
|
||||||
TileEntityFurnace tileFurnace = (TileEntityFurnace) world.getTileEntity(abovePos);
|
|
||||||
if(world.getBlockState(abovePos).getBlock() == Blocks.LIT_FURNACE){
|
|
||||||
tileFurnace.setField(0,1000);
|
|
||||||
}
|
|
||||||
if(world.getBlockState(abovePos).getBlock() == Blocks.FURNACE){
|
|
||||||
BlockFurnace.setState(true, world, abovePos);
|
|
||||||
tileFurnace.setField(0,1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,19 +97,74 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void craftingManager(Block block, World world, BlockPos pos, IBlockState state){
|
private void craftingManager() {
|
||||||
ForgeCrafting recipe = ForgeCrafting.getRecipe(block);
|
|
||||||
|
for (int i = 2; i < this.getSlotListSize(); i++) {
|
||||||
|
Item itemTest = this.getSlotStack(i).getItem();
|
||||||
|
ForgeCrafting recipe = ForgeCrafting.getRecipe(itemTest);
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
if(this.getHeat() >= recipe.getHeatThreshold() && recipe.getStartState().equals(state) ){
|
|
||||||
cookCounter++;
|
if(i == 2){
|
||||||
|
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||||
|
cookCounter2++;
|
||||||
}
|
}
|
||||||
if(this.getHeat() < recipe.getHeatThreshold() && cookCounter > 0){
|
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter2 > 0) {
|
||||||
cookCounter--;
|
cookCounter2--;
|
||||||
}
|
}
|
||||||
if(cookCounter >= recipe.getIdealTime() ){
|
if (cookCounter2 >= recipe.getIdealTime()) {
|
||||||
world.setBlockState(pos, recipe.getOutput(), 3);
|
this.setSlotStack(i, new ItemStack(recipe.getOutput(), 1));
|
||||||
cookCounter = 0;
|
cookCounter2 = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(i == 3){
|
||||||
|
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||||
|
cookCounter3++;
|
||||||
|
}
|
||||||
|
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter3 > 0) {
|
||||||
|
cookCounter3--;
|
||||||
|
}
|
||||||
|
if (cookCounter3 >= recipe.getIdealTime()) {
|
||||||
|
this.setSlotStack(i, new ItemStack(recipe.getOutput(), 1));
|
||||||
|
cookCounter3 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i == 4){
|
||||||
|
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||||
|
cookCounter4++;
|
||||||
|
}
|
||||||
|
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter4 > 0) {
|
||||||
|
cookCounter4--;
|
||||||
|
}
|
||||||
|
if (cookCounter4 >= recipe.getIdealTime()) {
|
||||||
|
this.setSlotStack(i, new ItemStack(recipe.getOutput(), 1));
|
||||||
|
cookCounter4 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i == 5){
|
||||||
|
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||||
|
cookCounter5++;
|
||||||
|
}
|
||||||
|
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter5 > 0) {
|
||||||
|
cookCounter5--;
|
||||||
|
}
|
||||||
|
if (cookCounter5 >= recipe.getIdealTime()) {
|
||||||
|
this.setSlotStack(i, new ItemStack(recipe.getOutput(), 1));
|
||||||
|
cookCounter5 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i == 6){
|
||||||
|
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||||
|
cookCounter6++;
|
||||||
|
}
|
||||||
|
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter6 > 0) {
|
||||||
|
cookCounter6--;
|
||||||
|
}
|
||||||
|
if (cookCounter6 >= recipe.getIdealTime()) {
|
||||||
|
this.setSlotStack(i, new ItemStack(recipe.getOutput(), 1));
|
||||||
|
cookCounter6 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
System.out.println(state.getValue(IngotBall.ACTIVE) + " : " + recipe.getStartState());
|
System.out.println(state.getValue(IngotBall.ACTIVE) + " : " + recipe.getStartState());
|
||||||
System.out.println(cookCounter + " : " + recipe.getIdealTime());
|
System.out.println(cookCounter + " : " + recipe.getIdealTime());
|
||||||
@@ -130,51 +173,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
private void slotOneManager(){
|
|
||||||
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(this.getSlotStack(1));
|
|
||||||
if(recipe != null){
|
|
||||||
//System.out.println(recipe.getIdealTime() + " : " + recipe.getHeatThreshold());
|
|
||||||
//System.out.println(this.cookCounter + " : " + this.getHeat());
|
|
||||||
//System.out.println("====================");
|
|
||||||
if(this.getHeat() >= recipe.getHeatThreshold()){
|
|
||||||
cookCounter++;
|
|
||||||
}
|
}
|
||||||
if(cookCounter >= recipe.getIdealTime() ){
|
|
||||||
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
|
|
||||||
this.setSlotStack(1, recipe.getOutput());
|
|
||||||
this.cookCounter = 0;
|
|
||||||
//System.out.print(" :Success: " + this.getSlotStack(1));
|
|
||||||
this.updateBlock();
|
|
||||||
this.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(cookCounter > recipe.getIdealTime() + (recipe.getIdealTime() * recipe.getTimeVariance())){
|
|
||||||
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
|
|
||||||
this.setSlotStack(1, recipe.getOutputFailed());
|
|
||||||
this.cookCounter = 0;
|
|
||||||
//System.out.print(" :Failure Time: " + this.getSlotStack(1));
|
|
||||||
this.updateBlock();
|
|
||||||
this.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(this.getHeat() > recipe.getHeatThreshold() + (recipe.getHeatThreshold() * recipe.getHeatVariance())){
|
|
||||||
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
|
|
||||||
this.setSlotStack(1, recipe.getOutputFailed());
|
|
||||||
this.cookCounter = 0;
|
|
||||||
//System.out.print(" :Failure Heat: " + this.getSlotStack(1));
|
|
||||||
this.updateBlock();
|
|
||||||
this.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.getSlotStack(1).isEmpty()){
|
|
||||||
this.cookCounter=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public int getHeat(){
|
public int getHeat(){
|
||||||
@@ -203,6 +202,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 159 B |
Binary file not shown.
|
Before Width: | Height: | Size: 141 B |
@@ -1,14 +1,20 @@
|
|||||||
{
|
{
|
||||||
"parent": "item/generated",
|
"parent": "forgecraft:item/pickaxehead",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "forgecraft:items/ironpickaxehead"
|
"particle": "forgecraft:blocks/iron_ingot",
|
||||||
|
"texture": "blocks/planks_oak",
|
||||||
|
"texture1": "forgecraft:blocks/iron_ingot"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"type": 0.0
|
"type": 0.0
|
||||||
},
|
},
|
||||||
"model": "forgecraft:item/pickaxehead"
|
"model": "forgecraft:item/ironpickaxehead_0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "forgecraft:item/pickaxehead",
|
||||||
|
"textures": {
|
||||||
|
"particle": "forgecraft:blocks/iron_ingot",
|
||||||
|
"texture": "blocks/planks_oak",
|
||||||
|
"texture1": "forgecraft:blocks/iron_ingot"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,5 +47,27 @@
|
|||||||
"east": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" }
|
"east": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"rotation": [ 180, 90, 0 ],
|
||||||
|
"translation": [ 0, 4.5, 0 ]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"rotation": [ 180, 90, 0 ],
|
||||||
|
"translation": [ 0, 6, 0 ]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [ 90, -45, 90 ],
|
||||||
|
"translation": [ 3.5, -3.5, 0 ]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"rotation": [ 180, 0, 0 ],
|
||||||
|
"translation": [ 0, 2, 0 ]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [ 180, 90, 0 ],
|
||||||
|
"translation": [ 0, 4.5, 0 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
|
||||||
|
"textures": {
|
||||||
|
"particle": "blocks/iron_ingot",
|
||||||
|
"texture": "blocks/planks_oak",
|
||||||
|
"texture1": "blocks/iron_ingot"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"__comment": "Cube2",
|
||||||
|
"from": [ 7, 13, 4.5 ],
|
||||||
|
"to": [ 9, 14, 11.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" },
|
||||||
|
"up": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" },
|
||||||
|
"north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
|
||||||
|
"south": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
|
||||||
|
"west": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" },
|
||||||
|
"east": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube5",
|
||||||
|
"from": [ 7.5, 13, 11 ],
|
||||||
|
"to": [ 8.5, 14, 14.5 ],
|
||||||
|
"rotation": { "origin": [ 7.5, 13, 11 ], "axis": "x", "angle": 22.5 },
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7.5, 1.5, 8.5, 5.5 ], "texture": "#texture1" },
|
||||||
|
"up": { "uv": [ 7.5, 10.5, 8.5, 14.5 ], "texture": "#texture1" },
|
||||||
|
"north": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
|
||||||
|
"south": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
|
||||||
|
"west": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" },
|
||||||
|
"east": { "uv": [ 1.5, 2.5, 5.5, 3 ], "texture": "#texture1" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube5",
|
||||||
|
"from": [ 7.5, 13, 1.5 ],
|
||||||
|
"to": [ 8.5, 14, 5 ],
|
||||||
|
"rotation": { "origin": [ 8.5, 13, 5 ], "axis": "x", "angle": -22.5 },
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7.5, 1.5, 8.5, 5.5 ], "texture": "#texture1", "rotation": 180 },
|
||||||
|
"up": { "uv": [ 7.5, 10.5, 8.5, 14.5 ], "texture": "#texture1", "rotation": 180 },
|
||||||
|
"north": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
|
||||||
|
"south": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
|
||||||
|
"west": { "uv": [ 1.5, 2.5, 5.5, 3 ], "texture": "#texture1" },
|
||||||
|
"east": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"rotation": [ 180, 90, 0 ],
|
||||||
|
"translation": [ 0, 4.5, 0 ]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"rotation": [ 180, 90, 0 ],
|
||||||
|
"translation": [ 0, 6, 0 ]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [ 90, -45, 90 ],
|
||||||
|
"translation": [ 3.5, -3.5, 0 ]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"rotation": [ 180, 0, 0 ],
|
||||||
|
"translation": [ 0, 2, 0 ]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [ 180, 90, 0 ],
|
||||||
|
"translation": [ 0, 4.5, 0 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user