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


Java General.getItem方法代码示例

本文整理汇总了Java中info.jbcs.minecraft.utilities.General.getItem方法的典型用法代码示例。如果您正苦于以下问题:Java General.getItem方法的具体用法?Java General.getItem怎么用?Java General.getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在info.jbcs.minecraft.utilities.General的用法示例。


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

示例1: addInformation

import info.jbcs.minecraft.utilities.General; //导入方法依赖的package包/类
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) {
   	if(! Chisel.blockDescriptions) return;
   	
   	Item item=General.getItem(stack);
   	if(item==null) return;
   	
   	Block block = Block.getBlockFromItem(this);
   	if(! (block instanceof Carvable)) return;
   	
   	Carvable carvable=(Carvable) block;
   	CarvableVariation var=carvable.getVariation(stack.getItemDamage());
   	if(var==null) return;
   	
   	lines.add(var.description);
   }
 
开发者ID:asiekierka,项目名称:Chisel-1.7.2,代码行数:17,代码来源:ItemCarvable.java

示例2: updateItems

import info.jbcs.minecraft.utilities.General; //导入方法依赖的package包/类
public void updateItems() {
    ItemStack chiseledItem = items[normalSlots];

    clearItems();

    if (chiseledItem == null || chiseledItem.itemID < 0 || chiseledItem.itemID >= Item.itemsList.length) {
        container.onChiselSlotChanged();
        return;
    }

    if (chiseledItem.itemID >= Block.blocksList.length)
        return;

    Item item = General.getItem(chiseledItem);
    if (item == null) return;

    ArrayList<ItemStack> list = container.carvingRegistry.getItems(chiseledItem);

    activeVariations = 0;
    while (activeVariations < normalSlots && activeVariations < list.size()) {
        items[activeVariations] = list.get(activeVariations);
        activeVariations++;
    }

    container.onChiselSlotChanged();
}
 
开发者ID:delta534,项目名称:Chisel,代码行数:27,代码来源:InventoryChiselSelection.java

示例3: addInformation

import info.jbcs.minecraft.utilities.General; //导入方法依赖的package包/类
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) {
    if (!Chisel.blockDescriptions) return;

    Item item = General.getItem(stack);
    if (item == null) return;

    Block block = General.getBlock(item.itemID);
    if (!(block instanceof Carvable)) return;

    Carvable carvable = (Carvable) block;
    RenderVariation var = carvable.getVariation(stack.getItemDamage());
    if (var == null) return;

    lines.add(LangUtil.translateG(var.description));
}
 
开发者ID:delta534,项目名称:Chisel,代码行数:17,代码来源:ItemCarvable.java

示例4: ContainerChisel

import info.jbcs.minecraft.utilities.General; //导入方法依赖的package包/类
public ContainerChisel(InventoryPlayer inventoryplayer, InventoryChiselSelection inv) {
	inventory = inv;
	playerInventory=inventoryplayer;
	currentIndex=playerInventory.currentItem;
	inv.container=this;

	int[] leftOffsets = { 8, 26, 134, 152, 44, 116 };
	int[] topOffsets = { 8, 26, 44, 62 };

	int index = 0;
	for (int i = 0; i < 2; i++) {
		for (int y = 0; y < 4; y++) {
			for (int x = 0; x < 2; x++) {
				addSlotToContainer(new SlotChiselSelection(this,inventory, inventory, x + i * 8 + y * 2, leftOffsets[x+i*2], topOffsets[y]));
			}
		}
	}

	for (int y = 0; y < 4; y++) {
		for (int x = 0; x < 2; x++) {
			addSlotToContainer(new SlotChiselSelection(this,inventory, inventory, 16 + x + y * 2, leftOffsets[4 + x], topOffsets[3-y]));
		}
	}
	
	addSlotToContainer(new SlotChiselInput(this,inventory, InventoryChiselSelection.normalSlots, 80, 35));

	for (int k = 0; k < 3; k++) {
		for (int j1 = 0; j1 < 9; j1++) {
			addSlotToContainer(new Slot(inventoryplayer, j1 + k * 9 + 9, 8 + j1 * 18, 102 + k * 18 - 18));
		}
	}

	for (int l = 0; l < 9; l++) {
		addSlotToContainer(l==currentIndex?
				new SlotChiselPlayer(this,inventoryplayer, l, 8 + l * 18, 160 - 18):
				new Slot(inventoryplayer, l, 8 + l * 18, 160 - 18)
		);
	}
	
	chisel=inventoryplayer.getCurrentItem();
	if(chisel.stackTagCompound!=null){
		ItemStack stack=ItemStack.loadItemStackFromNBT(chisel.stackTagCompound.getCompoundTag("chiselTarget"));
		inventory.setInventorySlotContents(InventoryChiselSelection.normalSlots, stack);
	}
	
	Item item=General.getItem(chisel);
	carving=item instanceof ItemChisel?((ItemChisel)item).carving:Carving.chisel;
	
	inventory.updateItems();
}
 
开发者ID:asiekierka,项目名称:Chisel-1.7.2,代码行数:51,代码来源:ContainerChisel.java

示例5: ContainerChisel

import info.jbcs.minecraft.utilities.General; //导入方法依赖的package包/类
public ContainerChisel(InventoryPlayer inventoryplayer, InventoryChiselSelection inv) {
    inventory = inv;
    playerInventory = inventoryplayer;
    currentIndex = playerInventory.currentItem;
    inv.container = this;

    int[] leftOffsets = {8, 26, 134, 152, 44, 116};
    int[] topOffsets = {8, 26, 44, 62};
    chisel = inventoryplayer.getCurrentItem();

    int index = 0;
    for (int i = 0; i < 2; i++) {
        for (int y = 0; y < 4; y++) {
            for (int x = 0; x < 2; x++) {
                addSlotToContainer(new SlotChiselSelection(this, inventory, inventory, x + i * 8 + y * 2, leftOffsets[x + i * 2], topOffsets[y]));
            }
        }
    }

    for (int y = 0; y < 4; y++) {
        for (int x = 0; x < 2; x++) {
            addSlotToContainer(new SlotChiselSelection(this, inventory, inventory, 16 + x + y * 2, leftOffsets[4 + x], topOffsets[3 - y]));
        }
    }

    addSlotToContainer(new SlotChiselInput(this, inventory, InventoryChiselSelection.normalSlots, 80, 35));

    for (int k = 0; k < 3; k++) {
        for (int j1 = 0; j1 < 9; j1++) {
            addSlotToContainer(new Slot(inventoryplayer, j1 + k * 9 + 9, 8 + j1 * 18, 102 + k * 18 - 18));
        }
    }

    for (int l = 0; l < 9; l++) {
        addSlotToContainer(l == currentIndex ?
                new SlotChiselPlayer(this, inventoryplayer, l, 8 + l * 18, 160 - 18) :
                new Slot(inventoryplayer, l, 8 + l * 18, 160 - 18)
        );
    }

    if (chisel.stackTagCompound != null) {
        ItemStack stack = ItemStack.loadItemStackFromNBT(chisel.stackTagCompound.getCompoundTag("chiselTarget"));
        inventory.setInventorySlotContents(InventoryChiselSelection.normalSlots, stack);
    }

    Item item = General.getItem(chisel);
    carvingRegistry = item instanceof ItemChisel ? ((ItemChisel) item).carvingRegistry : CarvingRegistry.chisel;

    inventory.updateItems();
}
 
开发者ID:delta534,项目名称:Chisel,代码行数:51,代码来源:ContainerChisel.java


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