本文整理匯總了Java中net.minecraft.util.NonNullList.add方法的典型用法代碼示例。如果您正苦於以下問題:Java NonNullList.add方法的具體用法?Java NonNullList.add怎麽用?Java NonNullList.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.NonNullList
的用法示例。
在下文中一共展示了NonNullList.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createInput
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
* Creates a list of ingredients based on an Object[]. Valid types are {@link String}, {@link ItemStack}, {@link Item}, and {@link Block}.
* Used for shapeless recipes.
*/
private static NonNullList<Ingredient> createInput(Object[] input)
{
if (input[0] instanceof List)
input = ((List<?>) input[0]).toArray();
else if (input[0] instanceof Object[])
input = (Object[]) input[0];
NonNullList<Ingredient> inputL = NonNullList.create();
for (int i = 0; i < input.length; i++)
{
Object k = input[i];
if (k instanceof String)
inputL.add(i, new OreIngredient((String) k));
else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
else if (k instanceof IForgeRegistryEntry)
inputL.add(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
else
throw new UnsupportedOperationException(
"Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME);
}
return inputL;
}
示例2: isValidPosition
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
protected boolean isValidPosition(BlockPos pos) {
IBlockState blockState = worldCache.getBlockState(pos);
Block block = blockState.getBlock();
if (!worldCache.isAirBlock(pos) && !ignoreBlock(block)) {
NonNullList<ItemStack> droppedStacks = NonNullList.create();
if (block.canSilkHarvest(drone.world(), pos, blockState, drone.getFakePlayer())) {
droppedStacks.add(getSilkTouchBlock(block, blockState));
} else {
block.getDrops(droppedStacks, drone.world(), pos, blockState, 0);
}
for (ItemStack droppedStack : droppedStacks) {
if (widget.isItemValidForFilters(droppedStack, blockState)) {
swapBestItemToFirstSlot(pos);
return true;
}
}
}
return false;
}
示例3: getSubItems
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
if(!Config.DISABLED_TOOLS.contains("mace")) {
ItemStack stack1 = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound();
tag.setString(HEAD_TAG, Materials.randomHead().getName());
tag.setString(HAFT_TAG, Materials.randomHaft().getName());
tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
stack1.setTagCompound(tag);
if (isInCreativeTab(tab)) {
subItems.add(stack1);
}
}
}
示例4: getSubItems
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
if (!Config.DISABLED_TOOLS.contains("pickaxe")) {
ItemStack stack1 = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound();
tag.setString(HEAD_TAG, Materials.randomHead().getName());
tag.setString(HAFT_TAG, Materials.randomHaft().getName());
tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
stack1.setTagCompound(tag);
if (isInCreativeTab(tab)) {
subItems.add(stack1);
}
}
}
示例5: SuperCallTest
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public SuperCallTest()
{
new StringBuilder(); // This is also invokespecial and shouldn't be redirected
// invokevirtual but from different class
NonNullList<Integer> list = NonNullList.create();
list.add(1);
}
示例6: getSubBlocks
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
if (tab!=this.getCreativeTabToDisplayOn()) return;
for (int i=0; i<16; i++) {
list.add(new ItemStack(ItemBlock.getItemFromBlock(this), 1, i));
}
}
示例7: getIngredients
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<Ingredient> getIngredients()
{
NonNullList<Ingredient> lst = NonNullList.create();
lst.add(Ingredient.fromItem(ModItems.simic_slaw));
lst.add(new FoodIngredient());
return lst;
}
示例8: getDrops
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state,
int fortune) {
if(state.getValue(TYPE)==EnumKilnTypes.COMPLETE){
drops.add(new ItemStack(ItemsRegistry.ash_stack.getItem(), Config.PotteryAsh, ItemsRegistry.ash_stack.getItemDamage()));
}else if(state.getValue(TYPE)==EnumKilnTypes.WOOD||state.getValue(TYPE)==EnumKilnTypes.ACTIVE){
drops.add(new ItemStack(ItemsRegistry.wood_stack.getItem(), Config.WoodAmount, ItemsRegistry.wood_stack.getItemDamage()));
drops.add(new ItemStack(ItemsRegistry.thatch_stack.getItem(), Config.ThatchAmount, ItemsRegistry.thatch_stack.getItemDamage()));
}else if(state.getValue(TYPE)==EnumKilnTypes.THATCH){
drops.add(new ItemStack(ItemsRegistry.thatch_stack.getItem(), Config.ThatchAmount, ItemsRegistry.thatch_stack.getItemDamage()));
}
}
示例9: getSubItems
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
if(!Config.DISABLED_TOOLS.contains("dagger")) {
ItemStack stack1 = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound();
tag.setString(BLADE_TAG, Materials.randomHead().getName());
tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
stack1.setTagCompound(tag);
if (isInCreativeTab(tab)) {
subItems.add(stack1);
}
}
}
示例10: getSubItems
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getSubItems(CreativeTabs tab, @Nonnull NonNullList<ItemStack> items) {
if (this.isInCreativeTab(tab)) {
for (int i = 0; i < BlockGemOre.Gem.values().length; ++i) {
items.add(new ItemStack(this, 1, i));
}
}
}
示例11: getSubBlocks
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
if(this.burning) {
super.getSubBlocks(itemIn, items);
} else {
ItemStack stack = new ItemStack(this);
stack.getOrCreateSubCompound("randores").setInteger("furnace_speed", 1);
items.add(stack);
}
}
示例12: getSubBlocks
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list)
{
for (int i = 0; i < 4; ++i)
{
list.add(new ItemStack(this, 1, i));
}
}
示例13: getSubItems
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
for (int i = 0; i < meta_map.size(); i++) {
if (!Config.HIDE_UNCRAFTABLE_HEADS || (OreDictionary.getOres(meta_map.get(i).getCraftingItem()).size() > 0
&& OreDictionary.getOres(meta_map.get(i).getSmallCraftingItem()).size() > 0)) {
ItemStack stack = new ItemStack(this, 1, i);
if (isInCreativeTab(tab)) {
subItems.add(stack);
}
}
}
}
示例14: getSubBlocks
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list)
{
list.add(new ItemStack(itemIn));
list.add(new ItemStack(itemIn, 1, 1));
list.add(new ItemStack(itemIn, 1, 2));
}
示例15: getSubItems
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
for (String type : subtypes) {
ItemStack stack = new ItemStack(this);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(type_tag, type);
stack.setTagCompound(nbt);
if (isInCreativeTab(tab)) {
subItems.add(stack);
}
}
}