mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-21 11:03:04 +00:00
TU19: merge Minecraft.World/Recipes
This commit is contained in:
parent
19026c057b
commit
75a4897381
|
|
@ -35,10 +35,7 @@ bool ArmorDyeRecipe::matches(std::shared_ptr<CraftingContainer> craftSlots,
|
|||
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 colorTotals[3] = {0, 0, 0};
|
||||
int intensityTotal = 0;
|
||||
int colourCounts = 0;
|
||||
ArmorItem* armor = NULL;
|
||||
|
|
@ -53,6 +50,7 @@ std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(
|
|||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH &&
|
||||
target == NULL) {
|
||||
target = item->copy();
|
||||
target->count = 1;
|
||||
|
||||
if (armor->hasCustomColor(item)) {
|
||||
int color = armor->getColor(target);
|
||||
|
|
@ -72,8 +70,8 @@ std::shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(
|
|||
return nullptr;
|
||||
}
|
||||
} else if (item->id == Item::dye_powder_Id) {
|
||||
int tileData =
|
||||
ClothTile::getTileDataForItemAuxValue(item->getAuxValue());
|
||||
int tileData = ColoredTile::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);
|
||||
|
|
@ -124,9 +122,9 @@ const ItemInstance* ArmorDyeRecipe::getResultItem() { return NULL; }
|
|||
const int ArmorDyeRecipe::getGroup() { return ShapedRecipy::eGroupType_Armour; }
|
||||
|
||||
// 4J-PB
|
||||
bool ArmorDyeRecipe::requiresRecipe(int iRecipe) { return false; }
|
||||
bool ArmorDyeRecipe::requires(int iRecipe) { return false; }
|
||||
|
||||
void ArmorDyeRecipe::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
// int iCount=0;
|
||||
// bool bFound;
|
||||
// int j;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
// 4J-PB
|
||||
virtual bool
|
||||
requiresRecipe(int iRecipe);
|
||||
requires(int iRecipe);
|
||||
virtual void
|
||||
collectRequirements(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
|
|
@ -51,25 +51,25 @@ void ArmorRecipes::_init() {
|
|||
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_leather);
|
||||
// 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_leather);
|
||||
// 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_leather);
|
||||
// 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_leather);
|
||||
// ADD_OBJECT(map[4],Item::boots_chain);
|
||||
ADD_OBJECT(map[4], Item::boots_iron);
|
||||
ADD_OBJECT(map[4], Item::boots_diamond);
|
||||
|
|
@ -79,7 +79,7 @@ void ArmorRecipes::_init() {
|
|||
// 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_leather_Id:
|
||||
case Item::helmet_chain_Id:
|
||||
case Item::helmet_iron_Id:
|
||||
case Item::helmet_diamond_Id:
|
||||
|
|
@ -87,7 +87,7 @@ ArmorRecipes::_eArmorType ArmorRecipes::GetArmorType(int iId) {
|
|||
return eArmorType_Helmet;
|
||||
break;
|
||||
|
||||
case Item::chestplate_cloth_Id:
|
||||
case Item::chestplate_leather_Id:
|
||||
case Item::chestplate_chain_Id:
|
||||
case Item::chestplate_iron_Id:
|
||||
case Item::chestplate_diamond_Id:
|
||||
|
|
@ -95,7 +95,7 @@ ArmorRecipes::_eArmorType ArmorRecipes::GetArmorType(int iId) {
|
|||
return eArmorType_Chestplate;
|
||||
break;
|
||||
|
||||
case Item::leggings_cloth_Id:
|
||||
case Item::leggings_leather_Id:
|
||||
case Item::leggings_chain_Id:
|
||||
case Item::leggings_iron_Id:
|
||||
case Item::leggings_diamond_Id:
|
||||
|
|
@ -103,7 +103,7 @@ ArmorRecipes::_eArmorType ArmorRecipes::GetArmorType(int iId) {
|
|||
return eArmorType_Leggings;
|
||||
break;
|
||||
|
||||
case Item::boots_cloth_Id:
|
||||
case Item::boots_leather_Id:
|
||||
case Item::boots_chain_Id:
|
||||
case Item::boots_iron_Id:
|
||||
case Item::boots_diamond_Id:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "../Items/DyePowderItem.h"
|
||||
#include "../Blocks/Tile.h"
|
||||
#include "../Blocks/ClothTile.h"
|
||||
#include "net.minecraft.world.item.h"
|
||||
#include "../Headers/net.minecraft.world.level.tile.h"
|
||||
#include "Recipy.h"
|
||||
#include "Recipes.h"
|
||||
#include "ClothDyeRecipes.h"
|
||||
|
|
@ -11,10 +9,31 @@ 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)), //
|
||||
new ItemInstance(Tile::wool, 1,
|
||||
ColoredTile::getItemAuxValueForTileData(i)), //
|
||||
L"zzg", new ItemInstance(Item::dye_powder, 1, i),
|
||||
new ItemInstance(Item::items[Tile::cloth_Id], 1, 0), L'D');
|
||||
new ItemInstance(Item::items[Tile::wool_Id], 1, 0), L'D');
|
||||
r->addShapedRecipy(
|
||||
new ItemInstance(Tile::clayHardened_colored, 8,
|
||||
ColoredTile::getItemAuxValueForTileData(i)), //
|
||||
L"sssczczg", L"###", L"#X#", L"###", L'#',
|
||||
new ItemInstance(Tile::clayHardened), L'X',
|
||||
new ItemInstance(Item::dye_powder, 1, i), L'D');
|
||||
|
||||
#if 0
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stained_glass, 8, ColoredTile::getItemAuxValueForTileData(i)), //
|
||||
L"sssczczg",
|
||||
L"###",
|
||||
L"#X#",
|
||||
L"###",
|
||||
L'#', new ItemInstance(Tile::glass),
|
||||
L'X', new ItemInstance(Item::dye_powder, 1, i), L'D');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stained_glass_pane, 16, i), //
|
||||
L"ssczg",
|
||||
L"###",
|
||||
L"###",
|
||||
L'#', new ItemInstance(Tile::stained_glass, 1, i), L'D');
|
||||
#endif
|
||||
}
|
||||
|
||||
// some dye recipes
|
||||
|
|
@ -96,7 +115,7 @@ void ClothDyeRecipes::addRecipes(Recipes* r) {
|
|||
|
||||
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"##", L'#', new ItemInstance(Tile::wool, 1, i),
|
||||
L'D');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
337
Minecraft.World/Recipes/FireworksRecipe.cpp
Normal file
337
Minecraft.World/Recipes/FireworksRecipe.cpp
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "FireworksRecipe.h"
|
||||
|
||||
DWORD FireworksRecipe::tlsIdx = 0;
|
||||
FireworksRecipe::ThreadStorage* FireworksRecipe::tlsDefault = NULL;
|
||||
|
||||
FireworksRecipe::ThreadStorage::ThreadStorage() { resultItem = nullptr; }
|
||||
|
||||
void FireworksRecipe::CreateNewThreadStorage() {
|
||||
ThreadStorage* tls = new ThreadStorage();
|
||||
if (tlsDefault == NULL) {
|
||||
tlsIdx = TlsAlloc();
|
||||
tlsDefault = tls;
|
||||
}
|
||||
TlsSetValue(tlsIdx, tls);
|
||||
}
|
||||
|
||||
void FireworksRecipe::UseDefaultThreadStorage() {
|
||||
TlsSetValue(tlsIdx, tlsDefault);
|
||||
}
|
||||
|
||||
void FireworksRecipe::ReleaseThreadStorage() {
|
||||
ThreadStorage* tls = (ThreadStorage*)TlsGetValue(tlsIdx);
|
||||
if (tls == tlsDefault) return;
|
||||
|
||||
delete tls;
|
||||
}
|
||||
|
||||
void FireworksRecipe::setResultItem(std::shared_ptr<ItemInstance> item) {
|
||||
ThreadStorage* tls = (ThreadStorage*)TlsGetValue(tlsIdx);
|
||||
tls->resultItem = item;
|
||||
}
|
||||
|
||||
FireworksRecipe::FireworksRecipe() {
|
||||
// resultItem = nullptr;
|
||||
}
|
||||
|
||||
bool FireworksRecipe::matches(std::shared_ptr<CraftingContainer> craftSlots,
|
||||
Level* level) {
|
||||
std::shared_ptr<ItemInstance> resultItem = nullptr;
|
||||
|
||||
int paperCount = 0;
|
||||
int sulphurCount = 0;
|
||||
int colorCount = 0;
|
||||
int chargeCount = 0;
|
||||
int chargeComponents = 0;
|
||||
int typeComponents = 0;
|
||||
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
|
||||
if (item->id == Item::gunpowder_Id) {
|
||||
sulphurCount++;
|
||||
} else if (item->id == Item::fireworksCharge_Id) {
|
||||
chargeCount++;
|
||||
} else if (item->id == Item::dye_powder_Id) {
|
||||
colorCount++;
|
||||
} else if (item->id == Item::paper_Id) {
|
||||
paperCount++;
|
||||
} else if (item->id == Item::yellowDust_Id) {
|
||||
// glowstone dust gives flickering
|
||||
chargeComponents++;
|
||||
} else if (item->id == Item::diamond_Id) {
|
||||
// diamonds give trails
|
||||
chargeComponents++;
|
||||
} else if (item->id == Item::fireball_Id) {
|
||||
// fireball gives larger explosion
|
||||
typeComponents++;
|
||||
} else if (item->id == Item::feather_Id) {
|
||||
// burst
|
||||
typeComponents++;
|
||||
} else if (item->id == Item::goldNugget_Id) {
|
||||
// star
|
||||
typeComponents++;
|
||||
} else if (item->id == Item::skull_Id) {
|
||||
// creeper
|
||||
typeComponents++;
|
||||
} else {
|
||||
setResultItem(resultItem);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
chargeComponents += colorCount + typeComponents;
|
||||
|
||||
if (sulphurCount > 3 || paperCount > 1) {
|
||||
setResultItem(resultItem);
|
||||
return false;
|
||||
}
|
||||
|
||||
// create fireworks
|
||||
if (sulphurCount >= 1 && paperCount == 1 && chargeComponents == 0) {
|
||||
resultItem =
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(Item::fireworks));
|
||||
if (chargeCount > 0) {
|
||||
CompoundTag* itemTag = new CompoundTag();
|
||||
CompoundTag* fireTag =
|
||||
new CompoundTag(FireworksItem::TAG_FIREWORKS);
|
||||
ListTag<CompoundTag>* expTags =
|
||||
new ListTag<CompoundTag>(FireworksItem::TAG_EXPLOSIONS);
|
||||
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL || item->id != Item::fireworksCharge_Id)
|
||||
continue;
|
||||
|
||||
if (item->hasTag() &&
|
||||
item->getTag()->contains(FireworksItem::TAG_EXPLOSION)) {
|
||||
expTags->add((CompoundTag*)item->getTag()
|
||||
->getCompound(FireworksItem::TAG_EXPLOSION)
|
||||
->copy());
|
||||
}
|
||||
}
|
||||
|
||||
fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags);
|
||||
fireTag->putByte(FireworksItem::TAG_FLIGHT, (uint8_t)sulphurCount);
|
||||
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
|
||||
|
||||
resultItem->setTag(itemTag);
|
||||
}
|
||||
setResultItem(resultItem);
|
||||
return true;
|
||||
}
|
||||
// create firecharge
|
||||
if (sulphurCount == 1 && paperCount == 0 && chargeCount == 0 &&
|
||||
colorCount > 0 && typeComponents <= 1) {
|
||||
resultItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::fireworksCharge));
|
||||
CompoundTag* itemTag = new CompoundTag();
|
||||
CompoundTag* expTag = new CompoundTag(FireworksItem::TAG_EXPLOSION);
|
||||
|
||||
uint8_t type = 0;
|
||||
|
||||
std::vector<int> colors;
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
|
||||
if (item->id == Item::dye_powder_Id) {
|
||||
colors.push_back(DyePowderItem::COLOR_RGB[item->getAuxValue()]);
|
||||
} else if (item->id == Item::yellowDust_Id) {
|
||||
// glowstone dust gives flickering
|
||||
expTag->putBoolean(FireworksItem::TAG_E_FLICKER, true);
|
||||
} else if (item->id == Item::diamond_Id) {
|
||||
// diamonds give trails
|
||||
expTag->putBoolean(FireworksItem::TAG_E_TRAIL, true);
|
||||
} else if (item->id == Item::fireball_Id) {
|
||||
type = FireworksItem::TYPE_BIG;
|
||||
} else if (item->id == Item::feather_Id) {
|
||||
type = FireworksItem::TYPE_BURST;
|
||||
} else if (item->id == Item::goldNugget_Id) {
|
||||
type = FireworksItem::TYPE_STAR;
|
||||
} else if (item->id == Item::skull_Id) {
|
||||
type = FireworksItem::TYPE_CREEPER;
|
||||
}
|
||||
}
|
||||
intArray colorArray(colors.size());
|
||||
for (int i = 0; i < colorArray.length; i++) {
|
||||
colorArray[i] = colors.at(i);
|
||||
}
|
||||
expTag->putIntArray(FireworksItem::TAG_E_COLORS, colorArray);
|
||||
|
||||
expTag->putByte(FireworksItem::TAG_E_TYPE, type);
|
||||
|
||||
itemTag->put(FireworksItem::TAG_EXPLOSION, expTag);
|
||||
resultItem->setTag(itemTag);
|
||||
|
||||
setResultItem(resultItem);
|
||||
return true;
|
||||
}
|
||||
// apply fade colors to firecharge
|
||||
if (sulphurCount == 0 && paperCount == 0 && chargeCount == 1 &&
|
||||
colorCount > 0 && colorCount == chargeComponents) {
|
||||
std::vector<int> colors;
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
|
||||
if (item->id == Item::dye_powder_Id) {
|
||||
colors.push_back(DyePowderItem::COLOR_RGB[item->getAuxValue()]);
|
||||
} else if (item->id == Item::fireworksCharge_Id) {
|
||||
resultItem = item->copy();
|
||||
resultItem->count = 1;
|
||||
}
|
||||
}
|
||||
intArray colorArray(colors.size());
|
||||
for (int i = 0; i < colorArray.length; i++) {
|
||||
colorArray[i] = colors.at(i);
|
||||
}
|
||||
if (resultItem != NULL && resultItem->hasTag()) {
|
||||
CompoundTag* compound =
|
||||
resultItem->getTag()->getCompound(FireworksItem::TAG_EXPLOSION);
|
||||
if (compound == NULL) {
|
||||
delete colorArray.data;
|
||||
|
||||
setResultItem(resultItem);
|
||||
return false;
|
||||
}
|
||||
compound->putIntArray(FireworksItem::TAG_E_FADECOLORS, colorArray);
|
||||
} else {
|
||||
delete colorArray.data;
|
||||
|
||||
setResultItem(resultItem);
|
||||
return false;
|
||||
}
|
||||
|
||||
setResultItem(resultItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
setResultItem(resultItem);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> FireworksRecipe::assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots) {
|
||||
ThreadStorage* tls = (ThreadStorage*)TlsGetValue(tlsIdx);
|
||||
return tls->resultItem->copy();
|
||||
// return resultItem->copy();
|
||||
}
|
||||
|
||||
int FireworksRecipe::size() { return 10; }
|
||||
|
||||
const ItemInstance* FireworksRecipe::getResultItem() {
|
||||
ThreadStorage* tls = (ThreadStorage*)TlsGetValue(tlsIdx);
|
||||
return tls->resultItem.get();
|
||||
// return resultItem.get();
|
||||
}
|
||||
|
||||
void FireworksRecipe::updatePossibleRecipes(
|
||||
std::shared_ptr<CraftingContainer> craftSlots, bool* firework, bool* charge,
|
||||
bool* fade) {
|
||||
*firework = false;
|
||||
*charge = false;
|
||||
*fade = false;
|
||||
|
||||
int paperCount = 0;
|
||||
int sulphurCount = 0;
|
||||
int colorCount = 0;
|
||||
int chargeCount = 0;
|
||||
int chargeComponents = 0;
|
||||
int typeComponents = 0;
|
||||
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) {
|
||||
std::shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == NULL) continue;
|
||||
|
||||
if (item->id == Item::gunpowder_Id) {
|
||||
sulphurCount++;
|
||||
} else if (item->id == Item::fireworksCharge_Id) {
|
||||
chargeCount++;
|
||||
} else if (item->id == Item::dye_powder_Id) {
|
||||
colorCount++;
|
||||
} else if (item->id == Item::paper_Id) {
|
||||
paperCount++;
|
||||
} else if (item->id == Item::yellowDust_Id) {
|
||||
// glowstone dust gives flickering
|
||||
chargeComponents++;
|
||||
} else if (item->id == Item::diamond_Id) {
|
||||
// diamonds give trails
|
||||
chargeComponents++;
|
||||
} else if (item->id == Item::fireball_Id) {
|
||||
// fireball gives larger explosion
|
||||
typeComponents++;
|
||||
} else if (item->id == Item::feather_Id) {
|
||||
// burst
|
||||
typeComponents++;
|
||||
} else if (item->id == Item::goldNugget_Id) {
|
||||
// star
|
||||
typeComponents++;
|
||||
} else if (item->id == Item::skull_Id) {
|
||||
// creeper
|
||||
typeComponents++;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
chargeComponents += colorCount + typeComponents;
|
||||
|
||||
if (sulphurCount > 3 || paperCount > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create fireworks
|
||||
if (paperCount <= 1 && chargeComponents == 0) {
|
||||
*firework = true;
|
||||
}
|
||||
// create firecharge
|
||||
if (sulphurCount <= 1 && colorCount >= 0 && paperCount == 0 &&
|
||||
chargeCount == 0 && typeComponents <= 1) {
|
||||
*charge = true;
|
||||
}
|
||||
// apply fade colors to firecharge
|
||||
if (sulphurCount == 0 && paperCount == 0 && chargeCount <= 1 &&
|
||||
colorCount >= 0) {
|
||||
*fade = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool FireworksRecipe::isValidIngredient(std::shared_ptr<ItemInstance> item,
|
||||
bool firework, bool charge, bool fade) {
|
||||
bool valid = false;
|
||||
switch (item->id) {
|
||||
case Item::gunpowder_Id:
|
||||
valid = firework || charge;
|
||||
break;
|
||||
case Item::fireworksCharge_Id:
|
||||
valid = firework || fade;
|
||||
break;
|
||||
case Item::dye_powder_Id:
|
||||
valid = charge || fade;
|
||||
break;
|
||||
case Item::paper_Id:
|
||||
valid = firework;
|
||||
break;
|
||||
case Item::yellowDust_Id:
|
||||
valid = charge;
|
||||
break;
|
||||
case Item::diamond_Id:
|
||||
valid = charge;
|
||||
break;
|
||||
case Item::fireball_Id:
|
||||
valid = charge;
|
||||
break;
|
||||
case Item::feather_Id:
|
||||
valid = charge;
|
||||
break;
|
||||
case Item::goldNugget_Id:
|
||||
valid = charge;
|
||||
break;
|
||||
case Item::skull_Id:
|
||||
valid = charge;
|
||||
break;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
56
Minecraft.World/Recipes/FireworksRecipe.h
Normal file
56
Minecraft.World/Recipes/FireworksRecipe.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#pragma once
|
||||
|
||||
#include "Recipy.h"
|
||||
|
||||
class FireworksRecipe : public Recipy {
|
||||
private:
|
||||
// std::shared_ptr<ItemInstance> resultItem;
|
||||
|
||||
// 4J added so we can have separate contexts and rleBuf for different
|
||||
// threads
|
||||
class ThreadStorage {
|
||||
public:
|
||||
std::shared_ptr<ItemInstance> resultItem;
|
||||
ThreadStorage();
|
||||
};
|
||||
static DWORD tlsIdx;
|
||||
static ThreadStorage* tlsDefault;
|
||||
|
||||
void setResultItem(std::shared_ptr<ItemInstance> item);
|
||||
|
||||
public:
|
||||
// Each new thread that needs to use Compression will need to call one of
|
||||
// the following 2 functions, to either create its own local storage, or
|
||||
// share the default storage already allocated by the main thread
|
||||
static void CreateNewThreadStorage();
|
||||
static void UseDefaultThreadStorage();
|
||||
static void ReleaseThreadStorage();
|
||||
|
||||
public:
|
||||
FireworksRecipe();
|
||||
|
||||
bool matches(std::shared_ptr<CraftingContainer> craftSlots, Level* level);
|
||||
std::shared_ptr<ItemInstance> assemble(
|
||||
std::shared_ptr<CraftingContainer> craftSlots);
|
||||
int size();
|
||||
const ItemInstance* getResultItem();
|
||||
|
||||
virtual const int getGroup() { return 0; }
|
||||
|
||||
// 4J-PB
|
||||
virtual bool
|
||||
requires(int iRecipe)
|
||||
{
|
||||
return false;
|
||||
};
|
||||
virtual void
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq)
|
||||
{};
|
||||
|
||||
// 4J Added
|
||||
static void updatePossibleRecipes(
|
||||
std::shared_ptr<CraftingContainer> craftSlots, bool* firework,
|
||||
bool* charge, bool* fade);
|
||||
static bool isValidIngredient(std::shared_ptr<ItemInstance> item,
|
||||
bool firework, bool charge, bool fade);
|
||||
};
|
||||
|
|
@ -13,36 +13,27 @@ void FoodRecipies::addRecipes(Recipes* r) {
|
|||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
L'#', Item::goldNugget, L'X', Item::apple, L'F');
|
||||
L'#', Item::goldIngot, L'X', Item::apple, 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->addShapedRecipy(new ItemInstance(Item::speckledMelon, 1), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"###", //
|
||||
|
||||
L'#', Item::goldNugget, L'X', Item::melon, 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');
|
||||
Tile::mushroom_brown, Tile::mushroom_red, Item::bowl,
|
||||
L'F');
|
||||
|
||||
/*r->addShapedRecipy(new ItemInstance(Item::mushroomStew), //
|
||||
L"sssctctcig",
|
||||
L"Y", //
|
||||
L"X", //
|
||||
L"#", //
|
||||
|
||||
L'X', Tile::mushroom1,
|
||||
L'Y', Tile::mushroom2,
|
||||
L'#', Item::bowl,
|
||||
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",
|
||||
|
|
@ -74,13 +65,6 @@ void FoodRecipies::addRecipes(Recipes* r) {
|
|||
r->addShapelessRecipy(new ItemInstance(Item::pumpkinPie), //
|
||||
L"tiig", Tile::pumpkin, Item::sugar, Item::egg, 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->addShapedRecipy(new ItemInstance(Item::carrotGolden, 1, 0), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
|
|
@ -90,12 +74,9 @@ void FoodRecipies::addRecipes(Recipes* r) {
|
|||
L'#', Item::goldNugget, L'X', Item::carrots, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::fermentedSpiderEye), //
|
||||
L"itig", Item::spiderEye, Tile::mushroom1,
|
||||
L"itig", Item::spiderEye, Tile::mushroom_brown,
|
||||
Item::sugar, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::speckledMelon), //
|
||||
L"iig", Item::melon, Item::goldNugget, L'F');
|
||||
|
||||
r->addShapelessRecipy(new ItemInstance(Item::blazePowder, 2), //
|
||||
L"ig", Item::blazeRod, L'F');
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,9 @@ FurnaceRecipes::FurnaceRecipes() {
|
|||
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(Tile::cobblestone_Id, new ItemInstance(Tile::stone), .1f);
|
||||
addFurnaceRecipy(Item::clay_Id, new ItemInstance(Item::brick), .3f);
|
||||
addFurnaceRecipy(Tile::clay_Id, new ItemInstance(Tile::clayHardened), .35f);
|
||||
addFurnaceRecipy(
|
||||
Tile::cactus_Id,
|
||||
new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN), .2f);
|
||||
|
|
@ -35,8 +36,7 @@ FurnaceRecipes::FurnaceRecipes() {
|
|||
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),
|
||||
addFurnaceRecipy(Tile::netherRack_Id, new ItemInstance(Item::netherbrick),
|
||||
.1f);
|
||||
|
||||
// special silk touch related recipes:
|
||||
|
|
|
|||
62
Minecraft.World/Recipes/MapCloningRecipe.h
Normal file
62
Minecraft.World/Recipes/MapCloningRecipe.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#pragma once
|
||||
|
||||
/*
|
||||
class MapCloningRecipe implements Recipy {
|
||||
@Override
|
||||
public boolean matches(CraftingContainer craftSlots, Level
|
||||
level) { int count = 0; ItemInstance source = null;
|
||||
|
||||
for (int slot = 0; slot < craftSlots.getContainerSize();
|
||||
slot++) { ItemInstance item = craftSlots.getItem(slot); if (item == null)
|
||||
continue;
|
||||
|
||||
if (item.id == Item.map.id) {
|
||||
if (source != null) return false;
|
||||
source = item;
|
||||
} else if (item.id == Item.emptyMap.id) {
|
||||
count++;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return source != null && count > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemInstance assemble(CraftingContainer craftSlots) {
|
||||
int count = 0;
|
||||
ItemInstance source = null;
|
||||
|
||||
for (int slot = 0; slot < craftSlots.getContainerSize();
|
||||
slot++) { ItemInstance item = craftSlots.getItem(slot); if (item == null)
|
||||
continue;
|
||||
|
||||
if (item.id == Item.map.id) {
|
||||
if (source != null) return null;
|
||||
source = item;
|
||||
} else if (item.id == Item.emptyMap.id) {
|
||||
count++;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (source == null || count < 1) return null;
|
||||
|
||||
ItemInstance result = new ItemInstance(Item.map, count +
|
||||
1, source.getAuxValue()); if (source.hasCustomHoverName())
|
||||
result.setHoverName(source.getHoverName()); return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemInstance getResultItem() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
*/
|
||||
48
Minecraft.World/Recipes/MapExtendingRecipe.h
Normal file
48
Minecraft.World/Recipes/MapExtendingRecipe.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#pragma once
|
||||
/*
|
||||
class MapExtendingRecipe extends ShapedRecipy {
|
||||
public MapExtendingRecipe() {
|
||||
super(3, 3, new ItemInstance[] {
|
||||
new ItemInstance(Item.paper), new
|
||||
ItemInstance(Item.paper), new ItemInstance(Item.paper), new
|
||||
ItemInstance(Item.paper), new ItemInstance(Item.map, 0, Recipes.ANY_AUX_VALUE),
|
||||
new ItemInstance(Item.paper), new ItemInstance(Item.paper), new
|
||||
ItemInstance(Item.paper), new ItemInstance(Item.paper),
|
||||
}, new ItemInstance(Item.emptyMap, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(CraftingContainer craftSlots, Level
|
||||
level) { if (!super.matches(craftSlots, level)) return false; ItemInstance map =
|
||||
null;
|
||||
|
||||
for (int i = 0; i < craftSlots.getContainerSize() && map
|
||||
== null; i++) { ItemInstance item = craftSlots.getItem(i); if (item != null &&
|
||||
item.id == Item.map.id) map = item;
|
||||
}
|
||||
|
||||
if (map == null) return false;
|
||||
MapItemSavedData data = Item.map.getSavedData(map,
|
||||
level); if (data == null) return false; return data.scale <
|
||||
MapItemSavedData.MAX_SCALE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemInstance assemble(CraftingContainer craftSlots) {
|
||||
ItemInstance map = null;
|
||||
|
||||
for (int i = 0; i < craftSlots.getContainerSize() && map
|
||||
== null; i++) { ItemInstance item = craftSlots.getItem(i); if (item != null &&
|
||||
item.id == Item.map.id) map = item;
|
||||
}
|
||||
|
||||
map = map.copy();
|
||||
map.count = 1;
|
||||
|
||||
if (map.getTag() == null) map.setTag(new CompoundTag());
|
||||
map.getTag().putBoolean("map_is_scaling", true);
|
||||
|
||||
return map;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
|
@ -1,10 +1,3 @@
|
|||
// package net.minecraft.world.item.crafting;
|
||||
//
|
||||
// import net.minecraft.world.item.DyePowderItem;
|
||||
// import net.minecraft.world.item.Item;
|
||||
// import net.minecraft.world.item.ItemInstance;
|
||||
// import net.minecraft.world.level.tile.Tile;
|
||||
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "../Headers/net.minecraft.world.item.h"
|
||||
#include "../Items/DyePowderItem.h"
|
||||
|
|
@ -13,24 +6,7 @@
|
|||
#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)
|
||||
},
|
||||
};
|
||||
*/
|
||||
|
||||
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));
|
||||
|
||||
|
|
@ -46,6 +22,15 @@ void OreRecipies::_init() {
|
|||
ADD_OBJECT(map[4], Tile::lapisBlock);
|
||||
ADD_OBJECT(map[4],
|
||||
new ItemInstance(Item::dye_powder, 9, DyePowderItem::BLUE));
|
||||
|
||||
ADD_OBJECT(map[5], Tile::redstoneBlock);
|
||||
ADD_OBJECT(map[5], new ItemInstance(Item::redStone, 9));
|
||||
|
||||
ADD_OBJECT(map[6], Tile::coalBlock);
|
||||
ADD_OBJECT(map[6], new ItemInstance(Item::coal, 9, CoalItem::STONE_COAL));
|
||||
|
||||
ADD_OBJECT(map[7], Tile::hayBlock);
|
||||
ADD_OBJECT(map[7], new ItemInstance(Item::wheat, 9));
|
||||
}
|
||||
void OreRecipies::addRecipes(Recipes* r) {
|
||||
for (int i = 0; i < MAX_ORE_RECIPES; i++) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define MAX_ORE_RECIPES 5
|
||||
#define MAX_ORE_RECIPES 8
|
||||
|
||||
class OreRecipies {
|
||||
public:
|
||||
|
|
@ -9,7 +9,7 @@ public:
|
|||
OreRecipies() { _init(); }
|
||||
|
||||
private:
|
||||
std::vector<Object*>* map;
|
||||
std::vector<Object*> map[MAX_ORE_RECIPES];
|
||||
|
||||
public:
|
||||
void addRecipes(Recipes* r);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,3 @@
|
|||
/*package net.minecraft.world.Item::crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.Item::CoalItem;
|
||||
import net.minecraft.world.Item::Item;
|
||||
import net.minecraft.world.Item::ItemInstance;
|
||||
import net.minecraft.world.level.Tile::StoneSlabTile;
|
||||
import net.minecraft.world.level.Tile::Tile;*/
|
||||
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "../Containers/Container.h"
|
||||
#include "../Containers/AbstractContainerMenu.h"
|
||||
|
|
@ -32,6 +16,7 @@ OreRecipies* Recipes::pOreRecipies = NULL;
|
|||
StructureRecipies* Recipes::pStructureRecipies = NULL;
|
||||
ToolRecipies* Recipes::pToolRecipies = NULL;
|
||||
WeaponRecipies* Recipes::pWeaponRecipies = NULL;
|
||||
FireworksRecipe* Recipes::pFireworksRecipes = NULL;
|
||||
|
||||
void Recipes::staticCtor() { Recipes::instance = new Recipes(); }
|
||||
|
||||
|
|
@ -54,6 +39,10 @@ Recipes::Recipes() {
|
|||
|
||||
// 4J Stu - These just don't work with our crafting menu
|
||||
// recipies->push_back(new ArmorDyeRecipe());
|
||||
// recipies->add(new MapCloningRecipe());
|
||||
// recipies->add(new MapExtendingRecipe());
|
||||
// recipies->add(new FireworksRecipe());
|
||||
pFireworksRecipes = new FireworksRecipe();
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::wood, 4, 0), //
|
||||
L"sczg",
|
||||
|
|
@ -102,7 +91,7 @@ Recipes::Recipes() {
|
|||
L"ssctctg",
|
||||
L"###", //
|
||||
L"XXX", //
|
||||
L'#', Tile::cloth, L'X', Tile::wood, L'S');
|
||||
L'#', Tile::wool, L'X', Tile::wood, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::enchantTable, 1), //
|
||||
L"sssctcicig",
|
||||
|
|
@ -164,7 +153,7 @@ Recipes::Recipes() {
|
|||
L"###", //
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'S');
|
||||
L'#', Tile::cobblestone, L'S');
|
||||
|
||||
addShapedRecipy(
|
||||
new ItemInstance(Tile::cobbleWall, 6, WallTile::TYPE_MOSSY), //
|
||||
|
|
@ -172,7 +161,7 @@ Recipes::Recipes() {
|
|||
L"###", //
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::mossStone, L'S');
|
||||
L'#', Tile::mossyCobblestone, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::door_wood, 1), //
|
||||
L"sssctg",
|
||||
|
|
@ -210,7 +199,7 @@ Recipes::Recipes() {
|
|||
L"## ", //
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'S');
|
||||
L'#', Tile::cobblestone, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::stairs_bricks, 4), //
|
||||
L"sssctg",
|
||||
|
|
@ -226,7 +215,7 @@ Recipes::Recipes() {
|
|||
L"## ", //
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrickSmooth, L'S');
|
||||
L'#', Tile::cobblestone, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::stairs_netherBricks, 4), //
|
||||
L"sssctg",
|
||||
|
|
@ -291,6 +280,12 @@ Recipes::Recipes() {
|
|||
|
||||
L'#', Item::snowBall, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::topSnow, 6), //
|
||||
L"sctg",
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::snow, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::clay, 1), //
|
||||
L"sscig",
|
||||
L"##", //
|
||||
|
|
@ -305,7 +300,7 @@ Recipes::Recipes() {
|
|||
|
||||
L'#', Item::brick, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::cloth, 1), //
|
||||
addShapedRecipy(new ItemInstance(Tile::wool, 1), //
|
||||
L"sscig",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
|
@ -318,7 +313,7 @@ Recipes::Recipes() {
|
|||
L"#X#", //
|
||||
L"X#X", //
|
||||
|
||||
L'X', Item::sulphur, //
|
||||
L'X', Item::gunpowder, //
|
||||
L'#', Tile::sand, L'T');
|
||||
|
||||
addShapedRecipy(
|
||||
|
|
@ -333,13 +328,13 @@ Recipes::Recipes() {
|
|||
L"sctg",
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::rock, L'S');
|
||||
L'#', Tile::stone, L'S');
|
||||
addShapedRecipy(new ItemInstance(Tile::stoneSlabHalf, 6,
|
||||
StoneSlabTile::COBBLESTONE_SLAB), //
|
||||
L"sctg",
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'S');
|
||||
L'#', Tile::cobblestone, L'S');
|
||||
|
||||
addShapedRecipy(
|
||||
new ItemInstance(Tile::stoneSlabHalf, 6, StoneSlabTile::BRICK_SLAB), //
|
||||
|
|
@ -353,7 +348,7 @@ Recipes::Recipes() {
|
|||
L"sctg",
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrickSmooth, L'S');
|
||||
L'#', Tile::stoneBrick, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::stoneSlabHalf, 6,
|
||||
StoneSlabTile::NETHERBRICK_SLAB), //
|
||||
|
|
@ -405,8 +400,8 @@ Recipes::Recipes() {
|
|||
L"BEB", //
|
||||
L"CCC", //
|
||||
|
||||
L'A', Item::milk, //
|
||||
L'B', Item::sugar, //
|
||||
L'A', Item::bucket_milk, //
|
||||
L'B', Item::sugar, //
|
||||
L'C', Item::wheat, L'E', Item::egg, L'F');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::sugar, 1), //
|
||||
|
|
@ -434,6 +429,16 @@ Recipes::Recipes() {
|
|||
L'R', Item::redStone, //
|
||||
L'#', Item::stick, L'V');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::activatorRail, 6), //
|
||||
L"ssscictcig",
|
||||
L"XSX", //
|
||||
L"X#X", //
|
||||
L"XSX", //
|
||||
|
||||
L'X', Item::ironIngot, //
|
||||
L'#', Tile::redstoneTorch_on, //
|
||||
L'S', Item::stick, L'V');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::detectorRail, 6), //
|
||||
L"ssscicictg",
|
||||
L"X X", //
|
||||
|
|
@ -465,6 +470,20 @@ Recipes::Recipes() {
|
|||
|
||||
L'A', Tile::furnace, L'B', Item::minecart, L'V');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::minecart_tnt, 1), //
|
||||
L"ssctcig",
|
||||
L"A", //
|
||||
L"B", //
|
||||
|
||||
L'A', Tile::tnt, L'B', Item::minecart, L'V');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::minecart_hopper, 1), //
|
||||
L"ssctcig",
|
||||
L"A", //
|
||||
L"B", //
|
||||
|
||||
L'A', Tile::hopper, L'B', Item::minecart, L'V');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::boat, 1), //
|
||||
L"ssctg",
|
||||
L"# #", //
|
||||
|
|
@ -564,13 +583,14 @@ Recipes::Recipes() {
|
|||
L'#', Item::stick, L'T');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::torch, 4), //
|
||||
L"sscicig",
|
||||
L"X", //
|
||||
L"#", //
|
||||
L'X', Item::coal, //
|
||||
L"ssczcig",
|
||||
L"X", //
|
||||
L"#", //
|
||||
L'X',
|
||||
new ItemInstance(Item::coal, 1, CoalItem::STONE_COAL), //
|
||||
L'#', Item::stick, L'T');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::lightGem, 1), //
|
||||
addShapedRecipy(new ItemInstance(Tile::glowstone, 1), //
|
||||
L"sscig",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
|
@ -589,7 +609,7 @@ Recipes::Recipes() {
|
|||
L"X", //
|
||||
L"#", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'X', Item::stick, L'M');
|
||||
L'#', Tile::cobblestone, L'X', Item::stick, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::tripWireSource, 2), //
|
||||
L"sssctcicig",
|
||||
|
|
@ -600,20 +620,42 @@ Recipes::Recipes() {
|
|||
L'#', Tile::wood, L'S', Item::stick, L'I', Item::ironIngot,
|
||||
L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::notGate_on, 1), //
|
||||
addShapedRecipy(new ItemInstance(Tile::redstoneTorch_on, 1), //
|
||||
L"sscicig",
|
||||
L"X", //
|
||||
L"#", //
|
||||
|
||||
L'#', Item::stick, L'X', Item::redStone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::diode, 1), //
|
||||
addShapedRecipy(new ItemInstance(Item::repeater, 1), //
|
||||
L"ssctcictg",
|
||||
L"#X#", //
|
||||
L"III", //
|
||||
|
||||
L'#', Tile::notGate_on, L'X', Item::redStone, L'I',
|
||||
Tile::rock, L'M');
|
||||
L'#', Tile::redstoneTorch_on, L'X', Item::redStone, L'I',
|
||||
Tile::stone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::comparator, 1), //
|
||||
L"sssctcictg",
|
||||
L" # ", //
|
||||
L"#X#", //
|
||||
L"III", //
|
||||
|
||||
L'#', Tile::redstoneTorch_on, L'X', Item::netherQuartz,
|
||||
L'I', Tile::stone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::daylightDetector), L"sssctcictg",
|
||||
L"GGG", L"QQQ", L"WWW",
|
||||
|
||||
L'G', Tile::glass, L'Q', Item::netherQuartz, L'W',
|
||||
Tile::woodSlabHalf, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::hopper), L"ssscictg",
|
||||
L"I I", //
|
||||
L"ICI", //
|
||||
L" I ", //
|
||||
|
||||
L'I', Item::ironIngot, L'C', Tile::chest, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::clock, 1), //
|
||||
L"ssscicig",
|
||||
|
|
@ -626,14 +668,22 @@ Recipes::Recipes() {
|
|||
L"iig", Item::enderPearl, Item::blazePowder, L'T');
|
||||
|
||||
addShapelessRecipy(new ItemInstance(Item::fireball, 3), //
|
||||
L"iiig", Item::sulphur, Item::blazePowder, Item::coal,
|
||||
L"iiig", Item::gunpowder, Item::blazePowder, Item::coal,
|
||||
L'T');
|
||||
|
||||
addShapelessRecipy(new ItemInstance(Item::fireball, 3), //
|
||||
L"iizg", Item::sulphur, Item::blazePowder,
|
||||
L"iizg", Item::gunpowder, Item::blazePowder,
|
||||
new ItemInstance(Item::coal, 1, CoalItem::CHAR_COAL),
|
||||
L'T');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::lead, 2), //
|
||||
L"ssscicig",
|
||||
L"~~ ", //
|
||||
L"~O ", //
|
||||
L" ~", //
|
||||
|
||||
L'~', Item::string, L'O', Item::slimeBall, L'T');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::compass, 1), //
|
||||
L"ssscicig",
|
||||
L" # ", //
|
||||
|
|
@ -642,7 +692,6 @@ Recipes::Recipes() {
|
|||
|
||||
L'#', Item::ironIngot, L'X', Item::redStone, L'T');
|
||||
|
||||
// 4J-PB Added a MapItem init
|
||||
addShapedRecipy(new ItemInstance(Item::map, 1), //
|
||||
L"ssscicig",
|
||||
L"###", //
|
||||
|
|
@ -654,13 +703,13 @@ Recipes::Recipes() {
|
|||
addShapedRecipy(new ItemInstance(Tile::button, 1), //
|
||||
L"sctg",
|
||||
L"#", //
|
||||
// L"#", //
|
||||
L'#', Tile::rock, L'M');
|
||||
|
||||
L'#', Tile::stone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::button_wood, 1), //
|
||||
L"sctg",
|
||||
L"#", //
|
||||
// L"#", //
|
||||
|
||||
L'#', Tile::wood, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::pressurePlate_wood, 1), //
|
||||
|
|
@ -671,16 +720,36 @@ Recipes::Recipes() {
|
|||
addShapedRecipy(new ItemInstance(Tile::pressurePlate_stone, 1), //
|
||||
L"sctg",
|
||||
L"##", //
|
||||
L'#', Tile::rock, L'M');
|
||||
L'#', Tile::stone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::weightedPlate_heavy, 1), //
|
||||
L"scig",
|
||||
L"##", //
|
||||
|
||||
L'#', Item::ironIngot, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::weightedPlate_light, 1), //
|
||||
L"scig",
|
||||
L"##", //
|
||||
|
||||
L'#', Item::goldIngot, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::dispenser, 1), //
|
||||
L"sssctcicig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
L"#R#", //
|
||||
L'#', Tile::stoneBrick, L'X', Item::bow, L'R',
|
||||
L'#', Tile::cobblestone, L'X', Item::bow, L'R',
|
||||
Item::redStone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::dropper, 1), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"# #", //
|
||||
L"#R#", //
|
||||
|
||||
L'#', Tile::cobblestone, L'R', Item::redStone, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::cauldron, 1), //
|
||||
L"ssscig",
|
||||
L"# #", //
|
||||
|
|
@ -694,7 +763,7 @@ Recipes::Recipes() {
|
|||
L" B ", //
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'B', Item::blazeRod, L'S');
|
||||
L'#', Tile::cobblestone, L'B', Item::blazeRod, L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::litPumpkin, 1), //
|
||||
L"ssctctg",
|
||||
|
|
@ -703,7 +772,7 @@ Recipes::Recipes() {
|
|||
|
||||
L'A', Tile::pumpkin, L'B', Tile::torch, L'T');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::recordPlayer, 1), //
|
||||
addShapedRecipy(new ItemInstance(Tile::jukebox, 1), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
|
|
@ -724,7 +793,7 @@ Recipes::Recipes() {
|
|||
// Item.book, new ItemInstance(Item.dye_powder, 1,
|
||||
// DyePowderItem.BLACK), Item.feather);
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::musicBlock, 1), //
|
||||
addShapedRecipy(new ItemInstance(Tile::noteblock, 1), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
L"#X#", //
|
||||
|
|
@ -746,7 +815,7 @@ Recipes::Recipes() {
|
|||
L"#X#", //
|
||||
L"###", //
|
||||
|
||||
L'#', Item::stick, L'X', Tile::cloth, L'D');
|
||||
L'#', Item::stick, L'X', Tile::wool, L'D');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::frame, 1), //
|
||||
L"ssscicig",
|
||||
|
|
@ -787,7 +856,7 @@ Recipes::Recipes() {
|
|||
L"#X#", //
|
||||
L"#R#", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'X', Item::ironIngot, L'R',
|
||||
L'#', Tile::cobblestone, L'X', Item::ironIngot, L'R',
|
||||
Item::redStone, L'T', Tile::wood, L'M');
|
||||
|
||||
addShapedRecipy(new ItemInstance((Tile*)Tile::pistonStickyBase, 1), //
|
||||
|
|
@ -797,6 +866,29 @@ Recipes::Recipes() {
|
|||
|
||||
L'S', Item::slimeBall, L'P', Tile::pistonBase, L'M');
|
||||
|
||||
// 4J Stu - Added some dummy firework recipes to allow us to navigate
|
||||
// forward to the fireworks scene
|
||||
addShapedRecipy(new ItemInstance(Item::fireworks, 1), //
|
||||
L"sscicig",
|
||||
L" P ", //
|
||||
L" G ", //
|
||||
|
||||
L'P', Item::paper, L'G', Item::gunpowder, L'D');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::fireworksCharge, 1), //
|
||||
L"sscicig",
|
||||
L" D ", //
|
||||
L" G ", //
|
||||
|
||||
L'D', Item::dye_powder, L'G', Item::gunpowder, L'D');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::fireworksCharge, 1), //
|
||||
L"sscicig",
|
||||
L" D ", //
|
||||
L" C ", //
|
||||
|
||||
L'D', Item::dye_powder, L'C', Item::fireworksCharge, L'D');
|
||||
|
||||
// Sort so the largest recipes get checked first!
|
||||
/* 4J-PB - TODO
|
||||
Collections.sort(recipies, new Comparator<Recipy>()
|
||||
|
|
@ -899,7 +991,7 @@ ShapedRecipy* Recipes::addShapedRecipy(ItemInstance* result, ...) {
|
|||
|
||||
break;
|
||||
case L'c':
|
||||
wchFrom = (wchar_t)va_arg(vl, int);
|
||||
wchFrom = va_arg(vl, wchar_t);
|
||||
break;
|
||||
case L'z':
|
||||
pItemInstance = va_arg(vl, ItemInstance*);
|
||||
|
|
@ -907,7 +999,7 @@ ShapedRecipy* Recipes::addShapedRecipy(ItemInstance* result, ...) {
|
|||
break;
|
||||
case L'i':
|
||||
pItem = va_arg(vl, Item*);
|
||||
pItemInstance = new ItemInstance(pItem);
|
||||
pItemInstance = new ItemInstance(pItem, 1, ANY_AUX_VALUE);
|
||||
mappings->insert(myMap::value_type(wchFrom, pItemInstance));
|
||||
break;
|
||||
case L't':
|
||||
|
|
@ -916,7 +1008,7 @@ ShapedRecipy* Recipes::addShapedRecipy(ItemInstance* result, ...) {
|
|||
mappings->insert(myMap::value_type(wchFrom, pItemInstance));
|
||||
break;
|
||||
case L'g':
|
||||
wchFrom = (wchar_t)va_arg(vl, int);
|
||||
wchFrom = va_arg(vl, wchar_t);
|
||||
switch (wchFrom) {
|
||||
// case L'W':
|
||||
// group=ShapedRecipy::eGroupType_Weapon;
|
||||
|
|
@ -1004,7 +1096,7 @@ void Recipes::addShapelessRecipy(ItemInstance* result, ...) {
|
|||
ingredients->push_back(new ItemInstance(pTile));
|
||||
break;
|
||||
case L'g':
|
||||
wchFrom = (wchar_t)va_arg(vl, int);
|
||||
wchFrom = va_arg(vl, wchar_t);
|
||||
switch (wchFrom) {
|
||||
case L'T':
|
||||
group = Recipy::eGroupType_Tool;
|
||||
|
|
@ -1037,7 +1129,8 @@ void Recipes::addShapelessRecipy(ItemInstance* result, ...) {
|
|||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> Recipes::getItemFor(
|
||||
std::shared_ptr<CraftingContainer> craftSlots, Level* level) {
|
||||
std::shared_ptr<CraftingContainer> craftSlots, Level* level,
|
||||
Recipy* recipesClass /*= NULL*/) {
|
||||
int count = 0;
|
||||
std::shared_ptr<ItemInstance> first = nullptr;
|
||||
std::shared_ptr<ItemInstance> second = nullptr;
|
||||
|
|
@ -1063,10 +1156,15 @@ std::shared_ptr<ItemInstance> Recipes::getItemFor(
|
|||
new ItemInstance(first->id, 1, resultDamage));
|
||||
}
|
||||
|
||||
AUTO_VAR(itEnd, recipies->end());
|
||||
for (AUTO_VAR(it, recipies->begin()); it != itEnd; it++) {
|
||||
Recipy* r = *it; // recipies->at(i);
|
||||
if (r->matches(craftSlots, level)) return r->assemble(craftSlots);
|
||||
if (recipesClass != NULL) {
|
||||
if (recipesClass->matches(craftSlots, level))
|
||||
return recipesClass->assemble(craftSlots);
|
||||
} else {
|
||||
AUTO_VAR(itEnd, recipies->end());
|
||||
for (AUTO_VAR(it, recipies->begin()); it != itEnd; it++) {
|
||||
Recipy* r = *it; // recipies->at(i);
|
||||
if (r->matches(craftSlots, level)) return r->assemble(craftSlots);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -1092,7 +1190,7 @@ void Recipes::buildRecipeIngredientsArray(void) {
|
|||
Recipy* recipe = *it;
|
||||
// wprintf(L"RECIPE - [%d] is
|
||||
// %w\n",iCount,recipe->getResultItem()->getItem()->getName());
|
||||
recipe->collectRequirements(&m_pRecipeIngredientsRequired[iCount++]);
|
||||
recipe->requires(&m_pRecipeIngredientsRequired[iCount++]);
|
||||
}
|
||||
|
||||
// printf("Total recipes in buildRecipeIngredientsArray - %d",iCount);
|
||||
|
|
@ -1100,4 +1198,4 @@ void Recipes::buildRecipeIngredientsArray(void) {
|
|||
|
||||
Recipy::INGREDIENTS_REQUIRED* Recipes::getRecipeIngredientsArray(void) {
|
||||
return m_pRecipeIngredientsRequired;
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ class StructureRecipies;
|
|||
class ToolRecipies;
|
||||
class WeaponRecipies;
|
||||
class ShapedRecipy;
|
||||
class FireworksRecipe;
|
||||
|
||||
typedef std::unordered_map<wchar_t, ItemInstance*> myMap;
|
||||
|
||||
|
|
@ -98,7 +99,8 @@ public:
|
|||
void addShapelessRecipy(ItemInstance* result, ...);
|
||||
|
||||
std::shared_ptr<ItemInstance> getItemFor(
|
||||
std::shared_ptr<CraftingContainer> craftSlots, Level* level);
|
||||
std::shared_ptr<CraftingContainer> craftSlots, Level* level,
|
||||
Recipy* recipesClass = NULL); // 4J Added recipesClass param
|
||||
std::vector<Recipy*>* getRecipies();
|
||||
|
||||
// 4J-PB - Added all below for new Xbox 'crafting'
|
||||
|
|
@ -109,6 +111,7 @@ private:
|
|||
void buildRecipeIngredientsArray();
|
||||
Recipy::INGREDIENTS_REQUIRED* m_pRecipeIngredientsRequired;
|
||||
|
||||
public:
|
||||
static ToolRecipies* pToolRecipies;
|
||||
static WeaponRecipies* pWeaponRecipies;
|
||||
static StructureRecipies* pStructureRecipies;
|
||||
|
|
@ -116,4 +119,5 @@ private:
|
|||
static FoodRecipies* pFoodRecipies;
|
||||
static ClothDyeRecipes* pClothDyeRecipes;
|
||||
static ArmorRecipes* pArmorRecipes;
|
||||
static FireworksRecipe* pFireworksRecipes;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ public:
|
|||
|
||||
// 4J-PB
|
||||
virtual bool
|
||||
requiresRecipe(int iRecipe)
|
||||
requires(int iRecipe)
|
||||
= 0;
|
||||
virtual void
|
||||
collectRequirements(INGREDIENTS_REQUIRED* pIngReq)
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq)
|
||||
= 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ std::shared_ptr<ItemInstance> ShapedRecipy::assemble(
|
|||
int ShapedRecipy::size() { return width * height; }
|
||||
|
||||
// 4J-PB
|
||||
bool ShapedRecipy::requiresRecipe(int iRecipe) {
|
||||
bool ShapedRecipy::requires(int iRecipe) {
|
||||
app.DebugPrintf("ShapedRecipy %d\n", iRecipe);
|
||||
int iCount = 0;
|
||||
for (int x = 0; x < 3; x++) {
|
||||
|
|
@ -109,7 +109,7 @@ bool ShapedRecipy::requiresRecipe(int iRecipe) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ShapedRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
void ShapedRecipy::requires(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
// printf("ShapedRecipy %d\n",iRecipe);
|
||||
|
||||
int iCount = 0;
|
||||
|
|
@ -120,14 +120,11 @@ void ShapedRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
|||
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);
|
||||
|
|
@ -140,10 +137,8 @@ void ShapedRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
|||
|
||||
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;
|
||||
TempIngReq.uiGridA[x + y * 3] = expected->id | iAuxVal
|
||||
<< 24;
|
||||
|
||||
bFound = false;
|
||||
for (j = 0; j < TempIngReq.iIngC; j++) {
|
||||
|
|
@ -204,4 +199,4 @@ ShapedRecipy*
|
|||
ShapedRecipy::keepTag() {
|
||||
_keepTag = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
// 4J-PB - to return the items required to make a recipe
|
||||
virtual bool
|
||||
requiresRecipe(int iRecipe);
|
||||
requires(int iRecipe);
|
||||
virtual void
|
||||
collectRequirements(INGREDIENTS_REQUIRED* pIngReq);
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ std::shared_ptr<ItemInstance> ShapelessRecipy::assemble(
|
|||
int ShapelessRecipy::size() { return (int)ingredients->size(); }
|
||||
|
||||
// 4J-PB
|
||||
bool ShapelessRecipy::requiresRecipe(int iRecipe) {
|
||||
bool ShapelessRecipy::requires(int iRecipe) {
|
||||
std::vector<ItemInstance*>* tempList = new std::vector<ItemInstance*>;
|
||||
|
||||
*tempList = *ingredients;
|
||||
|
|
@ -87,7 +87,7 @@ bool ShapelessRecipy::requiresRecipe(int iRecipe) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ShapelessRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
void ShapelessRecipy::requires(INGREDIENTS_REQUIRED* pIngReq) {
|
||||
int iCount = 0;
|
||||
bool bFound;
|
||||
int j;
|
||||
|
|
@ -116,9 +116,7 @@ void ShapelessRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
|||
|
||||
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;
|
||||
TempIngReq.uiGridA[iCount++] = expected->id | 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;
|
||||
|
|
@ -168,4 +166,4 @@ void ShapelessRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
|||
delete[] TempIngReq.iIngValA;
|
||||
delete[] TempIngReq.iIngAuxValA;
|
||||
delete[] TempIngReq.uiGridA;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
// 4J-PB - to return the items required to make a recipe
|
||||
virtual bool
|
||||
requiresRecipe(int iRecipe);
|
||||
requires(int iRecipe);
|
||||
virtual void
|
||||
collectRequirements(INGREDIENTS_REQUIRED* pIngReq);
|
||||
requires(INGREDIENTS_REQUIRED* pIngReq);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void StructureRecipies::addRecipes(Recipes* r) {
|
|||
L"# #", //
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stoneBrick, L'S');
|
||||
L'#', Tile::cobblestone, L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance((Tile*)Tile::chest), //
|
||||
L"sssctg",
|
||||
|
|
@ -80,6 +80,12 @@ void StructureRecipies::addRecipes(Recipes* r) {
|
|||
|
||||
L'#', Tile::wood, L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::chest_trap), //
|
||||
L"sctctg",
|
||||
L"#-", //
|
||||
|
||||
L'#', Tile::chest, L'-', Tile::tripWireSource, L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::enderChest), //
|
||||
L"sssctcig",
|
||||
L"###", //
|
||||
|
|
@ -88,12 +94,12 @@ void StructureRecipies::addRecipes(Recipes* r) {
|
|||
|
||||
L'#', Tile::obsidian, L'E', Item::eyeOfEnder, L'S');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stoneBrickSmooth, 4), //
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stoneBrick, 4), //
|
||||
L"ssctg",
|
||||
L"##", //
|
||||
L"##", //
|
||||
|
||||
L'#', Tile::rock, L'S');
|
||||
L'#', Tile::stone, L'S');
|
||||
|
||||
// 4J Stu - Move this into "Recipes" to change the order things are
|
||||
// displayed on the crafting menu
|
||||
|
|
@ -124,5 +130,14 @@ void StructureRecipies::addRecipes(Recipes* r) {
|
|||
L" R ", //
|
||||
L"RGR", //
|
||||
L" R ", //
|
||||
L'R', Item::redStone, 'G', Tile::lightGem, L'M');
|
||||
L'R', Item::redStone, 'G', Tile::glowstone, L'M');
|
||||
|
||||
r->addShapedRecipy(new ItemInstance(Tile::beacon, 1), //
|
||||
L"sssctcictg",
|
||||
L"GGG", //
|
||||
L"GSG", //
|
||||
L"OOO", //
|
||||
|
||||
L'G', Tile::glass, L'S', Item::netherStar, L'O',
|
||||
Tile::obsidian, L'M');
|
||||
}
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// package net.minecraft.world.item.crafting;
|
||||
|
||||
// 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"
|
||||
|
|
@ -28,25 +24,11 @@ std::wstring ToolRecipies::shapes[][4] = {
|
|||
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))
|
||||
|
||||
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], Tile::cobblestone);
|
||||
ADD_OBJECT(map[0], Item::ironIngot);
|
||||
ADD_OBJECT(map[0], Item::diamond);
|
||||
ADD_OBJECT(map[0], Item::goldIngot);
|
||||
|
|
|
|||
|
|
@ -13,19 +13,11 @@ std::wstring WeaponRecipies::shapes[][4] = {
|
|||
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},
|
||||
};
|
||||
*/
|
||||
|
||||
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], Tile::cobblestone);
|
||||
ADD_OBJECT(map[0], Item::ironIngot);
|
||||
ADD_OBJECT(map[0], Item::diamond);
|
||||
ADD_OBJECT(map[0], Item::goldIngot);
|
||||
|
|
|
|||
Loading…
Reference in a new issue