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

The following examples show how to use net.minecraft.init.Items#DYE . 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: TileEntityPortalPanel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private int getDyeMetaFromItem(int target)
{
    // The large button in the center will take the color of the active target
    if (target == 8)
    {
        target = this.getActiveTargetId();
    }

    if (target >= 0 && target < 8)
    {
        ItemStack stack = this.itemHandlerBase.getStackInSlot(target + 8);

        if (stack.isEmpty() == false && stack.getItem() == Items.DYE)
        {
            return stack.getMetadata();
        }
    }

    return -1;
}
 
Example 2
Source File: ItemArmorCyberware.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public ItemStack[] getComponents(ItemStack stack)
{
	Item i = stack.getItem();
	
	if (i == CyberwareContent.trenchcoat)
	{
		return new ItemStack[]
				{
					new ItemStack(CyberwareContent.component, 2, 2),
					new ItemStack(Items.LEATHER, 12, 0),
					new ItemStack(Items.DYE, 1, 0)
				};
	}
	else if (i == CyberwareContent.jacket)
	{
		return new ItemStack[]
				{
					new ItemStack(CyberwareContent.component, 1, 2),
					new ItemStack(Items.LEATHER, 8, 0),
					new ItemStack(Items.DYE, 1, 0)
				};
	}
	return new ItemStack[]
			{
				new ItemStack(Blocks.STAINED_GLASS, 4, 15),
				new ItemStack(CyberwareContent.component, 1, 4)
			};
}
 
Example 3
Source File: CyberwareDyingHandler.java    From Cyberware with MIT License 5 votes vote down vote up
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
	ItemStack itemstack = null;
	List<ItemStack> list = Lists.<ItemStack>newArrayList();

	for (int i = 0; i < inv.getSizeInventory(); ++i)
	{
		ItemStack itemstack1 = inv.getStackInSlot(i);

		if (itemstack1 != null)
		{
			if (itemstack1.getItem() instanceof ItemArmor)
			{
				ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

				if (itemarmor.getArmorMaterial() != CyberwareContent.trenchMat || itemstack != null)
				{
					return false;
				}

				itemstack = itemstack1;
			}
			else
			{
				if (itemstack1.getItem() != Items.DYE)
				{
					return false;
				}

				list.add(itemstack1);
			}
		}
	}

	return itemstack != null && !list.isEmpty();
}
 
Example 4
Source File: PlayerInteractEventHandler.java    From AgriCraft with MIT License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void denyBonemeal(PlayerInteractEvent.RightClickBlock event) {
    if (!event.getEntityPlayer().isSneaking()) {
        return;
    }
    ItemStack heldItem = event.getEntityPlayer().getActiveItemStack();
    if (!heldItem.isEmpty() && heldItem.getItem() == Items.DYE && heldItem.getItemDamage() == 15) {
        TileEntity te = event.getWorld().getTileEntity(event.getPos());
        if (te != null && (te instanceof TileEntityCrop)) {
            event.setUseItem(Event.Result.DENY);
        }
    }
}
 
Example 5
Source File: CocoaHandler.java    From BetterChests with GNU Lesser General Public License v3.0 4 votes vote down vote up
private boolean canPlantStack(ItemStack stack) {
	return stack.getItem() == Items.DYE && stack.getMetadata() == EnumDyeColor.BROWN.getDyeDamage();
}
 
Example 6
Source File: ItemJunk.java    From minecraft-roguelike with GNU General Public License v3.0 4 votes vote down vote up
@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);
	}
}