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


Java Items類代碼示例

本文整理匯總了Java中net.minecraft.init.Items的典型用法代碼示例。如果您正苦於以下問題:Java Items類的具體用法?Java Items怎麽用?Java Items使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: onItemRightClick

import net.minecraft.init.Items; //導入依賴的package包/類
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.isRiding() && playerIn.ridingEntity instanceof EntityPig)
    {
        EntityPig entitypig = (EntityPig)playerIn.ridingEntity;

        if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 7)
        {
            entitypig.getAIControlledByPlayer().boostSpeed();
            itemStackIn.damageItem(7, playerIn);

            if (itemStackIn.stackSize == 0)
            {
                ItemStack itemstack = new ItemStack(Items.fishing_rod);
                itemstack.setTagCompound(itemStackIn.getTagCompound());
                return itemstack;
            }
        }
    }

    playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    return itemStackIn;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:27,代碼來源:ItemCarrotOnAStick.java

示例2: createSkeleton

import net.minecraft.init.Items; //導入依賴的package包/類
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
    EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
    entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
    entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
    entityskeleton.hurtResistantTime = 60;
    entityskeleton.enablePersistence();

    if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
    {
        entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
    }

    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
    return entityskeleton;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:EntityAISkeletonRiders.java

示例3: EntityPig

import net.minecraft.init.Items; //導入依賴的package包/類
public EntityPig(World worldIn)
{
    super(worldIn);
    this.setSize(0.9F, 0.9F);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIPanic(this, 1.25D));
    this.tasks.addTask(2, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 0.3F));
    this.tasks.addTask(3, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Items.carrot_on_a_stick, false));
    this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Items.carrot, false));
    this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D));
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(8, new EntityAILookIdle(this));
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:EntityPig.java

示例4: setupMaterials

import net.minecraft.init.Items; //導入依賴的package包/類
private static void setupMaterials() {
		// regular materials
		advancedWood = EnumHelper.addToolMaterial("advancedWood", 1, 236, 8.0F, 1.75F, 8);
		(advancedStone = EnumHelper.addToolMaterial("advancedStone", 2, 524, 12.0F, 3.0F, 3)).setRepairItem(new ItemStack(ACBlocks.advancedStone));
		(advancedIron = EnumHelper.addToolMaterial("advancedIron", 3, 2250, 18.0F, 10.0F, 7)).setRepairItem(new ItemStack(Blocks.IRON_BLOCK));
		(advancedGold = EnumHelper.addToolMaterial("advancedGold", 2, 1561, 8.0F, 6.0F, 15)).setRepairItem(new ItemStack(Blocks.GOLD_BLOCK));
		(advancedEmerald = EnumHelper.addToolMaterial("advancedEmerald", 4, 3122, 12.0F, ACConfig.emeraldSwordDamage - 4, 22)).setRepairItem(new ItemStack(Blocks.EMERALD_BLOCK));
		(advancedDiamond = EnumHelper.addToolMaterial("advancedDiamond", 4, 8192, 24.0F, 20.0F, 5)).setRepairItem(new ItemStack(Blocks.DIAMOND_BLOCK));
		(netherStar = EnumHelper.addToolMaterial("netherStar", 4, 9366, 20.0F, 26.0F, 1)).setRepairItem(new ItemStack(Items.NETHER_STAR));
		(advancedNetherStar = EnumHelper.addToolMaterial("advancedNetherStar", 5, 16384, 30.0F, 56.0F, 0)).setRepairItem(new ItemStack(ACBlocks.netherStarBlock));
		
		creative = EnumHelper.addToolMaterial("creative_", 1000, 1, 0, 0, 0);
		
		// thaumic materials
//		advancedThaumium = EnumHelper.addToolMaterial("advancedThaumium", 3, 2250, 18.0F, 11.0F, 12);
//		advancedElemental = EnumHelper.addToolMaterial("advancedElemental", 4, 6144, 24.0F, 22.0F, 8);
//		advancedVoid = EnumHelper.addToolMaterial("advancedVoid", 4, 524, 18.0F, 24.0F, 12);
//		advancedCrimson = EnumHelper.addToolMaterial("advancedCrimson", 4, 668, 20.0F, 30.0F, 12);
//		advancedPrimal = EnumHelper.addToolMaterial("advancedPrimal", 5, 937, 22.0F, 36.0F, 12);
//		if(ASModIntegration.thaumcraftExists) {
//			advancedThaumium.setRepairItem(new ItemStack(BlocksTC.metal, 1, 0));
//			advancedVoid.setRepairItem(new ItemStack(BlocksTC.metal, 1, 1));
//		}
	}
 
