Java Code Examples for net.minecraft.init.Items.SPLASH_POTION

The following are Jave code examples for showing how to use SPLASH_POTION of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: EntityPotion.java   View Source Code Vote up 6 votes
public ItemStack getPotion()
{
    ItemStack itemstack = (ItemStack)this.getDataManager().get(ITEM);

    if (itemstack.getItem() != Items.SPLASH_POTION && itemstack.getItem() != Items.LINGERING_POTION)
    {
        if (this.world != null)
        {
            LOGGER.error("ThrownPotion entity {} has no item?!", new Object[] {Integer.valueOf(this.getEntityId())});
        }

        return new ItemStack(Items.SPLASH_POTION);
    }
    else
    {
        return itemstack;
    }
}
 
Example 2
Project: CombinedPotions   File: RecipeCombinedPotions2.java   View Source Code Vote up 6 votes
private boolean canCombineItems(ItemStack stackA, ItemStack stackB)
{
	if (ItemStack.areItemsEqual(stackA, stackB)) return true;

	if (stackA.getItem() == Items.POTIONITEM && stackB.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackB.getMetadata() == 0) return true;
	if (stackA.getItem() == Items.SPLASH_POTION && stackB.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackB.getMetadata() == 1) return true;
	if (stackA.getItem() == Items.LINGERING_POTION && stackB.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackB.getMetadata() == 2) return true;

	if (stackB.getItem() == Items.POTIONITEM && stackA.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackA.getMetadata() == 0) return true;
	if (stackB.getItem() == Items.SPLASH_POTION && stackA.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackA.getMetadata() == 1) return true;
	if (stackB.getItem() == Items.LINGERING_POTION && stackA.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackA.getMetadata() == 2) return true;

	if (stackA.getItem() == Items.TIPPED_ARROW && stackB.getItem() == Item.getByNameOrId("potioncore:custom_arrow")) return true;
	if (stackB.getItem() == Items.TIPPED_ARROW && stackA.getItem() == Item.getByNameOrId("potioncore:custom_arrow")) return true;

	return false;
}
 
Example 3
Project: CombinedPotions   File: RecipeCombinedPotions2.java   View Source Code Vote up 6 votes
private ItemStack getOutputStack(ItemStack inputStack)
{
	Item item = inputStack.getItem();

	if (item == Items.POTIONITEM || (item == Item.getByNameOrId("potioncore:custom_potion") && inputStack.getMetadata() == 0))
	{
		return new ItemStack(Items.POTIONITEM, 1, 0);
	}
	else if (item == Items.SPLASH_POTION || (item == Item.getByNameOrId("potioncore:custom_potion") && inputStack.getMetadata() == 1))
	{
		return new ItemStack(Items.SPLASH_POTION, 1, 0);
	}
	else if (item == Items.LINGERING_POTION || (item == Item.getByNameOrId("potioncore:custom_potion") && inputStack.getMetadata() == 2))
	{
		return new ItemStack(Items.LINGERING_POTION, 1, 0);
	}
	else if (item == Items.TIPPED_ARROW || item == Item.getByNameOrId("potioncore:custom_arrow"))
	{
		return new ItemStack(Items.TIPPED_ARROW, 1, 0);
	}

	else return ItemStack.EMPTY;
}
 
Example 4
Project: CustomWorldGen   File: EntityPotion.java   View Source Code Vote up 6 votes
public ItemStack getPotion()
{
    ItemStack itemstack = (ItemStack)((Optional)this.getDataManager().get(ITEM)).orNull();

    if (itemstack == null || itemstack.getItem() != Items.SPLASH_POTION && itemstack.getItem() != Items.LINGERING_POTION)
    {
        if (this.worldObj != null)
        {
            LOGGER.error("ThrownPotion entity {} has no item?!", new Object[] {Integer.valueOf(this.getEntityId())});
        }

        return new ItemStack(Items.SPLASH_POTION);
    }
    else
    {
        return itemstack;
    }
}
 
