当前位置: 首页>>代码示例>>Java>>正文


Java NBTUtil类代码示例

本文整理汇总了Java中net.lomeli.lomlib.util.NBTUtil的典型用法代码示例。如果您正苦于以下问题:Java NBTUtil类的具体用法?Java NBTUtil怎么用?Java NBTUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NBTUtil类属于net.lomeli.lomlib.util包,在下文中一共展示了NBTUtil类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSubItems

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) {
    ItemStack empty = new ItemStack(itemIn);
    NBTUtil.setInteger(empty, ModNBT.STORED_ENERGY, 0);
    subItems.add(empty);
    ItemStack full = new ItemStack(itemIn);
    NBTUtil.setInteger(full, ModNBT.STORED_ENERGY, Config.fusionCoreCapacity);
    subItems.add(full);
}
 
开发者ID:Lomeli12,项目名称:PowerTools,代码行数:11,代码来源:ItemFusionCore.java

示例2: receiveEnergy

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@Override
public int receiveEnergy(ItemStack stack, int max, boolean simulate) {
    if (stack == null) return 0;
    int energy = NBTUtil.getInt(stack, ModNBT.STORED_ENERGY);
    int added = Math.min(Config.fusionCoreCapacity - energy, max);
    if (!simulate)
        NBTUtil.setInteger(stack, ModNBT.STORED_ENERGY, energy + added);
    return added;
}
 
开发者ID:Lomeli12,项目名称:PowerTools,代码行数:10,代码来源:ItemFusionCore.java

示例3: extractEnergy

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@Override
public int extractEnergy(ItemStack stack, int max, boolean simulate) {
    if (stack == null) return 0;
    int energy = getEnergyStored(stack);
    int loss = Math.min(energy, max);
    if (!simulate)
        NBTUtil.setInteger(stack, ModNBT.STORED_ENERGY, energy - loss);
    return loss;
}
 
开发者ID:Lomeli12,项目名称:PowerTools,代码行数:10,代码来源:ItemFusionCore.java

示例4: handleItemTooltipEvent

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@SubscribeEvent
public void handleItemTooltipEvent(ItemTooltipEvent event) {
    ItemStack stack = event.itemStack;
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && CharmRegistry.isValidArmor(stack) && NBTUtil.hasTag(stack, ModLibs.CHARM_TAG)) {
        String[] charms = ArmorAAPI.charmRegistry.getItemCharms(stack);
        if (charms != null && charms.length > 0) {
            event.toolTip.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Charms:" + EnumChatFormatting.RESET);
            for (String id : charms) {
                AbstractCharm charm = ArmorAAPI.charmRegistry.getCharm(id);
                if (charm != null && ArmorAAPI.charmRegistry.canApplyCharmToItem(stack, id))
                    event.toolTip.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal(charm.unlocalizedName()) + EnumChatFormatting.RESET);
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:ArmorA,代码行数:16,代码来源:ItemTooltipHandler.java

示例5: getItemCharms

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@Override
public String[] getItemCharms(ItemStack stack) {
    if (stack == null || stack.getItem() == null)
        return new String[0];
    String values = NBTUtil.getString(stack, ModLibs.CHARM_TAG);
    String[] charms = values.split(";");
    return charms != null ? charms : new String[0];
}
 
开发者ID:Lomeli12,项目名称:ArmorA,代码行数:9,代码来源:CharmRegistry.java

示例6: applyCharmToItem

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@Override
public boolean applyCharmToItem(ItemStack stack, String charmID) {
    if (itemHasCharm(stack, charmID))
        return false;
    String values = NBTUtil.getString(stack, ModLibs.CHARM_TAG) + charmID + ";";
    NBTUtil.setString(stack, ModLibs.CHARM_TAG, values);
    return true;
}
 
开发者ID:Lomeli12,项目名称:ArmorA,代码行数:9,代码来源:CharmRegistry.java

示例7: setStackEMC

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
public static void setStackEMC(ItemStack stack, EnergyValue value) {
    if (stack == null)
        return;
    NBTTagCompound emcTag = new NBTTagCompound();
    value.writeToNBT(emcTag);
    NBTUtil.setTagCompound(stack, EMC_TAG, emcTag);
    int meta = value.getValue() > 1200000f ? 5 : MathHelper.floor(value.getValue() / 200000f);
    stack.setItemDamage(meta);
}
 
开发者ID:Lomeli12,项目名称:SimpleCondenser,代码行数:10,代码来源:ItemGreatStar.java

示例8: getStackEMC

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
public static EnergyValue getStackEMC(ItemStack stack) {
    EnergyValue value = new EnergyValue(0);

    if (stack != null && stack.hasTagCompound()) {
        NBTTagCompound emcTag = NBTUtil.getTagCompound(stack, EMC_TAG);
        value.readFromNBT(emcTag);
    }
    return value;
}
 
开发者ID:Lomeli12,项目名称:SimpleCondenser,代码行数:10,代码来源:ItemGreatStar.java

示例9: getEnergyStored

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
@Override
public int getEnergyStored(ItemStack stack) {
    if (stack == null) return 0;
    return NBTUtil.getInt(stack, ModNBT.STORED_ENERGY);
}
 
开发者ID:Lomeli12,项目名称:PowerTools,代码行数:6,代码来源:ItemFusionCore.java

示例10: hasOwnerUUID

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
public static boolean hasOwnerUUID(ItemStack itemStack) {
    return itemStack != null && itemStack.getItem() != null && NBTUtil.hasTag(itemStack, "ownerUUIDMostSig") && NBTUtil.hasTag(itemStack, "ownerUUIDLeastSig");
}
 
开发者ID:Lomeli12,项目名称:SimpleCondenser,代码行数:4,代码来源:ItemLib.java

示例11: getOwnerUUID

import net.lomeli.lomlib.util.NBTUtil; //导入依赖的package包/类
public static UUID getOwnerUUID(ItemStack itemStack) {
    return hasOwnerUUID(itemStack) ? new UUID(NBTUtil.getLong(itemStack, "ownerUUIDMostSig"), NBTUtil.getLong(itemStack, "ownerUUIDLeastSig")) : null;
}
 
开发者ID:Lomeli12,项目名称:SimpleCondenser,代码行数:4,代码来源:ItemLib.java


注:本文中的net.lomeli.lomlib.util.NBTUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。