aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/WeaponRecipies.cpp
blob: 1dbe6bdabb2f7efb870600388fde95b4cec95743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "stdafx.h"

#include "net.minecraft.world.item.h"
#include "Tile.h"
#include "Recipy.h"
#include "Recipes.h"
#include "WeaponRecipies.h"

// 4J-PB - adding "" on the end of these so we can detect it
wstring WeaponRecipies::shapes[][4] = 
{
			{L"X", //
			 L"X",//
			 L"#",L""},//
};

void WeaponRecipies::_init()
{
	map = new vector <Object *> [MAX_WEAPON_RECIPES];

	ADD_OBJECT(map[0],Tile::wood);
	ADD_OBJECT(map[0],Tile::cobblestone);
	ADD_OBJECT(map[0],Item::ironIngot);
	ADD_OBJECT(map[0],Item::diamond);
	ADD_OBJECT(map[0],Item::goldIngot);

	ADD_OBJECT(map[1],Item::sword_wood);
	ADD_OBJECT(map[1],Item::sword_stone);
	ADD_OBJECT(map[1],Item::sword_iron);
	ADD_OBJECT(map[1],Item::sword_diamond);
	ADD_OBJECT(map[1],Item::sword_gold);
}

void WeaponRecipies::addRecipes(Recipes *r) 
{
	wchar_t wchTypes[7];
	wchTypes[6]=0;

	for (unsigned int m = 0; m < map[0].size(); m++) 
	{
		Object *pObjMaterial = map[0].at(m);

		for (int t=0; t<MAX_WEAPON_RECIPES-1; t++) 
		{
			Item *target = map[t+1].at(m)->item;

			wchTypes[0]=L'w';
			wchTypes[1]=L'c';
			wchTypes[2]=L'i';
			wchTypes[3]=L'c';
			wchTypes[5]=L'g';
			if(pObjMaterial->GetType()==eType_TILE)
			{
				wchTypes[4]=L't';
				r->addShapedRecipy(new ItemInstance(target), 
					wchTypes,
					shapes[t], 

					L'#', Item::stick,
					L'X', pObjMaterial->tile,
					L'T');
			}
			else
			{
				// must be Item
				wchTypes[4]=L'i';
				r->addShapedRecipy(new ItemInstance(target), 
					wchTypes,
					shapes[t], 

					L'#', Item::stick,
					L'X', pObjMaterial->item,
					L'T');
			}
		}
	}

	/* 4J-PB - moved out to main recipes so we can avoid them stacking on the group display name
	r->addShapedRecipy(new ItemInstance(Item::bow, 1), //
		L"ssscicig",
		L" #X", //
		L"# X", //
		L" #X", //

		L'X', Item::string,// 
		L'#', Item::stick,
		L'T');

	r->addShapedRecipy(new ItemInstance(Item::arrow, 4), //
		L"ssscicicig",
		L"X", //
		L"#", //
		L"Y", //

		L'Y', Item::feather,// 
		L'X', Item::flint,// 
		L'#', Item::stick,
		L'T');
		*/
}