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.helper.WorldHelper;
|
||||||
import nmd.primal.core.common.tiles.machines.TileStorageCrate;
|
import nmd.primal.core.common.tiles.machines.TileStorageCrate;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||||
import nmd.primal.forgecraft.init.ModItems;
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.items.ItemCrucible;
|
import nmd.primal.forgecraft.items.ItemCrucible;
|
||||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||||
@@ -66,8 +67,13 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
|||||||
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
ItemStack pItem = player.inventory.getCurrentItem();
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
|
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
|
||||||
|
/**PICKS UP THE CRUCIBLE**/
|
||||||
if(pItem.isEmpty()){
|
if(pItem.isEmpty()){
|
||||||
if(!player.isSneaking()) {
|
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);
|
return takeBlock(world, pos, state, face, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +134,6 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
|||||||
if (tile instanceof TileNBTCrucible) {
|
if (tile instanceof TileNBTCrucible) {
|
||||||
|
|
||||||
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, this.getItem(world, pos, state));
|
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, this.getItem(world, pos, state));
|
||||||
|
|
||||||
//world.updateComparatorOutputLevel(pos, state.getBlock());
|
//world.updateComparatorOutputLevel(pos, state.getBlock());
|
||||||
return world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
return world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||||
}
|
}
|
||||||
@@ -139,10 +144,16 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
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,
|
if (!world.isRemote) {
|
||||||
// otherwise the repair_item entities was getting thrown off in random directions well beyond pickup range
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
//if (!world.isRemote)
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
// CommonUtils.spawnItemOnPlayer(world, player, this.getItem(world, pos, state));
|
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
|
@Override
|
||||||
|
|||||||
@@ -81,9 +81,11 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
|||||||
|
|
||||||
private void slotOneManager(){
|
private void slotOneManager(){
|
||||||
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
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");
|
NBTTagCompound tag = this.getSlotStack(1).getSubCompound("BlockEntityTag");
|
||||||
if(tag != null) {
|
if(tag != null) {
|
||||||
ItemStackHelper.loadAllItems(tag, ingList);
|
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));
|
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
if (this.getHeat() >= recipe.getCookTemp() &&
|
if (this.getHeat() >= recipe.getCookTemp() &&
|
||||||
@@ -93,11 +95,10 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
|||||||
this.updateBlock();
|
this.updateBlock();
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
if (cookCounter >= recipe.getCookTime() &&
|
if (cookCounter >= recipe.getCookTime() && !this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
|
||||||
|
|
||||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
||||||
cookCounter = 0;
|
cookCounter = 0;
|
||||||
|
//dropList.set(0, recipe.getDropsCooked());
|
||||||
this.updateBlock();
|
this.updateBlock();
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,22 +8,23 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 {
|
||||||
|
|
||||||
private Item drops;
|
private ItemStack drops;
|
||||||
private int heat;
|
private int heat;
|
||||||
private boolean hot;
|
private boolean hot;
|
||||||
private boolean status;
|
private boolean status;
|
||||||
|
|
||||||
public Item getDrops() {
|
public ItemStack getDrops() {
|
||||||
return drops;
|
return drops;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDrops(Item drops) {
|
public void setDrops(ItemStack drops) {
|
||||||
this.drops = 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> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||||
|
//public NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update () {
|
public void update () {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
World world = this.getWorld();
|
World world = this.getWorld();
|
||||||
IBlockState state = world.getBlockState(this.pos);
|
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);
|
super.readNBT(nbt);
|
||||||
this.ingList = NonNullList.<ItemStack>withSize(this.ingList.size(), ItemStack.EMPTY);
|
this.ingList = NonNullList.<ItemStack>withSize(this.ingList.size(), ItemStack.EMPTY);
|
||||||
ItemStackHelper.loadAllItems(nbt, this.ingList);
|
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.heat = nbt.getInteger("heat");
|
||||||
this.hot = nbt.getBoolean("hot");
|
this.hot = nbt.getBoolean("hot");
|
||||||
this.status = nbt.getBoolean("status");
|
this.status = nbt.getBoolean("status");
|
||||||
@@ -89,6 +108,7 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
|||||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
ItemStackHelper.saveAllItems(nbt, this.ingList);
|
ItemStackHelper.saveAllItems(nbt, this.ingList);
|
||||||
|
//ItemStackHelper.saveAllItems(nbt, this.dropList);
|
||||||
nbt.setInteger("heat", this.heat);
|
nbt.setInteger("heat", this.heat);
|
||||||
nbt.setBoolean("hot", this.hot);
|
nbt.setBoolean("hot", this.hot);
|
||||||
nbt.setBoolean("status", this.status);
|
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