開發者ID:sblectric,項目名稱:AdvancedCombat,代碼行數:25,代碼來源:Swords.java

示例5: createSkeleton

import net.minecraft.init.Items; //導入依賴的package包/類
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, AbstractHorse p_188514_2_)
{
    EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.world);
    entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
    entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
    entityskeleton.hurtResistantTime = 60;
    entityskeleton.enablePersistence();

    if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD).func_190926_b())
    {
        entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
    }

    entityskeleton.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false));
    entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false));
    entityskeleton.world.spawnEntityInWorld(entityskeleton);
    return entityskeleton;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:EntityAISkeletonRiders.java

示例6: onBroken

import net.minecraft.init.Items; //導入依賴的package包/類
/**
 * Called when this entity is broken. Entity parameter may be null.
 */
public void onBroken(Entity brokenEntity)
{
    if (this.worldObj.getGameRules().getBoolean("doEntityDrops"))
    {
        if (brokenEntity instanceof EntityPlayer)
        {
            EntityPlayer entityplayer = (EntityPlayer)brokenEntity;

            if (entityplayer.capabilities.isCreativeMode)
            {
                return;
            }
        }

        this.entityDropItem(new ItemStack(Items.painting), 0.0F);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityPainting.java

示例7: tweakRecipes

import net.minecraft.init.Items; //導入依賴的package包/類
private static void tweakRecipes() {
	if (EtFuturum.enableDoors) {
		Items.wooden_door.setMaxStackSize(64);
		Items.iron_door.setMaxStackSize(64);
		removeFirstRecipeFor(Items.wooden_door);
		removeFirstRecipeFor(Items.iron_door);
	}

	if (EtFuturum.enableFences) {
		removeFirstRecipeFor(Blocks.fence);
		removeFirstRecipeFor(Blocks.fence_gate);
		Blocks.fence.setCreativeTab(null);
		Blocks.fence_gate.setCreativeTab(null);
	}

	if (EtFuturum.enableBurnableBlocks) {
		Blocks.fire.setFireInfo(Blocks.fence_gate, 5, 20);
		Blocks.fire.setFireInfo(Blocks.fence, 5, 20);
		Blocks.fire.setFireInfo(Blocks.deadbush, 60, 100);
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:22,代碼來源:ModRecipes.java

示例8: handleGUIButtonPress

import net.minecraft.init.Items; //導入依賴的package包/類
@Override
public void handleGUIButtonPress(int guiID, EntityPlayer player) {
    if (guiID == 1) {
        if (filterMode.ordinal() >= EnumFilterMode.values().length - 1) {
            filterMode = EnumFilterMode.ITEM;
        } else {
            filterMode = EnumFilterMode.values()[filterMode.ordinal() + 1];
        }
        //when an SideOnly exception is thrown this method automatically will set the filter mode to Item.
        filterHandler.doesItemMatchFilter(new ItemStack(Items.STICK));

    } else if (guiID == 2) {
        creativeTabID++;
        if (creativeTabID == 5 || creativeTabID == 11) creativeTabID++;
        if (creativeTabID >= CreativeTabs.CREATIVE_TAB_ARRAY.length) {
            creativeTabID = 0;
        }
    } else if (guiID == 0) {
        redstoneMode++;
        if (redstoneMode > 2) redstoneMode = 0;
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:23,代碼來源:TileEntityPressureChamberInterface.java

示例9: addRecipes

import net.minecraft.init.Items; //導入依賴的package包/類
@Override
public void addRecipes()
{
	if (this.Enabled)
	{
		// One Firework Rocket Launcher (empty)
		GameRegistry.addRecipe(new ItemStack(this, 1 , this.getMaxDamage()), "x  ", "yx ", "zyx",
				'x', Blocks.planks,
				'y', Items.iron_ingot,
				'z', Items.flint_and_steel
				);
	}
	else if (Main.noCreative) { this.setCreativeTab(null); }	// Not enabled and not allowed to be in the creative menu

	// Fill the RPG with 1 rocket
	GameRegistry.addRecipe(new ItemStack(this), " ab", "zya", " x ",
			'x', new ItemStack(this, 1 , this.getMaxDamage()),
			'y', Blocks.tnt,
			'z', Blocks.planks,
			'a', Items.paper,
			'b', Items.string
			);
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:24,代碼來源:RPG.java

示例10: smeltItem

import net.minecraft.init.Items; //導入依賴的package包/類
/**
 * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
 */
public void smeltItem()
{
    if (this.canSmelt())
    {
        ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(0);
        ItemStack itemstack1 = FurnaceRecipes.instance().getSmeltingResult(itemstack);
        ItemStack itemstack2 = (ItemStack)this.furnaceItemStacks.get(2);

        if (itemstack2.func_190926_b())
        {
            this.furnaceItemStacks.set(2, itemstack1.copy());
        }
        else if (itemstack2.getItem() == itemstack1.getItem())
        {
            itemstack2.func_190917_f(1);
        }

        if (itemstack.getItem() == Item.getItemFromBlock(Blocks.SPONGE) && itemstack.getMetadata() == 1 && !((ItemStack)this.furnaceItemStacks.get(1)).func_190926_b() && ((ItemStack)this.furnaceItemStacks.get(1)).getItem() == Items.BUCKET)
        {
            this.furnaceItemStacks.set(1, new ItemStack(Items.WATER_BUCKET));
        }

        itemstack.func_190918_g(1);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:TileEntityFurnace.java

示例11: setEquipmentBasedOnDifficulty

import net.minecraft.init.Items; //導入依賴的package包/類
/**
 * Gives armor or weapon for entity based on given DifficultyInstance
 */
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    super.setEquipmentBasedOnDifficulty(difficulty);

    if (this.rand.nextFloat() < (this.world.getDifficulty() == EnumDifficulty.HARD ? 0.05F : 0.01F))
    {
        int i = this.rand.nextInt(3);

        if (i == 0)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
        }
        else
        {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SHOVEL));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:22,代碼來源:EntityZombie.java

示例12: dropFewItems

import net.minecraft.init.Items; //導入依賴的package包/類
/**
 * Drop 0-2 items of this living's type
 */
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
{
    int i = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + p_70628_2_);

    for (int j = 0; j < i; ++j)
    {
        if (this.isBurning())
        {
            this.dropItem(Items.cooked_porkchop, 1);
        }
        else
        {
            this.dropItem(Items.porkchop, 1);
        }
    }

    if (this.getSaddled())
    {
        this.dropItem(Items.saddle, 1);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:EntityPig.java

示例13: addRecipes

import net.minecraft.init.Items; //導入依賴的package包/類
@Override
public void addRecipes()	// Enabled defines whether or not the item can be crafted. Reloading existing weapons is always permitted.
{
	if (this.Enabled)
	{
		// One quiverbow with 256 damage value (empty)
		GameRegistry.addRecipe(new ItemStack(this, 1 , this.getMaxDamage()), "zxy", "xzy", "zxy",
				'x', Items.stick,
				'y', Items.string,
				'z', Items.leather
				);
	}
	else if (Main.noCreative) { this.setCreativeTab(null); }	// Not enabled and not allowed to be in the creative menu

	// Ammo
	ItemStack bundle = Helper.getAmmoStack(ArrowBundle.class, 0);

	Helper.makeAmmoRecipe(bundle, 1, 8, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 2, 16, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 3, 24, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 4, 32, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 5, 40, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 6, 48, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 7, 56, this.getMaxDamage(), this);
	Helper.makeAmmoRecipe(bundle, 8, 64, this.getMaxDamage(), this);
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:27,代碼來源:QuiverBow.java

示例14: drawScreen

import net.minecraft.init.Items; //導入依賴的package包/類
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.disableLighting();
	RenderHelper.disableStandardItemLighting();
	RenderHelper.enableGUIStandardItemLighting();
	GlStateManager.enableAlpha();
	Minecraft.getMinecraft().getTextureManager().bindTexture(GUIDEBOOK_GUI_TEXTURE);

       int i = (width - 256) / 2;
       int j = (height - 192) / 2;
       this.drawTexturedModalRect(i, j, 0, 0, 256, 192);
       this.itemRender.renderItemIntoGUI(new ItemStack(Items.WRITABLE_BOOK), (width / 2) - 100, (height / 2) - 85);
       //String text = "test tset";
       //this.fontRendererObj.drawString(text, (width / 2) - ((text.length() * 5) / 2), (height / 2) - 30, TextFormatting.GRAY.getColorIndex());
}
 
開發者ID:Kalman98,項目名稱:Elicitation,代碼行數:18,代碼來源:GuiGuidebookPages.java

示例15: dropFewItems

import net.minecraft.init.Items; //導入依賴的package包/類
/**
 * Drop 0-2 items of this living's type
 */
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
{
    EntityItem entityitem = this.dropItem(Items.nether_star, 1);

    if (entityitem != null)
    {
        entityitem.setNoDespawn();
    }

    if (!this.worldObj.isRemote)
    {
        for (EntityPlayer entityplayer : this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.getEntityBoundingBox().expand(50.0D, 100.0D, 50.0D)))
        {
            entityplayer.triggerAchievement(AchievementList.killWither);
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:EntityWither.java


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