Example 5
Project: Backmemed   File: CustomItems.java   View Source Code Vote up 5 votes
private static int getPotionDamage(ItemStack p_getPotionDamage_0_)
{
    NBTTagCompound nbttagcompound = p_getPotionDamage_0_.getTagCompound();

    if (nbttagcompound == null)
    {
        return 0;
    }
    else
    {
        String s = nbttagcompound.getString("Potion");

        if (s == null)
        {
            return 0;
        }
        else
        {
            Integer integer = (Integer)mapPotionDamages.get(s);

            if (integer == null)
            {
                return -1;
            }
            else
            {
                int i = integer.intValue();

                if (p_getPotionDamage_0_.getItem() == Items.SPLASH_POTION)
                {
                    i |= 16384;
                }

                return i;
            }
        }
    }
}
 
Example 6
Project: Backmemed   File: TileEntityBrewingStand.java   View Source Code Vote up 5 votes
/**
 * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For
 * guis use Slot.isItemValid
 */
public boolean isItemValidForSlot(int index, ItemStack stack)
{
    if (index == 3)
    {
        return PotionHelper.isReagent(stack);
    }
    else
    {
        Item item = stack.getItem();
        return index == 4 ? item == Items.BLAZE_POWDER : (item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE) && this.getStackInSlot(index) == ItemStack.field_190927_a;
    }
}
 
Example 7
Project: CombinedPotions   File: RecipeCombinedPotions.java   View Source Code Vote up 5 votes
@Override
public boolean matches(InventoryCrafting inv, World worldIn)
{
	ItemStack tempStack = ItemStack.EMPTY;

	int potionEffects = 0;
	for (int i = 0; i < inv.getSizeInventory(); i++)
	{
		ItemStack stack = inv.getStackInSlot(i);
		if (!stack.isEmpty())
		{

			Item item = stack.getItem();
			if (item != Items.TIPPED_ARROW && item != Items.POTIONITEM && item != Items.SPLASH_POTION && item != Items.LINGERING_POTION) return false;

			if (tempStack.isEmpty())
			{
				tempStack = stack.copy();
			}
			else
			{
				if (!ItemStack.areItemsEqual(tempStack, stack)) return false;
			}

			if (ModConfiguration.maxPotionEffects >= 0)
			{
				potionEffects += PotionUtils.getEffectsFromStack(stack).size();
				if (potionEffects > ModConfiguration.maxPotionEffects) return false;
			}
		}
	}

	return true;
}
 
Example 8
Project: CustomWorldGen   File: VanillaBrewingRecipe.java   View Source Code Vote up 5 votes
/**
 * Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack)
 */
@Override
public boolean isInput(ItemStack stack)
{
    Item item = stack.getItem();
    return item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
}
 
Example 9
Project: Wurst-MC-1.12-OF   File: InventoryUtils.java   View Source Code Vote up 4 votes
public static boolean isSplashPotion(ItemStack stack)
{
	return stack.getItem() == Items.SPLASH_POTION;
}
 
Example 10
Project: Wurst-MC-1.12-OF   File: InventoryUtils.java   View Source Code Vote up 4 votes
public static ItemStack createSplashPotion()
{
	return new ItemStack(Items.SPLASH_POTION);
}
 
Example 11
Project: Wurst-MC-1.12   File: InventoryUtils.java   View Source Code Vote up 4 votes
public static boolean isSplashPotion(ItemStack stack)
{
	return stack.getItem() == Items.SPLASH_POTION;
}
 
Example 12
Project: Wurst-MC-1.12   File: InventoryUtils.java   View Source Code Vote up 4 votes
public static ItemStack createSplashPotion()
{
	return new ItemStack(Items.SPLASH_POTION);
}
 
Example 13
Project: Backmemed   File: ContainerBrewingStand.java   View Source Code Vote up 4 votes
public static boolean canHoldPotion(ItemStack stack)
{
    Item item = stack.getItem();
    return item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
}
 
Example 14
Project: Backmemed   File: CustomItemProperties.java   View Source Code Vote up 4 votes
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};
}