本文整理汇总了Java中net.minecraft.util.NonNullList.withSize方法的典型用法代码示例。如果您正苦于以下问题:Java NonNullList.withSize方法的具体用法?Java NonNullList.withSize怎么用?Java NonNullList.withSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.NonNullList
的用法示例。
在下文中一共展示了NonNullList.withSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InventoryItem
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
/**
* @param itemstack
* - the ItemStack to which this inventory belongs
*/
public InventoryItem(ItemStack stack) {
invItem = stack;
inventory = NonNullList.withSize(INV_SIZE, ItemStack.EMPTY);
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
readFromNBT(stack.getTagCompound());
uniqueID = "";
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
uniqueID = UUID.randomUUID().toString();
}
}
示例2: getToolHeadSchematicRecipe
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
private static IRecipe getToolHeadSchematicRecipe(ItemStack output, String material, String type, int cost) {
NonNullList<Ingredient> inputs = NonNullList.withSize(cost + 1, Ingredient.EMPTY);
ItemStack schematic = new ItemStack(ModItems.schematic);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, type);
schematic.setTagCompound(nbt);
Ingredient schematicIngredient = new IngredientNBT(schematic) {
};
inputs.set(0, schematicIngredient);
for (int i = 1; i <= cost; i++) {
inputs.set(i, new OreIngredient(material));
}
return new ShapelessOreRecipe(null, inputs, output);
}
示例3: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
NonNullList<ItemStack> nonnulllist = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
for (int i = 0; i < nonnulllist.size(); ++i) {
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack.isItemEqual(new ItemStack(Items.POTIONITEM))) {
nonnulllist.set(i, new ItemStack(Items.GLASS_BOTTLE, 1));
continue;
}
nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
}
return nonnulllist;
}
示例4: onOutputTaken
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public void onOutputTaken() {
ItemStack input = this.input.getStackInSlot(0);
input.setCount(input.getCount() - 1);
if (input.getCount() == 0) {
input = ItemStack.EMPTY;
}
this.input.setStackInSlot(0, input);
NonNullList<ItemStack> toDisplay = NonNullList.withSize(9, ItemStack.EMPTY);
PagedItemStackHandler handler = new PagedItemStackHandler(toDisplay, this.handler.getIndex());
this.handler = handler;
this.delegate.setHandler(handler);
this.detectAndSendChanges();
}
示例5: addMeatCompressionRecipe
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public static void addMeatCompressionRecipe(IForgeRegistry<IRecipe> registry, EnumEdibleMeat meat, boolean cooked, ItemStack ingredient) {
ResourceLocation group = new ResourceLocation("thermionics_world", "compress.meat");
Ingredient input = Ingredient.fromStacks(ingredient);
ShapedRecipes recipe =
new ShapedRecipes(group.toString(), 3, 3,
NonNullList.withSize(3*3, input),
new ItemStack(TWBlocks.MEAT_EDIBLE, 1, BlockMeatEdible.getMetaFromValue(meat, cooked)) );
recipe.setRegistryName(new ResourceLocation("thermionics_world", meat.getName()+((cooked)?".cooked":".raw")+"_CompressToBlock"));
registry.register(recipe);
}
示例6: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
/**
* Copied from ShapedRecipes
*/
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
NonNullList<ItemStack> aitemstack = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
for (int i = 0; i < aitemstack.size(); ++i) {
ItemStack itemstack = inv.getStackInSlot(i);
aitemstack.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
}
return aitemstack;
}
示例7: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
// TODO Auto-generated method stub
NonNullList<ItemStack> aitemstack = NonNullList.withSize(inv.getSizeInventory(),ItemStack.EMPTY);
for (int i = 0; i < aitemstack.size(); ++i) {
ItemStack itemstack = inv.getStackInSlot(i);
aitemstack.set(i,net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
}
return aitemstack;
}
示例8: fromBytes
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
int i = buf.readShort();
itemStacks = NonNullList.<ItemStack>withSize(i, ItemStack.EMPTY);
stackSizes = new int[i];
for (int j = 0; j < i; ++j) {
itemStacks.set(j, ByteBufUtils.readItemStack(buf));
}
for (int j = 0; j < i; ++j) {
stackSizes[j] = buf.readInt();
}
}
示例9: getSlots
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public NonNullList<ItemStack> getSlots() {
NonNullList list = NonNullList.withSize(3, ItemStack.EMPTY);
list.set(0, this.getInput().getStackInSlot(0));
list.set(1, this.getFuel().getStackInSlot(0));
list.set(2, this.getOutput().getStackInSlot(0));
return list;
}
示例10: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>withSize(inv.getSizeInventory(), ItemStack.EMPTY);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
}
return nonnulllist;
}
示例11: onSheared
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
return NonNullList.withSize(1, new ItemStack(this));
}
示例12: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
return NonNullList.<ItemStack>withSize(9, ItemStack.EMPTY);
}
示例13: ItemStackHandlerMachine
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public ItemStackHandlerMachine(TileEntityMachineBase tile, int size) {
this.tile = tile;
stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
示例14: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
NonNullList items = NonNullList.<ItemStack>withSize(inv.getSizeInventory(), ItemStack.EMPTY);
return items;
}
示例15: TempChest
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public TempChest(int numSlots) {
invList = NonNullList.withSize(numSlots, ItemStack.EMPTY);
}