crucible happy path is working
This commit is contained in:
@@ -32,6 +32,7 @@ import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.core.common.helper.WorldHelper;
|
||||
import nmd.primal.core.common.tiles.machines.TileStorageCrate;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.ItemCrucible;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
@@ -66,8 +67,13 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
|
||||
/**PICKS UP THE CRUCIBLE**/
|
||||
if(pItem.isEmpty()){
|
||||
if(!player.isSneaking()) {
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
|
||||
if(recipe != null){
|
||||
tile.setDrops(recipe.getDropsRaw());
|
||||
}
|
||||
return takeBlock(world, pos, state, face, player);
|
||||
}
|
||||
}
|
||||
@@ -128,7 +134,6 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
if (tile instanceof TileNBTCrucible) {
|
||||
|
||||
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, this.getItem(world, pos, state));
|
||||
|
||||
//world.updateComparatorOutputLevel(pos, state.getBlock());
|
||||
return world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||
}
|
||||
@@ -139,10 +144,16 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
// Spawn the dropped daub repair_item here to avoid collision with the remaining block,
|
||||
// otherwise the repair_item entities was getting thrown off in random directions well beyond pickup range
|
||||
//if (!world.isRemote)
|
||||
// CommonUtils.spawnItemOnPlayer(world, player, this.getItem(world, pos, state));
|
||||
if (!world.isRemote) {
|
||||
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
|
||||
System.out.println("Harvested" + tile.getStatus() + " | " + tile.getHot());
|
||||
if(recipe != null && tile.getStatus() && !tile.getHot()){
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, tile.getDrops());
|
||||
System.out.println("Drop stuff");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -81,9 +81,11 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
|
||||
private void slotOneManager(){
|
||||
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
NBTTagCompound tag = this.getSlotStack(1).getSubCompound("BlockEntityTag");
|
||||
if(tag != null) {
|
||||
ItemStackHelper.loadAllItems(tag, ingList);
|
||||
ItemStackHelper.loadAllItems(tag, dropList);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
if (recipe != null) {
|
||||
if (this.getHeat() >= recipe.getCookTemp() &&
|
||||
@@ -93,11 +95,10 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
if (cookCounter >= recipe.getCookTime() &&
|
||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
|
||||
if (cookCounter >= recipe.getCookTime() && !this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
||||
cookCounter = 0;
|
||||
//dropList.set(0, recipe.getDropsCooked());
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@@ -8,22 +8,23 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 11/11/17.
|
||||
*/
|
||||
public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
|
||||
private Item drops;
|
||||
private ItemStack drops;
|
||||
private int heat;
|
||||
private boolean hot;
|
||||
private boolean status;
|
||||
|
||||
public Item getDrops() {
|
||||
public ItemStack getDrops() {
|
||||
return drops;
|
||||
}
|
||||
|
||||
public void setDrops(Item drops) {
|
||||
public void setDrops(ItemStack drops) {
|
||||
this.drops = drops;
|
||||
}
|
||||
|
||||
@@ -60,13 +61,29 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
//public NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
if (!world.isRemote) {
|
||||
World world = this.getWorld();
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
coolManager();
|
||||
}
|
||||
}
|
||||
|
||||
private void coolManager() {
|
||||
if(this.getHot()){
|
||||
if(this.getHeat() > 0){
|
||||
this.setHeat( this.getHeat() - 1);
|
||||
System.out.println(this.getHeat());
|
||||
}
|
||||
if(this.getHeat() == 0){
|
||||
this.setHot(false);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
this.setDrops(recipe.getDropsCooked());
|
||||
}
|
||||
//CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +96,8 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
super.readNBT(nbt);
|
||||
this.ingList = NonNullList.<ItemStack>withSize(this.ingList.size(), ItemStack.EMPTY);
|
||||
ItemStackHelper.loadAllItems(nbt, this.ingList);
|
||||
//this.dropList = NonNullList.<ItemStack>withSize(this.dropList.size(), ItemStack.EMPTY);
|
||||
//ItemStackHelper.loadAllItems(nbt, this.dropList);
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.hot = nbt.getBoolean("hot");
|
||||
this.status = nbt.getBoolean("status");
|
||||
@@ -89,6 +108,7 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
ItemStackHelper.saveAllItems(nbt, this.ingList);
|
||||
//ItemStackHelper.saveAllItems(nbt, this.dropList);
|
||||
nbt.setInteger("heat", this.heat);
|
||||
nbt.setBoolean("hot", this.hot);
|
||||
nbt.setBoolean("status", this.status);
|
||||
|
||||
BIN
kfc/src/main/resources/assets/forgecraft/textures/Thumbs.db
Normal file
BIN
kfc/src/main/resources/assets/forgecraft/textures/Thumbs.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user