fixing bug with moved crucibles and broken textures

This commit is contained in:
Mohammad-Ali Minaie
2019-06-08 15:52:20 -04:00
parent a7f3b0b5ab
commit 5ada5951bf
4 changed files with 28 additions and 11 deletions

View File

@@ -23,6 +23,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.ItemHandlerHelper;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper;
@@ -32,6 +33,7 @@ import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import javax.swing.plaf.basic.BasicComboBoxUI;
import java.util.Random;
import static net.minecraft.util.EnumHand.MAIN_HAND;
@@ -67,13 +69,18 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
/**PICKS UP THE CRUCIBLE**/
if (playerStackStart.isEmpty()) {
if (!player.isSneaking()) {
System.out.println(tile.getHot());
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());
System.out.println(tile.getDrops());
//tile.setDrops(recipe.getDropsRaw());
}
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
//ItemHandlerHelper.giveItemToPlayer(player, this.getCrucibleItem(world, pos, state, player));
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
System.out.println(player.getHeldItemMainhand().getTagCompound());
return true;
}
}
@@ -131,7 +138,9 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
if (player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
//TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if (tile.getStatus() && tile.getHot() == 6) {
System.out.println(tile.getDrops());
ItemStack dropStack = tile.getDrops().copy();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
tile.setHot(0);

View File

@@ -102,7 +102,7 @@ public class ItemNBTCrucible extends ItemBlock {
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
System.out.println(getHot(item));
if (!item.hasTagCompound()) {
NonNullList<ItemStack> list = NonNullList.withSize(5, ItemStack.EMPTY);
item.setTagCompound(new NBTTagCompound());

View File

@@ -76,12 +76,19 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
private void dropsManager(){
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(this.ingList.get(0), this.ingList.get(1), this.ingList.get(2), this.ingList.get(3), this.ingList.get(4));
if(recipe!=null){
if( (this.getHot() == 15) && (this.getStatus()) ){
this.setDrops(recipe.getDropsCooked());
} else if ((this.getHot() == 15) && (!this.getStatus())){
if(recipe!=null) {
if(this.getDrops() == null){
this.setDrops(recipe.getDropsRaw());
}
if(this.getDrops() != recipe.getDropsCooked()) {
if ((this.getHot() == 6) && (this.getStatus())) {
this.setDrops(recipe.getDropsCooked());
}
if ((this.getHot() == 15) && (this.getStatus())) {
this.setDrops(recipe.getDropsRaw());
}
}
}
}

View File

@@ -1,8 +1,9 @@
{
"parent": "forgecraft:block/castingcrucible",
"parent": "forgecraft:block/castingcrucible3",
"textures": {
"particle": "forgecraft:blocks/stone_slab_hot",
"texture": "forgecraft:blocks/stone_slab_hot",
"texture1": "forgecraft:items/hot_bronze"
"particle": "forgecraft:blocks/stone_slab",
"texture": "forgecraft:blocks/stone_slab",
"texture1": "forgecraft:blocks/crucible_cooked",
"texture3": "forgecraft:blocks/crucible_cooked"
}
}
}