本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getXPSeed方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getXPSeed方法的具体用法?Java EntityPlayer.getXPSeed怎么用?Java EntityPlayer.getXPSeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getXPSeed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enchantItem
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
*/
public boolean enchantItem(EntityPlayer playerIn, int id)
{
ItemStack itemstack = this.tableInventory.getStackInSlot(0);
ItemStack itemstack1 = this.tableInventory.getStackInSlot(1);
int i = id + 1;
if ((itemstack1 == null || itemstack1.stackSize < i) && !playerIn.capabilities.isCreativeMode)
{
return false;
}
else if (this.enchantLevels[id] > 0 && itemstack != null && (playerIn.experienceLevel >= i && playerIn.experienceLevel >= this.enchantLevels[id] || playerIn.capabilities.isCreativeMode))
{
if (!this.worldPointer.isRemote)
{
List<EnchantmentData> list = this.func_178148_a(itemstack, id, this.enchantLevels[id]);
boolean flag = itemstack.getItem() == Items.book;
if (list != null)
{
playerIn.removeExperienceLevel(i);
if (flag)
{
itemstack.setItem(Items.enchanted_book);
}
for (int j = 0; j < list.size(); ++j)
{
EnchantmentData enchantmentdata = (EnchantmentData)list.get(j);
if (flag)
{
Items.enchanted_book.addEnchantment(itemstack, enchantmentdata);
}
else
{
itemstack.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
}
if (!playerIn.capabilities.isCreativeMode)
{
itemstack1.stackSize -= i;
if (itemstack1.stackSize <= 0)
{
this.tableInventory.setInventorySlotContents(1, (ItemStack)null);
}
}
playerIn.triggerAchievement(StatList.field_181739_W);
this.tableInventory.markDirty();
this.xpSeed = playerIn.getXPSeed();
this.onCraftMatrixChanged(this.tableInventory);
}
}
return true;
}
else
{
return false;
}
}
示例2: enchantItem
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
*/
public boolean enchantItem(EntityPlayer playerIn, int id)
{
ItemStack itemstack = this.tableInventory.getStackInSlot(0);
ItemStack itemstack1 = this.tableInventory.getStackInSlot(1);
int i = id + 1;
if ((itemstack1 == null || itemstack1.stackSize < i) && !playerIn.capabilities.isCreativeMode)
{
return false;
}
else if (this.enchantLevels[id] > 0 && itemstack != null && (playerIn.experienceLevel >= i && playerIn.experienceLevel >= this.enchantLevels[id] || playerIn.capabilities.isCreativeMode))
{
if (!this.worldPointer.isRemote)
{
List<EnchantmentData> list = this.getEnchantmentList(itemstack, id, this.enchantLevels[id]);
boolean flag = itemstack.getItem() == Items.BOOK;
if (list != null)
{
playerIn.removeExperienceLevel(i);
if (flag)
{
itemstack.setItem(Items.ENCHANTED_BOOK);
}
for (int j = 0; j < list.size(); ++j)
{
EnchantmentData enchantmentdata = (EnchantmentData)list.get(j);
if (flag)
{
Items.ENCHANTED_BOOK.addEnchantment(itemstack, enchantmentdata);
}
else
{
itemstack.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
}
if (!playerIn.capabilities.isCreativeMode)
{
itemstack1.stackSize -= i;
if (itemstack1.stackSize <= 0)
{
this.tableInventory.setInventorySlotContents(1, (ItemStack)null);
}
}
playerIn.addStat(StatList.ITEM_ENCHANTED);
this.tableInventory.markDirty();
this.xpSeed = playerIn.getXPSeed();
this.onCraftMatrixChanged(this.tableInventory);
this.worldPointer.playSound((EntityPlayer)null, this.position, SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.BLOCKS, 1.0F, this.worldPointer.rand.nextFloat() * 0.1F + 0.9F);
}
}
return true;
}
else
{
return false;
}
}