fixed the bronze ingot crucible upgrades, need to modify the casting recipes and the nbtcrucible model to open top

This commit is contained in:
Mohammad-Ali Minaie
2018-06-02 14:56:45 -04:00
parent 2b4b432db1
commit fdc0d90144
3 changed files with 57 additions and 40 deletions

View File

@@ -58,53 +58,70 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) {
if (!world.isRemote) { if (!world.isRemote) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos); if(hand == player.getActiveHand()) {
ItemStack pItem = player.inventory.getCurrentItem(); TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1); ItemStack pItem = player.inventory.getCurrentItem();
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/ System.out.println(tile.getStatus());
if(player.isSneaking() == false) { /**PICKS UP THE CRUCIBLE**/
if(!pItem.isEmpty()) { if (player.isSneaking() == false) {
if(pItem.getItem() instanceof SlottedTongs) { if (pItem.isEmpty()) {
return false; CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
} else { if (recipe != null) {
for (int i = 0; i < tile.ingList.size(); i++) { tile.setDrops(recipe.getDropsRaw());
if (tile.ingList.get(i).isEmpty()) { }
tile.ingList.set(i, pItem1); PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getItem(world, pos, state));
pItem.shrink(1); world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
tile.update(); return true;
tile.markDirty(); }
return true; }
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
if (player.isSneaking() == false) {
if (!pItem.isEmpty()) {
if (pItem.getItem() instanceof SlottedTongs) {
return false;
} else {
for (int i = 0; i < tile.ingList.size(); i++) {
if (tile.ingList.get(i).isEmpty()) {
tile.ingList.set(i, pItem1);
pItem.shrink(1);
tile.update();
tile.markDirty();
return true;
}
} }
} }
} }
} }
} /**CLEARS THE INVENTORY**/
/**CLEARS THE INVENTORY**/ if (player.isSneaking() == true) {
if (player.isSneaking() == true) { if (pItem.isEmpty()) {
if(pItem.isEmpty()) { if (!tile.getStatus()) {
for (int i = 0; i < tile.ingList.size(); i++) { for (int i = 0; i < tile.ingList.size(); i++) {
if (!tile.ingList.get(i).isEmpty()) { if (!tile.ingList.get(i).isEmpty()) {
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i)); PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i));
tile.ingList.set(i, ItemStack.EMPTY); tile.ingList.set(i, ItemStack.EMPTY);
}
}
tile.update();
tile.markDirty();
return true;
} }
} }
tile.update();
tile.markDirty();
return true;
} }
} /**REMOVE COOKED ITEM**/
/**PICKS UP THE CRUCIBLE**/ if (player.isSneaking() == true) {
if(player.isSneaking() == false) { if (pItem.isEmpty()) {
if (tile.getStatus()) {
if(pItem.isEmpty()){ PlayerHelper.spawnItemOnPlayer(world, player, tile.getDrops());
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4)); tile.setStatus(false);
if(recipe != null){ tile.update();
tile.setDrops(recipe.getDropsRaw()); tile.markDirty();
return true;
}
} }
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getItem(world, pos, state));
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
return true;
} }
} }
} }

View File

@@ -131,7 +131,7 @@ public class ModCrafting{
redBronze, redBronze,
100, 100,
100, 100,
1000); 100);
/* /*

View File

@@ -87,7 +87,7 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
this.setHot(false); this.setHot(false);
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));
this.setDrops(recipe.getDropsCooked()); this.setDrops(recipe.getDropsCooked());
this.setStatus(false); this.setStatus(true);
System.out.println("Ready to harvest: " + this.getDrops()); System.out.println("Ready to harvest: " + this.getDrops());
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, false), 2); world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, false), 2);
this.updateBlock(); this.updateBlock();