Search in sources :

Example 1 with Lens

use of org.spongepowered.common.item.inventory.lens.Lens in project SpongeCommon by SpongePowered.

the class ContainerUtil method generateAdapterLens.

@Nullable
private static Lens<IInventory, ItemStack> generateAdapterLens(SlotProvider<IInventory, ItemStack> slots, int index, CraftingInventoryData crafting, List<Slot> slotList, @Nullable IInventory subInventory) {
    if (!(subInventory instanceof InventoryAdapter)) {
        return null;
    }
    Lens<IInventory, ItemStack> adapterLens = ((InventoryAdapter) subInventory).getRootLens();
    if (adapterLens == null) {
        return null;
    }
    if (subInventory.getSizeInventory() == 0) {
        return new DefaultEmptyLens<>(((InventoryAdapter) subInventory));
    }
    if (adapterLens instanceof PlayerInventoryLens) {
        if (slotList.size() == 36) {
            return new DelegatingLens(index, new MainPlayerInventoryLensImpl(index, slots, true), slots);
        }
        return null;
    }
    // For Crafting Result we need the Slot to get Filter logic
    if (subInventory instanceof InventoryCraftResult) {
        Slot slot = slotList.get(0);
        adapterLens = new CraftingOutputSlotLensImpl(index, item -> slot.isItemValid(((ItemStack) item)), itemType -> (slot.isItemValid((ItemStack) org.spongepowered.api.item.inventory.ItemStack.of(itemType, 1))));
        crafting.out = index;
        if (slot instanceof SlotCrafting) {
            if (crafting.base == null) {
                // In case we do not find the InventoryCrafting later assume it is directly after the SlotCrafting
                // e.g. for IC2 ContainerIndustrialWorkbench
                crafting.base = index + 1;
                crafting.grid = ((SlotCrafting) slot).craftMatrix;
            }
        }
    }
    if (subInventory instanceof InventoryCrafting) {
        crafting.base = index;
        crafting.grid = ((InventoryCrafting) subInventory);
    }
    return new DelegatingLens(index, adapterLens, slots);
}
Also used : IInventory(net.minecraft.inventory.IInventory) MainPlayerInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.MainPlayerInventoryLensImpl) MinecraftFabric(org.spongepowered.common.item.inventory.lens.impl.MinecraftFabric) LargeChestInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.LargeChestInventoryLens) Random(java.util.Random) ContainerChest(net.minecraft.inventory.ContainerChest) ContainerWorkbench(net.minecraft.inventory.ContainerWorkbench) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) DelegatingLens(org.spongepowered.common.item.inventory.lens.impl.DelegatingLens) PhaseData(org.spongepowered.common.event.tracking.PhaseData) CustomContainer(org.spongepowered.common.item.inventory.custom.CustomContainer) BlockCarrier(org.spongepowered.api.item.inventory.BlockCarrier) Map(java.util.Map) InventoryArchetypes(org.spongepowered.api.item.inventory.InventoryArchetypes) AbstractChestHorse(net.minecraft.entity.passive.AbstractChestHorse) EntityItem(net.minecraft.entity.item.EntityItem) IPhaseState(org.spongepowered.common.event.tracking.IPhaseState) CraftingOutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.CraftingOutputSlotLensImpl) ContainerBeacon(net.minecraft.inventory.ContainerBeacon) Location(org.spongepowered.api.world.Location) InventoryAdapter(org.spongepowered.common.item.inventory.adapter.InventoryAdapter) InventoryHelper(net.minecraft.inventory.InventoryHelper) Collection(java.util.Collection) GridInventoryLens(org.spongepowered.common.item.inventory.lens.comp.GridInventoryLens) Carrier(org.spongepowered.api.item.inventory.Carrier) Collectors(java.util.stream.Collectors) SlotCrafting(net.minecraft.inventory.SlotCrafting) InventoryArchetype(org.spongepowered.api.item.inventory.InventoryArchetype) InventoryBasic(net.minecraft.inventory.InventoryBasic) BrewingStandInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.BrewingStandInventoryLens) List(java.util.List) ContainerLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.container.ContainerLens) PhaseContext(org.spongepowered.common.event.tracking.PhaseContext) CraftingOutputAdapter(org.spongepowered.common.item.inventory.adapter.impl.slots.CraftingOutputAdapter) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ContainerDispenser(net.minecraft.inventory.ContainerDispenser) CarriedInventory(org.spongepowered.api.item.inventory.type.CarriedInventory) Lens(org.spongepowered.common.item.inventory.lens.Lens) Optional(java.util.Optional) MixinInventoryHelper(org.spongepowered.common.mixin.core.inventory.MixinInventoryHelper) LensProvider(org.spongepowered.common.item.inventory.lens.LensProvider) ContainerRepair(net.minecraft.inventory.ContainerRepair) PlayerInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens) ContainerMerchant(net.minecraft.inventory.ContainerMerchant) SpongeImpl(org.spongepowered.common.SpongeImpl) GridInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.GridInventoryLensImpl) AbstractHorse(net.minecraft.entity.passive.AbstractHorse) VanillaAdapter(org.spongepowered.common.item.inventory.adapter.impl.VanillaAdapter) SpongeImplHooks(org.spongepowered.common.SpongeImplHooks) ContainerHopper(net.minecraft.inventory.ContainerHopper) InventoryCraftResult(net.minecraft.inventory.InventoryCraftResult) Multimap(com.google.common.collect.Multimap) TileEntityChest(net.minecraft.tileentity.TileEntityChest) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) ItemStack(net.minecraft.item.ItemStack) InputSlot(org.spongepowered.api.item.inventory.slot.InputSlot) Inventory2DLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.Inventory2DLensImpl) ContainerEnchantment(net.minecraft.inventory.ContainerEnchantment) DefaultEmptyLens(org.spongepowered.common.item.inventory.lens.impl.DefaultEmptyLens) InventoryLargeChest(net.minecraft.inventory.InventoryLargeChest) ContainerFurnace(net.minecraft.inventory.ContainerFurnace) IMixinContainer(org.spongepowered.common.interfaces.IMixinContainer) ContainerBrewingStand(net.minecraft.inventory.ContainerBrewingStand) WorldServer(net.minecraft.world.WorldServer) Nullable(javax.annotation.Nullable) FurnaceInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.FurnaceInventoryLens) Fabric(org.spongepowered.common.item.inventory.lens.Fabric) Inventory2DLens(org.spongepowered.common.item.inventory.lens.comp.Inventory2DLens) SlotProvider(org.spongepowered.common.item.inventory.lens.SlotProvider) ContainerHorseInventory(net.minecraft.inventory.ContainerHorseInventory) World(net.minecraft.world.World) BlockPos(net.minecraft.util.math.BlockPos) IMixinSingleBlockCarrier(org.spongepowered.common.interfaces.IMixinSingleBlockCarrier) PhaseTracker(org.spongepowered.common.event.tracking.PhaseTracker) CraftingInventoryLens(org.spongepowered.common.item.inventory.lens.comp.CraftingInventoryLens) CraftingInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.CraftingInventoryLensImpl) ContainerPlayer(net.minecraft.inventory.ContainerPlayer) Container(org.spongepowered.api.item.inventory.Container) SlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.SlotLensImpl) IInventory(net.minecraft.inventory.IInventory) Slot(net.minecraft.inventory.Slot) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) VecHelper(org.spongepowered.common.util.VecHelper) ItemDropData(org.spongepowered.common.event.tracking.context.ItemDropData) TileEntity(net.minecraft.tileentity.TileEntity) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) Collections(java.util.Collections) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) MainPlayerInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.MainPlayerInventoryLensImpl) PlayerInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens) InventoryCraftResult(net.minecraft.inventory.InventoryCraftResult) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) CraftingOutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.CraftingOutputSlotLensImpl) InventoryAdapter(org.spongepowered.common.item.inventory.adapter.InventoryAdapter) DefaultEmptyLens(org.spongepowered.common.item.inventory.lens.impl.DefaultEmptyLens) InputSlot(org.spongepowered.api.item.inventory.slot.InputSlot) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack) DelegatingLens(org.spongepowered.common.item.inventory.lens.impl.DelegatingLens) SlotCrafting(net.minecraft.inventory.SlotCrafting) Nullable(javax.annotation.Nullable)

