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


Java TagUtil.getExtraTag方法代码示例

本文整理汇总了Java中slimeknights.tconstruct.library.utils.TagUtil.getExtraTag方法的典型用法代码示例。如果您正苦于以下问题:Java TagUtil.getExtraTag方法的具体用法?Java TagUtil.getExtraTag怎么用?Java TagUtil.getExtraTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在slimeknights.tconstruct.library.utils.TagUtil的用法示例。


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

示例1: blockHarvestDrops

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
    World w = event.getWorld();
    if (!w.isRemote) {
        if (event.getState().getBlock().equals(tiberiumOre)) {
            event.getDrops().clear();
            NBTTagCompound tag = TagUtil.getExtraTag(tool);
            Data data = Data.read(tag);
            if (data.amount >= max_charges) {
                return;
            }
            data.amount += (0.25f + Utils.round2(random.nextDouble() / 4));
            if (data.amount >= max_charges) {
                TagUtil.setEnchantEffect(tool, true);
                if (event.getHarvester() instanceof EntityPlayerMP) {
                    Sounds.PlaySoundForPlayer(event.getHarvester(), Sounds.shocking_discharge, 1f, 0.8f + .2f * random.nextFloat());
                }
            }
            data.write(tag);
            TagUtil.setExtraTag(tool, tag);
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:24,代码来源:TraitTantrum.java

示例2: onUpdate

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
    // every 3.6 seconds we distribute one stat. This means 1h = 1000 applications
    if (entity.ticksExisted % TICK_PER_STAT > 0) {
        return;
    }

    // we don't update if the player is currently breaking a block because that'd reset it
    if (playerIsBreakingBlock(entity)) {
        return;
    }

    NBTTagCompound tag = TagUtil.getExtraTag(tool);
    Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
    if (data.brokenblocks > 0)
        data.brokenblocks -= 1;
    data.write(tag);
    TagUtil.setExtraTag(tool, tag);
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:20,代码来源:TraitSuperHeavy.java

示例3: onUpdate

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {

    if (entity instanceof FakePlayer || entity.world.isRemote) {
        return;
    }
    if (entity.ticksExisted % TICK_PER_STAT > 0) {
        return;
    }

    NBTTagCompound tag = TagUtil.getExtraTag(tool);
    Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
    data.radius += random.nextFloat() * 0.5f;
    if (data.radius >= 1) {
        TagUtil.setEnchantEffect(tool, true);
    }
    data.write(tag);
    TagUtil.setExtraTag(tool, tag);
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:20,代码来源:TraitWhirl.java

示例4: onEntityKill

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityKill(LivingDeathEvent e) {
    if (e.getSource().getTrueSource() instanceof EntityPlayer && !e.getSource().getTrueSource().world.isRemote && e.getEntity() instanceof EntityCreature) {
        if (TinkerUtil.hasTrait(TagUtil.getTagSafe(((EntityPlayer) e.getSource().getTrueSource()).getHeldItemMainhand()), identifier)) {
            ItemStack tool = ((EntityPlayer) e.getSource().getTrueSource()).getHeldItemMainhand();
            String name = e.getEntity().getName();
            NBTTagCompound tag = TagUtil.getExtraTag(tool);
            Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
            if (!data.name.isEmpty()) {
                return;
            }
            data.name = name;
            data.write(tag);
            TagUtil.setExtraTag(tool, tag);
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:18,代码来源:TraitCongenial.java

示例5: miningSpeed

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void miningSpeed(ItemStack tool, PlayerInteractEvent.BreakSpeed event) {
    NBTTagCompound tag = TagUtil.getExtraTag(tool);
    Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
    if (!data.active) return;
    event.setNewSpeed(event.getNewSpeed() * 4);
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:8,代码来源:TraitBerserk.java

示例6: onRightClickItem

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
    World w = event.getWorld();
    ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
    if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
        NBTTagCompound tag = TagUtil.getExtraTag(tool);
        Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
        NBTTagCompound root = TagUtil.getTagSafe(tool);
        StatNBT distributed = getBonus(root);
        ToolNBT stat = TagUtil.getToolStats(tool);
        if (data.active) {
            data.active = false;
            TagUtil.setEnchantEffect(root, false);
            TagUtil.setExtraTag(root, tag);
            data.write(tag);

        } else {
            stat.durability -= 10;
            distributed.durability -= 10;
            TagUtil.setToolTag(root, stat.get());
            setBonus(root, distributed);
            data.active = true;
            data.write(tag);

            TagUtil.setExtraTag(root, tag);
            data.write(tag);
        }

    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:31,代码来源:TraitBerserk.java

示例7: onUpdate

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
    NBTTagCompound tag = TagUtil.getExtraTag(tool);
    Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
    if (random.nextInt((chance + data.curse) / (data.curse + 1)) == 1) {
        if (isSelected) data.curse += 10;
        else data.curse++;
        entity.attackEntityFrom(new DamageSource("Curse"), random.nextFloat() * ((EntityPlayer) entity).getHealth() / 2);
    }

    data.write(tag);
    TagUtil.setExtraTag(tool, tag);
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:14,代码来源:TraitCursed.java

示例8: onItemTooltip

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent e) {
    ItemStack tool = e.getItemStack();
    if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
        NBTTagCompound tag = TagUtil.getExtraTag(tool);
        Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
        if (data.curse != 0) {
            e.getToolTip().add(TextFormatting.DARK_PURPLE + "Curse: " + TextFormatting.WHITE + data.curse);
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:12,代码来源:TraitCursed.java

示例9: miningSpeed

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void miningSpeed(ItemStack tool, PlayerInteractEvent.BreakSpeed event) {
    NBTTagCompound tag = TagUtil.getExtraTag(tool);
    Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
    if (data.brokenblocks == 0) return;
    event.setNewSpeed(Math.max(event.getNewSpeed() - data.brokenblocks * event.getOriginalSpeed() / blockcount, 0.35f));
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:8,代码来源:TraitSuperHeavy.java

示例10: afterBlockBreak

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@Override
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
    NBTTagCompound tag = TagUtil.getExtraTag(tool);
    Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
    data.brokenblocks += 1;
    data.write(tag);
    TagUtil.setExtraTag(tool, tag);
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:9,代码来源:TraitSuperHeavy.java

示例11: onItemTooltip

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent e) {
    ItemStack tool = e.getItemStack();
    if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
        NBTTagCompound tag = TagUtil.getExtraTag(tool);
        Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
        e.getToolTip().add(TextFormatting.RED + "Broken Blocks: " + TextFormatting.WHITE + data.brokenblocks);

    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:11,代码来源:TraitSuperHeavy.java

示例12: onItemTooltip

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent e) {
    ItemStack tool = e.getItemStack();
    if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
        NBTTagCompound tag = TagUtil.getExtraTag(tool);
        Data data = Data.read(tag);
        e.getToolTip().add(TextFormatting.RED + "Charge: " + data.amount);
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:10,代码来源:TraitTantrum.java

示例13: onItemTooltip

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent e) {
    ItemStack tool = e.getItemStack();
    if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
        NBTTagCompound tag = TagUtil.getExtraTag(tool);
        Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
        if (data.radius > 0) {
            e.getToolTip().add(TextFormatting.BLUE + "Actual Radius: " + TextFormatting.WHITE + Math.round(data.radius * 100) / 100);
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:12,代码来源:TraitWhirl.java

示例14: setStats

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
protected static void setStats(NBTTagCompound root, StatNBT data, String key) {
    NBTTagCompound extra = TagUtil.getExtraTag(root);
    NBTTagCompound tag = new NBTTagCompound();
    data.write(tag);
    extra.setTag(key, tag);
    TagUtil.setExtraTag(root, extra);
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:8,代码来源:TraitProgressiveStats.java

示例15: onItemTooltip

import slimeknights.tconstruct.library.utils.TagUtil; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent e) {
    ItemStack tool = e.getItemStack();
    if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
        NBTTagCompound tag = TagUtil.getExtraTag(tool);
        Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
        if (data.killcount != 0) {
            e.getToolTip().add(TextFormatting.WHITE + "Killed: " + TextFormatting.WHITE + data.killcount);
            e.getToolTip().add(TextFormatting.WHITE + "Bonus: " + TextFormatting.WHITE + data.bonus);
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:13,代码来源:TraitSoulEater.java


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