Search in sources :

Example 6 with GraveData

use of com.minecolonies.api.colony.GraveData in project minecolonies by Minecolonies.

the class TileEntityGrave method load.

@Override
public void load(final BlockState state, final CompoundNBT compound) {
    super.load(state, compound);
    inventory = createInventory(DEFAULT_SIZE);
    final ListNBT inventoryTagList = compound.getList(TAG_INVENTORY, TAG_COMPOUND);
    for (int i = 0; i < inventoryTagList.size(); i++) {
        final CompoundNBT inventoryCompound = inventoryTagList.getCompound(i);
        if (!inventoryCompound.contains(TAG_EMPTY)) {
            final ItemStack stack = ItemStack.of(inventoryCompound);
            inventory.setStackInSlot(i, stack);
        }
    }
    decay_timer = compound.contains(TAG_DECAY_TIMER) ? compound.getInt(TAG_DECAY_TIMER) : DEFAULT_DECAY_TIMER;
    decayed = compound.contains(TAG_DECAYED) ? compound.getBoolean(TAG_DECAYED) : false;
    if (compound.getAllKeys().contains(TAG_GRAVE_DATA)) {
        graveData = new GraveData();
        graveData.read(compound.getCompound(TAG_GRAVE_DATA));
    } else
        graveData = null;
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) CompoundNBT(net.minecraft.nbt.CompoundNBT) GraveData(com.minecolonies.api.colony.GraveData) ItemStack(net.minecraft.item.ItemStack)

Aggregations

GraveData (com.minecolonies.api.colony.GraveData)6 ListNBT (net.minecraft.nbt.ListNBT)6 CompoundNBT (net.minecraft.nbt.CompoundNBT)4 ModBlocks (com.minecolonies.api.blocks.ModBlocks)2 ICitizenData (com.minecolonies.api.colony.ICitizenData)2 IColony (com.minecolonies.api.colony.IColony)2 IGraveManager (com.minecolonies.api.colony.managers.interfaces.IGraveManager)2 MAX_TICKRATE (com.minecolonies.api.entity.ai.statemachine.tickratestatemachine.TickRateConstants.MAX_TICKRATE)2 GRAVE_DECAY_BONUS (com.minecolonies.api.research.util.ResearchConstants.GRAVE_DECAY_BONUS)2 TileEntityGrave (com.minecolonies.api.tileentities.TileEntityGrave)2 BlockPosUtil (com.minecolonies.api.util.BlockPosUtil)2 InventoryUtils (com.minecolonies.api.util.InventoryUtils)2 WorldUtil (com.minecolonies.api.util.WorldUtil)2 NbtTagConstants (com.minecolonies.api.util.constant.NbtTagConstants)2 BlockMinecoloniesGrave (com.minecolonies.coremod.blocks.BlockMinecoloniesGrave)2 Colony (com.minecolonies.coremod.colony.Colony)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 AirBlock (net.minecraft.block.AirBlock)2