本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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));
// }
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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
);
}
示例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);
}
}
示例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));
}
}
}
示例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);
}
}
示例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);
}
示例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());
}
示例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);
}
}
}