當前位置: 首頁>>代碼示例>>Java>>正文


Java Item.getItemById方法代碼示例

本文整理匯總了Java中net.minecraft.item.Item.getItemById方法的典型用法代碼示例。如果您正苦於以下問題:Java Item.getItemById方法的具體用法?Java Item.getItemById怎麽用?Java Item.getItemById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.item.Item的用法示例。


在下文中一共展示了Item.getItemById方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readItemStackFromBuffer

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * Reads an ItemStack from this buffer
 */
public ItemStack readItemStackFromBuffer() throws IOException
{
    int i = this.readShort();

    if (i < 0)
    {
        return ItemStack.field_190927_a;
    }
    else
    {
        int j = this.readByte();
        int k = this.readShort();
        ItemStack itemstack = new ItemStack(Item.getItemById(i), j, k);
        itemstack.setTagCompound(this.readNBTTagCompoundFromBuffer());
        return itemstack;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:PacketBuffer.java

示例2: setTurretInventory

import net.minecraft.item.Item; //導入方法依賴的package包/類
public static void setTurretInventory(int entityID, int itemID, int itemSlot, int metadata) 
{
	Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityID);
	
	if (entity == null) { return; }	// Doesn't exist? Shame.
	
	if (entity instanceof Entity_AA)
	{
		Entity_AA turret = (Entity_AA) entity;
		
		if (itemSlot >= turret.storage.length)	// Received a slot that is higher than what we got, so assuming that this turret has a storage upgrade
		{
			AI_Properties.applyStorageUpgrade(turret);	// Safeguard
		}
		
		if (itemID == -1)
		{
			turret.storage[itemSlot] = null;	// Empty
		}
		else
		{
			turret.storage[itemSlot] = new ItemStack(Item.getItemById(itemID), 1, metadata);	// There ya go. Now the client knows about that too.
		}
	}
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:26,代碼來源:Helper_Client.java

示例3: getSearchedStack

import net.minecraft.item.Item; //導入方法依賴的package包/類
@Nonnull
public static ItemStack getSearchedStack(ItemStack helmetStack) {
    if (helmetStack.isEmpty() || !NBTUtil.hasTag(helmetStack, "SearchStack")) return ItemStack.EMPTY;
    NBTTagCompound tag = NBTUtil.getCompoundTag(helmetStack, "SearchStack");
    if (tag.getInteger("itemID") == -1) return ItemStack.EMPTY;
    return new ItemStack(Item.getItemById(tag.getInteger("itemID")), 1, tag.getInteger("itemDamage"));
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:8,代碼來源:ItemPneumaticArmor.java

示例4: readFromNBT

import net.minecraft.item.Item; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);

    if (compound.hasKey("Item", 8))
    {
        this.flowerPotItem = Item.getByNameOrId(compound.getString("Item"));
    }
    else
    {
        this.flowerPotItem = Item.getItemById(compound.getInteger("Item"));
    }

    this.flowerPotData = compound.getInteger("Data");
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:TileEntityFlowerPot.java

示例5: handleSpawnPlayer

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * Handles the creation of a nearby player entity, sets the position and held item
 */
public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    double d0 = (double)packetIn.getX() / 32.0D;
    double d1 = (double)packetIn.getY() / 32.0D;
    double d2 = (double)packetIn.getZ() / 32.0D;
    float f = (float)(packetIn.getYaw() * 360) / 256.0F;
    float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
    EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getPlayer()).getGameProfile());
    entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double)(entityotherplayermp.serverPosX = packetIn.getX());
    entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double)(entityotherplayermp.serverPosY = packetIn.getY());
    entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double)(entityotherplayermp.serverPosZ = packetIn.getZ());
    int i = packetIn.getCurrentItemID();

    if (i == 0)
    {
        entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null;
    }
    else
    {
        entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(Item.getItemById(i), 1, 0);
    }

    entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
    List<DataWatcher.WatchableObject> list = packetIn.func_148944_c();

    if (list != null)
    {
        entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:NetHandlerPlayClient.java

示例6: getDropItem

import net.minecraft.item.Item; //導入方法依賴的package包/類
protected Item getDropItem()
{
    return Item.getItemById(-1);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:EntityWolf.java

示例7: readPacketData

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.item = Item.getItemById(buf.readVarIntFromBuffer());
    this.ticks = buf.readVarIntFromBuffer();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:9,代碼來源:SPacketCooldown.java

示例8: getModelTextures

import net.minecraft.item.Item; //導入方法依賴的package包/類
private String[] getModelTextures()
{
    if (this.type == 1 && this.items.length == 1)
    {
        Item item = Item.getItemById(this.items[0]);

        if (item == Items.potionitem && this.damage != null && this.damage.getCountRanges() > 0)
        {
            RangeInt rangeint = this.damage.getRange(0);
            int i = rangeint.getMin();
            boolean flag = (i & 16384) != 0;
            String s5 = this.getMapTexture(this.mapTextures, "texture.potion_overlay", "items/potion_overlay");
            String s6 = null;

            if (flag)
            {
                s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_splash", "items/potion_bottle_splash");
            }
            else
            {
                s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_drinkable", "items/potion_bottle_drinkable");
            }

            return new String[] {s5, s6};
        }

        if (item instanceof ItemArmor)
        {
            ItemArmor itemarmor = (ItemArmor)item;

            if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER)
            {
                String s = "leather";
                String s1 = "helmet";

                if (itemarmor.armorType == 0)
                {
                    s1 = "helmet";
                }

                if (itemarmor.armorType == 1)
                {
                    s1 = "chestplate";
                }

                if (itemarmor.armorType == 2)
                {
                    s1 = "leggings";
                }

                if (itemarmor.armorType == 3)
                {
                    s1 = "boots";
                }

                String s2 = s + "_" + s1;
                String s3 = this.getMapTexture(this.mapTextures, "texture." + s2, "items/" + s2);
                String s4 = this.getMapTexture(this.mapTextures, "texture." + s2 + "_overlay", "items/" + s2 + "_overlay");
                return new String[] {s3, s4};
            }
        }
    }

    return new String[] {this.texture};
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:66,代碼來源:CustomItemProperties.java

示例9: getEntityFX

import net.minecraft.item.Item; //導入方法依賴的package包/類
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
    int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
    return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:6,代碼來源:EntityBreakingFX.java

示例10: getModelTextures

import net.minecraft.item.Item; //導入方法依賴的package包/類
private String[] getModelTextures()
{
    if (this.type == 1 && this.items.length == 1)
    {
        Item item = Item.getItemById(this.items[0]);
        boolean flag = item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION;

        if (flag && this.damage != null && this.damage.getCountRanges() > 0)
        {
            RangeInt rangeint = this.damage.getRange(0);
            int i = rangeint.getMin();
            boolean flag1 = (i & 16384) != 0;
            String s5 = this.getMapTexture(this.mapTextures, "texture.potion_overlay", "items/potion_overlay");
            String s6 = null;

            if (flag1)
            {
                s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_splash", "items/potion_bottle_splash");
            }
            else
            {
                s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_drinkable", "items/potion_bottle_drinkable");
            }

            return new String[] {s5, s6};
        }

        if (item instanceof ItemArmor)
        {
            ItemArmor itemarmor = (ItemArmor)item;

            if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER)
            {
                String s = "leather";
                String s1 = "helmet";

                if (itemarmor.armorType == EntityEquipmentSlot.HEAD)
                {
                    s1 = "helmet";
                }

                if (itemarmor.armorType == EntityEquipmentSlot.CHEST)
                {
                    s1 = "chestplate";
                }

                if (itemarmor.armorType == EntityEquipmentSlot.LEGS)
                {
                    s1 = "leggings";
                }

                if (itemarmor.armorType == EntityEquipmentSlot.FEET)
                {
                    s1 = "boots";
                }

                String s2 = s + "_" + s1;
                String s3 = this.getMapTexture(this.mapTextures, "texture." + s2, "items/" + s2);
                String s4 = this.getMapTexture(this.mapTextures, "texture." + s2 + "_overlay", "items/" + s2 + "_overlay");
                return new String[] {s3, s4};
            }
        }
    }

    return new String[] {this.texture};
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:67,代碼來源:CustomItemProperties.java

示例11: createParticle

import net.minecraft.item.Item; //導入方法依賴的package包/類
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
    int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
    return new ParticleBreaking(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:6,代碼來源:ParticleBreaking.java

示例12: getItem

import net.minecraft.item.Item; //導入方法依賴的package包/類
public static Item getItem(int id) {
    //return Item.itemsList[id]; // < 1.8
    return Item.getItemById(id);
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:5,代碼來源:ZWrapper.java

示例13: cloneWithoutEffects

import net.minecraft.item.Item; //導入方法依賴的package包/類
public static IItemStack cloneWithoutEffects(IItemStack stack) {
	return new IItemStack(new ItemStack(Item.getItemById(Item.getIdFromItem(stack.getStack().getItem())),
			stack.getStack().stackSize));
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:5,代碼來源:IItemStack.java


注:本文中的net.minecraft.item.Item.getItemById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。