public boolean tryFireMinigun(EntityLivingBase target) { boolean lastShotOfAmmo = false; if (!ammo.isEmpty() && (pressurizable == null || pressurizable.getPressure(stack) > 0)) { setMinigunTriggerTimeOut(Math.max(10, getMinigunSoundCounter())); if (getMinigunSpeed() == MAX_GUN_SPEED && (!requiresTarget || gunAimedAtTarget)) { if (!requiresTarget) target = raytraceTarget(); lastShotOfAmmo = ammo.attemptDamageItem(1, rand, player instanceof EntityPlayerMP ? (EntityPlayerMP) player : null); if (pressurizable != null) pressurizable.addAir(stack, -airUsage); if (target != null) { ItemStack potion = ItemGunAmmo.getPotion(ammo); if (!potion.isEmpty()) { if (rand.nextInt(20) == 0) { List<PotionEffect> effects = PotionUtils.getEffectsFromStack(potion); for (PotionEffect effect : effects) { target.addPotionEffect(new PotionEffect(effect)); } } } else { target.attackEntityFrom(DamageSource.causePlayerDamage(player), ConfigHandler.general.configMinigunDamage); } } } } return lastShotOfAmmo; }
public static Tuple<List<BrewEffect>, List<PotionEffect>> deSerialize(NBTTagCompound compound) { List<PotionEffect> potionEffects = PotionUtils.getEffectsFromTag(compound); List<BrewEffect> brewEffects = new ArrayList<>(); Tuple<List<BrewEffect>, List<PotionEffect>> tuple = new Tuple<>(brewEffects, potionEffects); NBTTagList list = (NBTTagList) compound.getTag(BREW_DATA); for (int i = 0, size = list.tagCount(); i < size; i++) { NBTTagCompound tag = list.getCompoundTagAt(i); IBrew brew = BrewRegistry.getRegisteredBrew(tag.getString(BREW_ID)); int duration = tag.getInteger(BREW_DURATION); int amplifier = tag.getInteger(BREW_AMPLIFIER); brewEffects.add(new BrewEffect(brew, duration, amplifier)); } return tuple; }
@Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entity) { EntityPlayer entityplayer = entity instanceof EntityPlayer ? (EntityPlayer) entity : null; if (!world.isRemote) { for (BrewEffect effect : BrewUtils.getBrewsFromStack(stack)) { BrewStorageHandler.addEntityBrewEffect(entity, effect); } for (PotionEffect potioneffect : PotionUtils.getEffectsFromStack(stack)) { entity.addPotionEffect(new PotionEffect(potioneffect)); } } if (entityplayer == null || !entityplayer.capabilities.isCreativeMode) { stack.shrink(1); if (stack.getCount() <= 0) { return new ItemStack(Items.GLASS_BOTTLE); } if (entityplayer != null) { entityplayer.inventory.addItemStackToInventory(new ItemStack(Items.GLASS_BOTTLE)); } } return stack; }
/** * Applies all effects in the bottle to the entity; if the bottle has both a potion and a spirit, both are applied. */ public void apply(ItemStack bottle, EntityLivingBase entity) { if (entity.world.isRemote) return; Spirit spirit = getSpirit(bottle); if (spirit!=null) { if (spirit.isAlcoholic()) { PotionEffect effect = entity.getActivePotionEffect(Thermionics.POTION_TIPSY); int curStrength = 0; if (effect!=null) { curStrength = effect.getAmplifier(); } entity.removeActivePotionEffect(Thermionics.POTION_TIPSY); entity.addPotionEffect( new PotionEffect(Thermionics.POTION_TIPSY, 20*30, curStrength+1)); } } for (PotionEffect potion : PotionUtils.getEffectsFromStack(bottle)) { if (potion.getPotion().isInstant()) { potion.getPotion().affectEntity(entity, entity, entity, potion.getAmplifier(), 1.0D); } else { entity.addPotionEffect(new PotionEffect(potion)); } } }
/** * Called when this EntityThrowable hits a block or entity. */ protected void onImpact(RayTraceResult result) { if (!this.world.isRemote) { this.world.playEvent(2002, new BlockPos(this), PotionUtils.getPotionColor(PotionTypes.WATER)); int i = 3 + this.world.rand.nextInt(5) + this.world.rand.nextInt(5); while (i > 0) { int j = EntityXPOrb.getXPSplit(i); i -= j; this.world.spawnEntityInWorld(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j)); } this.setDead(); } }
/** * Clears potion metadata values if the entity has no potion effects. Otherwise, updates potion effect color, * ambience, and invisibility metadata values */ protected void updatePotionMetadata() { if (this.activePotionsMap.isEmpty()) { this.resetPotionEffectMetadata(); this.setInvisible(false); } else { Collection<PotionEffect> collection = this.activePotionsMap.values(); this.dataManager.set(HIDE_PARTICLES, Boolean.valueOf(areAllPotionsAmbient(collection))); this.dataManager.set(POTION_EFFECTS, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(collection))); this.setInvisible(this.isPotionActive(MobEffects.INVISIBILITY)); } }
private void func_190542_a(ItemStack p_190542_1_, PotionType p_190542_2_) { EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ); entityareaeffectcloud.setOwner(this.getThrower()); entityareaeffectcloud.setRadius(3.0F); entityareaeffectcloud.setRadiusOnUse(-0.5F); entityareaeffectcloud.setWaitTime(10); entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float)entityareaeffectcloud.getDuration()); entityareaeffectcloud.setPotion(p_190542_2_); for (PotionEffect potioneffect : PotionUtils.getFullEffectsFromItem(p_190542_1_)) { entityareaeffectcloud.addEffect(new PotionEffect(potioneffect)); } NBTTagCompound nbttagcompound = p_190542_1_.getTagCompound(); if (nbttagcompound != null && nbttagcompound.hasKey("CustomPotionColor", 99)) { entityareaeffectcloud.setColor(nbttagcompound.getInteger("CustomPotionColor")); } this.world.spawnEntityInWorld(entityareaeffectcloud); }
/** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if (compound.hasKey("Potion", 8)) { this.potion = PotionUtils.getPotionTypeFromNBT(compound); } for (PotionEffect potioneffect : PotionUtils.getFullEffectsFromTag(compound)) { this.addEffect(potioneffect); } if (compound.hasKey("Color", 99)) { this.func_191507_d(compound.getInteger("Color")); } else { this.func_190548_o(); } }
/** * Returns an Item that is the result of this recipe */ public ItemStack getCraftingResult(InventoryCrafting inv) { ItemStack itemstack = inv.getStackInRowAndColumn(1, 1); if (itemstack.getItem() != Items.LINGERING_POTION) { return ItemStack.field_190927_a; } else { ItemStack itemstack1 = new ItemStack(Items.TIPPED_ARROW, 8); PotionUtils.addPotionToItemStack(itemstack1, PotionUtils.getPotionFromItem(itemstack)); PotionUtils.appendEffects(itemstack1, PotionUtils.getFullEffectsFromItem(itemstack)); return itemstack1; } }
@Override public ItemStack getCraftingResult(InventoryCrafting inv) { ItemStack outputStack = ItemStack.EMPTY; if (countSlotsNotEmpty(inv) <= 1) return outputStack; Collection<PotionEffect> effects = new ArrayList<PotionEffect>(); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); if (!stack.isEmpty()) { if (outputStack.isEmpty()) outputStack = getOutputStack(stack); if (outputStack.isEmpty()) return outputStack; effects.addAll(getEffectsFromStack(stack)); } } outputStack = PotionUtils.appendEffects(outputStack, effects); outputStack.setStackDisplayName(I18n.translateToLocal("item.combined_" + outputStack.getItem().getUnlocalizedName().substring(5) + ".name")); return outputStack; }
public void setPotionEffect(ItemStack stack) { if (stack.getItem() == Items.TIPPED_ARROW) { this.potion = PotionUtils.getPotionTypeFromNBT(stack.getTagCompound()); Collection<PotionEffect> collection = PotionUtils.getFullEffectsFromItem(stack); if (!collection.isEmpty()) { for (PotionEffect potioneffect : collection) { this.customPotionEffects.add(new PotionEffect(potioneffect)); } } this.dataManager.set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, collection)))); } else if (stack.getItem() == Items.ARROW) { this.potion = PotionTypes.EMPTY; this.customPotionEffects.clear(); this.dataManager.set(COLOR, Integer.valueOf(0)); } }
/** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if (compound.hasKey("Potion", 8)) { this.potion = PotionUtils.getPotionTypeFromNBT(compound); } for (PotionEffect potioneffect : PotionUtils.getFullEffectsFromTag(compound)) { this.addEffect(potioneffect); } if (this.potion != PotionTypes.EMPTY || !this.customPotionEffects.isEmpty()) { this.dataManager.set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.customPotionEffects)))); } }
public void setPotion(PotionType potionIn) { this.potion = potionIn; if (!this.colorSet) { if (potionIn == PotionTypes.EMPTY && this.effects.isEmpty()) { this.getDataManager().set(COLOR, Integer.valueOf(0)); } else { this.getDataManager().set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(potionIn, this.effects)))); } } }
/** * Returns an Item that is the result of this recipe */ @Nullable public ItemStack getCraftingResult(InventoryCrafting inv) { ItemStack itemstack = inv.getStackInRowAndColumn(1, 1); if (itemstack != null && itemstack.getItem() == Items.LINGERING_POTION) { ItemStack itemstack1 = new ItemStack(Items.TIPPED_ARROW, 8); PotionUtils.addPotionToItemStack(itemstack1, PotionUtils.getPotionFromItem(itemstack)); PotionUtils.appendEffects(itemstack1, PotionUtils.getFullEffectsFromItem(itemstack)); return itemstack1; } else { return null; } }
@Override protected void onImpact(RayTraceResult result) { if (!this.world.isRemote) { this.world.playEvent(2002, new BlockPos(this), PotionUtils.getPotionColor(PotionTypes.HEALING)); int i = InteractionEriottoMod.SPIRIT_PER_BOTTLE; while (i > 0) { int j = EntitySpirit.getSpiritSplit(i); i -= j; this.world.spawnEntity(new EntitySpirit(this.world, this.posX, this.posY, this.posZ, j)); } this.setDead(); } }
@SubscribeEvent public void finishUse(LivingEntityUseItemEvent.Finish event){ EntityLivingBase entity = event.getEntityLiving(); ItemStack stack = event.getItem(); if(entity.isInsideOfMaterial(Material.WATER)){ if(ItemStackTools.isValid(stack) && stack.getItem() == Items.GLASS_BOTTLE){ //Restore to full air entity.setAir(300); ItemStack waterbottle = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER); if(ItemStackTools.getStackSize(stack) > 1){ event.setResultStack(ItemUtil.consumeItem(stack)); if(entity instanceof EntityPlayer){ if(!((EntityPlayer)entity).inventory.addItemStackToInventory(waterbottle)){ ItemUtil.spawnItemInWorldWithoutMotion(entity.getEntityWorld(), waterbottle, new BlockPos(entity)); } } else { ItemUtil.spawnItemInWorldWithoutMotion(entity.getEntityWorld(), waterbottle, new BlockPos(entity)); } } else { event.setResultStack(waterbottle); } } } }
protected ItemStack getArrowStack() { ItemStack dart = new ItemStack(ModItems.dart, 1, getType().getMetadata()); if(potion !=PotionTypes.EMPTY){ PotionUtils.addPotionToItemStack(dart, this.potion); PotionUtils.appendEffects(dart, this.customPotionEffects); if (this.hasColor) { NBTTagCompound nbttagcompound = dart.getTagCompound(); if (nbttagcompound == null) { nbttagcompound = new NBTTagCompound(); dart.setTagCompound(nbttagcompound); } nbttagcompound.setInteger("CustomPotionColor", this.getColor()); } } return dart; }
protected void handleAttackLogicUpdate() { PotionType potiontype = null; if (this.rand.nextFloat() < 0.15F && this.isInsideOfMaterial(Material.WATER) && !this.isPotionActive(MobEffects.WATER_BREATHING)) { potiontype = PotionTypes.WATER_BREATHING; } else if (this.rand.nextFloat() < 0.15F && this.isBurning() && !this.isPotionActive(MobEffects.FIRE_RESISTANCE)) { potiontype = PotionTypes.FIRE_RESISTANCE; } else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth()) { potiontype = PotionTypes.HEALING; } else if (this.rand.nextFloat() < 0.5F && this.getAttackTarget() != null && !this.isPotionActive(MobEffects.SPEED) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D) { potiontype = PotionTypes.SWIFTNESS; } if (potiontype != null) { this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potiontype)); this.attackTimer = 10; this.setAggressive(true); IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); iattributeinstance.removeModifier(MODIFIER); iattributeinstance.applyModifier(MODIFIER); } }
protected void handleDrinkingPotionUpdate() { if (this.attackTimer-- <= 0) { this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.setAggressive(false); ItemStack itemstack = this.getHeldItemOffhand(); this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY); if (itemstack != null && itemstack.getItem() == Items.POTIONITEM) { List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemstack); if (list != null) { for (PotionEffect potioneffect : list) { this.addPotionEffect(new PotionEffect(potioneffect)); } } } this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(MODIFIER); } }
protected void attackWithPotion(EntityLivingBase target) { double targetY = target.posY + (double) target.getEyeHeight() - 1.100000023841858D; double targetX = target.posX + target.motionX - this.posX; double d2 = targetY - this.posY; double targetZ = target.posZ + target.motionZ - this.posZ; float f = MathHelper.sqrt(targetX * targetX + targetZ * targetZ); PotionType potiontype = PotionTypes.HARMING; if (f >= 8.0F && !target.isPotionActive(MobEffects.SLOWNESS)) { potiontype = PotionTypes.SLOWNESS; } else if (target.getHealth() >= 8.0F && !target.isPotionActive(MobEffects.POISON)) { potiontype = PotionTypes.POISON; } else if (f <= 3.0F && !target.isPotionActive(MobEffects.WEAKNESS) && this.rand.nextFloat() < 0.25F) { potiontype = PotionTypes.WEAKNESS; } EntityPotion entitypotion = new EntityPotion(this.world, this, PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potiontype)); entitypotion.rotationPitch -= -20.0F; entitypotion.setThrowableHeading(targetX, d2 + (double) (f * 0.2F), targetZ, 0.75F, 8.0F); this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.world.spawnEntity(entitypotion); }
private static void registerUpgrades(PotionType normal, PotionType extended, PotionType strong) { BrewingRecipeRegistry.addRecipe(createBrewingRecipe(normal, new ItemStack(Items.REDSTONE), extended)); BrewingRecipeRegistry.addRecipe(createBrewingRecipe(strong, new ItemStack(Items.REDSTONE), extended)); BrewingRecipeRegistry.addRecipe(createBrewingRecipe(normal, new ItemStack(Items.GLOWSTONE_DUST), strong)); BrewingRecipeRegistry.addRecipe(createBrewingRecipe(extended, new ItemStack(Items.GLOWSTONE_DUST), strong)); BrewingRecipeRegistry.addRecipe(createSplashBrewingRecipe(normal, new ItemStack(Items.REDSTONE), extended)); BrewingRecipeRegistry.addRecipe(createSplashBrewingRecipe(strong, new ItemStack(Items.REDSTONE), extended)); BrewingRecipeRegistry.addRecipe(createSplashBrewingRecipe(normal, new ItemStack(Items.GLOWSTONE_DUST), strong)); BrewingRecipeRegistry.addRecipe(createSplashBrewingRecipe(extended, new ItemStack(Items.GLOWSTONE_DUST), strong)); BrewingRecipeRegistry.addRecipe(createLingeringBrewingRecipe(normal, new ItemStack(Items.REDSTONE), extended)); BrewingRecipeRegistry.addRecipe(createLingeringBrewingRecipe(strong, new ItemStack(Items.REDSTONE), extended)); BrewingRecipeRegistry.addRecipe(createLingeringBrewingRecipe(normal, new ItemStack(Items.GLOWSTONE_DUST), strong)); BrewingRecipeRegistry.addRecipe(createLingeringBrewingRecipe(extended, new ItemStack(Items.GLOWSTONE_DUST), strong)); BrewingRecipeRegistry.addRecipe(new BrewingRecipe(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), normal), new ItemStack(Items.GUNPOWDER), (PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), normal)))); BrewingRecipeRegistry.addRecipe(new BrewingRecipe(PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), normal), new ItemStack(Items.DRAGON_BREATH), (PotionUtils.addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), normal)))); }
@Override public NonNullList<ItemStack> getCraftingGrid(IRecipe r) { NonNullList<ItemStack> recipeItems = NonNullList.<ItemStack>create(); for ( int i = 0 ; i < 9 ; i++ ) { if (i != 4) { recipeItems.add(new ItemStack(Items.ARROW, 1)); } else { ItemStack stack = new ItemStack(Items.LINGERING_POTION, 1); PotionUtils.addPotionToItemStack(stack, PotionUtils.getPotionFromItem(inputStack)); PotionUtils.appendEffects(stack, PotionUtils.getFullEffectsFromItem(inputStack)); recipeItems.add(stack); } } return recipeItems; }
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack handStack = player.getHeldItem(hand); if (handStack.getItem() == GeneraItems.ItemGlassJar && handStack.getMetadata() == 1) { NBTTagCompound nbt = handStack.getTagCompound(); if (nbt == null) return false; PotionType potion; player.getEntityData().setInteger("genera.sacrifices_made", player.getEntityData().getInteger("genera.sacrifices_made") + 1); switch (nbt.getInteger("type")) { case 0: potion = PotionType.getPotionTypeForName("regeneration"); if (potion == null) return false; player.setHeldItem(hand, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potion)); return false; case 1: potion = PotionType.getPotionTypeForName("night_vision"); if (potion == null) return false; player.setHeldItem(hand, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potion)); return false; case 2: potion = PotionType.getPotionTypeForName("leaping"); if (potion == null) return false; player.setHeldItem(hand, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potion)); return false; } } return false; }
public static boolean hasEffect(ItemStack stack, Potion potion) { for(PotionEffect effect : PotionUtils.getEffectsFromStack(stack)) if(effect.getPotion() == potion) return true; return false; }
@SubscribeEvent public void colorCoke(PotionBrewEvent.Post event){ for(int i=0;i<event.getLength();i++){ if(PotionUtils.getPotionFromItem(event.getItem(i))==COKE_COLA|| PotionUtils.getPotionFromItem(event.getItem(i))==COKE_COLA_LONG|| PotionUtils.getPotionFromItem(event.getItem(i))==COKE_COLA_STRONG){ ItemStack brew=event.getItem(i).copy(); brew.getTagCompound().setInteger("CustomPotionColor", 4738376); event.setItem(i, brew); } } }
public void setPotionEffect(ItemStack stack) { if (stack.getItem() == Items.TIPPED_ARROW) { this.potion = PotionUtils.getPotionFromItem(stack); Collection<PotionEffect> collection = PotionUtils.getFullEffectsFromItem(stack); if (!collection.isEmpty()) { for (PotionEffect potioneffect : collection) { this.customPotionEffects.add(new PotionEffect(potioneffect)); } } int i = func_191508_b(stack); if (i == -1) { this.func_190548_o(); } else { this.func_191507_d(i); } } else if (stack.getItem() == Items.ARROW) { this.potion = PotionTypes.EMPTY; this.customPotionEffects.clear(); this.dataManager.set(COLOR, Integer.valueOf(-1)); } }
/** * Attack the specified entity using a ranged attack. * * @param distanceFactor How far the target is, normalized and clamped between 0.1 and 1.0 */ public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) { if (!this.isDrinkingPotion()) { double d0 = target.posY + (double)target.getEyeHeight() - 1.100000023841858D; double d1 = target.posX + target.motionX - this.posX; double d2 = d0 - this.posY; double d3 = target.posZ + target.motionZ - this.posZ; float f = MathHelper.sqrt(d1 * d1 + d3 * d3); PotionType potiontype = PotionTypes.HARMING; if (f >= 8.0F && !target.isPotionActive(MobEffects.SLOWNESS)) { potiontype = PotionTypes.SLOWNESS; } else if (target.getHealth() >= 8.0F && !target.isPotionActive(MobEffects.POISON)) { potiontype = PotionTypes.POISON; } else if (f <= 3.0F && !target.isPotionActive(MobEffects.WEAKNESS) && this.rand.nextFloat() < 0.25F) { potiontype = PotionTypes.WEAKNESS; } EntityPotion entitypotion = new EntityPotion(this.world, this, PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potiontype)); entitypotion.rotationPitch -= -20.0F; entitypotion.setThrowableHeading(d1, d2 + (double)(f * 0.2F), d3, 0.75F, 8.0F); this.world.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.world.spawnEntityInWorld(entitypotion); } }
private void func_190618_C() { if (this.potion == PotionTypes.EMPTY && this.effects.isEmpty()) { this.getDataManager().set(COLOR, Integer.valueOf(0)); } else { this.getDataManager().set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.effects)))); } }
/** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */ public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) { for (PotionType potiontype : PotionType.REGISTRY) { if (potiontype != PotionTypes.EMPTY) { subItems.add(PotionUtils.addPotionToItemStack(new ItemStack(itemIn), potiontype)); } } }
/** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */ public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) { for (PotionType potiontype : PotionType.REGISTRY) { if (!potiontype.getEffects().isEmpty()) { subItems.add(PotionUtils.addPotionToItemStack(new ItemStack(itemIn), potiontype)); } } }
public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_) { PotionType potiontype = PotionUtils.getPotionFromItem(p_190901_2_); if (potiontype != PotionTypes.WATER && potiontype != PotionTypes.EMPTY) { this.player.addStat(AchievementList.POTION); } super.func_190901_a(p_190901_1_, p_190901_2_); return p_190901_2_; }