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