Example 2 with Lens

use of org.spongepowered.common.item.inventory.lens.Lens in project SpongeCommon by SpongePowered.

the class MixinInventoryPlayer method onConstructed.

@Inject(method = "<init>*", at = @At("RETURN"), remap = false)
private void onConstructed(EntityPlayer playerIn, CallbackInfo ci) {
    // Find offhand slot
    for (NonNullList<ItemStack> inventory : this.allInventories) {
        if (inventory == this.offHandInventory) {
            break;
        }
        this.offhandIndex += inventory.size();
    }
    // Set Carrier if we got a real Player
    if (playerIn instanceof EntityPlayerMP) {
        this.carrier = (Player) playerIn;
        this.inventory = new IInventoryFabric((IInventory) this);
        Class clazz = this.getClass();
        if (clazz == InventoryPlayer.class) {
            // Build Player Lens
            // We only care about Server inventories
            this.slots = new SlotCollection.Builder().add(this.mainInventory.size()).add(this.offHandInventory.size()).add(EquipmentSlotAdapter.class, index -> new EquipmentSlotLensImpl(index, i -> true, t -> true, e -> e == EquipmentTypes.BOOTS)).add(EquipmentSlotAdapter.class, index -> new EquipmentSlotLensImpl(index, i -> true, t -> true, e -> e == EquipmentTypes.LEGGINGS)).add(EquipmentSlotAdapter.class, index -> new EquipmentSlotLensImpl(index, i -> true, t -> true, e -> e == EquipmentTypes.CHESTPLATE)).add(EquipmentSlotAdapter.class, index -> new EquipmentSlotLensImpl(index, i -> true, t -> true, e -> e == EquipmentTypes.HEADWEAR)).add(this.armorInventory.size() - 4, EquipmentSlotAdapter.class).add(this.getSizeInventory() - this.mainInventory.size() - this.offHandInventory.size() - this.armorInventory.size()).build();
            this.lens = new PlayerInventoryLens(this, this.slots);
        } else if (this.getSizeInventory() != 0) {
            // Fallback OrderedLens when not 0 sized inventory
            this.slots = new SlotCollection.Builder().add(this.getSizeInventory()).build();
            this.lens = new OrderedInventoryLensImpl(0, this.getSizeInventory(), 1, slots);
        }
    }
}
Also used : IInventory(net.minecraft.inventory.IInventory) Inventory(org.spongepowered.api.item.inventory.Inventory) PlayerInventory(org.spongepowered.api.item.inventory.entity.PlayerInventory) InventoryEventArgs(org.spongepowered.common.item.inventory.observer.InventoryEventArgs) Inject(org.spongepowered.asm.mixin.injection.Inject) EnumHand(net.minecraft.util.EnumHand) EquipmentInventory(org.spongepowered.api.item.inventory.equipment.EquipmentInventory) ItemStackSnapshot(org.spongepowered.api.item.inventory.ItemStackSnapshot) Overwrite(org.spongepowered.asm.mixin.Overwrite) MainPlayerInventoryAdapter(org.spongepowered.common.item.inventory.adapter.impl.comp.MainPlayerInventoryAdapter) ItemStackUtil(org.spongepowered.common.item.inventory.util.ItemStackUtil) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) CallbackInfoReturnable(org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) CallbackInfo(org.spongepowered.asm.mixin.injection.callback.CallbackInfo) SlotTransaction(org.spongepowered.api.item.inventory.transaction.SlotTransaction) IMixinInventoryPlayer(org.spongepowered.common.interfaces.entity.player.IMixinInventoryPlayer) Mixin(org.spongepowered.asm.mixin.Mixin) NonNullList(net.minecraft.util.NonNullList) At(org.spongepowered.asm.mixin.injection.At) Fabric(org.spongepowered.common.item.inventory.lens.Fabric) SlotProvider(org.spongepowered.common.item.inventory.lens.SlotProvider) IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) Redirect(org.spongepowered.asm.mixin.injection.Redirect) EquipmentInventoryAdapter(org.spongepowered.common.item.inventory.adapter.impl.comp.EquipmentInventoryAdapter) EquipmentSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.EquipmentSlotLensImpl) InventoryPlayer(net.minecraft.entity.player.InventoryPlayer) Slot(org.spongepowered.api.item.inventory.Slot) Final(org.spongepowered.asm.mixin.Final) EquipmentSlotAdapter(org.spongepowered.common.item.inventory.adapter.impl.slots.EquipmentSlotAdapter) HotbarAdapter(org.spongepowered.common.item.inventory.adapter.impl.comp.HotbarAdapter) List(java.util.List) EntityPlayer(net.minecraft.entity.player.EntityPlayer) IInventory(net.minecraft.inventory.IInventory) Lens(org.spongepowered.common.item.inventory.lens.Lens) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) Shadow(org.spongepowered.asm.mixin.Shadow) Optional(java.util.Optional) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) Player(org.spongepowered.api.entity.living.player.Player) EquipmentTypes(org.spongepowered.api.item.inventory.equipment.EquipmentTypes) SlotIndex(org.spongepowered.api.item.inventory.property.SlotIndex) SlotAdapter(org.spongepowered.common.item.inventory.adapter.impl.slots.SlotAdapter) PlayerInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens) SPacketHeldItemChange(net.minecraft.network.play.server.SPacketHeldItemChange) MainPlayerInventory(org.spongepowered.api.item.inventory.entity.MainPlayerInventory) IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) EquipmentSlotAdapter(org.spongepowered.common.item.inventory.adapter.impl.slots.EquipmentSlotAdapter) PlayerInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) EquipmentSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.EquipmentSlotLensImpl) ItemStack(net.minecraft.item.ItemStack) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with Lens

