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


Java ContainerWorkbench类代码示例

本文整理汇总了Java中net.minecraft.inventory.ContainerWorkbench的典型用法代码示例。如果您正苦于以下问题:Java ContainerWorkbench类的具体用法?Java ContainerWorkbench怎么用?Java ContainerWorkbench使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContainerWorkbench类属于net.minecraft.inventory包,在下文中一共展示了ContainerWorkbench类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createContainer

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
@Override
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer entityPlayer) {
    ContainerWorkbench container = new ContainerWorkbench(playerInventory, this.world, this.position);

    for(int i = 0; i < used.length; i++) {
        if(used[i] == null) continue;

        ItemStack playerStack = entityPlayer.inventory.mainInventory.get(used[i]);
        
        if(playerStack != null && playerStack.getCount() > 0)
        {
            ItemStack stackUsed = playerStack.copy();
            stackUsed.setCount(1);
            playerStack.setCount(playerStack.getCount() - 1);
            
            if(playerStack.getCount() == 0)
            {
            	entityPlayer.inventory.mainInventory.remove(used[i]);
            }

            container.craftMatrix.setInventorySlotContents(i, stackUsed);
        }
    }

    return container;
}
 
开发者ID:Creysys,项目名称:GuideBook,代码行数:27,代码来源:MessagePutItemsInWorkbench.java

示例2: displayGUIWorkbench

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public void displayGUIWorkbench(int p_71058_1_, int p_71058_2_, int p_71058_3_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.worldObj, p_71058_1_, p_71058_2_, p_71058_3_));

    if (container == null)
    {
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 1, "Crafting", 9, true));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:18,代码来源:EntityPlayerMP.java

