fixed slot tongs rendering

This commit is contained in:
Mohammad-Ali Minaie
2018-09-21 23:25:16 -04:00
parent a45d502cc6
commit 6f5dd58fc5
2 changed files with 23 additions and 22 deletions

View File

@@ -283,7 +283,7 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
@Override @Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz) public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
{ {
if(!world.isRemote){ //if(!world.isRemote){
//if (hand.equals(player.swingingHand)) { //if (hand.equals(player.swingingHand)) {
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
Block block = world.getBlockState(pos).getBlock(); Block block = world.getBlockState(pos).getBlock();
@@ -430,8 +430,8 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
} }
} }
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} //}
return EnumActionResult.FAIL; //return EnumActionResult.FAIL;
} }
public ItemStack getItem(World world, BlockPos pos, IBlockState state, Block block) public ItemStack getItem(World world, BlockPos pos, IBlockState state, Block block)

View File

@@ -233,31 +233,32 @@ public interface AnvilHandler {
static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) { static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) {
if (!world.isRemote) {
if (pItem.getItem().equals(ModItems.slottedtongs)) {
SlottedTongs tongs = (SlottedTongs) pItem.getItem(); if (pItem.getItem().equals(ModItems.slottedtongs)) {
ItemStack tongStack = tongs.getSlotList().get(0).copy();
if (tongStack.isEmpty()) { SlottedTongs tongs = (SlottedTongs) pItem.getItem();
if (!tile.getSlotStack(counter).isEmpty()) { ItemStack tongStack = tongs.getSlotList().get(0).copy();
ItemStack tempStack = tile.getSlotStack(counter).copy();
tongs.setSlotList(tempStack);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
}
if (!tongStack.isEmpty()) { if (tongStack.isEmpty()) {
if (tile.getSlotStack(counter).isEmpty()) { if (!tile.getSlotStack(counter).isEmpty()) {
ItemStack tempStack = tongs.getSlotList().get(0).copy(); ItemStack tempStack = tile.getSlotStack(counter).copy();
tile.setSlotStack(counter, tempStack); tongs.setSlotList(tempStack);
tongs.setSlotList(ItemStack.EMPTY); tile.setSlotStack(counter, ItemStack.EMPTY);
return true; return true;
}
} }
} }
if (!tongStack.isEmpty()) {
if (tile.getSlotStack(counter).isEmpty()) {
ItemStack tempStack = tongs.getSlotList().get(0).copy();
tile.setSlotStack(counter, tempStack);
tongs.setSlotList(ItemStack.EMPTY);
return true;
}
}
}
if (!world.isRemote) {
if (pItem.getItem().equals(Items.AIR) && player.isSneaking()) { if (pItem.getItem().equals(Items.AIR) && player.isSneaking()) {
if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) { if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) {