本文整理汇总了Java中net.minecraft.item.ItemNameTag类的典型用法代码示例。如果您正苦于以下问题:Java ItemNameTag类的具体用法?Java ItemNameTag怎么用?Java ItemNameTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemNameTag类属于net.minecraft.item包,在下文中一共展示了ItemNameTag类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: instanceOf
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
public boolean instanceOf(IItemType type) {
if (type.equals(IItemType.ItemFishingRod)) {
return item instanceof ItemFishingRod;
} else if (type.equals(IItemType.ItemPotion)) {
return item instanceof ItemPotion;
} else if (type.equals(IItemType.ItemFood)) {
return item instanceof ItemFood;
} else if (type.equals(IItemType.ItemSword)) {
return item instanceof ItemSword;
} else if (type.equals(IItemType.ItemTool)) {
return item instanceof ItemTool;
} else if (type.equals(IItemType.ItemNameTag)) {
return item instanceof ItemNameTag;
} else if (type.equals(IItemType.ItemBlock)) {
return item instanceof ItemBlock;
} else if (type.equals(IItemType.ItemHoe)) {
return item instanceof ItemHoe;
}
return false;
}
开发者ID:Moudoux,项目名称:EMC,代码行数:21,代码来源:IItem.java
示例2: onEnable
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
@Override
public void onEnable() {
if (Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() == null ||
!(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem() instanceof ItemNameTag)) {
WurstClient.INSTANCE.chat.error("You are not holding a nametag in your hand.");
setEnabled(false);
return;
} else if (!Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) {
WurstClient.INSTANCE.chat.error("Creative mode only.");
setEnabled(false);
return;
}
String stackName = "";
for (int i = 0; i < 3000; i++) {
StringBuilder builder = new StringBuilder().append(stackName);
stackName = builder.append("############").toString();
}
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().setStackDisplayName(stackName);
Minecraft.getMinecraft().displayGuiScreen(new GuiInventory(Minecraft.getMinecraft().thePlayer));
Minecraft.getMinecraft().thePlayer.closeScreen();
WurstClient.INSTANCE.chat.message("CrashItem created. Right click a mob with it.");
setEnabled(false);
}
开发者ID:null-dev,项目名称:EvenWurse,代码行数:24,代码来源:CrashItemMod.java
示例3: processInteract
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (hand != EnumHand.MAIN_HAND) return true;
if (!isDead) {
final ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem.getItem() instanceof ItemNameTag) return false;
if (world.isRemote) {
if (player.isSneaking()) spawnPickupParticles();
} else {
if (player.isSneaking()) {
ItemStack luggageItem = convertToItem();
if (player.inventory.addItemStackToInventory(luggageItem)) {
setDead();
playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.5f, world.rand.nextFloat() * 0.1f + 0.9f);
}
} else {
playSound(SoundEvents.BLOCK_CHEST_OPEN, 0.5f, world.rand.nextFloat() * 0.1f + 0.9f);
player.openGui(OpenBlocks.instance, OpenBlocksGuiHandler.GuiId.luggage.ordinal(), player.world, getEntityId(), 0, 0);
}
}
}
return true;
}
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:27,代码来源:EntityLuggage.java
示例4: onEnable
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
@Override
public void onEnable()
{
// check gamemode
if(!WMinecraft.getPlayer().capabilities.isCreativeMode)
{
ChatUtils.error("Creative mode only.");
setEnabled(false);
return;
}
// check held item
ItemStack heldStack = WMinecraft.getPlayer().inventory.getCurrentItem();
if(heldStack == null || !(heldStack.getItem() instanceof ItemNameTag))
{
ChatUtils.error("You need a nametag in your hand.");
setEnabled(false);
return;
}
// modify held item
StringBuilder stackName = new StringBuilder();
for(int i = 0; i < 18000; i++)
stackName.append('#');
heldStack.setStackDisplayName(stackName.toString());
// open & close the inventory
// for some reason that's needed for the item to update
mc.displayGuiScreen(new GuiInventory(WMinecraft.getPlayer()));
WMinecraft.getPlayer().closeScreen();
ChatUtils.message("Nametag modified.");
setEnabled(false);
}
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:35,代码来源:CrashTagMod.java
示例5: attackEntityFrom
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if(world.isRemote)
return false;
if(source.isCreativePlayer()) {
ItemStack heldItem = ((EntityPlayerMP)source.getEntity()).getHeldItemMainhand();
if(heldItem != null) {
if(heldItem.getItem() instanceof TeleporterItem) {
return false;
}
if(heldItem.getItem() instanceof ItemNameTag) {
this.setCustomNameTag(heldItem.getDisplayName());
return false;
}
if(heldItem.getItem() instanceof WandItem) {
return false;
}
}
this.setDead();
return true;
}
return false;
}
开发者ID:tiffit,项目名称:TaleCraft,代码行数:28,代码来源:EntityPoint.java
示例6: interactWithCreatures
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
@SubscribeEvent
public void interactWithCreatures(EntityInteractEvent event)
{
EntityPlayer player = event.entityPlayer;
if (!event.entityPlayer.worldObj.isRemote)
{
if (Utils.notNullAndInstanceOf(event.target, EntitySpider.class))
{
if (Wearing.isWearingTheRightBackpack(player, "Spider"))
{
EntityFriendlySpider pet = new EntityFriendlySpider(event.target.worldObj);
pet.setLocationAndAngles(event.target.posX, event.target.posY, event.target.posZ, event.target.rotationYaw, event.target.rotationPitch);
event.target.setDead();
event.entityPlayer.worldObj.spawnEntityInWorld(pet);
event.entityPlayer.mountEntity(pet);
}
}
if (Utils.notNullAndInstanceOf(event.target, EntityHorse.class))
{
ItemStack stack = player.getCurrentEquippedItem();
EntityHorse horse = (EntityHorse) event.target;
if (stack != null && stack.getItem() != null && stack.getItem() instanceof ItemNameTag && stack.hasDisplayName())
{
if (horse.getCustomNameTag() == null || horse.getCustomNameTag().equals("") && horse.isTame())
{
horse.setTamedBy(player);
horse.tasks.addTask(4, new EntityAIHorseFollowOwner(horse, 1.5d, 2.0f, 20.0f));
if (horse.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.followRange) != null)
{
horse.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
LogHelper.info("The horse follow range is now: " + horse.getEntityAttribute(SharedMonsterAttributes.followRange).getBaseValue());
}
}
}
}
}
event.setResult(Event.Result.ALLOW);
}
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:40,代码来源:PlayerEventHandler.java
示例7: isFindableItem
import net.minecraft.item.ItemNameTag; //导入依赖的package包/类
private boolean isFindableItem(Item food) {
return (food != null && !(food instanceof ItemFatCatUnko) &&
!(food instanceof ItemFurball) && !(food instanceof ItemLead) &&
!(food instanceof ItemNameTag));
}
开发者ID:shu3,项目名称:FatCatMOD,代码行数:6,代码来源:EntityAIEatEntityItem.java
注:本文中的net.minecraft.item.ItemNameTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论