本文整理汇总了Java中net.minecraft.util.NonNullList.set方法的典型用法代码示例。如果您正苦于以下问题:Java NonNullList.set方法的具体用法?Java NonNullList.set怎么用?Java NonNullList.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.NonNullList
的用法示例。
在下文中一共展示了NonNullList.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack.getItem() instanceof ItemWrittenBook)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.func_190920_e(1);
nonnulllist.set(i, itemstack1);
break;
}
}
return nonnulllist;
}
示例2: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack.getItem().hasContainerItem())
{
nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
}
}
return nonnulllist;
}
示例3: reArrangeStacks
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public static void reArrangeStacks(InventoryDankNull inventory) {
if (inventory != null) {
int count = 0;
NonNullList<ItemStack> stackList = NonNullList.withSize(inventory.getSizeInventory(), ItemStack.EMPTY);
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack stack = inventory.getStackInSlot(i);
if (!stack.isEmpty()) {
stackList.set(count, inventory.getStackInSlot(i));
count++;
}
}
if (stackList.size() == 0) {
setSelectedStackIndex(inventory, -1);
}
else {
for (int i = 0; i < stackList.size(); i++) {
inventory.setInventorySlotContents(i, stackList.get(i));
}
for (int i = stackList.size(); i < inventory.getSizeInventory(); i++) {
inventory.setInventorySlotContents(i, ItemStack.EMPTY);
}
}
setSelectedIndexApplicable(inventory);
}
}
示例4: 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;
}
示例5: 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);
}
示例6: setInventorySlotContents
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
/**
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/
public void setInventorySlotContents(int index, ItemStack stack)
{
NonNullList<ItemStack> nonnulllist = null;
for (NonNullList<ItemStack> nonnulllist1 : this.allInventories)
{
if (index < nonnulllist1.size())
{
nonnulllist = nonnulllist1;
break;
}
index -= nonnulllist1.size();
}
if (nonnulllist != null)
{
nonnulllist.set(index, stack);
}
}
示例7: func_191283_b
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public static void func_191283_b(NBTTagCompound p_191283_0_, NonNullList<ItemStack> p_191283_1_)
{
NBTTagList nbttaglist = p_191283_0_.getTagList("Items", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
int j = nbttagcompound.getByte("Slot") & 255;
if (j >= 0 && j < p_191283_1_.size())
{
p_191283_1_.set(j, new ItemStack(nbttagcompound));
}
}
}
示例8: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting craftMatrix, World worldIn) {
for (IRecipe irecipe : this.recipes)
if (irecipe.matches(craftMatrix, worldIn))
return irecipe.getRemainingItems(craftMatrix);
NonNullList<ItemStack> aitemstack = NonNullList.withSize(craftMatrix.getSizeInventory(),ItemStack.EMPTY);
for (int i = 0; i < aitemstack.size(); ++i)
aitemstack.set(i,craftMatrix.getStackInSlot(i));
return aitemstack;
}
示例9: fromBytes
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
this.entityId = buf.readInt();
int size = buf.readInt();
NonNullList<ItemStack> list = NonNullList.withSize(size, ItemStack.EMPTY);
for (int i = 0; i < list.size(); i++) {
list.set(i, ByteBufUtils.readItemStack(buf));
}
this.cart = list;
}
示例10: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
int slots = inv.getHeight() * inv.getWidth();
NonNullList<ItemStack> nonNullList = NonNullList.<ItemStack>withSize(slots, ItemStack.EMPTY);
int center = (int) ((float) slots / 2);
ItemStack stack = inv.getStackInSlot(center);
nonNullList.set(center, stack.copy());
return nonNullList;
}
示例11: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> items = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
matches(inv, null);
for (int i = 0; i < invSlots.length; i++)
{
int amount = damageAmounts[i];
int invIndex = invSlots[i];
if (amount > 0)
{
ItemStack stack = inv.getStackInSlot(invIndex).copy();
stack.setItemDamage(stack.getItemDamage() + amount);
if (stack.getItemDamage() > stack.getMaxDamage())
{
stack = ForgeHooks.getContainerItem(stack);
}
items.set(invIndex, stack);
} else
{
items.set(invIndex, ForgeHooks.getContainerItem(inv.getStackInSlot(invIndex)));
}
}
return items;
}
示例12: 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;
}
示例13: removeStackFromSlot
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
/**
* Removes a stack from the given slot and returns it.
*/
public ItemStack removeStackFromSlot(int index)
{
NonNullList<ItemStack> nonnulllist = null;
for (NonNullList<ItemStack> nonnulllist1 : this.allInventories)
{
if (index < nonnulllist1.size())
{
nonnulllist = nonnulllist1;
break;
}
index -= nonnulllist1.size();
}
if (nonnulllist != null && !((ItemStack)nonnulllist.get(index)).func_190926_b())
{
ItemStack itemstack = (ItemStack)nonnulllist.get(index);
nonnulllist.set(index, ItemStack.field_190927_a);
return itemstack;
}
else
{
return ItemStack.field_190927_a;
}
}
示例14: getRemainingItems
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
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;
}
示例15: render
import net.minecraft.util.NonNullList; //导入方法依赖的package包/类
@Override
public void render(TileEntityArcaneTransfigurationTable te, double x, double y, double z, float partialTicks,
int destroyStage, float alpha)
{
te.frameAge++;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.disableRescaleNormal();
IItemHandler cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
for (int i = 0; i < cap.getSlots(); i++)
{
renderItem(cap.getStackInSlot(i), i);
}
EntityPlayer player = Minecraft.getMinecraft().player;
World world = Minecraft.getMinecraft().world;
ItemStack held = player.getHeldItemMainhand();
if (held.isEmpty() || !(held.getItem() instanceof IArcaneTransfigurationItem))
{
held = player.getHeldItemOffhand();
}
if (!held.isEmpty() && held.getItem() instanceof IArcaneTransfigurationItem)
{
NonNullList<ItemStack> recipeInputs = NonNullList.withSize(9, ItemStack.EMPTY);
for (int i = 0; i < 9; i++)
{
recipeInputs.set(i, cap.getStackInSlot(i));
}
IArcaneTransfigurationRecipe foundRecipe = ArcaneMagicAPI.getArcaneTransfigurationRecipe(player, held, recipeInputs, world);
if (foundRecipe != null)
{
GLHelper.renderItemStackFancy(foundRecipe.getRecipeOutput(), new Vec3d(0, 1.5, 0), true, Color.RED,
te.frameAge / 4, te.getWorld().getSeed());
}
}
GlStateManager.popMatrix();
}