Java Code Examples for net.minecraft.init.Items#GLASS_BOTTLE
The following examples show how to use
net.minecraft.init.Items#GLASS_BOTTLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DrinkSoymilkRamune.java From TofuCraftReload with MIT License | 6 votes |
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (entityLiving instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)entityLiving; entityplayer.getFoodStats().addStats(this, stack); worldIn.playSound((EntityPlayer)null, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); this.onFoodEaten(stack, worldIn, entityplayer); entityplayer.addStat(StatList.getObjectUseStats(this)); if (entityplayer instanceof EntityPlayerMP) { CriteriaTriggers.CONSUME_ITEM.trigger((EntityPlayerMP)entityplayer, stack); } } return new ItemStack(Items.GLASS_BOTTLE); }
Example 2
Source File: BlockDoubanjiangBarrel.java From TofuCraftReload with MIT License | 6 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItem(hand).getItem() ==Items.GLASS_BOTTLE && hasSoy(state)){ ItemStack doubanjiang = new ItemStack(ItemLoader.sauce_bottle,1,3); if(playerIn.getHeldItem(hand).getCount()>1){ playerIn.getHeldItem(hand).shrink(1); playerIn.inventory.addItemStackToInventory(doubanjiang); } else{ playerIn.setHeldItem(hand, doubanjiang); } worldIn.setBlockState(pos, this.withFerm(8), 2); } return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ); }
Example 3
Source File: ContainerSaltFurnace.java From TofuCraftReload with MIT License | 4 votes |
/** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int index) { // 0-3: Salt furnace inventory // 4-30: Player inventory // 31-39: Hot bar in the player inventory ItemStack itemStack = null; Slot slot = (Slot)this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemStack1 = slot.getStack(); itemStack = itemStack1.copy(); if (index == 1 || index == 3) { if (!this.mergeItemStack(itemStack1, 4, 40, true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemStack1, itemStack); } else if (index >= 4) { if (TileEntityFurnace.isItemFuel(itemStack1)) { if (!this.mergeItemStack(itemStack1, 0, 1, false)) { return ItemStack.EMPTY; } } else if (itemStack1.getItem() == Items.GLASS_BOTTLE) { if (!this.mergeItemStack(itemStack1, 2, 3, false)) { return ItemStack.EMPTY; } } else if (index >= 4 && index < 31) { if (!this.mergeItemStack(itemStack1, 31, 40, false)) { return ItemStack.EMPTY; } } else if (index >= 31 && index < 40 && !this.mergeItemStack(itemStack1, 4, 31, false)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemStack1, 4, 40, false)) { return ItemStack.EMPTY; } if (itemStack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemStack1.getCount() == itemStack.getCount()) { return ItemStack.EMPTY; } slot.onTake(par1EntityPlayer, itemStack1); } return itemStack; }
Example 4
Source File: PotionItemFluidHandler.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
@Override protected void setContainerToEmpty() { this.container = new ItemStack(Items.GLASS_BOTTLE); }
Example 5
Source File: ItemJunk.java From minecraft-roguelike with GNU General Public License v3.0 | 4 votes |
@Override public ItemStack getLootItem(Random rand, int level){ if(level > 0 && rand.nextInt(200) == 0){ if(level > 2 && rand.nextInt(10) == 0) return new ItemStack(Items.DIAMOND_HORSE_ARMOR, 1, 0); if(level > 1 && rand.nextInt(5) == 0) return new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1, 0); if(rand.nextInt(3) == 0) return new ItemStack(Items.IRON_HORSE_ARMOR, 1, 0); return new ItemStack(Items.SADDLE); } if(rand.nextInt(100) == 0) return PotionMixture.getRandom(rand); if(level > 1 && rand.nextInt(100) == 0) return new ItemStack(Items.GHAST_TEAR); if(level < 3 && rand.nextInt(80) == 0) return new ItemStack(Items.BOOK); if(rand.nextInt(80) == 0) return Shield.get(rand); if(level > 1 && rand.nextInt(60) == 0) return TippedArrow.get(rand, 4 + rand.nextInt(level) * 2); if(level > 1 && rand.nextInt(50) == 0){ switch(rand.nextInt(6)){ case 0: return new ItemStack(Items.GUNPOWDER, 1 + rand.nextInt(3)); case 1: return new ItemStack(Items.BLAZE_POWDER, 1 + rand.nextInt(3)); case 2: return new ItemStack(Items.GOLD_NUGGET, 1 + rand.nextInt(3)); case 3: return new ItemStack(Items.REDSTONE, 1 + rand.nextInt(3)); case 4: return new ItemStack(Items.GLOWSTONE_DUST, 1 + rand.nextInt(8)); case 5: return new ItemStack(Items.DYE, 1 + rand.nextInt(3)); } } if(rand.nextInt(60) == 0) return PotionMixture.getPotion(rand, PotionMixture.LAUDANUM); if(rand.nextInt(30) == 0) return new ItemStack(Blocks.TORCH, 6 + rand.nextInt(20)); if(level > 0 && rand.nextInt(8) == 0){ switch(rand.nextInt(8)){ case 0: return new ItemStack(Items.SLIME_BALL); case 1: return new ItemStack(Items.SNOWBALL); case 2: return new ItemStack(Items.MUSHROOM_STEW); case 3: return new ItemStack(Items.CLAY_BALL); case 4: return new ItemStack(Items.FLINT); case 5: return new ItemStack(Items.FEATHER); case 6: return new ItemStack(Items.GLASS_BOTTLE); case 7: return new ItemStack(Items.LEATHER); } } switch(rand.nextInt(7)){ case 0: return new ItemStack(Items.BONE); case 1: return new ItemStack(Items.ROTTEN_FLESH); case 2: return new ItemStack(Items.SPIDER_EYE); case 3: return new ItemStack(Items.PAPER); case 4: return new ItemStack(Items.STRING); case 5: return new ItemStack(Items.STICK); default: return new ItemStack(Items.STICK); } }