Java Code Examples for net.minecraft.init.Items#FIREWORKS

The following examples show how to use net.minecraft.init.Items#FIREWORKS . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: NotEnoughItems   File:    License: MIT License 5 votes vote down vote up
public CachedFireworkRecipe(Object[] base, Object extra, int type) {
    super(new ItemStack(Items.FIREWORKS));
    this.baseIngredients = base;
    this.extraIngred = extra;
    this.recipeType = type;

Example 2
public static ItemStack get(Random rand, int stackSize){

	ItemStack rocket = new ItemStack(Items.FIREWORKS, stackSize);
	NBTTagCompound tag = new NBTTagCompound();
	NBTTagCompound fireworks = new NBTTagCompound();
	fireworks.setByte("Flight", (byte) (rand.nextInt(3) + 1));
	NBTTagList explosion = new NBTTagList();
	NBTTagCompound properties = new NBTTagCompound();
	properties.setByte("Flicker", (byte) (rand.nextBoolean() ? 1 : 0));
	properties.setByte("Trail", (byte) (rand.nextBoolean() ? 1 : 0));
	properties.setByte("Type", (byte) (rand.nextInt(5)));
	int size = rand.nextInt(4) + 1;
	int[] colorArr = new int[size];
	for(int i = 0; i < size; ++i){
		colorArr[i] = DyeColor.HSLToColor(rand.nextFloat(), (float)1.0, (float)0.5);
	NBTTagIntArray colors = new NBTTagIntArray(colorArr);
	properties.setTag("Colors", colors);
	fireworks.setTag("Explosions", explosion);
	tag.setTag("Fireworks", fireworks);
	return rocket;