Java Code Examples for net.minecraft.nbt.CompoundNBT#getInt()

The following examples show how to use net.minecraft.nbt.CompoundNBT#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderBlockTileEntity.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void read(CompoundNBT tag) {
    super.read(tag);
    renderBlock = NBTUtil.readBlockState(tag.getCompound("renderBlock"));
    originalDurability = tag.getInt("originalDurability");
    priorDurability = tag.getInt("priorDurability");
    durability = tag.getInt("durability");
    ticksSinceMine = tag.getInt("ticksSinceMine");
    playerUUID = tag.getUniqueId("playerUUID");
    gadgetUpgrades = UpgradeTools.getUpgradesFromTag(tag);
    breakType = MiningProperties.BreakTypes.values()[tag.getByte("breakType")];
    gadgetFilters = MiningProperties.deserializeItemStackList(tag.getCompound("gadgetFilters"));
    gadgetIsWhitelist = tag.getBoolean("gadgetIsWhitelist");
    blockAllowed = tag.getBoolean("blockAllowed");
}
 
Example 2
Source File: SawmillTileEntity.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void func_230337_a_(BlockState state, CompoundNBT compound)
{
    super.func_230337_a_(state, compound);

    ITEMS_CAP.readNBT(inventory, null, compound.get("Items"));

    remainingBurnTime = compound.getInt("BurnTime");
    cookTime = compound.getInt("CookTime");
    needRefreshRecipe = true;
}
 
Example 3
Source File: NBTStructureLoader.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
private CompoundNBT loadStructureStarts(int chunkX, int chunkZ) {
    try {
        CompoundNBT compound = this.chunkLoader.readChunk(chunkX, chunkZ);
        if (compound == null) return null;
        int dataVersion = compound.contains("DataVersion", 99) ? compound.getInt("DataVersion") : -1;
        if (dataVersion < 1493) {
            if (compound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
                compound = getLegacyStructureDataUtil().func_212181_a(compound);
            }
        }
        return compound.getCompound("Level").getCompound("Structures").getCompound("Starts");
    } catch (IOException ignored) {
    }
    return null;
}
 
Example 4
Source File: MiningProperties.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static int getSpeed(ItemStack gadget) {
    CompoundNBT compound = gadget.getOrCreateTag();
    return !compound.contains(KEY_SPEED) ? setSpeed(gadget, 1) : compound.getInt(KEY_SPEED);
}
 
Example 5
Source File: MiningProperties.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static int getRange(ItemStack gadget) {
    CompoundNBT compound = gadget.getOrCreateTag();
    return !compound.contains(KEY_RANGE) ? setRange(gadget, 1) : compound.getInt(KEY_RANGE);
}
 
Example 6
Source File: MiningProperties.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static int getBeamRange(ItemStack gadget) {
    CompoundNBT compound = gadget.getOrCreateTag();
    return !compound.contains(KEY_BEAM_RANGE) ? setBeamRange(gadget, MIN_RANGE) : compound.getInt(KEY_BEAM_RANGE);
}
 
Example 7
Source File: MiningProperties.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static int getBeamMaxRange(ItemStack gadget) {
    CompoundNBT compound = gadget.getOrCreateTag();
    return !compound.contains(KEY_MAX_BEAM_RANGE) ? setBeamMaxRange(gadget, MIN_RANGE) : compound.getInt(KEY_MAX_BEAM_RANGE);
}
 
Example 8
Source File: MiningProperties.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static int getFreezeDelay(ItemStack gadget) {
    CompoundNBT compound = gadget.getOrCreateTag();
    return !compound.contains(FREEZE_PARTICLE_DELAY) ? setFreezeDelay(gadget, 0) : compound.getInt(FREEZE_PARTICLE_DELAY);
}