本文整理汇总了Java中net.minecraft.init.Items.diamond方法的典型用法代码示例。如果您正苦于以下问题:Java Items.diamond方法的具体用法?Java Items.diamond怎么用?Java Items.diamond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.diamond方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCollideWithPlayer
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Called by a player entity when they collide with an entity
*/
public void onCollideWithPlayer(EntityPlayer entityIn)
{
if (!this.worldObj.isRemote)
{
ItemStack itemstack = this.getEntityItem();
int i = itemstack.stackSize;
if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
{
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
{
entityIn.triggerAchievement(AchievementList.mineWood);
}
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
{
entityIn.triggerAchievement(AchievementList.mineWood);
}
if (itemstack.getItem() == Items.leather)
{
entityIn.triggerAchievement(AchievementList.killCow);
}
if (itemstack.getItem() == Items.diamond)
{
entityIn.triggerAchievement(AchievementList.diamonds);
}
if (itemstack.getItem() == Items.blaze_rod)
{
entityIn.triggerAchievement(AchievementList.blazeRod);
}
if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
{
EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());
if (entityplayer != null && entityplayer != entityIn)
{
entityplayer.triggerAchievement(AchievementList.diamondsToYou);
}
}
if (!this.isSilent())
{
this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
entityIn.onItemPickup(this, i);
if (itemstack.stackSize <= 0)
{
this.setDead();
}
}
}
}
示例2: getRepairItem
import net.minecraft.init.Items; //导入方法依赖的package包/类
public Item getRepairItem()
{
return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
}
示例3: getRepairItem
import net.minecraft.init.Items; //导入方法依赖的package包/类
public Item getRepairItem()
{
return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null))));
}
示例4: getItemDropped
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
示例5: isItemValid
import net.minecraft.init.Items; //导入方法依赖的package包/类
public boolean isItemValid(ItemStack stack)
{
return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
示例6: isItemValidForSlot
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
public boolean isItemValidForSlot(int index, ItemStack stack)
{
return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}