本文整理汇总了Java中net.minecraft.item.ItemEditableBook类的典型用法代码示例。如果您正苦于以下问题:Java ItemEditableBook类的具体用法?Java ItemEditableBook怎么用?Java ItemEditableBook使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemEditableBook类属于net.minecraft.item包,在下文中一共展示了ItemEditableBook类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemainingItems
import net.minecraft.item.ItemEditableBook; //导入依赖的package包/类
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && itemstack.getItem() instanceof ItemEditableBook)
{
aitemstack[i] = itemstack;
break;
}
}
return aitemstack;
}
示例2: getCraftingResult
import net.minecraft.item.ItemEditableBook; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
for(int slot = 0; slot < crafting.getSizeInventory(); slot++) {
if(crafting.getStackInSlot(slot) != null){
if (crafting.getStackInSlot(slot).getItem().equals(Items.written_book)) {
ItemStack stack = crafting.getStackInSlot(slot);
ItemStack output = getRecipeOutput().copy();
if (ItemEditableBook.validBookTagContents(stack.getTagCompound())) {
NBTTagList text = stack.getTagCompound().getTagList("pages", 8);
output.setTagInfo("pages", text);
return output;
}
}
}
}
return getRecipeOutput();
}
示例3: getCraftingResult
import net.minecraft.item.ItemEditableBook; //导入依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
int i = 0;
ItemStack itemstack = null;
for (int j = 0; j < inv.getSizeInventory(); ++j)
{
ItemStack itemstack1 = inv.getStackInSlot(j);
if (itemstack1 != null)
{
if (itemstack1.getItem() == Items.written_book)
{
if (itemstack != null)
{
return null;
}
itemstack = itemstack1;
}
else
{
if (itemstack1.getItem() != Items.writable_book)
{
return null;
}
++i;
}
}
}
if (itemstack != null && i >= 1 && ItemEditableBook.getGeneration(itemstack) < 2)
{
ItemStack itemstack2 = new ItemStack(Items.written_book, i);
itemstack2.setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
itemstack2.getTagCompound().setInteger("generation", ItemEditableBook.getGeneration(itemstack) + 1);
if (itemstack.hasDisplayName())
{
itemstack2.setStackDisplayName(itemstack.getDisplayName());
}
return itemstack2;
}
else
{
return null;
}
}