Utils ported
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user