Update to 1.14.2

This commit is contained in:
LexManos authored and cpw committed 2019-06-07 16:50:47 -04:00
1 parent d3e8804dbf
commit a7df63e1a1
1010 files changed
+15254 -19520

No files matched your search

@@ -20,10 +20,10 @@
package net.minecraftforge.items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.INBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
@@ -40,17 +40,17 @@ public class CapabilityItemHandler
CapabilityManager.INSTANCE.register(IItemHandler.class, new Capability.IStorage<IItemHandler>()
{
@Override
public INBTBase writeNBT(Capability<IItemHandler> capability, IItemHandler instance, EnumFacing side)
public INBT writeNBT(Capability<IItemHandler> capability, IItemHandler instance, Direction side)
{
NBTTagList nbtTagList = new NBTTagList();
ListNBT nbtTagList = new ListNBT();
int size = instance.getSlots();
for (int i = 0; i < size; i++)
{
ItemStack stack = instance.getStackInSlot(i);
if (!stack.isEmpty())
{
NBTTagCompound itemTag = new NBTTagCompound();
itemTag.setInt("Slot", i);
CompoundNBT itemTag = new CompoundNBT();
itemTag.putInt("Slot", i);
stack.write(itemTag);
nbtTagList.add(itemTag);
}
@@ -59,15 +59,15 @@ public class CapabilityItemHandler
}
@Override
public void readNBT(Capability<IItemHandler> capability, IItemHandler instance, EnumFacing side, INBTBase base)
public void readNBT(Capability<IItemHandler> capability, IItemHandler instance, Direction side, INBT base)
{
if (!(instance instanceof IItemHandlerModifiable))
throw new RuntimeException("IItemHandler instance does not implement IItemHandlerModifiable");
IItemHandlerModifiable itemHandlerModifiable = (IItemHandlerModifiable) instance;
NBTTagList tagList = (NBTTagList) base;
ListNBT tagList = (ListNBT) base;
for (int i = 0; i < tagList.size(); i++)
{
NBTTagCompound itemTags = tagList.getCompound(i);
CompoundNBT itemTags = tagList.getCompound(i);
int j = itemTags.getInt("Slot");
if (j >= 0 && j < instance.getSlots())
@@ -23,6 +23,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
@@ -19,13 +19,13 @@
package net.minecraftforge.items;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
@@ -150,7 +150,7 @@ public class ItemHandlerHelper
}
/** giveItemToPlayer without preferred slot */
public static void giveItemToPlayer(EntityPlayer player, @Nonnull ItemStack stack) {
public static void giveItemToPlayer(PlayerEntity player, @Nonnull ItemStack stack) {
giveItemToPlayer(player, stack, -1);
}
@@ -161,7 +161,7 @@ public class ItemHandlerHelper
* @param player The player to give the item to
* @param stack The itemstack to insert
*/
public static void giveItemToPlayer(EntityPlayer player, @Nonnull ItemStack stack, int preferredSlot)
public static void giveItemToPlayer(PlayerEntity player, @Nonnull ItemStack stack, int preferredSlot)
{
if (stack.isEmpty()) return;
@@ -191,12 +191,11 @@ public class ItemHandlerHelper
// drop remaining itemstack into the world
if (!remainder.isEmpty() && !world.isRemote)
{
EntityItem entityitem = new EntityItem(world, player.posX, player.posY + 0.5, player.posZ, remainder);
ItemEntity entityitem = new ItemEntity(world, player.posX, player.posY + 0.5, player.posZ, remainder);
entityitem.setPickupDelay(40);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.func_213317_d(entityitem.func_213322_ci().func_216372_d(0, 1, 0));
world.spawnEntity(entityitem);
world.func_217376_c(entityitem);
}
}
@@ -20,15 +20,15 @@
package net.minecraftforge.items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.INBTSerializable;
import javax.annotation.Nonnull;
public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, INBTSerializable<NBTTagCompound>
public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, INBTSerializable<CompoundNBT>
{
protected NonNullList<ItemStack> stacks;
@@ -171,33 +171,33 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
}
@Override
public NBTTagCompound serializeNBT()
public CompoundNBT serializeNBT()
{
NBTTagList nbtTagList = new NBTTagList();
ListNBT nbtTagList = new ListNBT();
for (int i = 0; i < stacks.size(); i++)
{
if (!stacks.get(i).isEmpty())
{
NBTTagCompound itemTag = new NBTTagCompound();
itemTag.setInt("Slot", i);
CompoundNBT itemTag = new CompoundNBT();
itemTag.putInt("Slot", i);
stacks.get(i).write(itemTag);
nbtTagList.add(itemTag);
}
}
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("Items", nbtTagList);
nbt.setInt("Size", stacks.size());
CompoundNBT nbt = new CompoundNBT();
nbt.func_218657_a("Items", nbtTagList);
nbt.putInt("Size", stacks.size());
return nbt;
}
@Override
public void deserializeNBT(NBTTagCompound nbt)
public void deserializeNBT(CompoundNBT nbt)
{
setSize(nbt.contains("Size", Constants.NBT.TAG_INT) ? nbt.getInt("Size") : stacks.size());
NBTTagList tagList = nbt.getList("Items", Constants.NBT.TAG_COMPOUND);
ListNBT tagList = nbt.getList("Items", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.size(); i++)
{
NBTTagCompound itemTags = tagList.getCompound(i);
CompoundNBT itemTags = tagList.getCompound(i);
int slot = itemTags.getInt("Slot");
if (slot >= 0 && slot < stacks.size())
@@ -19,18 +19,16 @@
package net.minecraftforge.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentString;
import javax.annotation.Nonnull;
public class SlotItemHandler extends Slot
{
private static IInventory emptyInventory = new InventoryBasic(new TextComponentString("[Null]"), 0);
private static IInventory emptyInventory = new Inventory(0);
private final IItemHandler itemHandler;
private final int index;
@@ -107,7 +105,7 @@ public class SlotItemHandler extends Slot
}
@Override
public boolean canTakeStack(EntityPlayer playerIn)
public boolean canTakeStack(PlayerEntity playerIn)
{
return !this.getItemHandler().extractItem(index, 1, true).isEmpty();
}
@@ -20,16 +20,16 @@
package net.minecraftforge.items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.tileentity.HopperTileEntity;
import net.minecraftforge.items.wrapper.InvWrapper;
import javax.annotation.Nonnull;
public class VanillaHopperItemHandler extends InvWrapper
{
private final TileEntityHopper hopper;
private final HopperTileEntity hopper;
public VanillaHopperItemHandler(TileEntityHopper hopper)
public VanillaHopperItemHandler(HopperTileEntity hopper)
{
super(hopper);
this.hopper = hopper;
@@ -20,14 +20,14 @@
package net.minecraftforge.items;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDropper;
import net.minecraft.block.BlockHopper;
import net.minecraft.block.DropperBlock;
import net.minecraft.block.HopperBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.IHopper;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.EnumFacing;
import net.minecraft.tileentity.DispenserTileEntity;
import net.minecraft.tileentity.HopperTileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@@ -48,7 +48,7 @@ public class VanillaInventoryCodeHooks
@Nullable
public static Boolean extractHook(IHopper dest)
{
return getItemHandler(dest, EnumFacing.UP)
return getItemHandler(dest, Direction.UP)
.map(itemHandlerResult -> {
IItemHandler handler = itemHandlerResult.getKey();
@@ -85,9 +85,9 @@ public class VanillaInventoryCodeHooks
/**
* Copied from BlockDropper#dispense and added capability support
*/
public static boolean dropperInsertHook(World world, BlockPos pos, TileEntityDispenser dropper, int slot, @Nonnull ItemStack stack)
public static boolean dropperInsertHook(World world, BlockPos pos, DispenserTileEntity dropper, int slot, @Nonnull ItemStack stack)
{
EnumFacing enumfacing = world.getBlockState(pos).get(BlockDropper.FACING);
Direction enumfacing = world.getBlockState(pos).get(DropperBlock.FACING);
BlockPos blockpos = pos.offset(enumfacing);
return getItemHandler(world, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), enumfacing.getOpposite())
.map(destinationResult -> {
@@ -115,9 +115,9 @@ public class VanillaInventoryCodeHooks
/**
* Copied from TileEntityHopper#transferItemsOut and added capability support
*/
public static boolean insertHook(TileEntityHopper hopper)
public static boolean insertHook(HopperTileEntity hopper)
{
EnumFacing hopperFacing = hopper.getBlockState().get(BlockHopper.FACING);
Direction hopperFacing = hopper.getBlockState().get(HopperBlock.FACING);
return getItemHandler(hopper, hopperFacing)
.map(destinationResult -> {
IItemHandler itemHandler = destinationResult.getKey();
@@ -187,9 +187,9 @@ public class VanillaInventoryCodeHooks
if (insertedItem)
{
if (inventoryWasEmpty && destination instanceof TileEntityHopper)
if (inventoryWasEmpty && destination instanceof HopperTileEntity)
{
TileEntityHopper destinationHopper = (TileEntityHopper)destination;
HopperTileEntity destinationHopper = (HopperTileEntity)destination;
if (!destinationHopper.mayTransfer())
{
@@ -212,7 +212,7 @@ public class VanillaInventoryCodeHooks
return stack;
}
private static LazyOptional<Pair<IItemHandler, Object>> getItemHandler(IHopper hopper, EnumFacing hopperFacing)
private static LazyOptional<Pair<IItemHandler, Object>> getItemHandler(IHopper hopper, Direction hopperFacing)
{
double x = hopper.getXPos() + (double) hopperFacing.getXOffset();
double y = hopper.getYPos() + (double) hopperFacing.getYOffset();
@@ -246,13 +246,13 @@ public class VanillaInventoryCodeHooks
return true;
}
public static LazyOptional<Pair<IItemHandler, Object>> getItemHandler(World worldIn, double x, double y, double z, final EnumFacing side)
public static LazyOptional<Pair<IItemHandler, Object>> getItemHandler(World worldIn, double x, double y, double z, final Direction side)
{
int i = MathHelper.floor(x);
int j = MathHelper.floor(y);
int k = MathHelper.floor(z);
BlockPos blockpos = new BlockPos(i, j, k);
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
net.minecraft.block.BlockState state = worldIn.getBlockState(blockpos);
if (state.hasTileEntity())
{
@@ -19,8 +19,8 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraftforge.items.IItemHandler;
/**
@@ -29,8 +29,8 @@ import net.minecraftforge.items.IItemHandler;
*/
public class EntityArmorInvWrapper extends EntityEquipmentInvWrapper
{
public EntityArmorInvWrapper(final EntityLivingBase entity)
public EntityArmorInvWrapper(final LivingEntity entity)
{
super(entity, EntityEquipmentSlot.Type.ARMOR);
super(entity, EquipmentSlotType.Group.ARMOR);
}
}
@@ -20,13 +20,17 @@
package net.minecraftforge.items.wrapper;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemHandlerHelper;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@@ -41,24 +45,24 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
/**
* The entity.
*/
protected final EntityLivingBase entity;
protected final LivingEntity entity;
/**
* The slots exposed by this wrapper, with {@link EntityEquipmentSlot#index} as the index.
*/
protected final List<EntityEquipmentSlot> slots;
protected final List<EquipmentSlotType> slots;
/**
* @param entity The entity.
* @param slotType The slot type to expose.
*/
public EntityEquipmentInvWrapper(final EntityLivingBase entity, final EntityEquipmentSlot.Type slotType)
public EntityEquipmentInvWrapper(final LivingEntity entity, final EquipmentSlotType.Group slotType)
{
this.entity = entity;
final List<EntityEquipmentSlot> slots = new ArrayList<EntityEquipmentSlot>();
final List<EquipmentSlotType> slots = new ArrayList<EquipmentSlotType>();
for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values())
for (final EquipmentSlotType slot : EquipmentSlotType.values())
{
if (slot.getSlotType() == slotType)
{
@@ -89,7 +93,7 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
if (stack.isEmpty())
return ItemStack.EMPTY;
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
final EquipmentSlotType equipmentSlot = validateSlotIndex(slot);
final ItemStack existing = entity.getItemStackFromSlot(equipmentSlot);
@@ -130,7 +134,7 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
if (amount == 0)
return ItemStack.EMPTY;
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
final EquipmentSlotType equipmentSlot = validateSlotIndex(slot);
final ItemStack existing = entity.getItemStackFromSlot(equipmentSlot);
@@ -162,8 +166,8 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
@Override
public int getSlotLimit(final int slot)
{
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
return equipmentSlot.getSlotType() == EntityEquipmentSlot.Type.ARMOR ? 1 : 64;
final EquipmentSlotType equipmentSlot = validateSlotIndex(slot);
return equipmentSlot.getSlotType() == EquipmentSlotType.Group.ARMOR ? 1 : 64;
}
protected int getStackLimit(final int slot, @Nonnull final ItemStack stack)
@@ -174,7 +178,7 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
@Override
public void setStackInSlot(final int slot, @Nonnull final ItemStack stack)
{
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
final EquipmentSlotType equipmentSlot = validateSlotIndex(slot);
if (ItemStack.areItemStacksEqual(entity.getItemStackFromSlot(equipmentSlot), stack))
return;
entity.setItemStackToSlot(equipmentSlot, stack);
@@ -186,7 +190,7 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
return true;
}
protected EntityEquipmentSlot validateSlotIndex(final int slot)
protected EquipmentSlotType validateSlotIndex(final int slot)
{
if (slot < 0 || slot >= slots.size())
throw new IllegalArgumentException("Slot " + slot + " not in valid range - [0," + slots.size() + ")");
@@ -194,7 +198,7 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
return slots.get(slot);
}
public static LazyOptional<IItemHandlerModifiable>[] create(EntityLivingBase entity)
public static LazyOptional<IItemHandlerModifiable>[] create(LivingEntity entity)
{
@SuppressWarnings("unchecked")
LazyOptional<IItemHandlerModifiable>[] ret = new LazyOptional[3];
@@ -19,8 +19,8 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraftforge.items.IItemHandler;
/**
@@ -29,8 +29,8 @@ import net.minecraftforge.items.IItemHandler;
*/
public class EntityHandsInvWrapper extends EntityEquipmentInvWrapper
{
public EntityHandsInvWrapper(EntityLivingBase entity)
public EntityHandsInvWrapper(LivingEntity entity)
{
super(entity, EntityEquipmentSlot.Type.HAND);
super(entity, EquipmentSlotType.Group.HAND);
}
}
@@ -19,17 +19,17 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class PlayerArmorInvWrapper extends RangedWrapper
{
private final InventoryPlayer inventoryPlayer;
private final PlayerInventory inventoryPlayer;
public PlayerArmorInvWrapper(InventoryPlayer inv)
public PlayerArmorInvWrapper(PlayerInventory inv)
{
super(new InvWrapper(inv), inv.mainInventory.size(), inv.mainInventory.size() + inv.armorInventory.size());
inventoryPlayer = inv;
@@ -39,10 +39,10 @@ public class PlayerArmorInvWrapper extends RangedWrapper
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
EntityEquipmentSlot equ = null;
for (EntityEquipmentSlot s : EntityEquipmentSlot.values())
EquipmentSlotType equ = null;
for (EquipmentSlotType s : EquipmentSlotType.values())
{
if (s.getSlotType() == EntityEquipmentSlot.Type.ARMOR && s.getIndex() == slot)
if (s.getSlotType() == EquipmentSlotType.Group.ARMOR && s.getIndex() == slot)
{
equ = s;
break;
@@ -56,7 +56,7 @@ public class PlayerArmorInvWrapper extends RangedWrapper
return stack;
}
public InventoryPlayer getInventoryPlayer()
public PlayerInventory getInventoryPlayer()
{
return inventoryPlayer;
}
@@ -19,11 +19,11 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.player.PlayerInventory;
public class PlayerInvWrapper extends CombinedInvWrapper
{
public PlayerInvWrapper(InventoryPlayer inv)
public PlayerInvWrapper(PlayerInventory inv)
{
super(new PlayerMainInvWrapper(inv), new PlayerArmorInvWrapper(inv), new PlayerOffhandInvWrapper(inv));
}
@@ -19,8 +19,8 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
@@ -31,9 +31,9 @@ import javax.annotation.Nonnull;
*/
public class PlayerMainInvWrapper extends RangedWrapper
{
private final InventoryPlayer inventoryPlayer;
private final PlayerInventory inventoryPlayer;
public PlayerMainInvWrapper(InventoryPlayer inv)
public PlayerMainInvWrapper(PlayerInventory inv)
{
super(new InvWrapper(inv), 0, inv.mainInventory.size());
inventoryPlayer = inv;
@@ -54,7 +54,7 @@ public class PlayerMainInvWrapper extends RangedWrapper
{
inSlot.setAnimationsToGo(5);
}
else if(getInventoryPlayer().player instanceof EntityPlayerMP) {
else if(getInventoryPlayer().player instanceof ServerPlayerEntity) {
getInventoryPlayer().player.openContainer.detectAndSendChanges();
}
}
@@ -62,7 +62,7 @@ public class PlayerMainInvWrapper extends RangedWrapper
return rest;
}
public InventoryPlayer getInventoryPlayer()
public PlayerInventory getInventoryPlayer()
{
return inventoryPlayer;
}
@@ -19,11 +19,11 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.player.PlayerInventory;
public class PlayerOffhandInvWrapper extends RangedWrapper
{
public PlayerOffhandInvWrapper(InventoryPlayer inv)
public PlayerOffhandInvWrapper(PlayerInventory inv)
{
super(new InvWrapper(inv), inv.mainInventory.size() + inv.armorInventory.size(),
inv.mainInventory.size() + inv.armorInventory.size() + inv.offHandInventory.size());
@@ -19,23 +19,18 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.items.IItemHandlerModifiable;
public class RecipeWrapper implements IInventory {
protected final IItemHandlerModifiable inv;
protected final int width;
protected final int height;
public RecipeWrapper(IItemHandlerModifiable inv, int width, int height)
public RecipeWrapper(IItemHandlerModifiable inv)
{
this.inv = inv;
this.width = width;
this.height = height;
}
/**
@@ -44,7 +39,7 @@ public class RecipeWrapper implements IInventory {
@Override
public int getSizeInventory()
{
return getHeight() * getWidth();
return inv.getSlots();
}
/**
@@ -75,24 +70,6 @@ public class RecipeWrapper implements IInventory {
inv.setStackInSlot(slot, stack);
}
/**
* Returns the height of this inventory.
*/
@Override
public int getHeight()
{
return height;
}
/**
* Returns the width of this inventory.
*/
@Override
public int getWidth()
{
return width;
}
/**
* Removes the stack contained in this slot from the underlying handler, and returns it.
*/
@@ -136,22 +113,10 @@ public class RecipeWrapper implements IInventory {
@Override
public void markDirty() {}
@Override
public boolean isUsableByPlayer(EntityPlayer player) { return false; }
public boolean isUsableByPlayer(PlayerEntity player) { return false; }
@Override
public void openInventory(EntityPlayer player) {}
public void openInventory(PlayerEntity player) {}
@Override
public void closeInventory(EntityPlayer player) {}
@Override
public int getField(int id) { return 0; }
@Override
public void setField(int id, int value) {}
@Override
public int getFieldCount() { return 0; }
@Override
public ITextComponent getName() { return null; }
@Override
public boolean hasCustomName() { return false; }
@Override
public ITextComponent getCustomName() { return null; }
public void closeInventory(PlayerEntity player) {}
}
@@ -21,7 +21,7 @@ package net.minecraftforge.items.wrapper;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemHandlerHelper;
@@ -31,25 +31,25 @@ import javax.annotation.Nonnull;
public class SidedInvWrapper implements IItemHandlerModifiable
{
protected final ISidedInventory inv;
protected final EnumFacing side;
protected final Direction side;
@SuppressWarnings("unchecked")
public static LazyOptional<IItemHandlerModifiable>[] create(ISidedInventory inv, EnumFacing... sides) {
public static LazyOptional<IItemHandlerModifiable>[] create(ISidedInventory inv, Direction... sides) {
LazyOptional<IItemHandlerModifiable>[] ret = new LazyOptional[sides.length];
for (int x = 0; x < sides.length; x++) {
final EnumFacing side = sides[x];
final Direction side = sides[x];
ret[x] = LazyOptional.of(() -> new SidedInvWrapper(inv, side));
}
return ret;
}
public SidedInvWrapper(ISidedInventory inv, EnumFacing side)
public SidedInvWrapper(ISidedInventory inv, Direction side)
{
this.inv = inv;
this.side = side;
}
public static int getSlot(ISidedInventory inv, int slot, EnumFacing side)
public static int getSlot(ISidedInventory inv, int slot, Direction side)
{
int[] slots = inv.getSlotsForFace(side);
if (slot < slots.length)