Search in sources :

Example 1 with IInventoryFabric

use of org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric in project SpongeCommon by SpongePowered.

the class InventoryUtil method toSpongeInventory.

public static CraftingGridInventory toSpongeInventory(InventoryCrafting inv) {
    IInventoryFabric fabric = new IInventoryFabric(inv);
    CraftingGridInventoryLens lens = new CraftingGridInventoryLensImpl(0, inv.getWidth(), inv.getHeight(), inv.getWidth(), SlotLensImpl::new);
    return new CraftingGridInventoryAdapter(fabric, lens);
}
Also used : CraftingGridInventoryLens(org.spongepowered.common.item.inventory.lens.comp.CraftingGridInventoryLens) IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) SlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.SlotLensImpl) CraftingGridInventoryAdapter(org.spongepowered.common.item.inventory.adapter.impl.comp.CraftingGridInventoryAdapter) CraftingGridInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.CraftingGridInventoryLensImpl)

Example 2 with IInventoryFabric

use of org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric in project SpongeCommon by SpongePowered.

the class MixinEntityMinecartHopper method onConstructed.

@Inject(method = "<init>*", at = @At("RETURN"))
public void onConstructed(CallbackInfo ci) {
    this.fabric = new IInventoryFabric(this);
    this.slots = new SlotCollection.Builder().add(5).build();
    this.lens = new OrderedInventoryLensImpl(0, 5, 1, this.slots);
}
Also used : IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with IInventoryFabric

use of org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric in project SpongeCommon by SpongePowered.

the class MixinInventoryCrafting method onConstructed.

@Inject(method = "<init>", at = @At("RETURN"))
public void onConstructed(CallbackInfo ci) {
    this.fabric = new IInventoryFabric(this);
    this.slots = new SlotCollection.Builder().add(this.stackList.size()).build();
    this.lens = rootLens(fabric, ((InventoryAdapter) this));
}
Also used : IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 4 with IInventoryFabric

use of org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric in project SpongeCommon by SpongePowered.

the class MixinEntityMinecartChest method onConstructed.

@Inject(method = "<init>*", at = @At("RETURN"))
public void onConstructed(CallbackInfo ci) {
    this.fabric = new IInventoryFabric(this);
    this.slots = new SlotCollection.Builder().add(27).build();
    this.lens = new GridInventoryLensImpl(0, 9, 3, 9, this.slots);
}
Also used : IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) GridInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.GridInventoryLensImpl) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 5 with IInventoryFabric

use of org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric in project SpongeCommon by SpongePowered.

the class MixinEntityVillager method onConstructed.

@Inject(method = "<init>", at = @At("RETURN"))
public void onConstructed(CallbackInfo ci) {
    this.fabric = new IInventoryFabric(this.villagerInventory);
    this.slots = new SlotCollection.Builder().add(8).build();
    this.lens = new OrderedInventoryLensImpl(0, 8, 1, this.slots);
}
Also used : IInventoryFabric(org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric) SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

IInventoryFabric (org.spongepowered.common.item.inventory.lens.impl.fabric.IInventoryFabric)7 Inject (org.spongepowered.asm.mixin.injection.Inject)6 SlotCollection (org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection)5 OrderedInventoryLensImpl (org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl)3 IInventory (net.minecraft.inventory.IInventory)2 EquipmentSlotAdapter (org.spongepowered.common.item.inventory.adapter.impl.slots.EquipmentSlotAdapter)2 PlayerInventoryLens (org.spongepowered.common.item.inventory.lens.impl.minecraft.PlayerInventoryLens)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 InventoryPlayer (net.minecraft.entity.player.InventoryPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 SPacketHeldItemChange (net.minecraft.network.play.server.SPacketHeldItemChange)1 EnumHand (net.minecraft.util.EnumHand)1 NonNullList (net.minecraft.util.NonNullList)1 Player (org.spongepowered.api.entity.living.player.Player)1 User (org.spongepowered.api.entity.living.player.User)1 Inventory (org.spongepowered.api.item.inventory.Inventory)1