workign through issues in the ForgeHandler
This commit is contained in:
@@ -102,7 +102,6 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
||||
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||
ItemStack fuelItem = tile.getSlotStack(0);
|
||||
|
||||
if (!world.isRemote) {
|
||||
/***********************
|
||||
FUEL SLOT CODE
|
||||
***********************/
|
||||
@@ -166,8 +165,6 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
||||
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -325,15 +325,14 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
IItemHandler inventory = itemstack.getCapability(ITEM_HANDLER, null);
|
||||
ItemStack slotStack = inventory.getStackInSlot(0).copy();
|
||||
/*
|
||||
if (block instanceof AnvilStone) {
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
|
||||
doAnvilInventoryManager(itemstack, world, tile, pos, hitx, hity, hitz, state, player);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (!(block instanceof AnvilBase)) {
|
||||
if (!(block instanceof Forge)) {
|
||||
System.out.println(inventory.getStackInSlot(0));
|
||||
if (slotStack.isEmpty()) {
|
||||
if (block instanceof NBTCrucible) {
|
||||
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
|
||||
@@ -361,14 +360,14 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
DROPS the ToolParts into the World
|
||||
*****/
|
||||
if (!slotStack.isEmpty()) {
|
||||
if (!(block instanceof AnvilBase)) {
|
||||
|
||||
if (slotStack.getItem() instanceof ToolPart) {
|
||||
ItemStack tempStack = slotStack;
|
||||
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
|
||||
inventory.extractItem(0, 1, false);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*****
|
||||
@@ -396,12 +395,12 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
DROPS the Ingots into the World
|
||||
*****/
|
||||
if (!slotStack.isEmpty()) {
|
||||
if (!(block instanceof AnvilBase)) {
|
||||
if (!(block instanceof Forge)) {
|
||||
System.out.println("Tongs isn't empty");
|
||||
if (slotStack.getItem() instanceof BaseMultiItem) {
|
||||
ItemStack tempStack = slotStack.copy();
|
||||
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
|
||||
inventory.extractItem(0, 1, false);
|
||||
System.out.println(inventory.getStackInSlot(0));
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (!(slotStack.getItem() instanceof BaseMultiItem)) {
|
||||
@@ -434,9 +433,7 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
@@ -500,11 +497,11 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
@Override
|
||||
public NBTTagCompound getNBTShareTag(ItemStack stack)
|
||||
{
|
||||
super.getNBTShareTag(stack);
|
||||
IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
|
||||
NonNullList<ItemStack> setList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
ItemStackHelper.saveAllItems(stack.getTagCompound(), setList);
|
||||
return stack.getTagCompound();
|
||||
return super.getNBTShareTag(stack);
|
||||
//IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
|
||||
//NonNullList<ItemStack> setList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
//ItemStackHelper.saveAllItems(stack.getTagCompound(), setList);
|
||||
//return stack.getTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -512,11 +509,11 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
{
|
||||
super.readNBTShareTag(stack, nbt);
|
||||
|
||||
stack.deserializeNBT(nbt);
|
||||
IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
|
||||
NonNullList<ItemStack> setList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
ItemStackHelper.loadAllItems(nbt, setList);
|
||||
inventory.insertItem(0, setList.get(0), false);
|
||||
//stack.deserializeNBT(nbt);
|
||||
//IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
|
||||
//NonNullList<ItemStack> setList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
//ItemStackHelper.loadAllItems(nbt, setList);
|
||||
//inventory.insertItem(0, setList.get(0), false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ public interface AnvilHandler {
|
||||
|
||||
static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) {
|
||||
|
||||
if (!world.isRemote) {
|
||||
if (pItem.getItem().equals(ModItems.slottedtongs)) {
|
||||
|
||||
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
|
||||
@@ -259,7 +260,7 @@ public interface AnvilHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
|
||||
|
||||
if (pItem.getItem().equals(Items.AIR) && player.isSneaking()) {
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import nmd.primal.core.common.helper.RecipeHelper;
|
||||
import nmd.primal.core.common.items.tools.Gallagher;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
@@ -53,6 +54,7 @@ public interface ForgeHandler {
|
||||
default boolean doForgeInventoryManager(ItemStack pItem, World world, TileForge tile, BlockPos pos, float hitx, float hity, float hitz, IBlockState state, EntityPlayer player) {
|
||||
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
|
||||
int counter = 0;
|
||||
for (int z = 0; z < arraySize; z++) {
|
||||
for (int x = 0; x < arraySize; x++) {
|
||||
@@ -109,16 +111,15 @@ public interface ForgeHandler {
|
||||
}
|
||||
|
||||
static boolean doWork(ItemStack pItem, Integer counter, TileForge tile, World world, BlockPos pos, EntityPlayer player) {
|
||||
|
||||
if (pItem.getItem().equals(ModItems.slottedtongs)) {
|
||||
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
|
||||
IItemHandler inventory = (IItemHandlerModifiable) pItem.getCapability(ITEM_HANDLER, null);
|
||||
ItemStack tongsStack = inventory.getStackInSlot(0).copy();
|
||||
|
||||
if (tongsStack.isEmpty()) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack tempStack = tile.getSlotStack(counter).copy();
|
||||
inventory.insertItem(0, tempStack, false);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
inventory.insertItem(0, tempStack, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user