Search in sources :

Example 1 with Butterfly

use of forestry.lepidopterology.genetics.Butterfly in project ForestryMC by ForestryMC.

the class TileCocoon method readFromNBT.

/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);
    if (nbttagcompound.hasKey("Caterpillar")) {
        caterpillar = new Butterfly(nbttagcompound.getCompoundTag("Caterpillar"));
    }
    ownerHandler.readFromNBT(nbttagcompound);
    age = nbttagcompound.getInteger("Age");
    maturationTime = nbttagcompound.getInteger("CATMAT");
    isSolid = nbttagcompound.getBoolean("isSolid");
}
Also used : IButterfly(forestry.api.lepidopterology.IButterfly) Butterfly(forestry.lepidopterology.genetics.Butterfly)

Example 2 with Butterfly

use of forestry.lepidopterology.genetics.Butterfly in project ForestryMC by ForestryMC.

the class EntityButterfly method readEntityFromNBT.

@Override
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
    super.readEntityFromNBT(nbttagcompound);
    IButterfly butterfly = null;
    if (nbttagcompound.hasKey("BTFLY")) {
        butterfly = new Butterfly((NBTTagCompound) nbttagcompound.getTag("BTFLY"));
    }
    setIndividual(butterfly);
    if (nbttagcompound.hasKey("PLN")) {
        NBTTagCompound pollenNBT = nbttagcompound.getCompoundTag("PLN");
        ISpeciesRoot root;
        if (pollenNBT.hasKey("Root")) {
            root = AlleleManager.alleleRegistry.getSpeciesRoot(pollenNBT.getString("Root"));
        } else {
            root = TreeManager.treeRoot;
        }
        pollen = root.getMember(pollenNBT);
    }
    EnumButterflyState state = EnumButterflyState.VALUES[nbttagcompound.getByte("STATE")];
    setState(state);
    exhaustion = nbttagcompound.getInteger("EXH");
    BlockPos home = new BlockPos(nbttagcompound.getInteger("homeX"), nbttagcompound.getInteger("homeY"), nbttagcompound.getInteger("homeZ"));
    setHomePosAndDistance(home, ModuleLepidopterology.maxDistance);
}
Also used : ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) IButterfly(forestry.api.lepidopterology.IButterfly) IEntityButterfly(forestry.api.lepidopterology.IEntityButterfly) IButterfly(forestry.api.lepidopterology.IButterfly) Butterfly(forestry.lepidopterology.genetics.Butterfly) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

IButterfly (forestry.api.lepidopterology.IButterfly)2 Butterfly (forestry.lepidopterology.genetics.Butterfly)2 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)1 IEntityButterfly (forestry.api.lepidopterology.IEntityButterfly)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 BlockPos (net.minecraft.util.math.BlockPos)1