use of org.spongepowered.common.item.inventory.lens.Lens in project SpongeCommon by SpongePowered.

the class MixinContainerWorkbench method rootLens.

@Override
public Lens<IInventory, ItemStack> rootLens(Fabric<IInventory> fabric, InventoryAdapter<IInventory, ItemStack> adapter) {
    List<Lens<IInventory, ItemStack>> lenses = new ArrayList<>();
    lenses.add(new CraftingInventoryLensImpl(0, 1, 3, 3, inventory$getSlotProvider()));
    lenses.add(new MainPlayerInventoryLensImpl(3 * 3 + 1, inventory$getSlotProvider(), true));
    return new ContainerLens(adapter, inventory$getSlotProvider(), lenses);
}
Also used : MainPlayerInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.MainPlayerInventoryLensImpl) CraftingInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.CraftingInventoryLensImpl) ContainerLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.container.ContainerLens) ArrayList(java.util.ArrayList) ContainerLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.container.ContainerLens) Lens(org.spongepowered.common.item.inventory.lens.Lens)

Example 4 with Lens

use of org.spongepowered.common.item.inventory.lens.Lens in project SpongeCommon by SpongePowered.

the class MixinTraitAdapter method getReusableLens.

@SuppressWarnings("unchecked")
private ReusableLens<?> getReusableLens() {
    if (this.reusableLens != null) {
        return this.reusableLens;
    }
    if (this instanceof ReusableLensProvider) {
        return ((ReusableLensProvider<IInventory, ItemStack>) this).generateLens(this.getFabric(), this);
    }
    if (this instanceof LensProvider) {
        this.slots = ((LensProvider) this).slotProvider(this.getFabric(), this);
        Lens lens = ((LensProvider) this).rootLens(this.getFabric(), this);
        return new ReusableLens<>(this.slots, lens);
    }
    SlotCollection slots = new SlotCollection.Builder().add(this.getFabric().getSize()).build();
    Lens<IInventory, ItemStack> lens;
    if (this.getFabric().getSize() == 0) {
        lens = new DefaultEmptyLens<>(this);
    } else {
        lens = new OrderedInventoryLensImpl(0, this.getFabric().getSize(), 1, slots);
    }
    return new ReusableLens<>(slots, lens);
}
Also used : IInventory(net.minecraft.inventory.IInventory) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) ReusableLensProvider(org.spongepowered.common.item.inventory.lens.ReusableLensProvider) ReusableLens(org.spongepowered.common.item.inventory.lens.impl.ReusableLens) DefaultEmptyLens(org.spongepowered.common.item.inventory.lens.impl.DefaultEmptyLens) Lens(org.spongepowered.common.item.inventory.lens.Lens) ReusableLens(org.spongepowered.common.item.inventory.lens.impl.ReusableLens) ItemStack(net.minecraft.item.ItemStack) ReusableLensProvider(org.spongepowered.common.item.inventory.lens.ReusableLensProvider) LensProvider(org.spongepowered.common.item.inventory.lens.LensProvider)

