当前位置: 首页>>代码示例>>Java>>正文


Java NonNullList.withSize方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:23,代码来源:InventoryItem.java

示例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);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:17,代码来源:ModRecipes.java

示例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;
}
 
开发者ID:TeamCovertDragon,项目名称:MooncakeCraft,代码行数:19,代码来源:RemainBottleRecipeFactory.java

示例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();
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:17,代码来源:CraftiniumConverterContainer.java

示例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);
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:11,代码来源:ThermionicsWorld.java

示例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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:15,代码来源:AbstractRecipe.java

示例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;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:13,代码来源:AustraliumRecipe.java

示例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();
	}

}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:14,代码来源:PacketSyncDankNull.java

示例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;
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:8,代码来源:CraftiniumForgeTileEntity.java

示例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;
   }
 
开发者ID:rafradek,项目名称:Mods,代码行数:14,代码来源:RecipeFromScrap.java

示例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));
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:5,代码来源:BlockModLeaves.java

示例12: getRemainingItems

import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	return NonNullList.<ItemStack>withSize(9, ItemStack.EMPTY);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:5,代码来源:BookRecipe.java

示例13: ItemStackHandlerMachine

import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public ItemStackHandlerMachine(TileEntityMachineBase tile, int size) {
    this.tile = tile;
    stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:5,代码来源:ItemStackHandlerMachine.java

示例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;
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:6,代码来源:ToolRecipe.java

示例15: TempChest

import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public TempChest(int numSlots) {
	invList = NonNullList.withSize(numSlots, ItemStack.EMPTY);
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:4,代码来源:EntityFrienderman.java


注:本文中的net.minecraft.util.NonNullList.withSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。