Search in sources :

Example 1 with AttunementRecipe

use of hellfirepvp.astralsorcery.common.crafting.nojson.attunement.AttunementRecipe in project AstralSorcery by HellFirePvP.

the class TileAttunementAltar method readNetNBT.

@Override
public void readNetNBT(CompoundNBT compound) {
    super.readNetNBT(compound);
    if (compound.contains("activeConstellation")) {
        this.activeConstellation = ConstellationRegistry.getConstellation(new ResourceLocation(compound.getString("activeConstellation")));
    } else {
        this.activeConstellation = null;
    }
    if (compound.contains("currentRecipe")) {
        CompoundNBT nbt = compound.getCompound("currentRecipe");
        AttunementRecipe recipe = AttunementCraftingRegistry.INSTANCE.getRecipe(new ResourceLocation(nbt.getString("recipe")));
        if (recipe != null) {
            this.currentRecipe = recipe.deserialize(this, nbt, this.currentRecipe);
        } else if (this.currentRecipe != null) {
            this.currentRecipe.stopEffects(this);
            this.currentRecipe = null;
        }
    } else if (this.currentRecipe != null) {
        this.currentRecipe.stopEffects(this);
        this.currentRecipe = null;
    }
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT) ResourceLocation(net.minecraft.util.ResourceLocation) AttunementRecipe(hellfirepvp.astralsorcery.common.crafting.nojson.attunement.AttunementRecipe)

Aggregations

AttunementRecipe (hellfirepvp.astralsorcery.common.crafting.nojson.attunement.AttunementRecipe)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1 ResourceLocation (net.minecraft.util.ResourceLocation)1