Search in sources :

Example 1 with ConstellationBaseItem

use of hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem in project AstralSorcery by HellFirePvP.

the class ContainerTome method slotChanged.

public void slotChanged() {
    if (EffectiveSide.get().isServer()) {
        LinkedList<IConstellation> saveConstellations = new LinkedList<>();
        for (int i = 36; i < 63; i++) {
            ItemStack in = inventorySlots.get(i).getStack();
            if (in.isEmpty()) {
                continue;
            }
            if (!(in.getItem() instanceof ConstellationBaseItem)) {
                continue;
            }
            IConstellation c = ((ConstellationBaseItem) in.getItem()).getConstellation(in);
            if (c != null) {
                saveConstellations.add(c);
            }
        }
        ResearchManager.updateConstellationPapers(saveConstellations, this.owningPlayer);
    }
}
Also used : ConstellationBaseItem(hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation)

Example 2 with ConstellationBaseItem

use of hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem in project AstralSorcery by HellFirePvP.

the class ItemTome method getTomeStorage.

public static IInventory getTomeStorage(ItemStack stack, PlayerEntity player) {
    Inventory inventory = new Inventory(27);
    getStoredConstellations(stack, player).stream().map(cst -> {
        ItemStack cstPaper = new ItemStack(ItemsAS.CONSTELLATION_PAPER);
        if (cstPaper.getItem() instanceof ConstellationBaseItem) {
            ((ConstellationBaseItem) cstPaper.getItem()).setConstellation(cstPaper, cst);
        }
        return cstPaper;
    }).forEach(inventory::addItem);
    return inventory;
}
Also used : ResearchManager(hellfirepvp.astralsorcery.common.data.research.ResearchManager) NBTHelper(hellfirepvp.astralsorcery.common.util.nbt.NBTHelper) Item(net.minecraft.item.Item) CommonProxy(hellfirepvp.astralsorcery.common.CommonProxy) Constants(net.minecraftforge.common.util.Constants) ConstellationBaseItem(hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem) Inventory(net.minecraft.inventory.Inventory) CompoundNBT(net.minecraft.nbt.CompoundNBT) ItemsAS(hellfirepvp.astralsorcery.common.lib.ItemsAS) ItemUseContext(net.minecraft.item.ItemUseContext) ItemStack(net.minecraft.item.ItemStack) PlayerProgress(hellfirepvp.astralsorcery.common.data.research.PlayerProgress) AstralSorcery(hellfirepvp.astralsorcery.AstralSorcery) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation) Hand(net.minecraft.util.Hand) ConstellationRegistry(hellfirepvp.astralsorcery.common.constellation.ConstellationRegistry) BlockState(net.minecraft.block.BlockState) LinkedList(java.util.LinkedList) LogicalSide(net.minecraftforge.fml.LogicalSide) ListNBT(net.minecraft.nbt.ListNBT) ResearchHelper(hellfirepvp.astralsorcery.common.data.research.ResearchHelper) PlayerEntity(net.minecraft.entity.player.PlayerEntity) World(net.minecraft.world.World) RegistriesAS(hellfirepvp.astralsorcery.common.lib.RegistriesAS) ActionResult(net.minecraft.util.ActionResult) Objects(java.util.Objects) List(java.util.List) LecternBlock(net.minecraft.block.LecternBlock) GuiType(hellfirepvp.astralsorcery.common.GuiType) IInventory(net.minecraft.inventory.IInventory) ResourceLocation(net.minecraft.util.ResourceLocation) PerkExperienceRevealer(hellfirepvp.astralsorcery.common.item.base.PerkExperienceRevealer) ContainerTomeProvider(hellfirepvp.astralsorcery.common.container.factory.ContainerTomeProvider) ActionResultType(net.minecraft.util.ActionResultType) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) ConstellationBaseItem(hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem) ItemStack(net.minecraft.item.ItemStack) Inventory(net.minecraft.inventory.Inventory) IInventory(net.minecraft.inventory.IInventory)

Aggregations

ConstellationBaseItem (hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem)2 IConstellation (hellfirepvp.astralsorcery.common.constellation.IConstellation)2 LinkedList (java.util.LinkedList)2 ItemStack (net.minecraft.item.ItemStack)2 AstralSorcery (hellfirepvp.astralsorcery.AstralSorcery)1 CommonProxy (hellfirepvp.astralsorcery.common.CommonProxy)1 GuiType (hellfirepvp.astralsorcery.common.GuiType)1 ConstellationRegistry (hellfirepvp.astralsorcery.common.constellation.ConstellationRegistry)1 ContainerTomeProvider (hellfirepvp.astralsorcery.common.container.factory.ContainerTomeProvider)1 PlayerProgress (hellfirepvp.astralsorcery.common.data.research.PlayerProgress)1 ResearchHelper (hellfirepvp.astralsorcery.common.data.research.ResearchHelper)1 ResearchManager (hellfirepvp.astralsorcery.common.data.research.ResearchManager)1 PerkExperienceRevealer (hellfirepvp.astralsorcery.common.item.base.PerkExperienceRevealer)1 ItemsAS (hellfirepvp.astralsorcery.common.lib.ItemsAS)1 RegistriesAS (hellfirepvp.astralsorcery.common.lib.RegistriesAS)1 NBTHelper (hellfirepvp.astralsorcery.common.util.nbt.NBTHelper)1 List (java.util.List)1 Objects (java.util.Objects)1 BlockState (net.minecraft.block.BlockState)1 LecternBlock (net.minecraft.block.LecternBlock)1