Example 5 with Lens

use of org.spongepowered.common.item.inventory.lens.Lens in project SpongeCommon by SpongePowered.

the class ContainerUtil method generateLens.

/**
 * Generates a fallback lens for given Container
 *
 * @param container The Container to generate a lens for
 * @param slots The slots of the Container
 * @return The generated fallback lens
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Lens<IInventory, ItemStack> generateLens(net.minecraft.inventory.Container container, SlotProvider<IInventory, ItemStack> slots) {
    // Get all inventories viewed in the Container & count slots & retain order
    Map<Optional<IInventory>, List<Slot>> viewed = container.inventorySlots.stream().collect(Collectors.groupingBy(i -> Optional.<IInventory>ofNullable(i.inventory), LinkedHashMap::new, Collectors.toList()));
    // Count the index
    int index = 0;
    CraftingInventoryData crafting = new CraftingInventoryData();
    List<Lens<IInventory, ItemStack>> lenses = new ArrayList<>();
    for (Map.Entry<Optional<IInventory>, List<Slot>> entry : viewed.entrySet()) {
        List<Slot> slotList = entry.getValue();
        int slotCount = slotList.size();
        IInventory subInventory = entry.getKey().orElse(null);
        // Generate Lens based on existing InventoryAdapter
        Lens<IInventory, ItemStack> lens = generateAdapterLens(slots, index, crafting, slotList, subInventory);
        // Check if sub-inventory is LensProvider
        if (lens == null && subInventory instanceof LensProvider) {
            Fabric<IInventory> keyFabric = MinecraftFabric.of(subInventory);
            lens = ((LensProvider) subInventory).rootLens(keyFabric, new VanillaAdapter(keyFabric, container));
        }
        // Unknown Inventory or Inventory size <> Lens size
        if (lens == null || lens.slotCount() != slotCount) {
            if (subInventory instanceof InventoryCraftResult) {
                // InventoryCraftResult is a Slot
                Slot slot = slotList.get(0);
                lens = new CraftingOutputSlotLensImpl(index, item -> slot.isItemValid(((ItemStack) item)), itemType -> (slot.isItemValid((ItemStack) org.spongepowered.api.item.inventory.ItemStack.of(itemType, 1))));
            } else if (subInventory instanceof InventoryCrafting) {
                // InventoryCrafting has width and height and is Input
                InventoryCrafting craftGrid = (InventoryCrafting) subInventory;
                lens = new GridInventoryLensImpl(index, craftGrid.getWidth(), craftGrid.getHeight(), craftGrid.getWidth(), InputSlot.class, slots);
            } else if (slotCount == 1) {
                // Unknown - A single Slot
                lens = new SlotLensImpl(index);
            } else if (subInventory instanceof InventoryBasic && subInventory.getClass().isAnonymousClass()) {
                // Anonymous InventoryBasic -> Check for Vanilla Containers:
                switch(subInventory.getName()) {
                    // Container InputSlots
                    case "Enchant":
                    case // Container InputSlots
                    "Repair":
                        lens = new OrderedInventoryLensImpl(index, slotCount, 1, InputSlot.class, slots);
                        break;
                    default:
                        // Unknown
                        lens = new OrderedInventoryLensImpl(index, slotCount, 1, slots);
                }
            } else {
                // Unknown - fallback to OrderedInventory
                lens = new OrderedInventoryLensImpl(index, slotCount, 1, slots);
            }
        }
        lenses.add(lens);
        index += slotCount;
    }
    List<Lens<IInventory, ItemStack>> additional = new ArrayList<>();
    try {
        if (crafting.out != null && crafting.base != null && crafting.grid != null) {
            additional.add(new CraftingInventoryLensImpl(crafting.out, crafting.base, crafting.grid.getWidth(), crafting.grid.getHeight(), slots));
        }
    } catch (Exception e) {
        SpongeImpl.getLogger().error("Error while creating CraftingInventoryLensImpl for " + container.getClass().getName(), e);
    }
    // Lens containing/delegating to other lenses
    return new ContainerLens((InventoryAdapter<IInventory, ItemStack>) container, slots, lenses, additional);
}
Also used : MainPlayerInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.MainPlayerInventoryLensImpl) MinecraftFabric(org.spongepowered.common.item.inventory.lens.impl.MinecraftFabric) LargeChestInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.LargeChestInventoryLens) Random(java.util.Random) ContainerChest(net.minecraft.inventory.ContainerChest) ContainerWorkbench(net.minecraft.inventory.ContainerWorkbench) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) DelegatingLens(org.spongepowered.common.item.inventory.lens.impl.DelegatingLens) PhaseData(org.spongepowered.common.event.tracking.PhaseData) CustomContainer(org.spongepowered.common.item.inventory.custom.CustomContainer) BlockCarrier(org.spongepowered.api.item.inventory.BlockCarrier) Map(java.util.Map) InventoryArchetypes(org.spongepowered.api.item.inventory.InventoryArchetypes) AbstractChestHorse(net.minecraft.entity.passive.AbstractChestHorse) EntityItem(net.minecraft.entity.item.EntityItem) IPhaseState(org.spongepowered.common.event.tracking.IPhaseState) CraftingOutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.CraftingOutputSlotLensImpl) ContainerBeacon(net.minecraft.inventory.ContainerBeacon) Location(org.spongepowered.api.world.Location) InventoryAdapter(org.spongepowered.common.item.inventory.adapter.InventoryAdapter) InventoryHelper(net.minecraft.inventory.InventoryHelper) Collection(java.util.Collection) GridInventoryLens(org.spongepowered.common.item.inventory.lens.comp.GridInventoryLens) Carrier(org.spongepowered.api.item.inventory.Carrier) Collectors(java.util.stream.Collectors) SlotCrafting(net.minecraft.inventory.SlotCrafting) InventoryArchetype(org.spongepowered.api.item.inventory.InventoryArchetype) InventoryBasic(net.minecraft.inventory.InventoryBasic) BrewingStandInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.BrewingStandInventoryLens) List(java.util.List) ContainerLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.container.ContainerLens) PhaseContext(org.spongepowered.common.event.tracking.PhaseContext) CraftingOutputAdapter(org.spongepowered.common.item.inventory.adapter.impl.slots.CraftingOutputAdapter) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ContainerDispenser(net.minecraft.inventory.ContainerDispenser) CarriedInventory(org.spongepowered.api.item.inventory.type.CarriedInventory) Lens(org.spongepowered.common.item.inventory.lens.Lens) Optional(java.util.Optional) MixinInventoryHelper(org.spongepowered.common.mixin.core.inventory.MixinInventoryHelper) LensProvider(org.spongepowered.common.item.inventory.lens.LensProvider) ContainerRepair(net.minecraft.inventory.ContainerRepair) PlayerInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens) ContainerMerchant(net.minecraft.inventory.ContainerMerchant) SpongeImpl(org.spongepowered.common.SpongeImpl) GridInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.GridInventoryLensImpl) AbstractHorse(net.minecraft.entity.passive.AbstractHorse) VanillaAdapter(org.spongepowered.common.item.inventory.adapter.impl.VanillaAdapter) SpongeImplHooks(org.spongepowered.common.SpongeImplHooks) ContainerHopper(net.minecraft.inventory.ContainerHopper) InventoryCraftResult(net.minecraft.inventory.InventoryCraftResult) Multimap(com.google.common.collect.Multimap) TileEntityChest(net.minecraft.tileentity.TileEntityChest) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) ItemStack(net.minecraft.item.ItemStack) InputSlot(org.spongepowered.api.item.inventory.slot.InputSlot) Inventory2DLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.Inventory2DLensImpl) ContainerEnchantment(net.minecraft.inventory.ContainerEnchantment) DefaultEmptyLens(org.spongepowered.common.item.inventory.lens.impl.DefaultEmptyLens) InventoryLargeChest(net.minecraft.inventory.InventoryLargeChest) ContainerFurnace(net.minecraft.inventory.ContainerFurnace) IMixinContainer(org.spongepowered.common.interfaces.IMixinContainer) ContainerBrewingStand(net.minecraft.inventory.ContainerBrewingStand) WorldServer(net.minecraft.world.WorldServer) Nullable(javax.annotation.Nullable) FurnaceInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.FurnaceInventoryLens) Fabric(org.spongepowered.common.item.inventory.lens.Fabric) Inventory2DLens(org.spongepowered.common.item.inventory.lens.comp.Inventory2DLens) SlotProvider(org.spongepowered.common.item.inventory.lens.SlotProvider) ContainerHorseInventory(net.minecraft.inventory.ContainerHorseInventory) World(net.minecraft.world.World) BlockPos(net.minecraft.util.math.BlockPos) IMixinSingleBlockCarrier(org.spongepowered.common.interfaces.IMixinSingleBlockCarrier) PhaseTracker(org.spongepowered.common.event.tracking.PhaseTracker) CraftingInventoryLens(org.spongepowered.common.item.inventory.lens.comp.CraftingInventoryLens) CraftingInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.CraftingInventoryLensImpl) ContainerPlayer(net.minecraft.inventory.ContainerPlayer) Container(org.spongepowered.api.item.inventory.Container) SlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.SlotLensImpl) IInventory(net.minecraft.inventory.IInventory) Slot(net.minecraft.inventory.Slot) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) VecHelper(org.spongepowered.common.util.VecHelper) ItemDropData(org.spongepowered.common.event.tracking.context.ItemDropData) TileEntity(net.minecraft.tileentity.TileEntity) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) Collections(java.util.Collections) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) ArrayList(java.util.ArrayList) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) GridInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.GridInventoryLensImpl) CraftingOutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.CraftingOutputSlotLensImpl) List(java.util.List) ArrayList(java.util.ArrayList) IInventory(net.minecraft.inventory.IInventory) Optional(java.util.Optional) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) CraftingInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.CraftingInventoryLensImpl) ContainerLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.container.ContainerLens) InventoryCraftResult(net.minecraft.inventory.InventoryCraftResult) LensProvider(org.spongepowered.common.item.inventory.lens.LensProvider) VanillaAdapter(org.spongepowered.common.item.inventory.adapter.impl.VanillaAdapter) CraftingOutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.CraftingOutputSlotLensImpl) SlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.SlotLensImpl) InputSlot(org.spongepowered.api.item.inventory.slot.InputSlot) Slot(net.minecraft.inventory.Slot) LargeChestInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.LargeChestInventoryLens) DelegatingLens(org.spongepowered.common.item.inventory.lens.impl.DelegatingLens) GridInventoryLens(org.spongepowered.common.item.inventory.lens.comp.GridInventoryLens) BrewingStandInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.BrewingStandInventoryLens) ContainerLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.container.ContainerLens) Lens(org.spongepowered.common.item.inventory.lens.Lens) PlayerInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens) DefaultEmptyLens(org.spongepowered.common.item.inventory.lens.impl.DefaultEmptyLens) FurnaceInventoryLens(org.spongepowered.common.item.inventory.lens.impl.minecraft.FurnaceInventoryLens) Inventory2DLens(org.spongepowered.common.item.inventory.lens.comp.Inventory2DLens) CraftingInventoryLens(org.spongepowered.common.item.inventory.lens.comp.CraftingInventoryLens) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) InventoryBasic(net.minecraft.inventory.InventoryBasic)

Aggregations

ArrayList (java.util.ArrayList)4 IInventory (net.minecraft.inventory.IInventory)4 ItemStack (net.minecraft.item.ItemStack)4 Lens (org.spongepowered.common.item.inventory.lens.Lens)4 List (java.util.List)3 Optional (java.util.Optional)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 SlotCollection (org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection)3 OrderedInventoryLensImpl (org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl)3 Multimap (com.google.common.collect.Multimap)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Random (java.util.Random)2 Collectors (java.util.stream.Collectors)2 Nullable (javax.annotation.Nullable)2 EntityItem (net.minecraft.entity.item.EntityItem)2 AbstractChestHorse (net.minecraft.entity.passive.AbstractChestHorse)2