Utils ported

This commit is contained in:
Sebastian Hartte
2020-06-28 03:41:44 +02:00
parent 7c28a71e10
commit fee5b7fdfc
204 changed files with 1371 additions and 1737 deletions
@@ -24,12 +24,12 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
@@ -73,7 +73,7 @@ import appeng.helpers.InventoryAction;
import appeng.me.helpers.PlayerSource;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.AdaptorFixedInv;
import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.item.AEItemStack;
@@ -262,7 +262,7 @@ public abstract class AEBaseContainer extends Container {
}
protected void bindPlayerInventory(final PlayerInventory PlayerInventory, final int offsetX, final int offsetY) {
ItemTransferable ih = new PlayerInvWrapper(PlayerInventory);
FixedItemInv ih = new PlayerInvWrapper(PlayerInventory);
// bind player inventory
for (int i = 0; i < 3; i++) {
@@ -523,8 +523,8 @@ public abstract class AEBaseContainer extends Container {
@Override
public boolean canInteractWith(final PlayerEntity PlayerEntity) {
if (this.isValidContainer()) {
if (this.tileEntity instanceof IInventory) {
return ((IInventory) this.tileEntity).isUsableByPlayer(PlayerEntity);
if (this.tileEntity instanceof Inventory) {
return ((Inventory) this.tileEntity).isUsableByPlayer(PlayerEntity);
}
return true;
}
@@ -666,7 +666,7 @@ public abstract class AEBaseContainer extends Container {
ais = Platform.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais,
this.getActionSource());
if (ais == null) {
final InventoryAdaptor ia = new AdaptorItemHandler(
final InventoryAdaptor ia = new AdaptorFixedInv(
new WrapperCursorItemHandler(player.inventory));
final ItemStack fail = ia.removeItems(1, extracted.getDefinition(), null);
@@ -705,7 +705,7 @@ public abstract class AEBaseContainer extends Container {
ais = Platform.poweredExtraction(this.getPowerSource(), this.getCellInventory(), ais,
this.getActionSource());
if (ais != null) {
final InventoryAdaptor ia = new AdaptorItemHandler(
final InventoryAdaptor ia = new AdaptorFixedInv(
new WrapperCursorItemHandler(player.inventory));
final ItemStack fail = ia.addItems(ais.createItemStack());
@@ -117,9 +117,9 @@ public final class ContainerLocator {
if (is.isEmpty()) {
throw new IllegalArgumentException("Cannot open an item-inventory with empty hands");
}
int invSize = player.inventory.getSizeInventory();
int invSize = player.inventory.size();
for (int i = 0; i < invSize; i++) {
if (player.inventory.getStackInSlot(i) == is) {
if (player.inventory.getStack(i) == is) {
return i;
}
}
@@ -20,7 +20,7 @@ package appeng.container.implementations;
import java.util.Iterator;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -83,7 +83,7 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
public void setFuzzy(final FuzzyMode valueOf) {
final ICellWorkbenchItem cwi = this.workBench.getCell();
if (cwi != null) {
cwi.setFuzzyMode(this.workBench.getInventoryByName("cell").getStackInSlot(0), valueOf);
cwi.setFuzzyMode(this.workBench.getInventoryByName("cell").getInvStack(0), valueOf);
}
}
@@ -102,14 +102,13 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
@Override
protected void setupConfig() {
final ItemTransferable cell = this.getUpgradeable().getInventoryByName("cell");
final FixedItemInv cell = this.getUpgradeable().getInventoryByName("cell");
this.addSlot(new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8,
this.getPlayerInv()));
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
final WrapperSupplierItemHandler upgradeInventory = new WrapperSupplierItemHandler(
this::getCellUpgradeInventory);
// null, 3 * 8 );
int offset = 0;
final int y = 29;
@@ -141,17 +140,17 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
@Override
public int availableUpgrades() {
final ItemStack is = this.workBench.getInventoryByName("cell").getStackInSlot(0);
final ItemStack is = this.workBench.getInventoryByName("cell").getInvStack(0);
if (this.prevStack != is) {
this.prevStack = is;
this.lastUpgrades = this.getCellUpgradeInventory().getSlots();
this.lastUpgrades = this.getCellUpgradeInventory().getSlotCount();
}
return this.lastUpgrades;
}
@Override
public void detectAndSendChanges() {
final ItemStack is = this.workBench.getInventoryByName("cell").getStackInSlot(0);
final ItemStack is = this.workBench.getInventoryByName("cell").getInvStack(0);
if (Platform.isServer()) {
for (final IContainerListener listener : this.listeners) {
if (this.prevStack != is) {
@@ -182,8 +181,8 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
return idx < this.availableUpgrades();
}
public ItemTransferable getCellUpgradeInventory() {
final ItemTransferable upgradeInventory = this.workBench.getCellUpgradeInventory();
public FixedItemInv getCellUpgradeInventory() {
final FixedItemInv upgradeInventory = this.workBench.getCellUpgradeInventory();
return upgradeInventory == null ? EmptyFixedItemInv.INSTANCE : upgradeInventory;
}
@@ -205,16 +204,16 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
private FuzzyMode getWorkBenchFuzzyMode() {
final ICellWorkbenchItem cwi = this.workBench.getCell();
if (cwi != null) {
return cwi.getFuzzyMode(this.workBench.getInventoryByName("cell").getStackInSlot(0));
return cwi.getFuzzyMode(this.workBench.getInventoryByName("cell").getInvStack(0));
}
return FuzzyMode.IGNORE_ALL;
}
public void partition() {
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
final ItemStack is = this.getUpgradeable().getInventoryByName("cell").getStackInSlot(0);
final ItemStack is = this.getUpgradeable().getInventoryByName("cell").getInvStack(0);
final IStorageChannel channel = is.getItem() instanceof IStorageCell
? ((IStorageCell) is.getItem()).getChannel()
: AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
@@ -227,7 +226,7 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
i = list.iterator();
}
for (int x = 0; x < inv.getSlots(); x++) {
for (int x = 0; x < inv.getSlotCount(); x++) {
if (i.hasNext()) {
// TODO: check if ok
final ItemStack g = i.next().asItemStackRepresentation();
@@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.network.PacketByteBuf;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.CondenserOutput;
import appeng.api.config.Settings;
@@ -54,7 +54,7 @@ public class CondenserContainer extends AEBaseContainer implements IProgressProv
super(TYPE, id, ip, condenser, null);
this.condenser = condenser;
ItemTransferable inv = condenser.getInternalInventory();
FixedItemInv inv = condenser.getInternalInventory();
this.addSlot(new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.TRASH, inv, 0, 51, 52, ip));
this.addSlot(new OutputSlot(inv, 1, 105, 52, -1));
@@ -163,7 +163,7 @@ public final class ContainerHelper<C extends AEBaseContainer, I> {
private I getHostFromPlayerInventory(PlayerEntity player, ContainerLocator locator) {
ItemStack it = player.inventory.getStackInSlot(locator.getItemIndex());
ItemStack it = player.inventory.getStack(locator.getItemIndex());
if (it.isEmpty()) {
AELog.debug("Cannot open container for player %s since they no longer hold the item in slot %d", player,
@@ -256,7 +256,7 @@ public class CraftConfirmContainer extends AEBaseContainer {
// :P
}
} catch (final Throwable e) {
this.getPlayerInv().player.sendMessage(new LiteralText("Error: " + e.toString()));
this.getPlayerInv().player.sendSystemMessage(new LiteralText("Error: " + e.toString()), Util.NIL_UUID);
AELog.debug(e);
this.setValidContainer(false);
this.result = null;
@@ -18,15 +18,15 @@
package appeng.container.implementations;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.world.World;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
@@ -64,13 +64,13 @@ public class CraftingTermContainer extends MEMonitorableContainer
private final AppEngInternalInventory output = new AppEngInternalInventory(this, 1);
private final CraftingMatrixSlot[] craftingSlots = new CraftingMatrixSlot[9];
private final CraftingTermSlot outputSlot;
private IRecipe<CraftingInventory> currentRecipe;
private Recipe<CraftingInventory> currentRecipe;
public CraftingTermContainer(int id, final PlayerInventory ip, final ITerminalHost monitorable) {
super(TYPE, id, ip, monitorable, false);
this.ct = (CraftingTerminalPart) monitorable;
final ItemTransferable crafting = this.ct.getInventoryByName("crafting");
final FixedItemInv crafting = this.ct.getInventoryByName("crafting");
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
@@ -92,23 +92,23 @@ public class CraftingTermContainer extends MEMonitorableContainer
*/
@Override
public void onCraftMatrixChanged(IInventory inventory) {
public void onCraftMatrixChanged(Inventory inventory) {
final ContainerNull cn = new ContainerNull();
final CraftingInventory ic = new CraftingInventory(cn, 3, 3);
for (int x = 0; x < 9; x++) {
ic.setInventorySlotContents(x, this.craftingSlots[x].getStack());
ic.setStack(x, this.craftingSlots[x].getStack());
}
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, this.getPlayerInv().player.world)) {
World world = this.getPlayerInv().player.world;
this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
this.currentRecipe = world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world).orElse(null);
}
if (this.currentRecipe == null) {
this.outputSlot.putStack(ItemStack.EMPTY);
} else {
final ItemStack craftingResult = this.currentRecipe.getCraftingResult(ic);
final ItemStack craftingResult = this.currentRecipe.craft(ic);
this.outputSlot.putStack(craftingResult);
}
@@ -120,13 +120,13 @@ public class CraftingTermContainer extends MEMonitorableContainer
}
@Override
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
}
@Override
public ItemTransferable getInventoryByName(final String name) {
public FixedItemInv getInventoryByName(final String name) {
if (name.equals("player")) {
return new PlayerInvWrapper(this.getPlayerInventory());
}
@@ -138,7 +138,7 @@ public class CraftingTermContainer extends MEMonitorableContainer
return true;
}
public IRecipe<CraftingInventory> getCurrentRecipe() {
public Recipe<CraftingInventory> getCurrentRecipe() {
return this.currentRecipe;
}
}
@@ -18,7 +18,7 @@
package appeng.container.implementations;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
@@ -69,7 +69,7 @@ public class FormationPlaneContainer extends UpgradeableContainer {
final int xo = 8;
final int yo = 23 + 6;
final ItemTransferable config = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv config = this.getUpgradeable().getInventoryByName("config");
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 9; x++) {
if (y < 2) {
@@ -80,7 +80,7 @@ public class FormationPlaneContainer extends UpgradeableContainer {
}
}
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
this.getPlayerInventory())).setNotDraggable());
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
@@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.network.PacketByteBuf;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerLocator;
@@ -49,7 +49,7 @@ public class GrinderContainer extends AEBaseContainer {
public GrinderContainer(int id, final PlayerInventory ip, final GrinderBlockEntity grinder) {
super(TYPE, id, ip, grinder, null);
ItemTransferable inv = grinder.getInternalInventory();
FixedItemInv inv = grinder.getInternalInventory();
this.addSlot(new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.ORE, inv, 0, 12, 17,
this.getPlayerInventory()));
@@ -18,7 +18,7 @@
package appeng.container.implementations;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
@@ -70,7 +70,7 @@ public class IOPortContainer extends UpgradeableContainer {
int offX = 19;
int offY = 17;
final ItemTransferable cells = this.getUpgradeable().getInventoryByName("cells");
final FixedItemInv cells = this.getUpgradeable().getInventoryByName("cells");
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 2; x++) {
@@ -88,7 +88,7 @@ public class IOPortContainer extends UpgradeableContainer {
}
}
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
this.getPlayerInventory())).setNotDraggable());
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
@@ -24,7 +24,7 @@ import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.AEApi;
import appeng.api.definitions.IItemDefinition;
@@ -74,7 +74,7 @@ public class InscriberContainer extends UpgradeableContainer implements IProgres
super(TYPE, id, ip, te);
this.ti = te;
ItemTransferable inv = te.getInternalInventory();
FixedItemInv inv = te.getInternalInventory();
RestrictedInputSlot top = new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.INSCRIBER_PLATE, inv, 0,
45, 16, this.getPlayerInventory());
@@ -127,8 +127,8 @@ public class InscriberContainer extends UpgradeableContainer implements IProgres
@Override
public boolean isValidForSlot(final Slot s, final ItemStack is) {
final ItemStack top = this.ti.getInternalInventory().getStackInSlot(0);
final ItemStack bot = this.ti.getInternalInventory().getStackInSlot(1);
final ItemStack top = this.ti.getInternalInventory().getInvStack(0);
final ItemStack bot = this.ti.getInternalInventory().getInvStack(1);
if (s == this.middle) {
IItemDefinition press = AEApi.instance().definitions().materials().namePress();
@@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.text.Text;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
@@ -54,10 +54,9 @@ import appeng.tile.misc.InterfaceBlockEntity;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.helpers.ItemHandlerUtil;
import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.AdaptorFixedInv;
import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.WrapperRangeItemHandler;
import appeng.util.inv.filter.IAEItemFilter;
public final class InterfaceTerminalContainer extends AEBaseContainer {
@@ -167,8 +166,8 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
} else {
for (final Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet()) {
final InvTracker inv = en.getValue();
for (int x = 0; x < inv.server.getSlots(); x++) {
if (this.isDifferent(inv.server.getStackInSlot(x), inv.client.getStackInSlot(x))) {
for (int x = 0; x < inv.server.getSlotCount(); x++) {
if (this.isDifferent(inv.server.getInvStack(x), inv.client.getInvStack(x))) {
this.addItems(this.data, inv, x, 1);
}
}
@@ -191,20 +190,20 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
public void doAction(final ServerPlayerEntity player, final InventoryAction action, final int slot, final long id) {
final InvTracker inv = this.byId.get(id);
if (inv != null) {
final ItemStack is = inv.server.getStackInSlot(slot);
final ItemStack is = inv.server.getInvStack(slot);
final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty();
final InventoryAdaptor playerHand = new AdaptorItemHandler(new WrapperCursorItemHandler(player.inventory));
final InventoryAdaptor playerHand = new AdaptorFixedInv(new WrapperCursorItemHandler(player.inventory));
final ItemTransferable theSlot = new WrapperFilteredItemHandler(
new WrapperRangeItemHandler(inv.server, slot, slot + 1), new PatternSlotFilter());
final InventoryAdaptor interfaceSlot = new AdaptorItemHandler(theSlot);
final FixedItemInv theSlot = new WrapperFilteredItemHandler(
inv.server.getSubInv(slot, slot + 1), new PatternSlotFilter());
final InventoryAdaptor interfaceSlot = new AdaptorFixedInv(theSlot);
switch (action) {
case PICKUP_OR_SET_DOWN:
if (hasItemInHand) {
ItemStack inSlot = theSlot.getStackInSlot(0);
ItemStack inSlot = theSlot.getInvStack(0);
if (inSlot.isEmpty()) {
player.inventory.setItemStack(interfaceSlot.addItems(player.inventory.getItemStack()));
} else {
@@ -224,7 +223,7 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
}
}
} else {
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerHand.addItems(theSlot.getStackInSlot(0)));
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerHand.addItems(theSlot.getInvStack(0)));
}
break;
@@ -253,15 +252,15 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player);
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerInv.addItems(theSlot.getStackInSlot(0)));
ItemHandlerUtil.setStackInSlot(theSlot, 0, playerInv.addItems(theSlot.getInvStack(0)));
break;
case MOVE_REGION:
final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor(player);
for (int x = 0; x < inv.server.getSlots(); x++) {
for (int x = 0; x < inv.server.getSlotCount(); x++) {
ItemHandlerUtil.setStackInSlot(inv.server, x,
playerInvAd.addItems(inv.server.getStackInSlot(x)));
playerInvAd.addItems(inv.server.getInvStack(x)));
}
break;
@@ -311,7 +310,7 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
for (final Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet()) {
final InvTracker inv = en.getValue();
this.byId.put(inv.which, inv);
this.addItems(data, inv, 0, inv.server.getSlots());
this.addItems(data, inv, 0, inv.server.getSlotCount());
}
}
@@ -324,7 +323,7 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
return true;
}
return !ItemStack.areItemStacksEqual(a, b);
return !ItemStack.areEqual(a, b);
}
private void addItems(final CompoundTag data, final InvTracker inv, final int offset, final int length) {
@@ -339,13 +338,13 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
for (int x = 0; x < length; x++) {
final CompoundTag itemNBT = new CompoundTag();
final ItemStack is = inv.server.getStackInSlot(x + offset);
final ItemStack is = inv.server.getInvStack(x + offset);
// "update" client side.
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
if (!is.isEmpty()) {
is.write(itemNBT);
is.toTag(itemNBT);
}
tag.put(Integer.toString(x + offset), itemNBT);
@@ -359,12 +358,12 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
private final long sortBy;
private final long which = autoBase++;
private final Text name;
private final ItemTransferable client;
private final ItemTransferable server;
private final FixedItemInv client;
private final FixedItemInv server;
public InvTracker(final DualityInterface dual, final ItemTransferable patterns, final Text name) {
public InvTracker(final DualityInterface dual, final FixedItemInv patterns, final Text name) {
this.server = patterns;
this.client = new AppEngInternalInventory(null, this.server.getSlots());
this.client = new AppEngInternalInventory(null, this.server.getSlotCount());
this.name = name;
this.sortBy = dual.getSortValue();
}
@@ -372,12 +371,12 @@ public final class InterfaceTerminalContainer extends AEBaseContainer {
private static class PatternSlotFilter implements IAEItemFilter {
@Override
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
public boolean allowExtract(FixedItemInv inv, int slot, int amount) {
return true;
}
@Override
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
public boolean allowInsert(FixedItemInv inv, int slot, ItemStack stack) {
return !stack.isEmpty() && stack.getItem() instanceof EncodedPatternItem;
}
}
@@ -18,7 +18,7 @@
package appeng.container.implementations;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.widget.TextFieldWidget;
@@ -84,7 +84,7 @@ public class LevelEmitterContainer extends UpgradeableContainer {
@Override
protected void setupConfig() {
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
if (this.availableUpgrades() > 0) {
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
this.getPlayerInventory())).setNotDraggable());
@@ -102,7 +102,7 @@ public class LevelEmitterContainer extends UpgradeableContainer {
8 + 18 * 3, this.getPlayerInventory())).setNotDraggable());
}
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
final int y = 40;
final int x = 80 + 44;
this.addSlot(new FakeTypeOnlySlot(inv, 0, x, y));
@@ -73,13 +73,13 @@ public class MEPortableCellContainer extends MEMonitorableContainer {
@Override
public void detectAndSendChanges() {
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem()
: this.getPlayerInv().getStackInSlot(this.slot);
: this.getPlayerInv().getStack(this.slot);
if (this.civ == null || currentItem.isEmpty()) {
this.setValidContainer(false);
} else if (this.civ != null && !this.civ.getItemStack().isEmpty() && currentItem != this.civ.getItemStack()) {
if (ItemStack.areItemsEqual(this.civ.getItemStack(), currentItem)) {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.civ.getItemStack());
this.getPlayerInv().setStack(this.getPlayerInv().currentItem, this.civ.getItemStack());
} else {
this.setValidContainer(false);
}
@@ -18,7 +18,7 @@
package appeng.container.implementations;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
@@ -70,9 +70,9 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
}
public boolean isValidItemForSlot(final int slotIndex, final ItemStack i) {
final ItemTransferable mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
final FixedItemInv mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
final ItemStack is = mac.getStackInSlot(10);
final ItemStack is = mac.getInvStack(10);
if (is.isEmpty()) {
return false;
}
@@ -99,7 +99,7 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
int offX = 29;
int offY = 30;
final ItemTransferable mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
final FixedItemInv mac = this.getUpgradeable().getInventoryByName(MolecularAssemblerBlockEntity.INVENTORY_MAIN);
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
@@ -120,7 +120,7 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
offX = 122;
offY = 17;
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
this.getPlayerInventory())).setNotDraggable());
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
@@ -80,7 +80,7 @@ public class NetworkToolContainer extends AEBaseContainer {
if (currentItem != this.toolInv.getItemStack()) {
if (!currentItem.isEmpty()) {
if (ItemStack.areItemsEqual(this.toolInv.getItemStack(), currentItem)) {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem,
this.getPlayerInv().setStack(this.getPlayerInv().currentItem,
this.toolInv.getItemStack());
} else {
this.setValidContainer(false);
@@ -22,9 +22,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.inventory.CraftResultInventory;
import net.minecraft.inventory.CraftingInventory;
@@ -33,8 +35,6 @@ import net.minecraft.inventory.container.CraftingResultSlot;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT;
@@ -68,7 +68,7 @@ import appeng.parts.reporting.PatternTerminalPart;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.AdaptorFixedInv;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperCursorItemHandler;
@@ -92,14 +92,14 @@ public class PatternTermContainer extends MEMonitorableContainer
private final PatternTerminalPart patternTerminal;
private final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
private final ItemTransferable crafting;
private final FixedItemInv crafting;
private final FakeCraftingMatrixSlot[] craftingSlots = new FakeCraftingMatrixSlot[9];
private final OptionalFakeSlot[] outputSlots = new OptionalFakeSlot[3];
private final PatternTermSlot craftSlot;
private final RestrictedInputSlot patternSlotIN;
private final RestrictedInputSlot patternSlotOUT;
private IRecipe<CraftingInventory> currentRecipe;
private Recipe<CraftingInventory> currentRecipe;
@GuiSync(97)
public boolean craftingMode = true;
@GuiSync(96)
@@ -109,8 +109,8 @@ public class PatternTermContainer extends MEMonitorableContainer
super(TYPE, id, ip, monitorable, false);
this.patternTerminal = (PatternTerminalPart) monitorable;
final ItemTransferable patternInv = this.getPatternTerminal().getInventoryByName("pattern");
final ItemTransferable output = this.getPatternTerminal().getInventoryByName("output");
final FixedItemInv patternInv = this.getPatternTerminal().getInventoryByName("pattern");
final FixedItemInv output = this.getPatternTerminal().getInventoryByName("output");
this.crafting = this.getPatternTerminal().getInventoryByName("crafting");
@@ -168,12 +168,12 @@ public class PatternTermContainer extends MEMonitorableContainer
final World world = this.getPlayerInv().player.world;
final CraftingInventory ic = new CraftingInventory(this, 3, 3);
for (int x = 0; x < ic.getSizeInventory(); x++) {
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
for (int x = 0; x < ic.size(); x++) {
ic.setStack(x, this.crafting.getInvStack(x));
}
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, world)) {
this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
this.currentRecipe = world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world).orElse(null);
}
final ItemStack is;
@@ -181,7 +181,7 @@ public class PatternTermContainer extends MEMonitorableContainer
if (this.currentRecipe == null) {
is = ItemStack.EMPTY;
} else {
is = this.currentRecipe.getCraftingResult(ic);
is = this.currentRecipe.craft(ic);
}
this.cOut.setStackInSlot(0, is);
@@ -194,7 +194,7 @@ public class PatternTermContainer extends MEMonitorableContainer
}
@Override
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
}
@@ -319,7 +319,7 @@ public class PatternTermContainer extends MEMonitorableContainer
final CompoundTag c = new CompoundTag();
if (!i.isEmpty()) {
i.write(c);
i.toTag(c);
}
return c;
@@ -339,7 +339,7 @@ public class PatternTermContainer extends MEMonitorableContainer
public void craftOrGetItem(final PatternSlotPacket packetPatternSlot) {
if (packetPatternSlot.slotItem != null && this.getCellInventory() != null) {
final IAEItemStack out = packetPatternSlot.slotItem.copy();
InventoryAdaptor inv = new AdaptorItemHandler(
InventoryAdaptor inv = new AdaptorFixedInv(
new WrapperCursorItemHandler(this.getPlayerInv().player.inventory));
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(this.getPlayerInv().player);
@@ -368,11 +368,11 @@ public class PatternTermContainer extends MEMonitorableContainer
final CraftingInventory real = new CraftingInventory(new ContainerNull(), 3, 3);
for (int x = 0; x < 9; x++) {
ic.setInventorySlotContents(x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY
ic.setStack(x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY
: packetPatternSlot.pattern[x].createItemStack());
}
final IRecipe<CraftingInventory> r = p.world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, p.world)
final Recipe<CraftingInventory> r = p.world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, p.world)
.orElse(null);
if (r == null) {
@@ -383,29 +383,29 @@ public class PatternTermContainer extends MEMonitorableContainer
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
final IItemList<IAEItemStack> all = storage.getStorageList();
final ItemStack is = r.getCraftingResult(ic);
final ItemStack is = r.craft(ic);
for (int x = 0; x < ic.getSizeInventory(); x++) {
if (!ic.getStackInSlot(x).isEmpty()) {
for (int x = 0; x < ic.size(); x++) {
if (!ic.getStack(x).isEmpty()) {
final ItemStack pulled = Platform.extractItemsByRecipe(this.getPowerSource(),
this.getActionSource(), storage, p.world, r, is, ic, ic.getStackInSlot(x), x, all,
this.getActionSource(), storage, p.world, r, is, ic, ic.getStack(x), x, all,
Actionable.MODULATE, ViewCellItem.createFilter(this.getViewCells()));
real.setInventorySlotContents(x, pulled);
real.setStack(x, pulled);
}
}
final IRecipe<CraftingInventory> rr = p.world.getRecipeManager()
.getRecipe(IRecipeType.CRAFTING, real, p.world).orElse(null);
final Recipe<CraftingInventory> rr = p.world.getRecipeManager()
.getRecipe(RecipeType.CRAFTING, real, p.world).orElse(null);
if (rr == r && Platform.itemComparisons().isSameItem(rr.getCraftingResult(real), is)) {
if (rr == r && Platform.itemComparisons().isSameItem(rr.craft(real), is)) {
final CraftResultInventory craftingResult = new CraftResultInventory();
craftingResult.setRecipeUsed(rr);
final CraftingResultSlot sc = new CraftingResultSlot(p, real, craftingResult, 0, 0, 0);
sc.onTake(p, is);
for (int x = 0; x < real.getSizeInventory(); x++) {
final ItemStack failed = playerInv.addItems(real.getStackInSlot(x));
for (int x = 0; x < real.size(); x++) {
final ItemStack failed = playerInv.addItems(real.getStack(x));
if (!failed.isEmpty()) {
p.dropItem(failed, false);
@@ -418,8 +418,8 @@ public class PatternTermContainer extends MEMonitorableContainer
}
this.detectAndSendChanges();
} else {
for (int x = 0; x < real.getSizeInventory(); x++) {
final ItemStack failed = real.getStackInSlot(x);
for (int x = 0; x < real.size(); x++) {
final ItemStack failed = real.getStack(x);
if (!failed.isEmpty()) {
this.getCellInventory().injectItems(AEItemStack.fromItemStack(failed), Actionable.MODULATE,
new MachineSource(this.getPatternTerminal()));
@@ -487,7 +487,7 @@ public class PatternTermContainer extends MEMonitorableContainer
}
@Override
public ItemTransferable getInventoryByName(final String name) {
public FixedItemInv getInventoryByName(final String name) {
if (name.equals("player")) {
return new PlayerInvWrapper(this.getPlayerInventory());
}
@@ -20,7 +20,7 @@ package appeng.container.implementations;
import javax.annotation.Nonnull;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
@@ -57,7 +57,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
private final QuartzKnifeObj toolInv;
private final ItemTransferable inSlot = new AppEngInternalInventory(null, 1, 1);
private final FixedItemInv inSlot = new AppEngInternalInventory(null, 1, 1);
private String myName = "";
public QuartzKnifeContainer(int id, final PlayerInventory ip, final QuartzKnifeObj te) {
@@ -84,7 +84,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
if (currentItem != this.toolInv.getItemStack()) {
if (!currentItem.isEmpty()) {
if (ItemStack.areItemsEqual(this.toolInv.getItemStack(), currentItem)) {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem,
this.getPlayerInv().setStack(this.getPlayerInv().currentItem,
this.toolInv.getItemStack());
} else {
this.setValidContainer(false);
@@ -99,20 +99,20 @@ public class QuartzKnifeContainer extends AEBaseContainer {
@Override
public void onContainerClosed(final PlayerEntity par1PlayerEntity) {
if (this.inSlot.getStackInSlot(0) != null) {
par1PlayerEntity.dropItem(this.inSlot.getStackInSlot(0), false);
if (this.inSlot.getInvStack(0) != null) {
par1PlayerEntity.dropItem(this.inSlot.getInvStack(0), false);
}
}
private class QuartzKniveSlot extends OutputSlot {
QuartzKniveSlot(ItemTransferable a, int b, int c, int d, int i) {
QuartzKniveSlot(FixedItemInv a, int b, int c, int d, int i) {
super(a, b, c, d, i);
}
@Override
public ItemStack getStack() {
final ItemTransferable baseInv = this.getItemHandler();
final ItemStack input = baseInv.getStackInSlot(0);
final FixedItemInv baseInv = this.getItemHandler();
final ItemStack input = baseInv.getInvStack(0);
if (input == ItemStack.EMPTY) {
return ItemStack.EMPTY;
}
@@ -153,7 +153,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
final ItemStack item = QuartzKnifeContainer.this.toolInv.getItemStack();
final ItemStack before = item.copy();
item.damageItem(1, QuartzKnifeContainer.this.getPlayerInv().player, p -> {
QuartzKnifeContainer.this.getPlayerInv().setInventorySlotContents(
QuartzKnifeContainer.this.getPlayerInv().setStack(
QuartzKnifeContainer.this.getPlayerInv().currentItem, ItemStack.EMPTY);
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(
QuartzKnifeContainer.this.getPlayerInv().player, before, null));
@@ -24,7 +24,7 @@ import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
@@ -139,7 +139,7 @@ public class SecurityStationContainer extends MEMonitorableContainer implements
}
@Override
public void onChangeInventory(final ItemTransferable inv, final int slot, final InvOperation mc,
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
if (!this.wirelessOut.getHasStack()) {
if (this.wirelessIn.getHasStack()) {
@@ -20,7 +20,7 @@ package appeng.container.implementations;
import java.util.Iterator;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
@@ -86,7 +86,7 @@ public class StorageBusContainer extends UpgradeableContainer {
final int xo = 8;
final int yo = 23 + 6;
final ItemTransferable config = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv config = this.getUpgradeable().getInventoryByName("config");
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 9; x++) {
if (y < 2) {
@@ -97,7 +97,7 @@ public class StorageBusContainer extends UpgradeableContainer {
}
}
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
this.getPlayerInventory())).setNotDraggable());
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18,
@@ -148,7 +148,7 @@ public class StorageBusContainer extends UpgradeableContainer {
}
public void partition() {
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
final IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler();
@@ -159,7 +159,7 @@ public class StorageBusContainer extends UpgradeableContainer {
i = list.iterator();
}
for (int x = 0; x < inv.getSlots(); x++) {
for (int x = 0; x < inv.getSlotCount(); x++) {
if (i.hasNext() && this.isSlotEnabled((x / 9) - 2)) {
// TODO: check if ok
final ItemStack g = i.next().asItemStackRepresentation();
@@ -21,13 +21,13 @@ package appeng.container.implementations;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.FuzzyMode;
import appeng.api.config.RedstoneMode;
@@ -111,8 +111,8 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
zCoord = mk.getPos().getZ();
}
final IInventory pi = this.getPlayerInv();
for (int x = 0; x < pi.getSizeInventory(); x++) {
final Inventory pi = this.getPlayerInv();
for (int x = 0; x < pi.size(); x++) {
final ItemStack pii = pi.getStackInSlot(x);
if (!pii.isEmpty() && pii.getItem() instanceof NetworkToolItem) {
this.lockPlayerInventorySlot(x);
@@ -149,7 +149,7 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
protected void setupConfig() {
this.setupUpgrades();
final ItemTransferable inv = this.getUpgradeable().getInventoryByName("config");
final FixedItemInv inv = this.getUpgradeable().getInventoryByName("config");
final int y = 40;
final int x = 80;
this.addSlot(new FakeTypeOnlySlot(inv, 0, x, y));
@@ -168,7 +168,7 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
}
protected void setupUpgrades() {
final ItemTransferable upgrades = this.getUpgradeable().getInventoryByName("upgrades");
final FixedItemInv upgrades = this.getUpgradeable().getInventoryByName("upgrades");
if (this.availableUpgrades() > 0) {
this.addSlot((new RestrictedInputSlot(RestrictedInputSlot.PlacableItemType.UPGRADES, upgrades, 0, 187, 8,
this.getPlayerInventory())).setNotDraggable());
@@ -229,12 +229,12 @@ public class UpgradeableContainer extends AEBaseContainer implements IOptionalSl
protected void checkToolbox() {
if (this.hasToolbox()) {
final ItemStack currentItem = this.getPlayerInv().getStackInSlot(this.tbSlot);
final ItemStack currentItem = this.getPlayerInv().getStack(this.tbSlot);
if (currentItem != this.tbInventory.getItemStack()) {
if (!currentItem.isEmpty()) {
if (ItemStack.areItemsEqual(this.tbInventory.getItemStack(), currentItem)) {
this.getPlayerInv().setInventorySlotContents(this.tbSlot, this.tbInventory.getItemStack());
this.getPlayerInv().setStack(this.tbSlot, this.tbInventory.getItemStack());
} else {
this.setValidContainer(false);
}
@@ -57,7 +57,7 @@ public class WirelessTermContainer extends MEPortableCellContainer {
if (!this.wirelessTerminalGUIObject.rangeCheck()) {
if (Platform.isServer() && this.isValidContainer()) {
this.getPlayerInv().player.sendMessage(PlayerMessages.OutOfRange.get());
this.getPlayerInv().player.sendSystemMessage(PlayerMessages.OutOfRange.get(), Util.NIL_UUID);
}
this.setValidContainer(false);
@@ -18,11 +18,11 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.recipe.RecipeType;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.fml.hooks.BasicEventHooks;
@@ -35,7 +35,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
/**
* The craft matrix inventory linked to this result slot.
*/
private final ItemTransferable craftMatrix;
private final FixedItemInv craftMatrix;
/**
* The player that is using the GUI where this slot resides.
@@ -48,8 +48,8 @@ public class AppEngCraftingSlot extends AppEngSlot {
*/
private int amountCrafted;
public AppEngCraftingSlot(final PlayerEntity par1PlayerEntity, final ItemTransferable par2IInventory,
final ItemTransferable par3IInventory, final int par4, final int par5, final int par6) {
public AppEngCraftingSlot(final PlayerEntity par1PlayerEntity, final FixedItemInv par2IInventory,
final FixedItemInv par3IInventory, final int par4, final int par5, final int par6) {
super(par3IInventory, par4, par5, par6);
this.thePlayer = par1PlayerEntity;
this.craftMatrix = par2IInventory;
@@ -92,8 +92,8 @@ public class AppEngCraftingSlot extends AppEngSlot {
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
final CraftingInventory ic = new CraftingInventory(this.getContainer(), 3, 3);
for (int x = 0; x < this.craftMatrix.getSlots(); x++) {
ic.setInventorySlotContents(x, this.craftMatrix.getStackInSlot(x));
for (int x = 0; x < this.craftMatrix.getSlotCount(); x++) {
ic.setStack(x, this.craftMatrix.getInvStack(x));
}
final NonNullList<ItemStack> aitemstack = this.getRemainingItems(ic, playerIn.world);
@@ -103,7 +103,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
for (int i = 0; i < aitemstack.size(); ++i) {
final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
final ItemStack itemstack1 = this.craftMatrix.getInvStack(i);
final ItemStack itemstack2 = aitemstack.get(i);
if (!itemstack1.isEmpty()) {
@@ -111,7 +111,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
}
if (!itemstack2.isEmpty()) {
if (this.craftMatrix.getStackInSlot(i).isEmpty()) {
if (this.craftMatrix.getInvStack(i).isEmpty()) {
ItemHandlerUtil.setStackInSlot(this.craftMatrix, i, itemstack2);
} else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) {
this.thePlayer.dropItem(itemstack2, false);
@@ -138,7 +138,7 @@ public class AppEngCraftingSlot extends AppEngSlot {
// TODO: This is really hacky and NEEDS to be solved with a full container/gui
// refactoring.
protected NonNullList<ItemStack> getRemainingItems(CraftingInventory ic, World world) {
return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world)
return world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world)
.map(iCraftingRecipe -> iCraftingRecipe.getRemainingItems(ic))
.orElse(NonNullList.withSize(9, ItemStack.EMPTY));
}
@@ -20,11 +20,10 @@ package appeng.container.slot;
import javax.annotation.Nonnull;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
@@ -33,8 +32,8 @@ import appeng.container.AEBaseContainer;
import appeng.util.helpers.ItemHandlerUtil;
public class AppEngSlot extends Slot {
private static IInventory emptyInventory = new Inventory(0);
private final ItemTransferable itemHandler;
private static Inventory emptyInventory = new Inventory(0);
private final FixedItemInv itemHandler;
private final int index;
private final int defX;
@@ -46,7 +45,7 @@ public class AppEngSlot extends Slot {
private CalculatedValidity isValid;
private boolean isDisplay = false;
public AppEngSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
public AppEngSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
super(emptyInventory, idx, x, y);
this.itemHandler = inv;
this.index = idx;
@@ -89,7 +88,7 @@ public class AppEngSlot extends Slot {
return ItemStack.EMPTY;
}
if (this.itemHandler.getSlots() <= this.getSlotIndex()) {
if (this.itemHandler.getSlotCount() <= this.getSlotIndex()) {
return ItemStack.EMPTY;
}
@@ -98,7 +97,7 @@ public class AppEngSlot extends Slot {
return this.getDisplayStack();
}
return this.itemHandler.getStackInSlot(this.index);
return this.itemHandler.getInvStack(this.index);
}
@Override
@@ -115,7 +114,7 @@ public class AppEngSlot extends Slot {
}
}
public ItemTransferable getItemHandler() {
public FixedItemInv getItemHandler() {
return this.itemHandler;
}
@@ -166,7 +165,7 @@ public class AppEngSlot extends Slot {
}
public ItemStack getDisplayStack() {
return this.itemHandler.getStackInSlot(this.index);
return this.itemHandler.getInvStack(this.index);
}
public float getOpacityOfIcon() {
@@ -18,8 +18,8 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import net.minecraft.inventory.IInventory;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import appeng.container.AEBaseContainer;
@@ -27,9 +27,9 @@ import appeng.util.inv.WrapperInvItemHandler;
public class CraftingMatrixSlot extends AppEngSlot {
private final AEBaseContainer c;
private final IInventory wrappedInventory;
private final Inventory wrappedInventory;
public CraftingMatrixSlot(final AEBaseContainer c, final ItemTransferable par1iInventory, final int par2,
public CraftingMatrixSlot(final AEBaseContainer c, final FixedItemInv par1iInventory, final int par2,
final int par3, final int par4) {
super(par1iInventory, par2, par3, par4);
this.c = c;
@@ -22,13 +22,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -50,15 +50,15 @@ import appeng.items.storage.ViewCellItem;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.helpers.ItemHandlerUtil;
import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.AdaptorFixedInv;
import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.inv.WrapperInvItemHandler;
import appeng.util.item.AEItemStack;
public class CraftingTermSlot extends AppEngCraftingSlot {
private final ItemTransferable craftInv;
private final ItemTransferable pattern;
private final FixedItemInv craftInv;
private final FixedItemInv pattern;
private final IActionSource mySrc;
private final IEnergySource energySrc;
@@ -66,8 +66,8 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
private final IContainerCraftingPacket container;
public CraftingTermSlot(final PlayerEntity player, final IActionSource mySrc, final IEnergySource energySrc,
final IStorageMonitorable storage, final ItemTransferable cMatrix, final ItemTransferable secondMatrix,
final ItemTransferable output, final int x, final int y, final IContainerCraftingPacket ccp) {
final IStorageMonitorable storage, final FixedItemInv cMatrix, final FixedItemInv secondMatrix,
final FixedItemInv output, final int x, final int y, final IContainerCraftingPacket ccp) {
super(player, cMatrix, output, 0, x, y);
this.energySrc = energySrc;
this.storage = storage;
@@ -77,7 +77,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
this.container = ccp;
}
public ItemTransferable getCraftingMatrix() {
public FixedItemInv getCraftingMatrix() {
return this.craftInv;
}
@@ -111,12 +111,12 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
maxTimesToCraft = (int) Math.floor((double) this.getStack().getMaxStackSize() / (double) howManyPerCraft);
} else if (action == InventoryAction.CRAFT_STACK) // craft into hand, full stack
{
ia = new AdaptorItemHandler(new WrapperCursorItemHandler(who.inventory));
ia = new AdaptorFixedInv(new WrapperCursorItemHandler(who.inventory));
maxTimesToCraft = (int) Math.floor((double) this.getStack().getMaxStackSize() / (double) howManyPerCraft);
} else
// pick up what was crafted...
{
ia = new AdaptorItemHandler(new WrapperCursorItemHandler(who.inventory));
ia = new AdaptorFixedInv(new WrapperCursorItemHandler(who.inventory));
maxTimesToCraft = 1;
}
@@ -139,7 +139,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
final List<ItemStack> drops = new ArrayList<>();
drops.add(extra);
Platform.spawnDrops(who.world,
new BlockPos((int) who.getPosX(), (int) who.getPosY(), (int) who.getPosZ()), drops);
new BlockPos((int) who.getX(), (int) who.getY(), (int) who.getPosZ()), drops);
return;
}
}
@@ -148,17 +148,17 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
// TODO: This is really hacky and NEEDS to be solved with a full container/gui
// refactoring.
protected IRecipe<CraftingInventory> findRecipe(CraftingInventory ic, World world) {
protected Recipe<CraftingInventory> findRecipe(CraftingInventory ic, World world) {
if (this.container instanceof CraftingTermContainer) {
final CraftingTermContainer containerTerminal = (CraftingTermContainer) this.container;
final IRecipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
final Recipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
if (recipe != null && recipe.matches(ic, world)) {
return containerTerminal.getCurrentRecipe();
}
}
return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
return world.getRecipeManager().getRecipe(RecipeType.CRAFTING, ic, world).orElse(null);
}
// TODO: This is really hacky and NEEDS to be solved with a full container/gui
@@ -167,7 +167,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
protected NonNullList<ItemStack> getRemainingItems(CraftingInventory ic, World world) {
if (this.container instanceof CraftingTermContainer) {
final CraftingTermContainer containerTerminal = (CraftingTermContainer) this.container;
final IRecipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
final Recipe<CraftingInventory> recipe = containerTerminal.getCurrentRecipe();
if (recipe != null && recipe.matches(ic, world)) {
return containerTerminal.getCurrentRecipe().getRemainingItems(ic);
@@ -187,7 +187,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
ItemStack is = this.getStack();
if (!is.isEmpty() && ItemStack.areItemsEqual(request, is)) {
final ItemStack[] set = new ItemStack[this.getPattern().getSlots()];
final ItemStack[] set = new ItemStack[this.getPattern().getSlotCount()];
// Safeguard for empty slots in the inventory for now
Arrays.fill(set, ItemStack.EMPTY);
@@ -195,17 +195,17 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
if (Platform.isServer()) {
final CraftingInventory ic = new CraftingInventory(new ContainerNull(), 3, 3);
for (int x = 0; x < 9; x++) {
ic.setInventorySlotContents(x, this.getPattern().getStackInSlot(x));
ic.setStack(x, this.getPattern().getInvStack(x));
}
final IRecipe<CraftingInventory> r = this.findRecipe(ic, p.world);
final Recipe<CraftingInventory> r = this.findRecipe(ic, p.world);
if (r == null) {
final Item target = request.getItem();
if (target.isDamageable() && target.isRepairable(request)) {
boolean isBad = false;
for (int x = 0; x < ic.getSizeInventory(); x++) {
final ItemStack pis = ic.getStackInSlot(x);
for (int x = 0; x < ic.size(); x++) {
final ItemStack pis = ic.getStack(x);
if (pis.isEmpty()) {
continue;
}
@@ -223,15 +223,15 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
return ItemStack.EMPTY;
}
is = r.getCraftingResult(ic);
is = r.craft(ic);
if (inv != null) {
for (int x = 0; x < this.getPattern().getSlots(); x++) {
if (!this.getPattern().getStackInSlot(x).isEmpty()) {
for (int x = 0; x < this.getPattern().getSlotCount(); x++) {
if (!this.getPattern().getInvStack(x).isEmpty()) {
set[x] = Platform.extractItemsByRecipe(this.energySrc, this.mySrc, inv, p.world, r, is, ic,
this.getPattern().getStackInSlot(x), x, all, Actionable.MODULATE,
this.getPattern().getInvStack(x), x, all, Actionable.MODULATE,
ViewCellItem.createFilter(this.container.getViewCells()));
ic.setInventorySlotContents(x, set[x]);
ic.setStack(x, set[x]);
}
}
}
@@ -267,8 +267,8 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
// add one of each item to the items on the board...
if (Platform.isServer()) {
// set new items onto the crafting table...
for (int x = 0; x < this.craftInv.getSlots(); x++) {
if (this.craftInv.getStackInSlot(x).isEmpty()) {
for (int x = 0; x < this.craftInv.getSlotCount(); x++) {
if (this.craftInv.getInvStack(x).isEmpty()) {
ItemHandlerUtil.setStackInSlot(this.craftInv, x, set[x]);
} else if (!set[x].isEmpty()) {
// eek! put it back!
@@ -282,11 +282,11 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
}
if (drops.size() > 0) {
Platform.spawnDrops(p.world, new BlockPos((int) p.getPosX(), (int) p.getPosY(), (int) p.getPosZ()), drops);
Platform.spawnDrops(p.world, new BlockPos((int) p.getX(), (int) p.getY(), (int) p.getPosZ()), drops);
}
}
ItemTransferable getPattern() {
FixedItemInv getPattern() {
return this.pattern;
}
}
@@ -20,11 +20,11 @@ package appeng.container.slot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class DisabledSlot extends AppEngSlot {
public DisabledSlot(final ItemTransferable par1iInventory, final int slotIndex, final int x, final int y) {
public DisabledSlot(final FixedItemInv par1iInventory, final int slotIndex, final int x, final int y) {
super(par1iInventory, slotIndex, x, y);
}
@@ -18,11 +18,11 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class FakeBlacklistSlot extends FakeTypeOnlySlot {
public FakeBlacklistSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
public FakeBlacklistSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
super(inv, idx, x, y);
}
@@ -18,11 +18,11 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class FakeCraftingMatrixSlot extends FakeSlot {
public FakeCraftingMatrixSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
public FakeCraftingMatrixSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
super(inv, idx, x, y);
}
}
@@ -18,13 +18,13 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
public class FakeSlot extends AppEngSlot {
public FakeSlot(final ItemTransferable inv, final int idx, final int x, final int y) {
public FakeSlot(final FixedItemInv inv, final int idx, final int x, final int y) {
super(inv, idx, x, y);
}
@@ -18,12 +18,12 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.item.ItemStack;
public class FakeTypeOnlySlot extends FakeSlot {
public FakeTypeOnlySlot(final ItemTransferable inv, final int idx, final int x, final int y) {
public FakeTypeOnlySlot(final FixedItemInv inv, final int idx, final int x, final int y) {
super(inv, idx, x, y);
}
@@ -20,13 +20,13 @@ package appeng.container.slot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class InaccessibleSlot extends AppEngSlot {
private ItemStack dspStack = ItemStack.EMPTY;
public InaccessibleSlot(final ItemTransferable i, final int slotIdx, final int x, final int y) {
public InaccessibleSlot(final FixedItemInv i, final int slotIdx, final int x, final int y) {
super(i, slotIdx, x, y);
}
@@ -19,7 +19,7 @@
package appeng.container.slot;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.container.implementations.MolecularAssemblerContainer;
@@ -27,7 +27,7 @@ public class MolecularAssemblerPatternSlot extends AppEngSlot {
private final MolecularAssemblerContainer mac;
public MolecularAssemblerPatternSlot(final MolecularAssemblerContainer mac, final ItemTransferable i, final int slotIdx,
public MolecularAssemblerPatternSlot(final MolecularAssemblerContainer mac, final FixedItemInv i, final int slotIdx,
final int x, final int y) {
super(i, slotIdx, x, y);
this.mac = mac;
@@ -18,11 +18,11 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class NormalSlot extends AppEngSlot {
public NormalSlot(final ItemTransferable inv, final int slot, final int xPos, final int yPos) {
public NormalSlot(final FixedItemInv inv, final int slot, final int xPos, final int yPos) {
super(inv, slot, xPos, yPos);
}
}
@@ -21,7 +21,7 @@ package appeng.container.slot;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class OptionalFakeSlot extends FakeSlot implements IOptionalSlot {
@@ -31,7 +31,7 @@ public class OptionalFakeSlot extends FakeSlot implements IOptionalSlot {
private final IOptionalSlotHost host;
private boolean renderDisabled = true;
public OptionalFakeSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int idx, final int x,
public OptionalFakeSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int idx, final int x,
final int y, final int offX, final int offY, final int groupNum) {
super(inv, idx, x + offX * 18, y + offY * 18);
this.srcX = x;
@@ -18,14 +18,14 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class OptionalNormalSlot extends AppEngSlot implements IOptionalSlot {
private final int groupNum;
private final IOptionalSlotHost host;
public OptionalNormalSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int slot,
public OptionalNormalSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int slot,
final int xPos, final int yPos, final int groupNum) {
super(inv, slot, xPos, yPos);
this.groupNum = groupNum;
@@ -18,7 +18,7 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerInventory;
public class OptionalRestrictedInputSlot extends RestrictedInputSlot {
@@ -26,7 +26,7 @@ public class OptionalRestrictedInputSlot extends RestrictedInputSlot {
private final int groupNum;
private final IOptionalSlotHost host;
public OptionalRestrictedInputSlot(final PlacableItemType valid, final ItemTransferable i, final IOptionalSlotHost host,
public OptionalRestrictedInputSlot(final PlacableItemType valid, final FixedItemInv i, final IOptionalSlotHost host,
final int slotIndex, final int x, final int y, final int grpNum, final PlayerInventory invPlayer) {
super(valid, i, slotIndex, x, y, invPlayer);
this.groupNum = grpNum;
@@ -19,11 +19,11 @@
package appeng.container.slot;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class OptionalTypeOnlyFakeSlot extends OptionalFakeSlot {
public OptionalTypeOnlyFakeSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int idx,
public OptionalTypeOnlyFakeSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int idx,
final int x, final int y, final int offX, final int offY, final int groupNum) {
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
}
@@ -19,11 +19,11 @@
package appeng.container.slot;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class OutputSlot extends AppEngSlot {
public OutputSlot(final ItemTransferable a, final int b, final int c, final int d, final int i) {
public OutputSlot(final FixedItemInv a, final int b, final int c, final int d, final int i) {
super(a, b, c, d);
this.setIIcon(i);
}
@@ -18,11 +18,11 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class PatternOutputsSlot extends OptionalFakeSlot {
public PatternOutputsSlot(final ItemTransferable inv, final IOptionalSlotHost containerBus, final int idx, final int x,
public PatternOutputsSlot(final FixedItemInv inv, final IOptionalSlotHost containerBus, final int idx, final int x,
final int y, final int offX, final int offY, final int groupNum) {
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
}
@@ -18,7 +18,7 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -37,8 +37,8 @@ public class PatternTermSlot extends CraftingTermSlot {
private final IOptionalSlotHost host;
public PatternTermSlot(final PlayerEntity player, final IActionSource mySrc, final IEnergySource energySrc,
final IStorageMonitorable storage, final ItemTransferable cMatrix, final ItemTransferable secondMatrix,
final ItemTransferable output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber,
final IStorageMonitorable storage, final FixedItemInv cMatrix, final FixedItemInv secondMatrix,
final FixedItemInv output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber,
final IContainerCraftingPacket c) {
super(player, mySrc, energySrc, storage, cMatrix, secondMatrix, output, x, y, c);
@@ -18,11 +18,11 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
public class PlayerHotBarSlot extends AppEngSlot {
public PlayerHotBarSlot(final ItemTransferable par1iInventory, final int par2, final int par3, final int par4) {
public PlayerHotBarSlot(final FixedItemInv par1iInventory, final int par2, final int par3, final int par4) {
super(par1iInventory, par2, par3, par4);
this.setPlayerSide(true);
}
@@ -18,13 +18,13 @@
package appeng.container.slot;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
// there is nothing special about this slot, its simply used to represent the players inventory, vs a container slot.
public class PlayerInvSlot extends AppEngSlot {
public PlayerInvSlot(final ItemTransferable par1iInventory, final int idx, final int x, final int y) {
public PlayerInvSlot(final FixedItemInv par1iInventory, final int idx, final int x, final int y) {
super(par1iInventory, idx, x, y);
this.setPlayerSide(true);
@@ -21,7 +21,7 @@ package appeng.container.slot;
import java.util.List;
import java.util.Set;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.PlayerEntity;
@@ -70,7 +70,7 @@ public class RestrictedInputSlot extends AppEngSlot {
private boolean allowEdit = true;
private int stackLimit = -1;
public RestrictedInputSlot(final PlacableItemType valid, final ItemTransferable i, final int slotIndex, final int x,
public RestrictedInputSlot(final PlacableItemType valid, final FixedItemInv i, final int slotIndex, final int x,
final int y, final PlayerInventory p) {
super(i, slotIndex, x, y);
this.which = valid;
@@ -233,7 +233,7 @@ public class RestrictedInputSlot extends AppEngSlot {
final ItemStack is = super.getStack();
if (!is.isEmpty() && is.getItem() instanceof EncodedPatternItem) {
final EncodedPatternItem iep = (EncodedPatternItem) is.getItem();
final ItemStack out = iep.getOutput(is);
final ItemStack out = iep.getOutput(p.player.world, is);
if (!out.isEmpty()) {
return out;
}