mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-23 11:06:34 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -5,174 +5,146 @@
|
||||
#include "../Headers/net.minecraft.world.item.crafting.h"
|
||||
#include "ArmorDyeRecipe.h"
|
||||
|
||||
bool ArmorDyeRecipe::matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> target = nullptr;
|
||||
std::vector<std::shared_ptr<ItemInstance> > dyes;
|
||||
bool ArmorDyeRecipe::matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level) {
|
||||
std::shared_ptr<ItemInstance> target = nullptr;
|
||||
std::vector<std::shared_ptr<ItemInstance> > dyes;
|
||||
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
|
||||
ArmorItem *armor = dynamic_cast<ArmorItem *>(item->getItem());
|
||||
if (armor)
|
||||
{
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL)
|
||||
{
|
||||
target = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (item->id == Item::dye_powder_Id)
|
||||
{
|
||||
dyes.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ArmorItem* armor = dynamic_cast<ArmorItem*>(item->getItem());
|
||||
if (armor) {
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH &&
|
||||
target == NULL) {
|
||||
target = item;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (item->id == Item::dye_powder_Id) {
|
||||
dyes.push_back(item);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return target != NULL && !dyes.empty();
|
||||
return target != NULL && !dyes.empty();
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr<CraftingContainer> craftSlots)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> target = nullptr;
|
||||
int colorTotals[3];
|
||||
colorTotals[0] = 0;
|
||||
colorTotals[1] = 0;
|
||||
colorTotals[2] = 0;
|
||||
int intensityTotal = 0;
|
||||
int colourCounts = 0;
|
||||
ArmorItem *armor = NULL;
|
||||
std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(
|
||||
std::shared_ptr<CraftingContainer> craftSlots) {
|
||||
std::shared_ptr<ItemInstance> target = nullptr;
|
||||
int colorTotals[3];
|
||||
colorTotals[0] = 0;
|
||||
colorTotals[1] = 0;
|
||||
colorTotals[2] = 0;
|
||||
int intensityTotal = 0;
|
||||
int colourCounts = 0;
|
||||
ArmorItem* armor = NULL;
|
||||
|
||||
if(craftSlots != NULL)
|
||||
{
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
if (craftSlots != NULL) {
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
|
||||
armor = dynamic_cast<ArmorItem *>(item->getItem());
|
||||
if (armor)
|
||||
{
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL)
|
||||
{
|
||||
target = item->copy();
|
||||
armor = dynamic_cast<ArmorItem*>(item->getItem());
|
||||
if (armor) {
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH &&
|
||||
target == NULL) {
|
||||
target = item->copy();
|
||||
|
||||
if (armor->hasCustomColor(item))
|
||||
{
|
||||
int color = armor->getColor(target);
|
||||
float red = (float) ((color >> 16) & 0xFF) / 0xFF;
|
||||
float green = (float) ((color >> 8) & 0xFF) / 0xFF;
|
||||
float blue = (float) (color & 0xFF) / 0xFF;
|
||||
if (armor->hasCustomColor(item)) {
|
||||
int color = armor->getColor(target);
|
||||
float red = (float)((color >> 16) & 0xFF) / 0xFF;
|
||||
float green = (float)((color >> 8) & 0xFF) / 0xFF;
|
||||
float blue = (float)(color & 0xFF) / 0xFF;
|
||||
|
||||
intensityTotal += std::max(red, std::max(green, blue)) * 0xFF;
|
||||
intensityTotal +=
|
||||
std::max(red, std::max(green, blue)) * 0xFF;
|
||||
|
||||
colorTotals[0] += red * 0xFF;
|
||||
colorTotals[1] += green * 0xFF;
|
||||
colorTotals[2] += blue * 0xFF;
|
||||
colourCounts++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else if (item->id == Item::dye_powder_Id)
|
||||
{
|
||||
int tileData = ClothTile::getTileDataForItemAuxValue(item->getAuxValue());
|
||||
int red = (int) (Sheep::COLOR[tileData][0] * 0xFF);
|
||||
int green = (int) (Sheep::COLOR[tileData][1] * 0xFF);
|
||||
int blue = (int) (Sheep::COLOR[tileData][2] * 0xFF);
|
||||
colorTotals[0] += red * 0xFF;
|
||||
colorTotals[1] += green * 0xFF;
|
||||
colorTotals[2] += blue * 0xFF;
|
||||
colourCounts++;
|
||||
}
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (item->id == Item::dye_powder_Id) {
|
||||
int tileData =
|
||||
ClothTile::getTileDataForItemAuxValue(item->getAuxValue());
|
||||
int red = (int)(Sheep::COLOR[tileData][0] * 0xFF);
|
||||
int green = (int)(Sheep::COLOR[tileData][1] * 0xFF);
|
||||
int blue = (int)(Sheep::COLOR[tileData][2] * 0xFF);
|
||||
|
||||
intensityTotal += std::max(red, std::max(green, blue));
|
||||
intensityTotal += std::max(red, std::max(green, blue));
|
||||
|
||||
colorTotals[0] += red;
|
||||
colorTotals[1] += green;
|
||||
colorTotals[2] += blue;
|
||||
colourCounts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
colorTotals[0] += red;
|
||||
colorTotals[1] += green;
|
||||
colorTotals[2] += blue;
|
||||
colourCounts++;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (armor == NULL) return nullptr;
|
||||
if (armor == NULL) return nullptr;
|
||||
|
||||
int red = (colorTotals[0] / colourCounts);
|
||||
int green = (colorTotals[1] / colourCounts);
|
||||
int blue = (colorTotals[2] / colourCounts);
|
||||
int red = (colorTotals[0] / colourCounts);
|
||||
int green = (colorTotals[1] / colourCounts);
|
||||
int blue = (colorTotals[2] / colourCounts);
|
||||
|
||||
float averageIntensity = (float) intensityTotal / colourCounts;
|
||||
float resultIntensity = (float) std::max(red, std::max(green, blue));
|
||||
// System.out.println(averageIntensity + ", " + resultIntensity);
|
||||
float averageIntensity = (float)intensityTotal / colourCounts;
|
||||
float resultIntensity = (float)std::max(red, std::max(green, blue));
|
||||
// System.out.println(averageIntensity + ", " + resultIntensity);
|
||||
|
||||
red = (int) ((float) red * averageIntensity / resultIntensity);
|
||||
green = (int) ((float) green * averageIntensity / resultIntensity);
|
||||
blue = (int) ((float) blue * averageIntensity / resultIntensity);
|
||||
red = (int)((float)red * averageIntensity / resultIntensity);
|
||||
green = (int)((float)green * averageIntensity / resultIntensity);
|
||||
blue = (int)((float)blue * averageIntensity / resultIntensity);
|
||||
|
||||
int rgb = red;
|
||||
rgb = (rgb << 8) + green;
|
||||
rgb = (rgb << 8) + blue;
|
||||
int rgb = red;
|
||||
rgb = (rgb << 8) + green;
|
||||
rgb = (rgb << 8) + blue;
|
||||
|
||||
armor->setColor(target, rgb);
|
||||
return target;
|
||||
armor->setColor(target, rgb);
|
||||
return target;
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> ArmorDyeRecipe::assemble(std::shared_ptr<CraftingContainer> craftSlots)
|
||||
{
|
||||
return ArmorDyeRecipe::assembleDyedArmor(craftSlots);
|
||||
std::shared_ptr<ItemInstance> ArmorDyeRecipe::assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots) {
|
||||
return ArmorDyeRecipe::assembleDyedArmor(craftSlots);
|
||||
}
|
||||
|
||||
int ArmorDyeRecipe::size()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
int ArmorDyeRecipe::size() { return 10; }
|
||||
|
||||
const ItemInstance *ArmorDyeRecipe::getResultItem()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const ItemInstance* ArmorDyeRecipe::getResultItem() { return NULL; }
|
||||
|
||||
const int ArmorDyeRecipe::getGroup()
|
||||
{
|
||||
return ShapedRecipy::eGroupType_Armour;
|
||||
}
|
||||
const int ArmorDyeRecipe::getGroup() { return ShapedRecipy::eGroupType_Armour; }
|
||||
|
||||
// 4J-PB
|
||||
bool ArmorDyeRecipe::requires(int iRecipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool ArmorDyeRecipe::requires(int iRecipe) { return false; }
|
||||
|
||||
void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED *pIngReq)
|
||||
{
|
||||
//int iCount=0;
|
||||
//bool bFound;
|
||||
//int j;
|
||||
INGREDIENTS_REQUIRED TempIngReq;
|
||||
void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
// int iCount=0;
|
||||
// bool bFound;
|
||||
// int j;
|
||||
INGREDIENTS_REQUIRED TempIngReq;
|
||||
|
||||
// shapeless doesn't have the 3x3 shape, but we'll just use this to store the ingredients anyway
|
||||
TempIngReq.iIngC=0;
|
||||
TempIngReq.iType = RECIPE_TYPE_2x2; // all the dyes can be made in a 2x2
|
||||
TempIngReq.uiGridA = new unsigned int [9];
|
||||
TempIngReq.iIngIDA= new int [3*3];
|
||||
TempIngReq.iIngValA = new int [3*3];
|
||||
TempIngReq.iIngAuxValA = new int [3*3];
|
||||
// shapeless doesn't have the 3x3 shape, but we'll just use this to store
|
||||
// the ingredients anyway
|
||||
TempIngReq.iIngC = 0;
|
||||
TempIngReq.iType = RECIPE_TYPE_2x2; // all the dyes can be made in a 2x2
|
||||
TempIngReq.uiGridA = new unsigned int[9];
|
||||
TempIngReq.iIngIDA = new int[3 * 3];
|
||||
TempIngReq.iIngValA = new int[3 * 3];
|
||||
TempIngReq.iIngAuxValA = new int[3 * 3];
|
||||
|
||||
ZeroMemory(TempIngReq.iIngIDA,sizeof(int)*9);
|
||||
ZeroMemory(TempIngReq.iIngValA,sizeof(int)*9);
|
||||
memset(TempIngReq.iIngAuxValA,Recipes::ANY_AUX_VALUE,sizeof(int)*9);
|
||||
ZeroMemory(TempIngReq.uiGridA,sizeof(unsigned int)*9);
|
||||
ZeroMemory(TempIngReq.iIngIDA, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.iIngValA, sizeof(int) * 9);
|
||||
memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
#if 0
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
@@ -210,31 +182,32 @@ void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED *pIngReq)
|
||||
}
|
||||
#endif
|
||||
|
||||
pIngReq->iIngIDA = new int [TempIngReq.iIngC];
|
||||
pIngReq->iIngValA = new int [TempIngReq.iIngC];
|
||||
pIngReq->iIngAuxValA = new int [TempIngReq.iIngC];
|
||||
pIngReq->uiGridA = new unsigned int [9];
|
||||
pIngReq->iIngIDA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngValA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngAuxValA = new int[TempIngReq.iIngC];
|
||||
pIngReq->uiGridA = new unsigned int[9];
|
||||
|
||||
pIngReq->pRecipy=this;
|
||||
pIngReq->pRecipy = this;
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
pIngReq->bCanMake[i]=false;
|
||||
}
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
pIngReq->bCanMake[i] = false;
|
||||
}
|
||||
|
||||
pIngReq->iIngC=TempIngReq.iIngC;
|
||||
pIngReq->iType=TempIngReq.iType;
|
||||
pIngReq->iIngC = TempIngReq.iIngC;
|
||||
pIngReq->iType = TempIngReq.iType;
|
||||
|
||||
if(pIngReq->iIngC!=0)
|
||||
{
|
||||
memcpy(pIngReq->iIngIDA,TempIngReq.iIngIDA,sizeof(int)*TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngValA,TempIngReq.iIngValA,sizeof(int)*TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngAuxValA,TempIngReq.iIngAuxValA,sizeof(int)*TempIngReq.iIngC);
|
||||
}
|
||||
memcpy(pIngReq->uiGridA,TempIngReq.uiGridA,sizeof(unsigned int) *9);
|
||||
if (pIngReq->iIngC != 0) {
|
||||
memcpy(pIngReq->iIngIDA, TempIngReq.iIngIDA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngValA, TempIngReq.iIngValA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngAuxValA, TempIngReq.iIngAuxValA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
}
|
||||
memcpy(pIngReq->uiGridA, TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
delete [] TempIngReq.iIngIDA;
|
||||
delete [] TempIngReq.iIngValA;
|
||||
delete [] TempIngReq.iIngAuxValA;
|
||||
delete [] TempIngReq.uiGridA;
|
||||
delete[] TempIngReq.iIngIDA;
|
||||
delete[] TempIngReq.iIngValA;
|
||||
delete[] TempIngReq.iIngAuxValA;
|
||||
delete[] TempIngReq.uiGridA;
|
||||
}
|
||||
|
||||
@@ -2,22 +2,25 @@
|
||||
|
||||
#include "Recipy.h"
|
||||
|
||||
class ArmorDyeRecipe : public Recipy
|
||||
{
|
||||
class ArmorDyeRecipe : public Recipy {
|
||||
public:
|
||||
bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level);
|
||||
bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level* level);
|
||||
|
||||
// 4J Stu - Made static as we use this in a different way from the Java (but needs to be a different name otherwise Orbis compiler complains
|
||||
static std::shared_ptr<ItemInstance> assembleDyedArmor(std::shared_ptr<CraftingContainer> craftSlots);
|
||||
std::shared_ptr<ItemInstance> assemble(std::shared_ptr<CraftingContainer> craftSlots);
|
||||
// 4J Stu - Made static as we use this in a different way from the Java (but
|
||||
// needs to be a different name otherwise Orbis compiler complains
|
||||
static std::shared_ptr<ItemInstance> assembleDyedArmor(
|
||||
std::shared_ptr<CraftingContainer> craftSlots);
|
||||
std::shared_ptr<ItemInstance> assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots);
|
||||
|
||||
int size();
|
||||
const ItemInstance *getResultItem();
|
||||
int size();
|
||||
const ItemInstance* getResultItem();
|
||||
|
||||
|
||||
virtual const int getGroup();
|
||||
virtual const int getGroup();
|
||||
|
||||
// 4J-PB
|
||||
virtual bool requires(int iRecipe);
|
||||
virtual void requires(INGREDIENTS_REQUIRED *pIngReq);
|
||||
// 4J-PB
|
||||
virtual bool
|
||||
requires(int iRecipe);
|
||||
virtual void
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
//package net.minecraft.world.item.crafting;
|
||||
// package net.minecraft.world.item.crafting;
|
||||
|
||||
//import net.minecraft.world.item.*;
|
||||
//import net.minecraft.world.level.tile.Tile;
|
||||
// import net.minecraft.world.item.*;
|
||||
// import net.minecraft.world.level.tile.Tile;
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "../Blocks/Tile.h"
|
||||
@@ -10,149 +10,138 @@
|
||||
#include "ArmorRecipes.h"
|
||||
|
||||
// 4J-PB - adding "" on the end of these so we can detect it
|
||||
std::wstring ArmorRecipes::shapes[][4] =
|
||||
{
|
||||
{L"XXX", //
|
||||
L"X X",L""},//
|
||||
std::wstring ArmorRecipes::shapes[][4] = {
|
||||
{L"XXX", //
|
||||
L"X X", L""}, //
|
||||
|
||||
{L"X X", //
|
||||
L"XXX",//
|
||||
L"XXX",L""},//
|
||||
{L"X X", //
|
||||
L"XXX", //
|
||||
L"XXX", L""}, //
|
||||
|
||||
{L"XXX", //
|
||||
L"X X",//
|
||||
L"X X",L""},//
|
||||
{L"XXX", //
|
||||
L"X X", //
|
||||
L"X X", L""}, //
|
||||
|
||||
{L"X X",//
|
||||
L"X X",L""},//
|
||||
{L"X X", //
|
||||
L"X X", L""}, //
|
||||
};
|
||||
|
||||
/*
|
||||
ArmorRecipes::map[5] =
|
||||
ArmorRecipes::map[5] =
|
||||
{
|
||||
{Item::leather, Tile::fire, Item::ironIngot, Item::diamond, Item::goldIngot},
|
||||
{Item::helmet_cloth, Item::helmet_chain, Item::helmet_iron, Item::helmet_diamond, Item::helmet_gold},
|
||||
{Item::chestplate_cloth, Item::chestplate_chain, Item::chestplate_iron, Item::chestplate_diamond, Item::chestplate_gold},
|
||||
{Item::leggings_cloth, Item::leggings_chain, Item::leggings_iron, Item::leggings_diamond, Item::leggings_gold},
|
||||
{Item::boots_cloth, Item::boots_chain, Item::boots_iron, Item::boots_diamond, Item::boots_gold},
|
||||
{Item::leather, Tile::fire, Item::ironIngot, Item::diamond,
|
||||
Item::goldIngot}, {Item::helmet_cloth, Item::helmet_chain, Item::helmet_iron,
|
||||
Item::helmet_diamond, Item::helmet_gold}, {Item::chestplate_cloth,
|
||||
Item::chestplate_chain, Item::chestplate_iron, Item::chestplate_diamond,
|
||||
Item::chestplate_gold}, {Item::leggings_cloth, Item::leggings_chain,
|
||||
Item::leggings_iron, Item::leggings_diamond, Item::leggings_gold},
|
||||
{Item::boots_cloth, Item::boots_chain, Item::boots_iron,
|
||||
Item::boots_diamond, Item::boots_gold},
|
||||
};
|
||||
*/
|
||||
|
||||
void ArmorRecipes::_init()
|
||||
{
|
||||
map = new std::vector <Object *> [MAX_ARMOUR_RECIPES];
|
||||
void ArmorRecipes::_init() {
|
||||
map = new std::vector<Object*>[MAX_ARMOUR_RECIPES];
|
||||
|
||||
// 4J-PB - removing the chain armour, since we show all possible recipes in the xbox game, and it's not one you can make
|
||||
ADD_OBJECT(map[0],Item::leather);
|
||||
// ADD_OBJECT(map[0],Tile::fire);
|
||||
ADD_OBJECT(map[0],Item::ironIngot);
|
||||
ADD_OBJECT(map[0],Item::diamond);
|
||||
ADD_OBJECT(map[0],Item::goldIngot);
|
||||
// 4J-PB - removing the chain armour, since we show all possible recipes in
|
||||
// the xbox game, and it's not one you can make
|
||||
ADD_OBJECT(map[0], Item::leather);
|
||||
// ADD_OBJECT(map[0],Tile::fire);
|
||||
ADD_OBJECT(map[0], Item::ironIngot);
|
||||
ADD_OBJECT(map[0], Item::diamond);
|
||||
ADD_OBJECT(map[0], Item::goldIngot);
|
||||
|
||||
ADD_OBJECT(map[1],Item::helmet_cloth);
|
||||
// ADD_OBJECT(map[1],Item::helmet_chain);
|
||||
ADD_OBJECT(map[1],Item::helmet_iron);
|
||||
ADD_OBJECT(map[1],Item::helmet_diamond);
|
||||
ADD_OBJECT(map[1],Item::helmet_gold);
|
||||
ADD_OBJECT(map[1], Item::helmet_cloth);
|
||||
// ADD_OBJECT(map[1],Item::helmet_chain);
|
||||
ADD_OBJECT(map[1], Item::helmet_iron);
|
||||
ADD_OBJECT(map[1], Item::helmet_diamond);
|
||||
ADD_OBJECT(map[1], Item::helmet_gold);
|
||||
|
||||
ADD_OBJECT(map[2],Item::chestplate_cloth);
|
||||
// ADD_OBJECT(map[2],Item::chestplate_chain);
|
||||
ADD_OBJECT(map[2],Item::chestplate_iron);
|
||||
ADD_OBJECT(map[2],Item::chestplate_diamond);
|
||||
ADD_OBJECT(map[2],Item::chestplate_gold);
|
||||
ADD_OBJECT(map[2], Item::chestplate_cloth);
|
||||
// ADD_OBJECT(map[2],Item::chestplate_chain);
|
||||
ADD_OBJECT(map[2], Item::chestplate_iron);
|
||||
ADD_OBJECT(map[2], Item::chestplate_diamond);
|
||||
ADD_OBJECT(map[2], Item::chestplate_gold);
|
||||
|
||||
ADD_OBJECT(map[3],Item::leggings_cloth);
|
||||
// ADD_OBJECT(map[3],Item::leggings_chain);
|
||||
ADD_OBJECT(map[3],Item::leggings_iron);
|
||||
ADD_OBJECT(map[3],Item::leggings_diamond);
|
||||
ADD_OBJECT(map[3],Item::leggings_gold);
|
||||
ADD_OBJECT(map[3], Item::leggings_cloth);
|
||||
// ADD_OBJECT(map[3],Item::leggings_chain);
|
||||
ADD_OBJECT(map[3], Item::leggings_iron);
|
||||
ADD_OBJECT(map[3], Item::leggings_diamond);
|
||||
ADD_OBJECT(map[3], Item::leggings_gold);
|
||||
|
||||
ADD_OBJECT(map[4],Item::boots_cloth);
|
||||
// ADD_OBJECT(map[4],Item::boots_chain);
|
||||
ADD_OBJECT(map[4],Item::boots_iron);
|
||||
ADD_OBJECT(map[4],Item::boots_diamond);
|
||||
ADD_OBJECT(map[4],Item::boots_gold);
|
||||
ADD_OBJECT(map[4], Item::boots_cloth);
|
||||
// ADD_OBJECT(map[4],Item::boots_chain);
|
||||
ADD_OBJECT(map[4], Item::boots_iron);
|
||||
ADD_OBJECT(map[4], Item::boots_diamond);
|
||||
ADD_OBJECT(map[4], Item::boots_gold);
|
||||
}
|
||||
|
||||
// 4J-PB added for quick equip in the inventory
|
||||
ArmorRecipes::_eArmorType ArmorRecipes::GetArmorType(int iId)
|
||||
{
|
||||
switch(iId)
|
||||
{
|
||||
case Item::helmet_cloth_Id:
|
||||
case Item::helmet_chain_Id:
|
||||
case Item::helmet_iron_Id:
|
||||
case Item::helmet_diamond_Id:
|
||||
case Item::helmet_gold_Id:
|
||||
return eArmorType_Helmet;
|
||||
break;
|
||||
ArmorRecipes::_eArmorType ArmorRecipes::GetArmorType(int iId) {
|
||||
switch (iId) {
|
||||
case Item::helmet_cloth_Id:
|
||||
case Item::helmet_chain_Id:
|
||||
case Item::helmet_iron_Id:
|
||||
case Item::helmet_diamond_Id:
|
||||
case Item::helmet_gold_Id:
|
||||
return eArmorType_Helmet;
|
||||
break;
|
||||
|
||||
case Item::chestplate_cloth_Id:
|
||||
case Item::chestplate_chain_Id:
|
||||
case Item::chestplate_iron_Id:
|
||||
case Item::chestplate_diamond_Id:
|
||||
case Item::chestplate_gold_Id:
|
||||
return eArmorType_Chestplate;
|
||||
break;
|
||||
case Item::chestplate_cloth_Id:
|
||||
case Item::chestplate_chain_Id:
|
||||
case Item::chestplate_iron_Id:
|
||||
case Item::chestplate_diamond_Id:
|
||||
case Item::chestplate_gold_Id:
|
||||
return eArmorType_Chestplate;
|
||||
break;
|
||||
|
||||
case Item::leggings_cloth_Id:
|
||||
case Item::leggings_chain_Id:
|
||||
case Item::leggings_iron_Id:
|
||||
case Item::leggings_diamond_Id:
|
||||
case Item::leggings_gold_Id:
|
||||
return eArmorType_Leggings;
|
||||
break;
|
||||
case Item::leggings_cloth_Id:
|
||||
case Item::leggings_chain_Id:
|
||||
case Item::leggings_iron_Id:
|
||||
case Item::leggings_diamond_Id:
|
||||
case Item::leggings_gold_Id:
|
||||
return eArmorType_Leggings;
|
||||
break;
|
||||
|
||||
case Item::boots_cloth_Id:
|
||||
case Item::boots_chain_Id:
|
||||
case Item::boots_iron_Id:
|
||||
case Item::boots_diamond_Id:
|
||||
case Item::boots_gold_Id:
|
||||
return eArmorType_Boots;
|
||||
break;
|
||||
}
|
||||
case Item::boots_cloth_Id:
|
||||
case Item::boots_chain_Id:
|
||||
case Item::boots_iron_Id:
|
||||
case Item::boots_diamond_Id:
|
||||
case Item::boots_gold_Id:
|
||||
return eArmorType_Boots;
|
||||
break;
|
||||
}
|
||||
|
||||
return eArmorType_None;
|
||||
return eArmorType_None;
|
||||
}
|
||||
|
||||
void ArmorRecipes::addRecipes(Recipes *r)
|
||||
{
|
||||
wchar_t wchTypes[5];
|
||||
wchTypes[4]=0;
|
||||
void ArmorRecipes::addRecipes(Recipes* r) {
|
||||
wchar_t wchTypes[5];
|
||||
wchTypes[4] = 0;
|
||||
|
||||
for (unsigned int m = 0; m < map[0].size(); m++)
|
||||
{
|
||||
Object *pObjMaterial = map[0].at(m);
|
||||
for (unsigned int m = 0; m < map[0].size(); m++) {
|
||||
Object* pObjMaterial = map[0].at(m);
|
||||
|
||||
for (int t=0; t<MAX_ARMOUR_RECIPES-1; t++)
|
||||
{
|
||||
Item *target = map[t+1].at(m)->item;
|
||||
for (int t = 0; t < MAX_ARMOUR_RECIPES - 1; t++) {
|
||||
Item* target = map[t + 1].at(m)->item;
|
||||
|
||||
wchTypes[0]=L'w';
|
||||
wchTypes[1]=L'c';
|
||||
wchTypes[3]=L'g';
|
||||
if(pObjMaterial->GetType()==eType_TILE)
|
||||
{
|
||||
wchTypes[2]=L't';
|
||||
r->addShapedRecipy(new ItemInstance(target),
|
||||
wchTypes,
|
||||
shapes[t],
|
||||
wchTypes[0] = L'w';
|
||||
wchTypes[1] = L'c';
|
||||
wchTypes[3] = L'g';
|
||||
if (pObjMaterial->GetType() == eType_TILE) {
|
||||
wchTypes[2] = L't';
|
||||
r->addShapedRecipy(new ItemInstance(target), wchTypes,
|
||||
shapes[t],
|
||||
|
||||
L'X', pObjMaterial->tile,
|
||||
L'A');
|
||||
}
|
||||
else
|
||||
{
|
||||
// must be Item
|
||||
wchTypes[2]=L'i';
|
||||
r->addShapedRecipy(new ItemInstance(target),
|
||||
wchTypes,
|
||||
shapes[t],
|
||||
L'X', pObjMaterial->tile, L'A');
|
||||
} else {
|
||||
// must be Item
|
||||
wchTypes[2] = L'i';
|
||||
r->addShapedRecipy(new ItemInstance(target), wchTypes,
|
||||
shapes[t],
|
||||
|
||||
L'X', pObjMaterial->item,
|
||||
L'A');
|
||||
}
|
||||
}
|
||||
}
|
||||
L'X', pObjMaterial->item, L'A');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
//package net.minecraft.world.item.crafting;
|
||||
// package net.minecraft.world.item.crafting;
|
||||
|
||||
//import net.minecraft.world.item.*;
|
||||
//import net.minecraft.world.level.tile.Tile;
|
||||
// import net.minecraft.world.item.*;
|
||||
// import net.minecraft.world.level.tile.Tile;
|
||||
#pragma once
|
||||
|
||||
#define MAX_ARMOUR_RECIPES 5
|
||||
class ArmorRecipes
|
||||
{
|
||||
class ArmorRecipes {
|
||||
public:
|
||||
enum _eArmorType
|
||||
{
|
||||
eArmorType_None=0,
|
||||
eArmorType_Helmet,
|
||||
eArmorType_Chestplate,
|
||||
eArmorType_Leggings,
|
||||
eArmorType_Boots,
|
||||
}
|
||||
eArmorType;
|
||||
enum _eArmorType {
|
||||
eArmorType_None = 0,
|
||||
eArmorType_Helmet,
|
||||
eArmorType_Chestplate,
|
||||
eArmorType_Leggings,
|
||||
eArmorType_Boots,
|
||||
} eArmorType;
|
||||
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
ArmorRecipes() { _init(); }
|
||||
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
ArmorRecipes() {_init();}
|
||||
private:
|
||||
// 4J-PB - this wasn't static in java, so might not be right
|
||||
static std::wstring shapes[][4];
|
||||
// 4J-PB - this wasn't static in java, so might not be right
|
||||
static std::wstring shapes[][4];
|
||||
|
||||
private:
|
||||
std::vector <Object *> *map;
|
||||
private:
|
||||
std::vector<Object*>* map;
|
||||
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
static _eArmorType GetArmorType(int iId);
|
||||
void addRecipes(Recipes* r);
|
||||
static _eArmorType GetArmorType(int iId);
|
||||
};
|
||||
|
||||
@@ -7,101 +7,96 @@
|
||||
#include "Recipes.h"
|
||||
#include "ClothDyeRecipes.h"
|
||||
|
||||
void ClothDyeRecipes::addRecipes(Recipes *r)
|
||||
{
|
||||
void ClothDyeRecipes::addRecipes(Recipes* r) {
|
||||
// recipes for converting cloth to colored cloth using dye
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
r->addShapelessRecipy(new ItemInstance(Tile::cloth, 1, ClothTile::getItemAuxValueForTileData(i)), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, i), new ItemInstance(Item::items[Tile::cloth_Id], 1, 0),L'D');
|
||||
for (int i = 0; i < 16; i++) {
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Tile::cloth, 1,
|
||||
ClothTile::getItemAuxValueForTileData(i)), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, i),
|
||||
new ItemInstance(Item::items[Tile::cloth_Id], 1, 0), L'D');
|
||||
}
|
||||
|
||||
// some dye recipes
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::YELLOW),
|
||||
L"tg",
|
||||
Tile::flower,L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::YELLOW), L"tg",
|
||||
Tile::flower, L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::RED),
|
||||
L"tg",
|
||||
Tile::rose,L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::RED), L"tg",
|
||||
Tile::rose, L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 3, DyePowderItem::WHITE),
|
||||
L"ig",
|
||||
Item::bone,L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 3, DyePowderItem::WHITE), L"ig",
|
||||
Item::bone, L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::PINK), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::PINK), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::ORANGE), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::YELLOW),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::ORANGE), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::YELLOW), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::LIME), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::LIME), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::GRAY), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::GRAY), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::SILVER), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::GRAY),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::SILVER), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::GRAY),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 3, DyePowderItem::SILVER), //
|
||||
L"zzzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 3, DyePowderItem::SILVER), //
|
||||
L"zzzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::LIGHT_BLUE), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::LIGHT_BLUE), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::CYAN), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::CYAN), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::PURPLE), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::PURPLE), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 2, DyePowderItem::MAGENTA), //
|
||||
L"zzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::PURPLE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::PINK),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 2, DyePowderItem::MAGENTA), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::PURPLE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::PINK), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 3, DyePowderItem::MAGENTA), //
|
||||
L"zzzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::PINK),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 3, DyePowderItem::MAGENTA), //
|
||||
L"zzzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::PINK), L'D');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::dye_powder, 4, DyePowderItem::MAGENTA), //
|
||||
L"zzzzg",
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE),L'D');
|
||||
r->addShapelessRecipy(
|
||||
new ItemInstance(Item::dye_powder, 4, DyePowderItem::MAGENTA), //
|
||||
L"zzzzg", new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::RED),
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE), L'D');
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
r->addShapedRecipy(new ItemInstance(Tile::woolCarpet, 3, i),
|
||||
L"sczg",
|
||||
L"##",
|
||||
L'#', new ItemInstance(Tile::cloth, 1, i),
|
||||
L'D'
|
||||
);
|
||||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
r->addShapedRecipy(new ItemInstance(Tile::woolCarpet, 3, i), L"sczg",
|
||||
L"##", L'#', new ItemInstance(Tile::cloth, 1, i),
|
||||
L'D');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class ClothDyeRecipes
|
||||
{
|
||||
|
||||
class ClothDyeRecipes {
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
void addRecipes(Recipes* r);
|
||||
};
|
||||
|
||||
@@ -6,117 +6,99 @@
|
||||
#include "Recipes.h"
|
||||
#include "FoodRecipes.h"
|
||||
|
||||
void FoodRecipies::addRecipes(Recipes *r)
|
||||
{
|
||||
// 4J-JEV: Bumped up in the list to avoid a colision with the title.
|
||||
r->addShapedRecipy(new ItemInstance(Item::apple_gold, 1, 0), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
L'#', Item::goldNugget, L'X', Item::apple,
|
||||
L'F');
|
||||
|
||||
// 4J-PB - Moving the mushroom stew shaped->shapeless forward from 1.9, so it will not need the crafting table
|
||||
r->addShapelessRecipy(new ItemInstance(Item::mushroomStew),
|
||||
L"ttig",
|
||||
Tile::mushroom1, Tile::mushroom2, Item::bowl,
|
||||
L'F');
|
||||
void FoodRecipies::addRecipes(Recipes* r) {
|
||||
// 4J-JEV: Bumped up in the list to avoid a colision with the title.
|
||||
r->addShapedRecipy(new ItemInstance(Item::apple_gold, 1, 0), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
L'#', Item::goldNugget, L'X', Item::apple, L'F');
|
||||
|
||||
/*r->addShapedRecipy(new ItemInstance(Item::mushroomStew), //
|
||||
L"sssctctcig",
|
||||
L"Y", //
|
||||
L"X", //
|
||||
L"#", //
|
||||
// 4J-PB - Moving the mushroom stew shaped->shapeless forward from 1.9, so
|
||||
// it will not need the crafting table
|
||||
r->addShapelessRecipy(new ItemInstance(Item::mushroomStew), L"ttig",
|
||||
Tile::mushroom1, Tile::mushroom2, Item::bowl, L'F');
|
||||
|
||||
L'X', Tile::mushroom1,
|
||||
L'Y', Tile::mushroom2,
|
||||
L'#', Item::bowl,
|
||||
L'F');*/
|
||||
/*r->addShapedRecipy(new ItemInstance(Item::mushroomStew), //
|
||||
L"sssctctcig",
|
||||
L"Y", //
|
||||
L"X", //
|
||||
L"#", //
|
||||
|
||||
// 4J-PB - removing for the xbox game - we already have it above
|
||||
// r->addShapedRecipy(new ItemInstance(Item::mushroomStew), //
|
||||
// L"sssctctcig",
|
||||
// L"Y", //
|
||||
// L"X", //
|
||||
// L"#", //
|
||||
//
|
||||
// L'X', Tile::mushroom2,
|
||||
// L'Y', Tile::mushroom1,
|
||||
// L'#', Item::bowl,
|
||||
// L'F');
|
||||
//
|
||||
r->addShapedRecipy(new ItemInstance(Item::cookie, 8), //
|
||||
L"sczcig",
|
||||
L"#X#", //
|
||||
L'X', Tile::mushroom1,
|
||||
L'Y', Tile::mushroom2,
|
||||
L'#', Item::bowl,
|
||||
L'F');*/
|
||||
|
||||
L'X', new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN),
|
||||
L'#', Item::wheat,
|
||||
L'F');
|
||||
// 4J-PB - removing for the xbox game - we already have it above
|
||||
// r->addShapedRecipy(new ItemInstance(Item::mushroomStew), //
|
||||
// L"sssctctcig",
|
||||
// L"Y", //
|
||||
// L"X", //
|
||||
// L"#", //
|
||||
//
|
||||
// L'X', Tile::mushroom2,
|
||||
// L'Y', Tile::mushroom1,
|
||||
// L'#', Item::bowl,
|
||||
// L'F');
|
||||
//
|
||||
r->addShapedRecipy(
|
||||
new ItemInstance(Item::cookie, 8), //
|
||||
L"sczcig",
|
||||
L"#X#", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::melon), //
|
||||
L"ssscig",
|
||||
L"MMM", //
|
||||
L"MMM", //
|
||||
L"MMM", //
|
||||
L'X', new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN), L'#',
|
||||
Item::wheat, L'F');
|
||||
|
||||
L'M', Item::melon,
|
||||
L'F');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::melon), //
|
||||
L"ssscig",
|
||||
L"MMM", //
|
||||
L"MMM", //
|
||||
L"MMM", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Item::seeds_melon), //
|
||||
L"scig",
|
||||
L"M", //
|
||||
L'M', Item::melon, L'F');
|
||||
|
||||
L'M', Item::melon,
|
||||
L'F');
|
||||
r->addShapedRecipy(new ItemInstance(Item::seeds_melon), //
|
||||
L"scig",
|
||||
L"M", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Item::seeds_pumpkin, 4), //
|
||||
L"sctg",
|
||||
L"M", //
|
||||
L'M', Item::melon, L'F');
|
||||
|
||||
L'M', Tile::pumpkin,
|
||||
L'F');
|
||||
r->addShapedRecipy(new ItemInstance(Item::seeds_pumpkin, 4), //
|
||||
L"sctg",
|
||||
L"M", //
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::pumpkinPie), //
|
||||
L"tiig",
|
||||
Tile::pumpkin, Item::sugar, Item::egg,
|
||||
L'F');
|
||||
L'M', Tile::pumpkin, L'F');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Item::apple_gold, 1, 1), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
L'#', Tile::goldBlock, L'X', Item::apple,
|
||||
L'F');
|
||||
r->addShapelessRecipy(new ItemInstance(Item::pumpkinPie), //
|
||||
L"tiig", Tile::pumpkin, Item::sugar, Item::egg, L'F');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Item::carrotGolden, 1, 0), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
r->addShapedRecipy(new ItemInstance(Item::apple_gold, 1, 1), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
L'#', Tile::goldBlock, L'X', Item::apple, L'F');
|
||||
|
||||
L'#', Item::goldNugget, L'X', Item::carrots,
|
||||
L'F');
|
||||
r->addShapedRecipy(new ItemInstance(Item::carrotGolden, 1, 0), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::fermentedSpiderEye), //
|
||||
L"itig",
|
||||
Item::spiderEye, Tile::mushroom1, Item::sugar,
|
||||
L'F');
|
||||
L'#', Item::goldNugget, L'X', Item::carrots, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::speckledMelon), //
|
||||
L"iig",
|
||||
Item::melon, Item::goldNugget,
|
||||
L'F');
|
||||
r->addShapelessRecipy(new ItemInstance(Item::fermentedSpiderEye), //
|
||||
L"itig", Item::spiderEye, Tile::mushroom1,
|
||||
Item::sugar, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::blazePowder, 2), //
|
||||
L"ig",
|
||||
Item::blazeRod,
|
||||
L'F');
|
||||
r->addShapelessRecipy(new ItemInstance(Item::speckledMelon), //
|
||||
L"iig", Item::melon, Item::goldNugget, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::magmaCream), //
|
||||
L"iig",
|
||||
Item::blazePowder, Item::slimeBall,
|
||||
L'F');
|
||||
r->addShapelessRecipy(new ItemInstance(Item::blazePowder, 2), //
|
||||
L"ig", Item::blazeRod, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::magmaCream), //
|
||||
L"iig", Item::blazePowder, Item::slimeBall, L'F');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class FoodRecipies
|
||||
{
|
||||
class FoodRecipies {
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
void addRecipes(Recipes* r);
|
||||
};
|
||||
|
||||
@@ -3,80 +3,81 @@
|
||||
#include "../Blocks/Tile.h"
|
||||
#include "FurnaceRecipes.h"
|
||||
|
||||
FurnaceRecipes *FurnaceRecipes::instance = NULL;
|
||||
FurnaceRecipes* FurnaceRecipes::instance = NULL;
|
||||
|
||||
void FurnaceRecipes::staticCtor()
|
||||
{
|
||||
FurnaceRecipes::instance = new FurnaceRecipes();
|
||||
void FurnaceRecipes::staticCtor() {
|
||||
FurnaceRecipes::instance = new FurnaceRecipes();
|
||||
}
|
||||
|
||||
FurnaceRecipes *FurnaceRecipes::getInstance()
|
||||
{
|
||||
return instance;
|
||||
FurnaceRecipes* FurnaceRecipes::getInstance() { return instance; }
|
||||
|
||||
FurnaceRecipes::FurnaceRecipes() {
|
||||
addFurnaceRecipy(Tile::ironOre_Id, new ItemInstance(Item::ironIngot), .7f);
|
||||
addFurnaceRecipy(Tile::goldOre_Id, new ItemInstance(Item::goldIngot), 1);
|
||||
addFurnaceRecipy(Tile::diamondOre_Id, new ItemInstance(Item::diamond), 1);
|
||||
addFurnaceRecipy(Tile::sand_Id, new ItemInstance(Tile::glass), .1f);
|
||||
addFurnaceRecipy(Item::porkChop_raw_Id,
|
||||
new ItemInstance(Item::porkChop_cooked), .35f);
|
||||
addFurnaceRecipy(Item::beef_raw_Id, new ItemInstance(Item::beef_cooked),
|
||||
.35f);
|
||||
addFurnaceRecipy(Item::chicken_raw_Id,
|
||||
new ItemInstance(Item::chicken_cooked), .35f);
|
||||
addFurnaceRecipy(Item::fish_raw_Id, new ItemInstance(Item::fish_cooked),
|
||||
.35f);
|
||||
addFurnaceRecipy(Tile::stoneBrick_Id, new ItemInstance(Tile::rock), .1f);
|
||||
addFurnaceRecipy(Item::clay_Id, new ItemInstance(Item::brick), .3f);
|
||||
addFurnaceRecipy(
|
||||
Tile::cactus_Id,
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN), .2f);
|
||||
addFurnaceRecipy(Tile::treeTrunk_Id,
|
||||
new ItemInstance(Item::coal, 1, CoalItem::CHAR_COAL),
|
||||
.15f);
|
||||
addFurnaceRecipy(Tile::emeraldOre_Id, new ItemInstance(Item::emerald), 1);
|
||||
addFurnaceRecipy(Item::potato_Id, new ItemInstance(Item::potatoBaked),
|
||||
.35f);
|
||||
// 4J - TU9 - add in smelting netherrack
|
||||
addFurnaceRecipy(Tile::hellRock_Id, new ItemInstance(Item::netherbrick),
|
||||
.1f);
|
||||
|
||||
// special silk touch related recipes:
|
||||
addFurnaceRecipy(Tile::coalOre_Id, new ItemInstance(Item::coal), .1f);
|
||||
addFurnaceRecipy(Tile::redStoneOre_Id, new ItemInstance(Item::redStone),
|
||||
.7f);
|
||||
addFurnaceRecipy(Tile::lapisOre_Id,
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE),
|
||||
.2f);
|
||||
addFurnaceRecipy(Tile::netherQuartz_Id,
|
||||
new ItemInstance(Item::netherQuartz), .2f);
|
||||
}
|
||||
|
||||
FurnaceRecipes::FurnaceRecipes()
|
||||
{
|
||||
addFurnaceRecipy(Tile::ironOre_Id, new ItemInstance(Item::ironIngot), .7f);
|
||||
addFurnaceRecipy(Tile::goldOre_Id, new ItemInstance(Item::goldIngot), 1);
|
||||
addFurnaceRecipy(Tile::diamondOre_Id, new ItemInstance(Item::diamond), 1);
|
||||
addFurnaceRecipy(Tile::sand_Id, new ItemInstance(Tile::glass), .1f);
|
||||
addFurnaceRecipy(Item::porkChop_raw_Id, new ItemInstance(Item::porkChop_cooked), .35f);
|
||||
addFurnaceRecipy(Item::beef_raw_Id, new ItemInstance(Item::beef_cooked), .35f);
|
||||
addFurnaceRecipy(Item::chicken_raw_Id, new ItemInstance(Item::chicken_cooked), .35f);
|
||||
addFurnaceRecipy(Item::fish_raw_Id, new ItemInstance(Item::fish_cooked), .35f);
|
||||
addFurnaceRecipy(Tile::stoneBrick_Id, new ItemInstance(Tile::rock), .1f);
|
||||
addFurnaceRecipy(Item::clay_Id, new ItemInstance(Item::brick), .3f);
|
||||
addFurnaceRecipy(Tile::cactus_Id, new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN), .2f);
|
||||
addFurnaceRecipy(Tile::treeTrunk_Id, new ItemInstance(Item::coal, 1, CoalItem::CHAR_COAL), .15f);
|
||||
addFurnaceRecipy(Tile::emeraldOre_Id, new ItemInstance(Item::emerald), 1);
|
||||
addFurnaceRecipy(Item::potato_Id, new ItemInstance(Item::potatoBaked), .35f);
|
||||
// 4J - TU9 - add in smelting netherrack
|
||||
addFurnaceRecipy(Tile::hellRock_Id, new ItemInstance(Item::netherbrick), .1f);
|
||||
|
||||
// special silk touch related recipes:
|
||||
addFurnaceRecipy(Tile::coalOre_Id, new ItemInstance(Item::coal), .1f);
|
||||
addFurnaceRecipy(Tile::redStoneOre_Id, new ItemInstance(Item::redStone), .7f);
|
||||
addFurnaceRecipy(Tile::lapisOre_Id, new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLUE), .2f);
|
||||
addFurnaceRecipy(Tile::netherQuartz_Id, new ItemInstance(Item::netherQuartz), .2f);
|
||||
|
||||
|
||||
void FurnaceRecipes::addFurnaceRecipy(int itemId, ItemInstance* result,
|
||||
float value) {
|
||||
// recipies->put(itemId, result);
|
||||
recipies[itemId] = result;
|
||||
recipeValue[result->id] = value;
|
||||
}
|
||||
|
||||
void FurnaceRecipes::addFurnaceRecipy(int itemId, ItemInstance *result, float value)
|
||||
{
|
||||
//recipies->put(itemId, result);
|
||||
recipies[itemId]=result;
|
||||
recipeValue[result->id] = value;
|
||||
bool FurnaceRecipes::isFurnaceItem(int itemId) {
|
||||
AUTO_VAR(it, recipies.find(itemId));
|
||||
return it != recipies.end();
|
||||
}
|
||||
|
||||
bool FurnaceRecipes::isFurnaceItem(int itemId)
|
||||
{
|
||||
AUTO_VAR(it, recipies.find(itemId));
|
||||
return it != recipies.end();
|
||||
ItemInstance* FurnaceRecipes::getResult(int itemId) {
|
||||
AUTO_VAR(it, recipies.find(itemId));
|
||||
if (it != recipies.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ItemInstance *FurnaceRecipes::getResult(int itemId)
|
||||
{
|
||||
AUTO_VAR(it, recipies.find(itemId));
|
||||
if(it != recipies.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return NULL;
|
||||
std::unordered_map<int, ItemInstance*>* FurnaceRecipes::getRecipies() {
|
||||
return &recipies;
|
||||
}
|
||||
|
||||
std::unordered_map<int, ItemInstance *> *FurnaceRecipes::getRecipies()
|
||||
{
|
||||
return &recipies;
|
||||
}
|
||||
|
||||
float FurnaceRecipes::getRecipeValue(int itemId)
|
||||
{
|
||||
AUTO_VAR(it, recipeValue.find(itemId));
|
||||
if (it != recipeValue.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return 0.0f;
|
||||
float FurnaceRecipes::getRecipeValue(int itemId) {
|
||||
AUTO_VAR(it, recipeValue.find(itemId));
|
||||
if (it != recipeValue.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -1,30 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
class FurnaceRecipes
|
||||
{
|
||||
class FurnaceRecipes {
|
||||
private:
|
||||
static FurnaceRecipes* instance;
|
||||
|
||||
public:
|
||||
static void staticCtor();
|
||||
|
||||
private:
|
||||
static FurnaceRecipes *instance;
|
||||
// Map<Integer, ItemInstance> recipies = new HashMap<Integer,
|
||||
// ItemInstance>();
|
||||
std::unordered_map<int, ItemInstance*> recipies;
|
||||
std::unordered_map<int, float> recipeValue;
|
||||
|
||||
public:
|
||||
static void staticCtor();
|
||||
|
||||
private:
|
||||
//Map<Integer, ItemInstance> recipies = new HashMap<Integer, ItemInstance>();
|
||||
std::unordered_map<int, ItemInstance *> recipies;
|
||||
std::unordered_map<int, float> recipeValue;
|
||||
static FurnaceRecipes* getInstance();
|
||||
|
||||
public:
|
||||
static FurnaceRecipes *getInstance();
|
||||
FurnaceRecipes();
|
||||
|
||||
public:
|
||||
FurnaceRecipes();
|
||||
|
||||
public:
|
||||
void addFurnaceRecipy(int itemId, ItemInstance *result, float value);
|
||||
bool isFurnaceItem(int itemId);
|
||||
ItemInstance *getResult(int itemId);
|
||||
std::unordered_map<int, ItemInstance *> *getRecipies();
|
||||
float getRecipeValue(int itemId);
|
||||
|
||||
void addFurnaceRecipy(int itemId, ItemInstance* result, float value);
|
||||
bool isFurnaceItem(int itemId);
|
||||
ItemInstance* getResult(int itemId);
|
||||
std::unordered_map<int, ItemInstance*>* getRecipies();
|
||||
float getRecipeValue(int itemId);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// package net.minecraft.world.item.crafting;
|
||||
//
|
||||
//
|
||||
// import net.minecraft.world.item.DyePowderItem;
|
||||
// import net.minecraft.world.item.Item;
|
||||
// import net.minecraft.world.item.ItemInstance;
|
||||
@@ -13,63 +13,56 @@
|
||||
#include "Recipes.h"
|
||||
#include "OreRecipes.h"
|
||||
|
||||
|
||||
/*
|
||||
private Object[][] map = {
|
||||
{
|
||||
Tile.goldBlock, new ItemInstance(Item.goldIngot, 9)
|
||||
}, {
|
||||
Tile.ironBlock, new ItemInstance(Item.ironIngot, 9)
|
||||
}, {
|
||||
Tile.diamondBlock, new ItemInstance(Item.diamond, 9)
|
||||
}, {
|
||||
Tile.lapisBlock, new ItemInstance(Item.dye_powder, 9, DyePowderItem.BLUE)
|
||||
},
|
||||
};
|
||||
private Object[][] map = {
|
||||
{
|
||||
Tile.goldBlock, new ItemInstance(Item.goldIngot, 9)
|
||||
}, {
|
||||
Tile.ironBlock, new ItemInstance(Item.ironIngot, 9)
|
||||
}, {
|
||||
Tile.diamondBlock, new ItemInstance(Item.diamond, 9)
|
||||
}, {
|
||||
Tile.lapisBlock, new
|
||||
ItemInstance(Item.dye_powder, 9, DyePowderItem.BLUE)
|
||||
},
|
||||
};
|
||||
*/
|
||||
|
||||
void OreRecipies::_init()
|
||||
{
|
||||
map = new std::vector <Object *> [MAX_ORE_RECIPES];
|
||||
void OreRecipies::_init() {
|
||||
map = new std::vector<Object*>[MAX_ORE_RECIPES];
|
||||
|
||||
ADD_OBJECT(map[0],Tile::goldBlock);
|
||||
ADD_OBJECT(map[0],new ItemInstance(Item::goldIngot, 9));
|
||||
ADD_OBJECT(map[0], Tile::goldBlock);
|
||||
ADD_OBJECT(map[0], new ItemInstance(Item::goldIngot, 9));
|
||||
|
||||
ADD_OBJECT(map[1],Tile::ironBlock);
|
||||
ADD_OBJECT(map[1],new ItemInstance(Item::ironIngot, 9));
|
||||
ADD_OBJECT(map[1], Tile::ironBlock);
|
||||
ADD_OBJECT(map[1], new ItemInstance(Item::ironIngot, 9));
|
||||
|
||||
ADD_OBJECT(map[2],Tile::diamondBlock);
|
||||
ADD_OBJECT(map[2],new ItemInstance(Item::diamond, 9));
|
||||
ADD_OBJECT(map[2], Tile::diamondBlock);
|
||||
ADD_OBJECT(map[2], new ItemInstance(Item::diamond, 9));
|
||||
|
||||
ADD_OBJECT(map[3],Tile::emeraldBlock);
|
||||
ADD_OBJECT(map[3],new ItemInstance(Item::emerald, 9));
|
||||
ADD_OBJECT(map[3], Tile::emeraldBlock);
|
||||
ADD_OBJECT(map[3], new ItemInstance(Item::emerald, 9));
|
||||
|
||||
ADD_OBJECT(map[4],Tile::lapisBlock);
|
||||
ADD_OBJECT(map[4],new ItemInstance(Item::dye_powder, 9, DyePowderItem::BLUE));
|
||||
ADD_OBJECT(map[4], Tile::lapisBlock);
|
||||
ADD_OBJECT(map[4],
|
||||
new ItemInstance(Item::dye_powder, 9, DyePowderItem::BLUE));
|
||||
}
|
||||
void OreRecipies::addRecipes(Recipes *r)
|
||||
{
|
||||
void OreRecipies::addRecipes(Recipes* r) {
|
||||
for (int i = 0; i < MAX_ORE_RECIPES; i++) {
|
||||
Tile* from = (Tile*)map[i].at(0)->tile;
|
||||
ItemInstance* to = (ItemInstance*)map[i].at(1)->iteminstance;
|
||||
r->addShapedRecipy(new ItemInstance(from), //
|
||||
L"sssczg",
|
||||
L"###", //
|
||||
L"###", //
|
||||
L"###", //
|
||||
|
||||
for (int i = 0; i < MAX_ORE_RECIPES; i++)
|
||||
{
|
||||
Tile *from = (Tile*) map[i].at(0)->tile;
|
||||
ItemInstance *to = (ItemInstance*) map[i].at(1)->iteminstance;
|
||||
r->addShapedRecipy(new ItemInstance(from), //
|
||||
L"sssczg",
|
||||
L"###", //
|
||||
L"###", //
|
||||
L"###", //
|
||||
L'#', to, L'D');
|
||||
|
||||
L'#', to,
|
||||
L'D');
|
||||
r->addShapedRecipy(to, //
|
||||
L"sctg",
|
||||
L"#", //
|
||||
|
||||
r->addShapedRecipy(to, //
|
||||
L"sctg",
|
||||
L"#", //
|
||||
|
||||
L'#', from,
|
||||
L'D');
|
||||
}
|
||||
L'#', from, L'D');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
#define MAX_ORE_RECIPES 5
|
||||
|
||||
class OreRecipies
|
||||
{
|
||||
class OreRecipies {
|
||||
public:
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
OreRecipies() {_init();}
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
OreRecipies() { _init(); }
|
||||
|
||||
private:
|
||||
std::vector <Object *> *map;
|
||||
std::vector<Object*>* map;
|
||||
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
void addRecipes(Recipes* r);
|
||||
};
|
||||
+1048
-1165
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,6 @@ import net.minecraft.world.level.tile.Tile;
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
class CraftingContainer;
|
||||
class FireTile;
|
||||
|
||||
@@ -32,80 +31,89 @@ class ToolRecipies;
|
||||
class WeaponRecipies;
|
||||
class ShapedRecipy;
|
||||
|
||||
typedef std::unordered_map<wchar_t, ItemInstance *> myMap;
|
||||
typedef std::unordered_map<wchar_t, ItemInstance*> myMap;
|
||||
|
||||
#define ADD_OBJECT(a,b) a.push_back(new Object(b))
|
||||
#define ADD_OBJECT(a, b) a.push_back(new Object(b))
|
||||
|
||||
class Object
|
||||
{
|
||||
class Object {
|
||||
public:
|
||||
union
|
||||
{
|
||||
Tile *tile;
|
||||
FireTile *firetile;
|
||||
Item *item;
|
||||
MapItem *mapitem;
|
||||
ItemInstance *iteminstance;
|
||||
};
|
||||
union {
|
||||
Tile* tile;
|
||||
FireTile* firetile;
|
||||
Item* item;
|
||||
MapItem* mapitem;
|
||||
ItemInstance* iteminstance;
|
||||
};
|
||||
|
||||
Object() { eType=eTYPE_NOTSET;}
|
||||
Object(Tile *t) { eType=eType_TILE;tile=t;}
|
||||
Object(FireTile *t) { eType=eType_FIRETILE;firetile=t;}
|
||||
Object(Item *i) { eType=eType_ITEM; item=i;}
|
||||
Object(MapItem *i) { eType=eType_MAPITEM;mapitem=i;}
|
||||
Object(ItemInstance *i) { eType=eType_ITEMINSTANCE;iteminstance=i;}
|
||||
Object() { eType = eTYPE_NOTSET; }
|
||||
Object(Tile* t) {
|
||||
eType = eType_TILE;
|
||||
tile = t;
|
||||
}
|
||||
Object(FireTile* t) {
|
||||
eType = eType_FIRETILE;
|
||||
firetile = t;
|
||||
}
|
||||
Object(Item* i) {
|
||||
eType = eType_ITEM;
|
||||
item = i;
|
||||
}
|
||||
Object(MapItem* i) {
|
||||
eType = eType_MAPITEM;
|
||||
mapitem = i;
|
||||
}
|
||||
Object(ItemInstance* i) {
|
||||
eType = eType_ITEMINSTANCE;
|
||||
iteminstance = i;
|
||||
}
|
||||
|
||||
eINSTANCEOF instanceof() { return eType;}
|
||||
eINSTANCEOF GetType() { return eType; };
|
||||
eINSTANCEOF instanceof() { return eType; }
|
||||
eINSTANCEOF GetType() { return eType; };
|
||||
|
||||
private:
|
||||
eINSTANCEOF eType;
|
||||
eINSTANCEOF eType;
|
||||
};
|
||||
|
||||
class Recipes
|
||||
{
|
||||
class Recipes {
|
||||
public:
|
||||
static const int ANY_AUX_VALUE = -1;
|
||||
|
||||
private:
|
||||
static Recipes *instance;
|
||||
|
||||
std::vector <Recipy *> *recipies;
|
||||
|
||||
public:
|
||||
static void staticCtor();
|
||||
|
||||
public:
|
||||
static Recipes *getInstance()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
private:
|
||||
void _init(); // 4J add
|
||||
Recipes();
|
||||
|
||||
public:
|
||||
ShapedRecipy *addShapedRecipy(ItemInstance *, ... );
|
||||
void addShapelessRecipy(ItemInstance *result,... );
|
||||
|
||||
std::shared_ptr<ItemInstance> getItemFor(std::shared_ptr<CraftingContainer> craftSlots, Level *level);
|
||||
std::vector <Recipy *> *getRecipies();
|
||||
|
||||
// 4J-PB - Added all below for new Xbox 'crafting'
|
||||
std::shared_ptr<ItemInstance> getItemForRecipe(Recipy *r);
|
||||
Recipy::INGREDIENTS_REQUIRED *getRecipeIngredientsArray();
|
||||
static const int ANY_AUX_VALUE = -1;
|
||||
|
||||
private:
|
||||
void buildRecipeIngredientsArray();
|
||||
Recipy::INGREDIENTS_REQUIRED *m_pRecipeIngredientsRequired;
|
||||
static Recipes* instance;
|
||||
|
||||
std::vector<Recipy*>* recipies;
|
||||
|
||||
static ToolRecipies *pToolRecipies;
|
||||
static WeaponRecipies *pWeaponRecipies;
|
||||
static StructureRecipies *pStructureRecipies;
|
||||
static OreRecipies *pOreRecipies;
|
||||
static FoodRecipies *pFoodRecipies;
|
||||
static ClothDyeRecipes *pClothDyeRecipes;
|
||||
static ArmorRecipes *pArmorRecipes;
|
||||
public:
|
||||
static void staticCtor();
|
||||
|
||||
public:
|
||||
static Recipes* getInstance() { return instance; }
|
||||
|
||||
private:
|
||||
void _init(); // 4J add
|
||||
Recipes();
|
||||
|
||||
public:
|
||||
ShapedRecipy* addShapedRecipy(ItemInstance*, ...);
|
||||
void addShapelessRecipy(ItemInstance* result, ...);
|
||||
|
||||
std::shared_ptr<ItemInstance> getItemFor(
|
||||
std::shared_ptr<CraftingContainer> craftSlots, Level* level);
|
||||
std::vector<Recipy*>* getRecipies();
|
||||
|
||||
// 4J-PB - Added all below for new Xbox 'crafting'
|
||||
std::shared_ptr<ItemInstance> getItemForRecipe(Recipy* r);
|
||||
Recipy::INGREDIENTS_REQUIRED* getRecipeIngredientsArray();
|
||||
|
||||
private:
|
||||
void buildRecipeIngredientsArray();
|
||||
Recipy::INGREDIENTS_REQUIRED* m_pRecipeIngredientsRequired;
|
||||
|
||||
static ToolRecipies* pToolRecipies;
|
||||
static WeaponRecipies* pWeaponRecipies;
|
||||
static StructureRecipies* pStructureRecipies;
|
||||
static OreRecipies* pOreRecipies;
|
||||
static FoodRecipies* pFoodRecipies;
|
||||
static ClothDyeRecipes* pClothDyeRecipes;
|
||||
static ArmorRecipes* pArmorRecipes;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// package net.minecraft.world.item.crafting;
|
||||
//
|
||||
//
|
||||
// import net.minecraft.world.inventory.CraftingContainer;
|
||||
// import net.minecraft.world.item.ItemInstance;
|
||||
|
||||
@@ -7,49 +7,54 @@
|
||||
|
||||
#include "../Containers/CraftingContainer.h"
|
||||
|
||||
#define RECIPE_TYPE_2x2 0
|
||||
#define RECIPE_TYPE_2x2 0
|
||||
#define RECIPE_TYPE_3x3 1
|
||||
|
||||
class Recipy
|
||||
{
|
||||
class Recipy {
|
||||
public:
|
||||
enum _eGroupType
|
||||
{
|
||||
eGroupType_First=0,
|
||||
eGroupType_Structure=0,
|
||||
eGroupType_Tool,
|
||||
eGroupType_Food,
|
||||
eGroupType_Armour,
|
||||
eGroupType_Mechanism,
|
||||
eGroupType_Transport,
|
||||
eGroupType_Decoration,
|
||||
eGroupType_Max
|
||||
}
|
||||
eGroupType; // to class the item produced by the recipe
|
||||
enum _eGroupType {
|
||||
eGroupType_First = 0,
|
||||
eGroupType_Structure = 0,
|
||||
eGroupType_Tool,
|
||||
eGroupType_Food,
|
||||
eGroupType_Armour,
|
||||
eGroupType_Mechanism,
|
||||
eGroupType_Transport,
|
||||
eGroupType_Decoration,
|
||||
eGroupType_Max
|
||||
} eGroupType; // to class the item produced by the recipe
|
||||
|
||||
// 4J-PB - we'll classing an ingredient ID with a different aux value as a different IngID AuxVal pair
|
||||
typedef struct
|
||||
{
|
||||
int iIngC;
|
||||
int iType; // Can be a 2x2 or a 3x3. Inventory crafting can only make a 2x2.
|
||||
int *iIngIDA;
|
||||
int *iIngValA;
|
||||
int *iIngAuxValA;
|
||||
Recipy *pRecipy;
|
||||
bool bCanMake[XUSER_MAX_COUNT];
|
||||
unsigned int *uiGridA; // hold the layout of the recipe (id | auxval<<24)
|
||||
unsigned short usBitmaskMissingGridIngredients[XUSER_MAX_COUNT]; // each bit set means we don't have that grid ingredient
|
||||
}
|
||||
INGREDIENTS_REQUIRED;
|
||||
~Recipy() {}
|
||||
virtual bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level) = 0;
|
||||
virtual std::shared_ptr<ItemInstance> assemble(std::shared_ptr<CraftingContainer> craftSlots) = 0;
|
||||
virtual int size() = 0;
|
||||
virtual const ItemInstance *getResultItem() = 0;
|
||||
virtual const int getGroup() = 0;
|
||||
// 4J-PB - we'll classing an ingredient ID with a different aux value as a
|
||||
// different IngID AuxVal pair
|
||||
typedef struct {
|
||||
int iIngC;
|
||||
int iType; // Can be a 2x2 or a 3x3. Inventory crafting can only make a
|
||||
// 2x2.
|
||||
int* iIngIDA;
|
||||
int* iIngValA;
|
||||
int* iIngAuxValA;
|
||||
Recipy* pRecipy;
|
||||
bool bCanMake[XUSER_MAX_COUNT];
|
||||
unsigned int*
|
||||
uiGridA; // hold the layout of the recipe (id | auxval<<24)
|
||||
unsigned short usBitmaskMissingGridIngredients
|
||||
[XUSER_MAX_COUNT]; // each bit set means we don't have that grid
|
||||
// ingredient
|
||||
} INGREDIENTS_REQUIRED;
|
||||
~Recipy() {}
|
||||
virtual bool matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level) = 0;
|
||||
virtual std::shared_ptr<ItemInstance> assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots) = 0;
|
||||
virtual int size() = 0;
|
||||
virtual const ItemInstance* getResultItem() = 0;
|
||||
virtual const int getGroup() = 0;
|
||||
|
||||
// 4J-PB
|
||||
virtual bool requires(int iRecipe) = 0;
|
||||
virtual void requires(INGREDIENTS_REQUIRED *pIngReq) = 0;
|
||||
// 4J-PB
|
||||
virtual bool
|
||||
requires(int iRecipe)
|
||||
= 0;
|
||||
virtual void
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq)
|
||||
= 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// package net.minecraft.world.item.crafting;
|
||||
//
|
||||
//
|
||||
// import net.minecraft.world.inventory.CraftingContainer;
|
||||
// import net.minecraft.world.item.ItemInstance;
|
||||
|
||||
@@ -11,224 +11,197 @@
|
||||
#include "Recipes.h"
|
||||
#include "ShapedRecipy.h"
|
||||
|
||||
// 4J-PB - for new crafting - Adding group to define type of item that the recipe produces
|
||||
ShapedRecipy::ShapedRecipy(int width, int height, ItemInstance **recipeItems, ItemInstance *result, int iGroup)
|
||||
: resultId(result->id)
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->recipeItems = recipeItems;
|
||||
this->result = result;
|
||||
this->group = iGroup;
|
||||
_keepTag = false;
|
||||
// 4J-PB - for new crafting - Adding group to define type of item that the
|
||||
// recipe produces
|
||||
ShapedRecipy::ShapedRecipy(int width, int height, ItemInstance** recipeItems,
|
||||
ItemInstance* result, int iGroup)
|
||||
: resultId(result->id) {
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->recipeItems = recipeItems;
|
||||
this->result = result;
|
||||
this->group = iGroup;
|
||||
_keepTag = false;
|
||||
}
|
||||
|
||||
const int ShapedRecipy::getGroup()
|
||||
{
|
||||
return group;
|
||||
const int ShapedRecipy::getGroup() { return group; }
|
||||
|
||||
const ItemInstance* ShapedRecipy::getResultItem() { return result; }
|
||||
|
||||
bool ShapedRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level) {
|
||||
for (int xOffs = 0; xOffs <= (3 - width); xOffs++) {
|
||||
for (int yOffs = 0; yOffs <= (3 - height); yOffs++) {
|
||||
if (matches(craftSlots, xOffs, yOffs, true)) return true;
|
||||
if (matches(craftSlots, xOffs, yOffs, false)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const ItemInstance *ShapedRecipy::getResultItem()
|
||||
{
|
||||
return result;
|
||||
bool ShapedRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
int xOffs, int yOffs, bool xFlip) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
for (int y = 0; y < 3; y++) {
|
||||
int xs = x - xOffs;
|
||||
int ys = y - yOffs;
|
||||
ItemInstance* expected = NULL;
|
||||
if (xs >= 0 && ys >= 0 && xs < width && ys < height) {
|
||||
if (xFlip)
|
||||
expected = recipeItems[(width - xs - 1) + ys * width];
|
||||
else
|
||||
expected = recipeItems[xs + ys * width];
|
||||
}
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(x, y);
|
||||
if (item == NULL && expected == NULL) {
|
||||
continue;
|
||||
}
|
||||
if ((item == NULL && expected != NULL) ||
|
||||
(item != NULL && expected == NULL)) {
|
||||
return false;
|
||||
}
|
||||
if (expected->id != item->id) {
|
||||
return false;
|
||||
}
|
||||
if (expected->getAuxValue() != Recipes::ANY_AUX_VALUE &&
|
||||
expected->getAuxValue() != item->getAuxValue()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShapedRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level)
|
||||
{
|
||||
for (int xOffs = 0; xOffs <= (3 - width); xOffs++)
|
||||
{
|
||||
for (int yOffs = 0; yOffs <= (3 - height); yOffs++)
|
||||
{
|
||||
if (matches(craftSlots, xOffs, yOffs, true)) return true;
|
||||
if (matches(craftSlots, xOffs, yOffs, false)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
std::shared_ptr<ItemInstance> ShapedRecipy::assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots) {
|
||||
std::shared_ptr<ItemInstance> result = getResultItem()->copy();
|
||||
|
||||
if (_keepTag && craftSlots != NULL) {
|
||||
for (int i = 0; i < craftSlots->getContainerSize(); i++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(i);
|
||||
|
||||
if (item != NULL && item->hasTag()) {
|
||||
result->setTag((CompoundTag*)item->tag->copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ShapedRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots, int xOffs, int yOffs, bool xFlip)
|
||||
{
|
||||
for (int x = 0; x < 3; x++) {
|
||||
for (int y = 0; y < 3; y++) {
|
||||
int xs = x - xOffs;
|
||||
int ys = y - yOffs;
|
||||
ItemInstance *expected = NULL;
|
||||
if (xs >= 0 && ys >= 0 && xs < width && ys < height)
|
||||
{
|
||||
if (xFlip) expected = recipeItems[(width - xs - 1) + ys * width];
|
||||
else expected = recipeItems[xs + ys * width];
|
||||
}
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(x, y);
|
||||
if (item == NULL && expected == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((item == NULL && expected != NULL) || (item != NULL && expected == NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (expected->id != item->id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (expected->getAuxValue() != Recipes::ANY_AUX_VALUE && expected->getAuxValue() != item->getAuxValue())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> ShapedRecipy::assemble(std::shared_ptr<CraftingContainer> craftSlots)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> result = getResultItem()->copy();
|
||||
|
||||
if (_keepTag && craftSlots != NULL)
|
||||
{
|
||||
for (int i = 0; i < craftSlots->getContainerSize(); i++)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(i);
|
||||
|
||||
if (item != NULL && item->hasTag())
|
||||
{
|
||||
result->setTag((CompoundTag *) item->tag->copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int ShapedRecipy::size()
|
||||
{
|
||||
return width * height;
|
||||
}
|
||||
int ShapedRecipy::size() { return width * height; }
|
||||
|
||||
// 4J-PB
|
||||
bool ShapedRecipy::requires(int iRecipe)
|
||||
{
|
||||
app.DebugPrintf("ShapedRecipy %d\n",iRecipe);
|
||||
int iCount=0;
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
if (x < width && y < height)
|
||||
{
|
||||
ItemInstance *expected = recipeItems[x+y*width];
|
||||
if (expected!=NULL)
|
||||
{
|
||||
//printf("\tIngredient %d is %d\n",iCount++,expected->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool ShapedRecipy::requires(int iRecipe) {
|
||||
app.DebugPrintf("ShapedRecipy %d\n", iRecipe);
|
||||
int iCount = 0;
|
||||
for (int x = 0; x < 3; x++) {
|
||||
for (int y = 0; y < 3; y++) {
|
||||
if (x < width && y < height) {
|
||||
ItemInstance* expected = recipeItems[x + y * width];
|
||||
if (expected != NULL) {
|
||||
// printf("\tIngredient %d is %d\n",iCount++,expected->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ShapedRecipy::requires(INGREDIENTS_REQUIRED *pIngReq)
|
||||
{
|
||||
//printf("ShapedRecipy %d\n",iRecipe);
|
||||
void ShapedRecipy::requires(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
// printf("ShapedRecipy %d\n",iRecipe);
|
||||
|
||||
int iCount=0;
|
||||
bool bFound;
|
||||
int j;
|
||||
INGREDIENTS_REQUIRED TempIngReq;
|
||||
TempIngReq.iIngC=0;
|
||||
TempIngReq.iType = ((width>2) ||(height>2))?RECIPE_TYPE_3x3:RECIPE_TYPE_2x2; // 3x3
|
||||
// 3x3
|
||||
// 4jcraft, genuinly what is this garbage code
|
||||
TempIngReq.uiGridA = new unsigned int [9];
|
||||
TempIngReq.iIngIDA= new int [9];
|
||||
TempIngReq.iIngValA = new int [9];
|
||||
TempIngReq.iIngAuxValA = new int [9];
|
||||
int iCount = 0;
|
||||
bool bFound;
|
||||
int j;
|
||||
INGREDIENTS_REQUIRED TempIngReq;
|
||||
TempIngReq.iIngC = 0;
|
||||
TempIngReq.iType = ((width > 2) || (height > 2)) ? RECIPE_TYPE_3x3
|
||||
: RECIPE_TYPE_2x2; // 3x3
|
||||
// 3x3
|
||||
// 4jcraft, genuinly what is this garbage code
|
||||
TempIngReq.uiGridA = new unsigned int[9];
|
||||
TempIngReq.iIngIDA = new int[9];
|
||||
TempIngReq.iIngValA = new int[9];
|
||||
TempIngReq.iIngAuxValA = new int[9];
|
||||
|
||||
// 4jcraft,yes, yes!!
|
||||
// use winapi and inbetween use a cstd function u could have used!
|
||||
ZeroMemory(TempIngReq.iIngIDA,sizeof(int)*9);
|
||||
ZeroMemory(TempIngReq.iIngValA,sizeof(int)*9);
|
||||
memset(TempIngReq.iIngAuxValA,Recipes::ANY_AUX_VALUE,sizeof(int)*9);
|
||||
ZeroMemory(TempIngReq.uiGridA,sizeof(unsigned int)*9);
|
||||
// 4jcraft,yes, yes!!
|
||||
// use winapi and inbetween use a cstd function u could have used!
|
||||
ZeroMemory(TempIngReq.iIngIDA, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.iIngValA, sizeof(int) * 9);
|
||||
memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
if (x < width && y < height)
|
||||
{
|
||||
ItemInstance *expected = recipeItems[x+y*width];
|
||||
for (int x = 0; x < 3; x++) {
|
||||
for (int y = 0; y < 3; y++) {
|
||||
if (x < width && y < height) {
|
||||
ItemInstance* expected = recipeItems[x + y * width];
|
||||
|
||||
if (expected!=NULL)
|
||||
{
|
||||
int iAuxVal = expected->getAuxValue();
|
||||
//4jcraft, added cast to uint (shift of negativ num, undefined)
|
||||
TempIngReq.uiGridA[x+y*3]=expected->id | (unsigned int) iAuxVal<<24;
|
||||
if (expected != NULL) {
|
||||
int iAuxVal = expected->getAuxValue();
|
||||
// 4jcraft, added cast to uint (shift of negativ num,
|
||||
// undefined)
|
||||
TempIngReq.uiGridA[x + y * 3] =
|
||||
expected->id | (unsigned int)iAuxVal << 24;
|
||||
|
||||
bFound=false;
|
||||
for(j=0;j<TempIngReq.iIngC;j++)
|
||||
{
|
||||
if((TempIngReq.iIngIDA[j]==expected->id) && (iAuxVal == Recipes::ANY_AUX_VALUE || TempIngReq.iIngAuxValA[j] == iAuxVal))
|
||||
{
|
||||
bFound= true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bFound)
|
||||
{
|
||||
TempIngReq.iIngValA[j]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
TempIngReq.iIngIDA[TempIngReq.iIngC]=expected->id;
|
||||
TempIngReq.iIngAuxValA[TempIngReq.iIngC]=iAuxVal;
|
||||
TempIngReq.iIngValA[TempIngReq.iIngC++]++;
|
||||
}
|
||||
//printf("\tIngredient %d is %d\n",iCount++,expected->id);
|
||||
}
|
||||
bFound = false;
|
||||
for (j = 0; j < TempIngReq.iIngC; j++) {
|
||||
if ((TempIngReq.iIngIDA[j] == expected->id) &&
|
||||
(iAuxVal == Recipes::ANY_AUX_VALUE ||
|
||||
TempIngReq.iIngAuxValA[j] == iAuxVal)) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound) {
|
||||
TempIngReq.iIngValA[j]++;
|
||||
} else {
|
||||
TempIngReq.iIngIDA[TempIngReq.iIngC] = expected->id;
|
||||
TempIngReq.iIngAuxValA[TempIngReq.iIngC] = iAuxVal;
|
||||
TempIngReq.iIngValA[TempIngReq.iIngC++]++;
|
||||
}
|
||||
// printf("\tIngredient %d is %d\n",iCount++,expected->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pIngReq->iIngIDA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngValA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngAuxValA = new int[TempIngReq.iIngC];
|
||||
pIngReq->uiGridA = new unsigned int[9];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
pIngReq->iIngIDA= new int [TempIngReq.iIngC];
|
||||
pIngReq->iIngValA= new int [TempIngReq.iIngC];
|
||||
pIngReq->iIngAuxValA = new int [TempIngReq.iIngC];
|
||||
pIngReq->uiGridA = new unsigned int [9];
|
||||
pIngReq->iIngC = TempIngReq.iIngC;
|
||||
pIngReq->iType = TempIngReq.iType;
|
||||
|
||||
pIngReq->iIngC=TempIngReq.iIngC;
|
||||
pIngReq->iType=TempIngReq.iType;
|
||||
pIngReq->pRecipy = this;
|
||||
|
||||
pIngReq->pRecipy=this;
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
pIngReq->bCanMake[i] = false;
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
pIngReq->bCanMake[i]=false;
|
||||
}
|
||||
for (j = 0; j < 9; j++) {
|
||||
pIngReq->uiGridA[j] = TempIngReq.uiGridA[j];
|
||||
}
|
||||
|
||||
for(j=0;j<9;j++)
|
||||
{
|
||||
pIngReq->uiGridA[j]=TempIngReq.uiGridA[j];
|
||||
}
|
||||
if (pIngReq->iIngC != 0) {
|
||||
memcpy(pIngReq->iIngIDA, TempIngReq.iIngIDA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngValA, TempIngReq.iIngValA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngAuxValA, TempIngReq.iIngAuxValA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
}
|
||||
memcpy(pIngReq->uiGridA, TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
if(pIngReq->iIngC!=0)
|
||||
{
|
||||
memcpy(pIngReq->iIngIDA,TempIngReq.iIngIDA,sizeof(int)*TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngValA,TempIngReq.iIngValA,sizeof(int)*TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngAuxValA,TempIngReq.iIngAuxValA,sizeof(int)*TempIngReq.iIngC);
|
||||
}
|
||||
memcpy(pIngReq->uiGridA,TempIngReq.uiGridA,sizeof(unsigned int)*9);
|
||||
|
||||
delete [] TempIngReq.iIngIDA;
|
||||
delete [] TempIngReq.iIngValA;
|
||||
delete [] TempIngReq.iIngAuxValA;
|
||||
delete [] TempIngReq.uiGridA;
|
||||
delete[] TempIngReq.iIngIDA;
|
||||
delete[] TempIngReq.iIngValA;
|
||||
delete[] TempIngReq.iIngAuxValA;
|
||||
delete[] TempIngReq.uiGridA;
|
||||
}
|
||||
|
||||
ShapedRecipy *ShapedRecipy::keepTag()
|
||||
{
|
||||
_keepTag = true;
|
||||
return this;
|
||||
ShapedRecipy*
|
||||
ShapedRecipy::keepTag() {
|
||||
_keepTag = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
class ShapedRecipy : public Recipy
|
||||
{
|
||||
class ShapedRecipy : public Recipy {
|
||||
private:
|
||||
int width, height, group;
|
||||
ItemInstance **recipeItems;
|
||||
ItemInstance *result;
|
||||
bool _keepTag;
|
||||
public:
|
||||
const int resultId;
|
||||
int width, height, group;
|
||||
ItemInstance** recipeItems;
|
||||
ItemInstance* result;
|
||||
bool _keepTag;
|
||||
|
||||
public:
|
||||
ShapedRecipy(int width, int height, ItemInstance **recipeItems, ItemInstance *result, int iGroup=Recipy::eGroupType_Decoration);
|
||||
const int resultId;
|
||||
|
||||
virtual const ItemInstance *getResultItem();
|
||||
virtual const int getGroup();
|
||||
virtual bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level);
|
||||
public:
|
||||
ShapedRecipy(int width, int height, ItemInstance** recipeItems,
|
||||
ItemInstance* result,
|
||||
int iGroup = Recipy::eGroupType_Decoration);
|
||||
|
||||
virtual const ItemInstance* getResultItem();
|
||||
virtual const int getGroup();
|
||||
virtual bool matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level);
|
||||
|
||||
private:
|
||||
bool matches(std::shared_ptr<CraftingContainer> craftSlots, int xOffs, int yOffs, bool xFlip);
|
||||
bool matches(std::shared_ptr<CraftingContainer> craftSlots, int xOffs,
|
||||
int yOffs, bool xFlip);
|
||||
|
||||
public:
|
||||
virtual std::shared_ptr<ItemInstance> assemble(std::shared_ptr<CraftingContainer> craftSlots);
|
||||
virtual int size();
|
||||
ShapedRecipy *keepTag();
|
||||
virtual std::shared_ptr<ItemInstance> assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots);
|
||||
virtual int size();
|
||||
ShapedRecipy* keepTag();
|
||||
|
||||
// 4J-PB - to return the items required to make a recipe
|
||||
virtual bool requires(int iRecipe);
|
||||
virtual void requires(INGREDIENTS_REQUIRED *pIngReq);
|
||||
// 4J-PB - to return the items required to make a recipe
|
||||
virtual bool
|
||||
requires(int iRecipe);
|
||||
virtual void
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// package net.minecraft.world.item.crafting;
|
||||
//
|
||||
//
|
||||
// import java.util.*;
|
||||
//
|
||||
//
|
||||
// import net.minecraft.world.inventory.CraftingContainer;
|
||||
// import net.minecraft.world.item.ItemInstance;
|
||||
#include "../Platform/stdafx.h"
|
||||
@@ -12,172 +12,160 @@
|
||||
#include "Recipes.h"
|
||||
#include "ShapelessRecipy.h"
|
||||
|
||||
ShapelessRecipy::ShapelessRecipy(ItemInstance *result, std::vector<ItemInstance *> *ingredients, _eGroupType egroup) :
|
||||
result(result),
|
||||
ingredients(ingredients),
|
||||
group(egroup)
|
||||
{
|
||||
ShapelessRecipy::ShapelessRecipy(ItemInstance* result,
|
||||
std::vector<ItemInstance*>* ingredients,
|
||||
_eGroupType egroup)
|
||||
: result(result), ingredients(ingredients), group(egroup) {}
|
||||
|
||||
const int ShapelessRecipy::getGroup() { return group; }
|
||||
|
||||
const ItemInstance* ShapelessRecipy::getResultItem() { return result; }
|
||||
|
||||
bool ShapelessRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level) {
|
||||
std::vector<ItemInstance*> tempList = *ingredients;
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(x, y);
|
||||
|
||||
if (item != NULL) {
|
||||
bool found = false;
|
||||
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
for (AUTO_VAR(cit, ingredients->begin()); cit != citEnd;
|
||||
++cit) {
|
||||
ItemInstance* ingredient = *cit;
|
||||
if (item->id == ingredient->id &&
|
||||
(ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE ||
|
||||
item->getAuxValue() == ingredient->getAuxValue())) {
|
||||
found = true;
|
||||
AUTO_VAR(it, find(tempList.begin(), tempList.end(),
|
||||
ingredient));
|
||||
if (it != tempList.end()) tempList.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tempList.empty();
|
||||
}
|
||||
|
||||
const int ShapelessRecipy::getGroup()
|
||||
{
|
||||
return group;
|
||||
std::shared_ptr<ItemInstance> ShapelessRecipy::assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots) {
|
||||
return result->copy();
|
||||
}
|
||||
|
||||
const ItemInstance *ShapelessRecipy::getResultItem()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ShapelessRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level)
|
||||
{
|
||||
std::vector <ItemInstance *> tempList = *ingredients;
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(x, y);
|
||||
|
||||
if (item != NULL)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
for (AUTO_VAR(cit, ingredients->begin()); cit != citEnd; ++cit)
|
||||
{
|
||||
ItemInstance *ingredient = *cit;
|
||||
if (item->id == ingredient->id && (ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == ingredient->getAuxValue()))
|
||||
{
|
||||
found = true;
|
||||
AUTO_VAR( it, find(tempList.begin(), tempList.end(), ingredient ) );
|
||||
if(it != tempList.end() ) tempList.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tempList.empty();
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> ShapelessRecipy::assemble(std::shared_ptr<CraftingContainer> craftSlots)
|
||||
{
|
||||
return result->copy();
|
||||
}
|
||||
|
||||
int ShapelessRecipy::size()
|
||||
{
|
||||
return (int)ingredients->size();
|
||||
}
|
||||
int ShapelessRecipy::size() { return (int)ingredients->size(); }
|
||||
|
||||
// 4J-PB
|
||||
bool ShapelessRecipy::requires(int iRecipe)
|
||||
{
|
||||
std::vector <ItemInstance *> *tempList = new std::vector<ItemInstance *>;
|
||||
bool ShapelessRecipy::requires(int iRecipe) {
|
||||
std::vector<ItemInstance*>* tempList = new std::vector<ItemInstance*>;
|
||||
|
||||
*tempList=*ingredients;
|
||||
*tempList = *ingredients;
|
||||
|
||||
//printf("ShapelessRecipy %d\n",iRecipe);
|
||||
// printf("ShapelessRecipy %d\n",iRecipe);
|
||||
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
int iCount=0;
|
||||
for (std::vector<ItemInstance *>::iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++)
|
||||
{
|
||||
//printf("\tIngredient %d is %d\n",iCount++,(*ingredient)->id);
|
||||
//if (item->id == (*ingredient)->id && ((*ingredient)->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == (*ingredient)->getAuxValue()))
|
||||
tempList->erase(ingredient);
|
||||
}
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
int iCount = 0;
|
||||
for (std::vector<ItemInstance*>::iterator ingredient = ingredients->begin();
|
||||
ingredient != citEnd; ingredient++) {
|
||||
// printf("\tIngredient %d is %d\n",iCount++,(*ingredient)->id);
|
||||
// if (item->id == (*ingredient)->id && ((*ingredient)->getAuxValue() ==
|
||||
// Recipes::ANY_AUX_VALUE || item->getAuxValue() ==
|
||||
// (*ingredient)->getAuxValue()))
|
||||
tempList->erase(ingredient);
|
||||
}
|
||||
|
||||
delete tempList;
|
||||
return false;
|
||||
delete tempList;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ShapelessRecipy::requires(INGREDIENTS_REQUIRED *pIngReq)
|
||||
{
|
||||
int iCount=0;
|
||||
bool bFound;
|
||||
int j;
|
||||
INGREDIENTS_REQUIRED TempIngReq;
|
||||
void ShapelessRecipy::requires(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
int iCount = 0;
|
||||
bool bFound;
|
||||
int j;
|
||||
INGREDIENTS_REQUIRED TempIngReq;
|
||||
|
||||
// shapeless doesn't have the 3x3 shape, but we'll just use this to store the ingredients anyway
|
||||
TempIngReq.iIngC=0;
|
||||
TempIngReq.iType = RECIPE_TYPE_2x2; // all the dyes can be made in a 2x2
|
||||
TempIngReq.uiGridA = new unsigned int [9];
|
||||
TempIngReq.iIngIDA= new int [3*3];
|
||||
TempIngReq.iIngValA = new int [3*3];
|
||||
TempIngReq.iIngAuxValA = new int [3*3];
|
||||
// shapeless doesn't have the 3x3 shape, but we'll just use this to store
|
||||
// the ingredients anyway
|
||||
TempIngReq.iIngC = 0;
|
||||
TempIngReq.iType = RECIPE_TYPE_2x2; // all the dyes can be made in a 2x2
|
||||
TempIngReq.uiGridA = new unsigned int[9];
|
||||
TempIngReq.iIngIDA = new int[3 * 3];
|
||||
TempIngReq.iIngValA = new int[3 * 3];
|
||||
TempIngReq.iIngAuxValA = new int[3 * 3];
|
||||
|
||||
ZeroMemory(TempIngReq.iIngIDA,sizeof(int)*9);
|
||||
ZeroMemory(TempIngReq.iIngValA,sizeof(int)*9);
|
||||
memset(TempIngReq.iIngAuxValA,Recipes::ANY_AUX_VALUE,sizeof(int)*9);
|
||||
ZeroMemory(TempIngReq.uiGridA,sizeof(unsigned int)*9);
|
||||
ZeroMemory(TempIngReq.iIngIDA, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.iIngValA, sizeof(int) * 9);
|
||||
memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
|
||||
for (std::vector<ItemInstance *>::const_iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++)
|
||||
{
|
||||
ItemInstance *expected = *ingredient;
|
||||
for (std::vector<ItemInstance*>::const_iterator ingredient =
|
||||
ingredients->begin();
|
||||
ingredient != citEnd; ingredient++) {
|
||||
ItemInstance* expected = *ingredient;
|
||||
|
||||
if (expected!=NULL)
|
||||
{
|
||||
int iAuxVal = (*ingredient)->getAuxValue();
|
||||
//4jcraft, added cast to uint, shift of negative int is undefined
|
||||
TempIngReq.uiGridA[iCount++]=expected->id | (unsigned int) iAuxVal<<24;
|
||||
// 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them in a 2x2 crafting screen
|
||||
if(iCount==2) iCount=3;
|
||||
bFound=false;
|
||||
for(j=0;j<TempIngReq.iIngC;j++)
|
||||
{
|
||||
if((TempIngReq.iIngIDA[j]==expected->id) && (iAuxVal == Recipes::ANY_AUX_VALUE || TempIngReq.iIngAuxValA[j] == iAuxVal))
|
||||
{
|
||||
bFound= true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bFound)
|
||||
{
|
||||
TempIngReq.iIngValA[j]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
TempIngReq.iIngIDA[TempIngReq.iIngC]=expected->id;
|
||||
TempIngReq.iIngAuxValA[TempIngReq.iIngC]=iAuxVal;
|
||||
TempIngReq.iIngValA[TempIngReq.iIngC++]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
pIngReq->iIngIDA = new int [TempIngReq.iIngC];
|
||||
pIngReq->iIngValA = new int [TempIngReq.iIngC];
|
||||
pIngReq->iIngAuxValA = new int [TempIngReq.iIngC];
|
||||
pIngReq->uiGridA = new unsigned int [9];
|
||||
if (expected != NULL) {
|
||||
int iAuxVal = (*ingredient)->getAuxValue();
|
||||
// 4jcraft, added cast to uint, shift of negative int is undefined
|
||||
TempIngReq.uiGridA[iCount++] = expected->id | (unsigned int)iAuxVal
|
||||
<< 24;
|
||||
// 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them
|
||||
// in a 2x2 crafting screen
|
||||
if (iCount == 2) iCount = 3;
|
||||
bFound = false;
|
||||
for (j = 0; j < TempIngReq.iIngC; j++) {
|
||||
if ((TempIngReq.iIngIDA[j] == expected->id) &&
|
||||
(iAuxVal == Recipes::ANY_AUX_VALUE ||
|
||||
TempIngReq.iIngAuxValA[j] == iAuxVal)) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound) {
|
||||
TempIngReq.iIngValA[j]++;
|
||||
} else {
|
||||
TempIngReq.iIngIDA[TempIngReq.iIngC] = expected->id;
|
||||
TempIngReq.iIngAuxValA[TempIngReq.iIngC] = iAuxVal;
|
||||
TempIngReq.iIngValA[TempIngReq.iIngC++]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
pIngReq->iIngIDA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngValA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngAuxValA = new int[TempIngReq.iIngC];
|
||||
pIngReq->uiGridA = new unsigned int[9];
|
||||
|
||||
pIngReq->pRecipy=this;
|
||||
pIngReq->pRecipy = this;
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
pIngReq->bCanMake[i]=false;
|
||||
}
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
pIngReq->bCanMake[i] = false;
|
||||
}
|
||||
|
||||
pIngReq->iIngC=TempIngReq.iIngC;
|
||||
pIngReq->iType=TempIngReq.iType;
|
||||
pIngReq->iIngC = TempIngReq.iIngC;
|
||||
pIngReq->iType = TempIngReq.iType;
|
||||
|
||||
if(pIngReq->iIngC!=0)
|
||||
{
|
||||
memcpy(pIngReq->iIngIDA,TempIngReq.iIngIDA,sizeof(int)*TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngValA,TempIngReq.iIngValA,sizeof(int)*TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngAuxValA,TempIngReq.iIngAuxValA,sizeof(int)*TempIngReq.iIngC);
|
||||
}
|
||||
memcpy(pIngReq->uiGridA,TempIngReq.uiGridA,sizeof(unsigned int) *9);
|
||||
if (pIngReq->iIngC != 0) {
|
||||
memcpy(pIngReq->iIngIDA, TempIngReq.iIngIDA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngValA, TempIngReq.iIngValA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
memcpy(pIngReq->iIngAuxValA, TempIngReq.iIngAuxValA,
|
||||
sizeof(int) * TempIngReq.iIngC);
|
||||
}
|
||||
memcpy(pIngReq->uiGridA, TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
delete [] TempIngReq.iIngIDA;
|
||||
delete [] TempIngReq.iIngValA;
|
||||
delete [] TempIngReq.iIngAuxValA;
|
||||
delete [] TempIngReq.uiGridA;
|
||||
delete[] TempIngReq.iIngIDA;
|
||||
delete[] TempIngReq.iIngValA;
|
||||
delete[] TempIngReq.iIngAuxValA;
|
||||
delete[] TempIngReq.uiGridA;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
class ShapelessRecipy : public Recipy
|
||||
{
|
||||
class ShapelessRecipy : public Recipy {
|
||||
private:
|
||||
_eGroupType group;
|
||||
const ItemInstance *result;
|
||||
std::vector<ItemInstance *> *ingredients;
|
||||
_eGroupType group;
|
||||
const ItemInstance* result;
|
||||
std::vector<ItemInstance*>* ingredients;
|
||||
|
||||
public:
|
||||
ShapelessRecipy(ItemInstance *result, std::vector<ItemInstance *> *ingredients, _eGroupType egroup=Recipy::eGroupType_Decoration);
|
||||
ShapelessRecipy(ItemInstance* result,
|
||||
std::vector<ItemInstance*>* ingredients,
|
||||
_eGroupType egroup = Recipy::eGroupType_Decoration);
|
||||
|
||||
virtual const ItemInstance *getResultItem();
|
||||
virtual const int getGroup();
|
||||
virtual bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level);
|
||||
virtual std::shared_ptr<ItemInstance> assemble(std::shared_ptr<CraftingContainer> craftSlots);
|
||||
virtual int size();
|
||||
|
||||
// 4J-PB - to return the items required to make a recipe
|
||||
virtual bool requires(int iRecipe);
|
||||
virtual void requires(INGREDIENTS_REQUIRED *pIngReq);
|
||||
virtual const ItemInstance* getResultItem();
|
||||
virtual const int getGroup();
|
||||
virtual bool matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level);
|
||||
virtual std::shared_ptr<ItemInstance> assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots);
|
||||
virtual int size();
|
||||
|
||||
// 4J-PB - to return the items required to make a recipe
|
||||
virtual bool
|
||||
requires(int iRecipe);
|
||||
virtual void
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
|
||||
@@ -5,124 +5,124 @@
|
||||
#include "Recipes.h"
|
||||
#include "StructureRecipes.h"
|
||||
|
||||
void StructureRecipies::addRecipes(Recipes *r)
|
||||
{
|
||||
r->addShapedRecipy(new ItemInstance(Tile::sandStone), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
void StructureRecipies::addRecipes(Recipes* r) {
|
||||
r->addShapedRecipy(new ItemInstance(Tile::sandStone), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
||||
L'#', Tile::sand,
|
||||
L'S');
|
||||
L'#', Tile::sand, L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::sandStone, 4, SandStoneTile::TYPE_SMOOTHSIDE), //
|
||||
L"ssczg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
r->addShapedRecipy(new ItemInstance(Tile::sandStone, 4,
|
||||
SandStoneTile::TYPE_SMOOTHSIDE), //
|
||||
L"ssczg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
||||
L'#', new ItemInstance(Tile::sandStone),
|
||||
L'S');
|
||||
L'#', new ItemInstance(Tile::sandStone), L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::sandStone, 1, SandStoneTile::TYPE_HEIROGLYPHS), //
|
||||
L"ssczg",
|
||||
L"#", //
|
||||
L"#", //
|
||||
r->addShapedRecipy(
|
||||
new ItemInstance(Tile::sandStone, 1,
|
||||
SandStoneTile::TYPE_HEIROGLYPHS), //
|
||||
L"ssczg",
|
||||
L"#", //
|
||||
L"#", //
|
||||
|
||||
L'#', new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB),
|
||||
L'S');
|
||||
L'#',
|
||||
new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB),
|
||||
L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::quartzBlock, 1, QuartzBlockTile::TYPE_CHISELED), //
|
||||
L"ssczg",
|
||||
L"#", //
|
||||
L"#", //
|
||||
r->addShapedRecipy(
|
||||
new ItemInstance(Tile::quartzBlock, 1,
|
||||
QuartzBlockTile::TYPE_CHISELED), //
|
||||
L"ssczg",
|
||||
L"#", //
|
||||
L"#", //
|
||||
|
||||
L'#', new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::QUARTZ_SLAB),
|
||||
L'S');
|
||||
L'#',
|
||||
new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::QUARTZ_SLAB),
|
||||
L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::quartzBlock, 2, QuartzBlockTile::TYPE_LINES_Y), //
|
||||
L"ssczg",
|
||||
L"#", //
|
||||
L"#", //
|
||||
r->addShapedRecipy(
|
||||
new ItemInstance(Tile::quartzBlock, 2,
|
||||
QuartzBlockTile::TYPE_LINES_Y), //
|
||||
L"ssczg",
|
||||
L"#", //
|
||||
L"#", //
|
||||
|
||||
L'#', new ItemInstance(Tile::quartzBlock, 1, QuartzBlockTile::TYPE_DEFAULT),
|
||||
L'S');
|
||||
L'#',
|
||||
new ItemInstance(Tile::quartzBlock, 1, QuartzBlockTile::TYPE_DEFAULT),
|
||||
L'S');
|
||||
|
||||
// 4J Stu - Changed the order, as the blocks that go with sandstone cause a 3-icon scroll
|
||||
// that touches the text "Structures" in the title in 720 fullscreen.
|
||||
r->addShapedRecipy(new ItemInstance(Tile::workBench), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
// 4J Stu - Changed the order, as the blocks that go with sandstone cause a
|
||||
// 3-icon scroll that touches the text "Structures" in the title in 720
|
||||
// fullscreen.
|
||||
r->addShapedRecipy(new ItemInstance(Tile::workBench), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
||||
L'#', Tile::wood,
|
||||
L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::furnace), //
|
||||
L"sssctg",
|
||||
L"###", //
|
||||
L"# #", //
|
||||
L"###", //
|
||||
L'#', Tile::wood, L'S');
|
||||
|
||||
L'#', Tile::stoneBrick,
|
||||
L'S');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::furnace), //
|
||||
L"sssctg",
|
||||
L"###", //
|
||||
L"# #", //
|
||||
L"###", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance((Tile*)Tile::chest), //
|
||||
L"sssctg",
|
||||
L"###", //
|
||||
L"# #", //
|
||||
L"###", //
|
||||
L'#', Tile::stoneBrick, L'S');
|
||||
|
||||
L'#', Tile::wood,
|
||||
L'S');
|
||||
r->addShapedRecipy(new ItemInstance((Tile*)Tile::chest), //
|
||||
L"sssctg",
|
||||
L"###", //
|
||||
L"# #", //
|
||||
L"###", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::enderChest), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"#E#", //
|
||||
L"###", //
|
||||
L'#', Tile::wood, L'S');
|
||||
|
||||
L'#', Tile::obsidian, L'E', Item::eyeOfEnder,
|
||||
L'S');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::enderChest), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"#E#", //
|
||||
L"###", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stoneBrickSmooth, 4), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
L'#', Tile::obsidian, L'E', Item::eyeOfEnder, L'S');
|
||||
|
||||
L'#', Tile::rock,
|
||||
L'S');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stoneBrickSmooth, 4), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
||||
// 4J Stu - Move this into "Recipes" to change the order things are displayed on the crafting menu
|
||||
//r->addShapedRecipy(new ItemInstance(Tile::ironFence, 16), //
|
||||
// L"sscig",
|
||||
// L"###", //
|
||||
// L"###", //
|
||||
L'#', Tile::rock, L'S');
|
||||
|
||||
// L'#', Item::ironIngot,
|
||||
// L'S');
|
||||
// 4J Stu - Move this into "Recipes" to change the order things are
|
||||
// displayed on the crafting menu
|
||||
// r->addShapedRecipy(new ItemInstance(Tile::ironFence, 16), //
|
||||
// L"sscig",
|
||||
// L"###", //
|
||||
// L"###", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::thinGlass, 16), //
|
||||
L"ssctg",
|
||||
L"###", //
|
||||
L"###", //
|
||||
// L'#', Item::ironIngot,
|
||||
// L'S');
|
||||
|
||||
L'#', Tile::glass,
|
||||
L'D');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::thinGlass, 16), //
|
||||
L"ssctg",
|
||||
L"###", //
|
||||
L"###", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::netherBrick, 1), //
|
||||
L"sscig",
|
||||
L"NN", //
|
||||
L"NN", //
|
||||
L'#', Tile::glass, L'D');
|
||||
|
||||
L'N', Item::netherbrick,
|
||||
L'S');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::netherBrick, 1), //
|
||||
L"sscig",
|
||||
L"NN", //
|
||||
L"NN", //
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::redstoneLight, 1), //
|
||||
L"ssscictg",
|
||||
L" R ", //
|
||||
L"RGR", //
|
||||
L" R ", //
|
||||
L'R', Item::redStone, 'G', Tile::lightGem,
|
||||
L'M');
|
||||
L'N', Item::netherbrick, L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::redstoneLight, 1), //
|
||||
L"ssscictg",
|
||||
L" R ", //
|
||||
L"RGR", //
|
||||
L" R ", //
|
||||
L'R', Item::redStone, 'G', Tile::lightGem, L'M');
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class StructureRecipies
|
||||
{
|
||||
class StructureRecipies {
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
void addRecipes(Recipes* r);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//package net.minecraft.world.item.crafting;
|
||||
// package net.minecraft.world.item.crafting;
|
||||
|
||||
//import net.minecraft.world.item.*;
|
||||
//import net.minecraft.world.level.tile.Tile;
|
||||
// import net.minecraft.world.item.*;
|
||||
// import net.minecraft.world.level.tile.Tile;
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "../Blocks/Tile.h"
|
||||
@@ -10,119 +10,105 @@
|
||||
#include "ToolRecipes.h"
|
||||
|
||||
// 4J-PB - adding "" on the end of these so we can detect it
|
||||
std::wstring ToolRecipies::shapes[][4] =
|
||||
{
|
||||
{L"XXX", //
|
||||
L" # ",//
|
||||
L" # "},//
|
||||
std::wstring ToolRecipies::shapes[][4] = {
|
||||
{L"XXX", //
|
||||
L" # ", //
|
||||
L" # "}, //
|
||||
|
||||
{L"X",//
|
||||
L"#",//
|
||||
L"#"},//
|
||||
{L"X", //
|
||||
L"#", //
|
||||
L"#"}, //
|
||||
|
||||
{L"XX",//
|
||||
L"X#",//
|
||||
L" #"},//
|
||||
{L"XX", //
|
||||
L"X#", //
|
||||
L" #"}, //
|
||||
|
||||
{L"XX",//
|
||||
L" #",//
|
||||
L" #"},//
|
||||
{L"XX", //
|
||||
L" #", //
|
||||
L" #"}, //
|
||||
};
|
||||
|
||||
/*
|
||||
Object[][] map = {
|
||||
{Tile.wood, Tile.stoneBrick, Item.ironIngot, Item.diamond, Item.goldIngot},
|
||||
{Item.pickAxe_wood, Item.pickAxe_stone, Item.pickAxe_iron, Item.pickAxe_diamond, Item.pickAxe_gold},
|
||||
{Item.shovel_wood, Item.shovel_stone, Item.shovel_iron, Item.shovel_diamond, Item.shovel_gold},
|
||||
{Item.hatchet_wood, Item.hatchet_stone, Item.hatchet_iron, Item.hatchet_diamond, Item.hatchet_gold},
|
||||
{Item.hoe_wood, Item.hoe_stone, Item.hoe_iron, Item.hoe_diamond, Item.hoe_gold},
|
||||
};
|
||||
*/
|
||||
//#define ADD_OBJECT(a,b) a.push_back(new Object(b))
|
||||
Object[][] map = {
|
||||
{Tile.wood, Tile.stoneBrick, Item.ironIngot,
|
||||
Item.diamond, Item.goldIngot}, {Item.pickAxe_wood, Item.pickAxe_stone,
|
||||
Item.pickAxe_iron, Item.pickAxe_diamond, Item.pickAxe_gold},
|
||||
{Item.shovel_wood, Item.shovel_stone, Item.shovel_iron,
|
||||
Item.shovel_diamond, Item.shovel_gold}, {Item.hatchet_wood,
|
||||
Item.hatchet_stone, Item.hatchet_iron, Item.hatchet_diamond,
|
||||
Item.hatchet_gold}, {Item.hoe_wood, Item.hoe_stone, Item.hoe_iron,
|
||||
Item.hoe_diamond, Item.hoe_gold},
|
||||
};
|
||||
*/
|
||||
// #define ADD_OBJECT(a,b) a.push_back(new Object(b))
|
||||
|
||||
void ToolRecipies::_init()
|
||||
{
|
||||
map = new std::vector <Object *> [MAX_TOOL_RECIPES];
|
||||
void ToolRecipies::_init() {
|
||||
map = new std::vector<Object*>[MAX_TOOL_RECIPES];
|
||||
|
||||
ADD_OBJECT(map[0],Tile::wood);
|
||||
ADD_OBJECT(map[0],Tile::stoneBrick);
|
||||
ADD_OBJECT(map[0],Item::ironIngot);
|
||||
ADD_OBJECT(map[0],Item::diamond);
|
||||
ADD_OBJECT(map[0],Item::goldIngot);
|
||||
ADD_OBJECT(map[0], Tile::wood);
|
||||
ADD_OBJECT(map[0], Tile::stoneBrick);
|
||||
ADD_OBJECT(map[0], Item::ironIngot);
|
||||
ADD_OBJECT(map[0], Item::diamond);
|
||||
ADD_OBJECT(map[0], Item::goldIngot);
|
||||
|
||||
ADD_OBJECT(map[1],Item::pickAxe_wood);
|
||||
ADD_OBJECT(map[1],Item::pickAxe_stone);
|
||||
ADD_OBJECT(map[1],Item::pickAxe_iron);
|
||||
ADD_OBJECT(map[1],Item::pickAxe_diamond);
|
||||
ADD_OBJECT(map[1],Item::pickAxe_gold);
|
||||
ADD_OBJECT(map[1], Item::pickAxe_wood);
|
||||
ADD_OBJECT(map[1], Item::pickAxe_stone);
|
||||
ADD_OBJECT(map[1], Item::pickAxe_iron);
|
||||
ADD_OBJECT(map[1], Item::pickAxe_diamond);
|
||||
ADD_OBJECT(map[1], Item::pickAxe_gold);
|
||||
|
||||
ADD_OBJECT(map[2],Item::shovel_wood);
|
||||
ADD_OBJECT(map[2],Item::shovel_stone);
|
||||
ADD_OBJECT(map[2],Item::shovel_iron);
|
||||
ADD_OBJECT(map[2],Item::shovel_diamond);
|
||||
ADD_OBJECT(map[2],Item::shovel_gold);
|
||||
ADD_OBJECT(map[2], Item::shovel_wood);
|
||||
ADD_OBJECT(map[2], Item::shovel_stone);
|
||||
ADD_OBJECT(map[2], Item::shovel_iron);
|
||||
ADD_OBJECT(map[2], Item::shovel_diamond);
|
||||
ADD_OBJECT(map[2], Item::shovel_gold);
|
||||
|
||||
ADD_OBJECT(map[3],Item::hatchet_wood);
|
||||
ADD_OBJECT(map[3],Item::hatchet_stone);
|
||||
ADD_OBJECT(map[3],Item::hatchet_iron);
|
||||
ADD_OBJECT(map[3],Item::hatchet_diamond);
|
||||
ADD_OBJECT(map[3],Item::hatchet_gold);
|
||||
ADD_OBJECT(map[3], Item::hatchet_wood);
|
||||
ADD_OBJECT(map[3], Item::hatchet_stone);
|
||||
ADD_OBJECT(map[3], Item::hatchet_iron);
|
||||
ADD_OBJECT(map[3], Item::hatchet_diamond);
|
||||
ADD_OBJECT(map[3], Item::hatchet_gold);
|
||||
|
||||
ADD_OBJECT(map[4],Item::hoe_wood);
|
||||
ADD_OBJECT(map[4],Item::hoe_stone);
|
||||
ADD_OBJECT(map[4],Item::hoe_iron);
|
||||
ADD_OBJECT(map[4],Item::hoe_diamond);
|
||||
ADD_OBJECT(map[4],Item::hoe_gold);
|
||||
ADD_OBJECT(map[4], Item::hoe_wood);
|
||||
ADD_OBJECT(map[4], Item::hoe_stone);
|
||||
ADD_OBJECT(map[4], Item::hoe_iron);
|
||||
ADD_OBJECT(map[4], Item::hoe_diamond);
|
||||
ADD_OBJECT(map[4], Item::hoe_gold);
|
||||
}
|
||||
|
||||
void ToolRecipies::addRecipes(Recipes *r)
|
||||
{
|
||||
wchar_t wchTypes[7];
|
||||
wchTypes[6]=0;
|
||||
void ToolRecipies::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 (unsigned int m = 0; m < map[0].size(); m++) {
|
||||
Object* pObjMaterial = map[0].at(m);
|
||||
|
||||
for (int t=0; t<MAX_TOOL_RECIPES-1; t++)
|
||||
{
|
||||
Item *target = map[t+1].at(m)->item;
|
||||
for (int t = 0; t < MAX_TOOL_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],
|
||||
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->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');
|
||||
}
|
||||
}
|
||||
}
|
||||
r->addShapedRecipy(new ItemInstance((Item *)Item::shears),
|
||||
L"sscig",
|
||||
L" #", //
|
||||
L"# ", //
|
||||
L'#', Item::ironIngot,
|
||||
L'T'
|
||||
);
|
||||
L'#', Item::stick, L'X', pObjMaterial->item, L'T');
|
||||
}
|
||||
}
|
||||
}
|
||||
r->addShapedRecipy(new ItemInstance((Item*)Item::shears), L"sscig",
|
||||
L" #", //
|
||||
L"# ", //
|
||||
L'#', Item::ironIngot, L'T');
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
//package net.minecraft.world.item.crafting;
|
||||
// package net.minecraft.world.item.crafting;
|
||||
|
||||
//import net.minecraft.world.item.*;
|
||||
//import net.minecraft.world.level.tile.Tile;
|
||||
// import net.minecraft.world.item.*;
|
||||
// import net.minecraft.world.level.tile.Tile;
|
||||
#pragma once
|
||||
|
||||
#define MAX_TOOL_RECIPES 5
|
||||
|
||||
class Recipes;
|
||||
|
||||
class ToolRecipies
|
||||
{
|
||||
class ToolRecipies {
|
||||
public:
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
ToolRecipies() {_init();}
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
ToolRecipies() { _init(); }
|
||||
|
||||
private:
|
||||
static std::wstring shapes[][4];
|
||||
std::vector <Object *> *map;
|
||||
static std::wstring shapes[][4];
|
||||
std::vector<Object*>* map;
|
||||
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
void addRecipes(Recipes* r);
|
||||
};
|
||||
|
||||
@@ -7,101 +7,88 @@
|
||||
#include "WeaponRecipes.h"
|
||||
|
||||
// 4J-PB - adding "" on the end of these so we can detect it
|
||||
std::wstring WeaponRecipies::shapes[][4] =
|
||||
{
|
||||
{L"X", //
|
||||
L"X",//
|
||||
L"#",L""},//
|
||||
std::wstring WeaponRecipies::shapes[][4] = {
|
||||
{L"X", //
|
||||
L"X", //
|
||||
L"#", L""}, //
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
private Object[][] map = {
|
||||
{Tile.wood, Tile.stoneBrick, Item.ironIngot, Item.diamond, Item.goldIngot},
|
||||
{Item.sword_wood, Item.sword_stone, Item.sword_iron, Item.sword_diamond, Item.sword_gold},
|
||||
};
|
||||
private Object[][] map = {
|
||||
{Tile.wood, Tile.stoneBrick, Item.ironIngot,
|
||||
Item.diamond, Item.goldIngot}, {Item.sword_wood, Item.sword_stone,
|
||||
Item.sword_iron, Item.sword_diamond, Item.sword_gold},
|
||||
};
|
||||
*/
|
||||
|
||||
void WeaponRecipies::_init()
|
||||
{
|
||||
map = new std::vector <Object *> [MAX_WEAPON_RECIPES];
|
||||
void WeaponRecipies::_init() {
|
||||
map = new std::vector<Object*>[MAX_WEAPON_RECIPES];
|
||||
|
||||
ADD_OBJECT(map[0],Tile::wood);
|
||||
ADD_OBJECT(map[0],Tile::stoneBrick);
|
||||
ADD_OBJECT(map[0],Item::ironIngot);
|
||||
ADD_OBJECT(map[0],Item::diamond);
|
||||
ADD_OBJECT(map[0],Item::goldIngot);
|
||||
ADD_OBJECT(map[0], Tile::wood);
|
||||
ADD_OBJECT(map[0], Tile::stoneBrick);
|
||||
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);
|
||||
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;
|
||||
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 (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;
|
||||
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],
|
||||
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->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');
|
||||
}
|
||||
}
|
||||
}
|
||||
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", //
|
||||
/* 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');
|
||||
L'X', Item::string,//
|
||||
L'#', Item::stick,
|
||||
L'T');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Item::arrow, 4), //
|
||||
L"ssscicicig",
|
||||
L"X", //
|
||||
L"#", //
|
||||
L"Y", //
|
||||
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');
|
||||
*/
|
||||
L'Y', Item::feather,//
|
||||
L'X', Item::flint,//
|
||||
L'#', Item::stick,
|
||||
L'T');
|
||||
*/
|
||||
}
|
||||
@@ -1,22 +1,21 @@
|
||||
//package net.minecraft.world.item.crafting;
|
||||
// package net.minecraft.world.item.crafting;
|
||||
|
||||
//import net.minecraft.world.item.*;
|
||||
//import net.minecraft.world.level.tile.Tile;
|
||||
// import net.minecraft.world.item.*;
|
||||
// import net.minecraft.world.level.tile.Tile;
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MAX_WEAPON_RECIPES 2
|
||||
class WeaponRecipies
|
||||
{
|
||||
class WeaponRecipies {
|
||||
public:
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
WeaponRecipies() {_init();}
|
||||
// 4J - added for common ctor code
|
||||
void _init();
|
||||
WeaponRecipies() { _init(); }
|
||||
|
||||
private:
|
||||
static std::wstring shapes[][4];
|
||||
std::vector <Object *> *map;
|
||||
|
||||
static std::wstring shapes[][4];
|
||||
std::vector<Object*>* map;
|
||||
|
||||
public:
|
||||
void addRecipes(Recipes *r);
|
||||
void addRecipes(Recipes* r);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user