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

The following are Jave code examples for showing how to use FEATHER 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: Mods   File: JumperRecipe.java   View Source Code Vote up 6 votes
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
	int feather = 0;
	ItemStack stack2 = ItemStack.EMPTY;

	for (int x = 0; x < inv.getSizeInventory(); x++) {
		ItemStack stack = inv.getStackInSlot(x);
		if (!stack.isEmpty())
			if (stack.getItem() == Items.FEATHER) {
				if (feather < 8)
					feather++;
				else
					return false;
			} else if (stack2.isEmpty() && ItemFromData.isSameType(stack, nameBefore))
				stack2 = stack;
			else
				return false;
	}
	// System.out.println("matches "+(australium&&stack2!=null));
	return feather == 8 && !stack2.isEmpty();
}
 
Example 2
Project: Mods   File: JumperRecipe.java   View Source Code Vote up 6 votes
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	// TODO Auto-generated method stub
	ItemStack stack2 = ItemStack.EMPTY;

	for (int x = 0; x < inv.getSizeInventory(); x++) {
		ItemStack stack = inv.getStackInSlot(x);
		if (!stack.isEmpty())
			if (!(stack.getItem() == Items.FEATHER))
				stack2 = stack;
	}
	// System.out.println("OutPut: "+stack2);
	if (!stack2.isEmpty()) {
		if(ItemFromData.isSameType(stack2, nameBefore))
			stack2=ItemFromData.getNewStack(nameAfter);
	}
	return stack2;
}
 
Example 3
Project: Mods   File: RecipesBlockLauncher.java   View Source Code Vote up 5 votes
@Override
public boolean matches(InventoryCrafting inventorycrafting, World world) {
	int launchers = 0;
	int slimeballs = 0;
	int feathers = 0;
	int ingots = 0;
	boolean activator = false;
	boolean shotblock = false;
	/*
	 * int bows=0; int flintandsteel=0; int powder=0; int redstone=0;
	 */
	for (int i = 0; i < inventorycrafting.getSizeInventory(); i++)
		if (inventorycrafting.getStackInSlot(i) != null && inventorycrafting.getStackInSlot(i).getCount() != 0)
			if (inventorycrafting.getStackInSlot(i).getItem() instanceof TNTCannon) {
				launchers++;
				activator = BlockLauncher.cannon.isActivator(inventorycrafting.getStackInSlot(i));
				shotblock = BlockLauncher.cannon.isSpreader(inventorycrafting.getStackInSlot(i));
			} else if (inventorycrafting.getStackInSlot(i).getItem() == Items.SLIME_BALL)
				slimeballs++;
			else if (inventorycrafting.getStackInSlot(i).getItem() == Items.FEATHER)
				feathers++;
			else if (inventorycrafting.getStackInSlot(i).getItem() == Items.IRON_INGOT)
				ingots++;
			else
				return false;
	if (launchers == 1 && (slimeballs == 0 || slimeballs == 4 || slimeballs == 8)
			&& (feathers == 0 || (feathers == 4 && activator)) && (ingots == 0 || ingots == 4 || (ingots == 8 && shotblock)))
		return true;
	return false;
}
 
Example 4
Project: Mods   File: RecipesBlockLauncher.java   View Source Code Vote up 4 votes
@Override
public ItemStack getCraftingResult(InventoryCrafting inventorycrafting) {
	int launchers = 0;
	int launcherslot = -1;
	int slimeballs = 0;
	int feathers = 0;
	int ingots = 0;
	/*
	 * int bows=0; int flintandsteel=0; int powder=0; int redstone=0;
	 */
	for (int i = 0; i < inventorycrafting.getSizeInventory(); i++)
		if (inventorycrafting.getStackInSlot(i) != null && inventorycrafting.getStackInSlot(i).getCount() != 0)
			if (inventorycrafting.getStackInSlot(i).getItem() instanceof TNTCannon) {
				launchers++;
				launcherslot = i;
			} else if (inventorycrafting.getStackInSlot(i).getItem() == Items.SLIME_BALL)
				slimeballs++;
			else if (inventorycrafting.getStackInSlot(i).getItem() == Items.FEATHER)
				feathers++;
			else if (inventorycrafting.getStackInSlot(i).getItem() == Items.IRON_INGOT)
				ingots++;
			else
				return null;
	if (launchers == 1) {
		ItemStack stack = inventorycrafting.getStackInSlot(launcherslot).copy();
		if (stack.getTagCompound() == null)
			stack.setTagCompound(new NBTTagCompound());
		if (slimeballs == 4) {
			stack.getTagCompound().setBoolean("Sticky", true);
			stack.getTagCompound().removeTag("Bouncy");
		} else if (slimeballs == 8) {
			stack.getTagCompound().setBoolean("Bouncy", true);
			stack.getTagCompound().removeTag("Sticky");
		}
		if (feathers == 4)
			stack.getTagCompound().setBoolean("Harmless", true);
		if (ingots == 8)
			stack.getTagCompound().setBoolean("Stack", true);
		else if(ingots == 4)
			stack.getTagCompound().setBoolean("Crushing", true);
		/*
		 * if(bows==1){ stack.getTagCompound().setBoolean("BowLike",true); }
		 * if(flintandsteel==1){
		 * stack.getTagCompound().setBoolean("Activator",true); }
		 * if(powder==1){ stack.getTagCompound().setBoolean("Powder", true);
		 * } if(redstone==1){ stack.getTagCompound().setBoolean("Glowstone",
		 * true); }
		 */
		return stack;
	}
	return ItemStack.EMPTY;
}
 