示例3: getGridItem

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public static ItemStack getGridItem(int nr) {
    GuiContainer menu = (GuiContainer)getMenu();
    Container slots = menu.inventorySlots;

    if (menu instanceof GuiCrafting) {
        return ((ContainerWorkbench)slots).craftMatrix.getStackInSlot(nr);
    } else if (menu instanceof GuiInventory) {
        return ((ContainerPlayer)slots).craftMatrix.getStackInSlot(nr);
    }

    return null;
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:13,代码来源:ZWrapper.java

示例4: createItem

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
private void createItem(EntitySheep entity, World worldObj) {
    final ContainerWorkbench container = new ContainerWorkbench(new InventoryPlayer(null), worldObj, entity.getPosition());
    for (int i = 0; i < 9; ++i) {
        container.craftMatrix.setInventorySlotContents(i, itemsConsumed[i]);
    }

    final CraftingManager instance = CraftingManager.getInstance();
    final ItemStack craftedItem = instance.findMatchingRecipe(container.craftMatrix, worldObj);
    if (craftedItem != null) {
        EntityItem entityItem = new EntityItem(worldObj, entity.posX, entity.posY, entity.posZ, craftedItem);
        worldObj.spawnEntityInWorld(entityItem);
        entityItem.rotationYaw = entity.renderYawOffset + 180;
        entityItem.moveRelative(0, 0.3f, 1);

        final ItemStack[] remainingItems = instance.getRemainingItems(container.craftMatrix, worldObj);
        for (final ItemStack remainingItem : remainingItems) {
            if (remainingItem == null) continue;
            entityItem = new EntityItem(worldObj, entity.posX, entity.posY, entity.posZ, remainingItem);
            worldObj.spawnEntityInWorld(entityItem);
            entityItem.rotationYaw = entity.renderYawOffset + 180;
            entityItem.moveRelative(0, 0.3f, 1);
        }
    }

    System.arraycopy(originalCraftingGrid, 0, itemsToCollect, 0, 9);
    itemsConsumed = new ItemStack[9];
    updateItemsConsumed();
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:29,代码来源:FollowAutoCraftItems.java

示例5: simulateInventoryOf

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
/**
 * Simulates an inventory with the given inputs as
 * @param inputs    The inputs
 * @param width     The width of the inventory to simulate
 * @param height    The height of the inventory to simulate
 * @return          The crafting inventory
 */
public static InventoryCrafting simulateInventoryOf(ItemStack[] inputs, int width, int height) {
    if(inputs == null) return null;

    // Make a container...
    Container c = new ContainerWorkbench(new InventoryPlayer(null), null, BlockPos.ORIGIN);

    // Figure out our sizes:
    if(width <= 0 && height <= 0) {
        width = height = inputs.length > 4 ? 3 : 2;
    }

    if(width <= 0) {
        width = (int)Math.ceil((double)inputs.length / height);
    }

    if(height <= 0) {
        height = (int)Math.ceil((double)inputs.length / width);
    }

    InventoryCrafting inv = new InventoryCrafting(c, width, height);

    for (int i = 0; i < inputs.length; i++) {
        inv.setInventorySlotContents(i, inputs[i]);
    }

    // And pretend we're crafting:
    return inv;
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:36,代码来源:ItemUtility.java

示例6: displayGUIWorkbench

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
/**
 * Displays the crafting GUI for a workbench.
 */
public void displayGUIWorkbench(int par1, int par2, int par3)
{
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 1, "Crafting", 9, true));
    this.openContainer = new ContainerWorkbench(this.inventory, this.worldObj, par1, par2, par3);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:12,代码来源:EntityPlayerMP.java

示例7: executeClient

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
@Override
public void executeClient(EntityPlayer player) {
	if(player.openContainer instanceof ContainerWorkbench)
	{
		EventHandler.index = index;
		((ContainerWorkbench)player.openContainer).craftResult.setInventorySlotContents(0, stack);
	}
}
 
开发者ID:CreativeMD,项目名称:CraftingManager,代码行数:9,代码来源:CraftResultPacket.java

示例8: executeServer

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
@Override
public void executeServer(EntityPlayer player) {
	if(player.openContainer instanceof ContainerWorkbench)
	{
		((ContainerWorkbench)player.openContainer).craftResult.setInventorySlotContents(0, stack);
		PacketHandler.sendPacketToPlayer(new CraftResultPacket(index, stack), (EntityPlayerMP) player);
	}
}
 
开发者ID:CreativeMD,项目名称:CraftingManager,代码行数:9,代码来源:CraftResultPacket.java

示例9: displayGUIWorkbench

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public void displayGUIWorkbench(int p_71058_1_, int p_71058_2_, int p_71058_3_)
{
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 1, "Crafting", 9, true));
    this.openContainer = new ContainerWorkbench(this.inventory, this.worldObj, p_71058_1_, p_71058_2_, p_71058_3_);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:9,代码来源:EntityPlayerMP.java

示例10: func_71058_b

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public void func_71058_b(int p_71058_1_, int p_71058_2_, int p_71058_3_) {
   this.func_71117_bO();
   this.field_71135_a.func_72567_b(new Packet100OpenWindow(this.field_71139_cq, 1, "Crafting", 9, true));
   this.field_71070_bA = new ContainerWorkbench(this.field_71071_by, this.field_70170_p, p_71058_1_, p_71058_2_, p_71058_3_);
   this.field_71070_bA.field_75152_c = this.field_71139_cq;
   this.field_71070_bA.func_75132_a(this);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:8,代码来源:EntityPlayerMP.java

示例11: displayGUIWorkbench

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
/**
 * Displays the crafting GUI for a workbench.
 */
public void displayGUIWorkbench(int par1, int par2, int par3)
{
    this.incrementWindowID();
    this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 1, "Crafting", 9, true));
    this.openContainer = new ContainerWorkbench(this.inventory, this.worldObj, par1, par2, par3);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:12,代码来源:EntityPlayerMP.java

示例12: onTooltip

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
@SubscribeEvent
public void onTooltip(ItemTooltipEvent event) {
  if (ItemStack.areItemStacksEqual(lastOutput, event.getItemStack())) {
    if ((event.getEntityPlayer().openContainer instanceof ContainerWorkbench
        && ((ContainerWorkbench) event.getEntityPlayer().openContainer).craftResult.getStackInSlot(0) == event.getItemStack())
        || (event.getEntityPlayer().openContainer instanceof ContainerPlayer
            && ((ContainerPlayer) event.getEntityPlayer().openContainer).craftResult.getStackInSlot(0) == event.getItemStack())) {
      event.getToolTip().add(Lang.RECIPE_CLEAR.get());
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:12,代码来源:ClearConfigRecipe.java

示例13: doesRecipeExist

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public boolean doesRecipeExist(ICraftingPatternMAC pattern)
{
	InventoryCrafting inv = new InventoryCrafting(new ContainerWorkbench(new InventoryPlayer(null), gridTE.getWorld(), 0, 0, 0)
	{
		public void onCraftMatrixChanged(IInventory par1IInventory)
		{
		}
	}, 3, 3);
	for (int i = 0; i < pattern.getCraftingMatrix().length; i++)
	{
		inv.setInventorySlotContents(i, pattern.getCraftingMatrix()[i]);
	}
	ItemStack thing = CraftingManager.getInstance().findMatchingRecipe(inv, gridTE.getWorld());
	return ItemStack.areItemStacksEqual(thing, pattern.getOutput());
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:16,代码来源:ECPrivatePatternInventory.java

示例14: createContainer

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerWorkbench(playerInventory, this.world, this.position);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockWorkbench.java

示例15: GuiCrafting

import net.minecraft.inventory.ContainerWorkbench; //导入依赖的package包/类
public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockPos blockPosition)
{
    super(new ContainerWorkbench(playerInv, worldIn, blockPosition));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:GuiCrafting.java


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