tried to add primal version 0.2.26
This commit is contained in:
@@ -102,6 +102,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)) {
|
||||
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
|
||||
tile.setHeat(100);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
|
||||
@@ -98,6 +98,8 @@ public class ForgeCrafting {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public IBlockState getStartState() {return this.start_state;}
|
||||
|
||||
public IBlockState getOutput()
|
||||
{
|
||||
return this.end_state;
|
||||
|
||||
@@ -13,7 +13,9 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.forgecraft.blocks.Forge;
|
||||
import nmd.primal.forgecraft.blocks.IngotBall;
|
||||
import nmd.primal.forgecraft.crafting.ForgeCrafting;
|
||||
import org.omg.PortableInterceptor.ACTIVE;
|
||||
|
||||
import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime;
|
||||
|
||||
@@ -36,6 +38,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
||||
this.iteration ++;
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ());
|
||||
IBlockState aboveState = world.getBlockState(abovePos);
|
||||
Block block = world.getBlockState(abovePos).getBlock();
|
||||
if(this.iteration == 300 ) {
|
||||
this.iteration = 0;
|
||||
@@ -62,14 +65,10 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
||||
}
|
||||
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
||||
}
|
||||
craftingManager(block, world, abovePos);
|
||||
craftingManager(block, world, abovePos, aboveState);
|
||||
}
|
||||
}
|
||||
|
||||
private void forgeRecipeManager(){
|
||||
|
||||
}
|
||||
|
||||
private void furnaceManager(BlockPos abovePos){
|
||||
if(world.getBlockState(abovePos).getBlock() instanceof BlockFurnace){
|
||||
TileEntityFurnace tileFurnace = (TileEntityFurnace) world.getTileEntity(abovePos);
|
||||
@@ -110,19 +109,25 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
||||
}
|
||||
|
||||
|
||||
private void craftingManager(Block block, World world, BlockPos pos){
|
||||
private void craftingManager(Block block, World world, BlockPos pos, IBlockState state){
|
||||
ForgeCrafting recipe = ForgeCrafting.getRecipe(block);
|
||||
if(recipe != null){
|
||||
if(this.getHeat() >= recipe.getHeatThreshold()){
|
||||
if(this.getHeat() >= recipe.getHeatThreshold() && recipe.getStartState().equals(state) ){
|
||||
cookCounter++;
|
||||
}
|
||||
if(this.getHeat() < recipe.getHeatThreshold() && cookCounter > 0){
|
||||
cookCounter--;
|
||||
}
|
||||
if(cookCounter >= recipe.getIdealTime() ){
|
||||
world.setBlockState(pos, recipe.getCoolOutput(), 3);
|
||||
world.setBlockState(pos, recipe.getOutput(), 3);
|
||||
cookCounter = 0;
|
||||
}
|
||||
/*
|
||||
System.out.println(state.getValue(IngotBall.ACTIVE) + " : " + recipe.getStartState());
|
||||
System.out.println(cookCounter + " : " + recipe.getIdealTime());
|
||||
System.out.println(this.heat + " : " + recipe.getHeatThreshold());
|
||||
System.out.println("========");
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user