Example 5
Project: Mods   File: GuiTF2Crafting.java   View Source Code Vote up 4 votes
@Override
@SuppressWarnings("unchecked")
protected void actionPerformed(GuiButton button) throws IOException {
	if (button.id < 12) {
		int currentRecipe = button.id + this.firstIndex;
		((ContainerTF2Workbench) this.inventorySlots).currentRecipe = currentRecipe;
		this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, currentRecipe);
		setButtons();
		this.inventorySlots.onCraftMatrixChanged(null);
		itemsToRender = new ItemStack[9];
		if (currentRecipe >= 0 && currentRecipe < TF2CraftingManager.INSTANCE.getRecipeList().size()) {
			IRecipe recipe = TF2CraftingManager.INSTANCE.getRecipeList().get(currentRecipe);
			if (recipe instanceof AustraliumRecipe) {
				itemsToRender[0] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[1] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[2] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[3] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[5] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[6] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[7] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[8] = new ItemStack(TF2weapons.itemTF2, 1, 2);
				itemsToRender[4] = new ItemStack(TF2weapons.itemTF2, 1, 9);
			} else if (recipe instanceof JumperRecipe) {
				itemsToRender[0] = new ItemStack(Items.FEATHER);
				itemsToRender[1] = new ItemStack(Items.FEATHER);
				itemsToRender[2] = new ItemStack(Items.FEATHER);
				itemsToRender[3] = new ItemStack(Items.FEATHER);
				itemsToRender[5] = new ItemStack(Items.FEATHER);
				itemsToRender[6] = new ItemStack(Items.FEATHER);
				itemsToRender[7] = new ItemStack(Items.FEATHER);
				itemsToRender[8] = new ItemStack(Items.FEATHER);
				itemsToRender[4] = ItemFromData.getNewStack(((JumperRecipe)recipe).nameBefore);
			} else if (recipe instanceof RecipeToScrap) {
				itemsToRender[0] = new ItemStack(TF2weapons.itemTF2, 1, 9);
				itemsToRender[1] = new ItemStack(TF2weapons.itemTF2, 1, 9);
			} else if (recipe instanceof OpenCrateRecipe) {
				itemsToRender[0] = new ItemStack(TF2weapons.itemTF2, 1, 7);
				itemsToRender[1] = ItemFromData.getNewStack("crate1");
			}
			else{
				List<Ingredient> input = recipe.getIngredients();
				
				for (int i = 0; i < input.size(); i++) {
					int space = 0;
					if(recipe instanceof ShapedRecipes)
						space = (3-((ShapedRecipes)recipe).recipeWidth)*(i/((ShapedRecipes)recipe).recipeWidth);
					else if(recipe instanceof ShapedOreRecipe)
						space = (3-((ShapedOreRecipe)recipe).getWidth())*(i/((ShapedOreRecipe)recipe).getWidth());
						
					if(input.get(i).getMatchingStacks().length>0) {
						itemsToRender[i + space] = input.get(i).getMatchingStacks()[0];
						if(itemsToRender[i + space].getMetadata()==32767)
							itemsToRender[i + space].setItemDamage(0);
					}
				}
			}
		}
	}
}