mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-21 17:23:56 +01:00
another crafting table backup point
This commit is contained in:
1 parent
350ada405f
commit
e010da4376
15 files changed
+1752
-852
No files matched your search
@@ -11,59 +11,48 @@
|
||||
|
||||
const BannerPatternRecipe::PatternInfo BannerPatternRecipe::PATTERNS[] =
|
||||
{
|
||||
{ L"bl", {" ", " ", "# "}, 0, -1 },
|
||||
{ L"br", {" ", " ", " #"}, 0, -1 },
|
||||
{ L"tl", {"# ", " ", " "}, 0, -1 },
|
||||
{ L"tr", {" #", " ", " "}, 0, -1 },
|
||||
{ L"bs", {" ", " ", "###"}, 0, -1 },
|
||||
{ L"ts", {"###", " ", " "}, 0, -1 },
|
||||
{ L"ls", {"# ", "# ", "# "}, 0, -1 },
|
||||
{ L"rs", {" #", " #", " #"}, 0, -1 },
|
||||
{ L"cs", {" # ", " # ", " # "}, 0, -1 },
|
||||
{ L"ms", {" ", "###", " "}, 0, -1 },
|
||||
{ L"drs", {"# ", " # ", " #"}, 0, -1 },
|
||||
{ L"dls", {" #", " # ", "# "}, 0, -1 },
|
||||
{ L"ss", {"# #", "# #", " "}, 0, -1 },
|
||||
{ L"cr", {"# #", " # ", "# #"}, 0, -1 },
|
||||
{ L"sc", {" # ", "###", " # "}, 0, -1 },
|
||||
{ L"bt", {" ", " # ", "# #"}, 0, -1 },
|
||||
{ L"tt", {"# #", " # ", " "}, 0, -1 },
|
||||
{ L"bts", {" ", "# #", " # "}, 0, -1 },
|
||||
{ L"tts", {" # ", "# #", " "}, 0, -1 },
|
||||
{ L"ld", {"## ", "# ", " "}, 0, -1 },
|
||||
{ L"rd", {" ", " #", " ##"}, 0, -1 },
|
||||
{ L"lud", {" ", "# ", "## "}, 0, -1 },
|
||||
{ L"rud", {" ##", " #", " "}, 0, -1 },
|
||||
{ L"mc", {" ", " # ", " "}, 0, -1 },
|
||||
{ L"mr", {" # ", "# #", " # "}, 0, -1 },
|
||||
{ L"vh", {"## ", "## ", "## "}, 0, -1 },
|
||||
{ L"hh", {"###", "###", " "}, 0, -1 },
|
||||
{ L"vhr", {" ##", " ##", " ##"}, 0, -1 },
|
||||
{ L"hhb", {" ", "###", "###"}, 0, -1 },
|
||||
{ L"bo", {"###", "# #", "###"}, 0, -1 },
|
||||
{ L"gra", {"# #", " # ", " # "}, 0, -1 },
|
||||
{ L"gru", {" # ", " # ", "# #"}, 0, -1 },
|
||||
{ L"cbo", {nullptr, nullptr, nullptr}, Tile::vine_Id, -1 },
|
||||
{ L"bri", {nullptr, nullptr, nullptr}, Tile::brick_block_Id, -1 },
|
||||
{ L"cre", {nullptr, nullptr, nullptr}, Item::skull_Id, 4 },
|
||||
{ L"sku", {nullptr, nullptr, nullptr}, Item::skull_Id, 1 },
|
||||
{ L"flo", {nullptr, nullptr, nullptr}, Tile::red_flower_Id, Rose::OXEYE_DAISY },
|
||||
{ L"moj", {nullptr, nullptr, nullptr}, Item::golden_apple_Id, 1 },
|
||||
{ L"bl", {" ", " ", "# "}, 0, -1 }, // 0
|
||||
{ L"br", {" ", " ", " #"}, 0, -1 }, // 1
|
||||
{ L"tl", {"# ", " ", " "}, 0, -1 }, // 2
|
||||
{ L"tr", {" #", " ", " "}, 0, -1 }, // 3
|
||||
{ L"bs", {" ", " ", "###"}, 0, -1 }, // 4
|
||||
{ L"ts", {"###", " ", " "}, 0, -1 }, // 5
|
||||
{ L"ls", {"# ", "# ", "# "}, 0, -1 }, // 6
|
||||
{ L"rs", {" #", " #", " #"}, 0, -1 }, // 7
|
||||
{ L"cs", {" # ", " # ", " # "}, 0, -1 }, // 8
|
||||
{ L"ms", {" ", "###", " "}, 0, -1 }, // 9
|
||||
{ L"drs", {"# ", " # ", " #"}, 0, -1 }, // 10
|
||||
{ L"dls", {" #", " # ", "# "}, 0, -1 }, // 11
|
||||
{ L"ss", {"# #", "# #", " "}, 0, -1 }, // 12
|
||||
{ L"cr", {"# #", " # ", "# #"}, 0, -1 }, // 13
|
||||
{ L"sc", {" # ", "###", " # "}, 0, -1 }, // 14
|
||||
{ L"bt", {" ", " # ", "# #"}, 0, -1 }, // 15
|
||||
{ L"tt", {"# #", " # ", " "}, 0, -1 }, // 16
|
||||
{ L"bts", {" ", "# #", " # "}, 0, -1 }, // 17
|
||||
{ L"tts", {" # ", "# #", " "}, 0, -1 }, // 18
|
||||
{ L"ld", {"## ", "# ", " "}, 0, -1 }, // 19
|
||||
{ L"rd", {" ", " #", " ##"}, 0, -1 }, // 20
|
||||
{ L"lud", {" ", "# ", "## "}, 0, -1 }, // 21
|
||||
{ L"rud", {" ##", " #", " "}, 0, -1 }, // 22
|
||||
{ L"mc", {" ", " # ", " "}, 0, -1 }, // 23
|
||||
{ L"mr", {" # ", "# #", " # "}, 0, -1 }, // 24
|
||||
{ L"vh", {"## ", "## ", "## "}, 0, -1 }, // 25
|
||||
{ L"hh", {"###", "###", " "}, 0, -1 }, // 26
|
||||
{ L"vhr", {" ##", " ##", " ##"}, 0, -1 }, // 27
|
||||
{ L"hhb", {" ", "###", "###"}, 0, -1 }, // 28
|
||||
{ L"bo", {"###", "# #", "###"}, 0, -1 }, // 29
|
||||
{ L"gra", {"# #", " # ", " # "}, 0, -1 }, // 30
|
||||
{ L"gru", {" # ", " # ", "# #"}, 0, -1 }, // 31
|
||||
{ L"cbo", {nullptr, nullptr, nullptr}, Tile::vine_Id, -1 }, // 32
|
||||
{ L"bri", {nullptr, nullptr, nullptr}, Tile::brick_block_Id, -1 }, // 33
|
||||
{ L"cre", {nullptr, nullptr, nullptr}, Item::skull_Id, 4 }, // 34
|
||||
{ L"sku", {nullptr, nullptr, nullptr}, Item::skull_Id, 1 }, // 35
|
||||
{ L"flo", {nullptr, nullptr, nullptr}, Tile::red_flower_Id, Rose::OXEYE_DAISY }, // 36
|
||||
{ L"moj", {nullptr, nullptr, nullptr}, Item::golden_apple_Id, 1 }, // 37
|
||||
};
|
||||
|
||||
const int BannerPatternRecipe::PATTERN_COUNT = static_cast<int>(sizeof(PATTERNS) / sizeof(PATTERNS[0]));
|
||||
|
||||
int BannerPatternRecipe::getBannerPatternCount(shared_ptr<ItemInstance> banner)
|
||||
{
|
||||
if (!banner->hasTag()) return 0;
|
||||
CompoundTag* tag = banner->getTag();
|
||||
if (!tag->contains(L"BlockEntityTag", Tag::TAG_Compound)) return 0;
|
||||
CompoundTag* bet = tag->getCompound(L"BlockEntityTag");
|
||||
if (!bet->contains(L"Patterns")) return 0;
|
||||
ListTag<Tag>* list = bet->getList(L"Patterns");
|
||||
return list ? list->size() : 0;
|
||||
}
|
||||
|
||||
const wchar_t* BannerPatternRecipe::matchPattern(shared_ptr<CraftingContainer> craftSlots, int& outDyeColor)
|
||||
{
|
||||
int slots = craftSlots->getContainerSize();
|
||||
@@ -265,3 +254,105 @@ void BannerPatternRecipe::writeToStream(DataOutputStream* dos)
|
||||
{
|
||||
dos->writeByte(99);
|
||||
}
|
||||
|
||||
void BannerPatternRecipe::addBannerPattern(shared_ptr<ItemInstance>& banner, const wchar_t* patternId, char dyeColor) {
|
||||
if (banner == nullptr || patternId == nullptr) return;
|
||||
if (getBannerPatternCount(banner) >= 6) return;
|
||||
|
||||
if (!banner->hasTag()) banner->setTag(new CompoundTag());
|
||||
CompoundTag* tag = banner->getTag();
|
||||
|
||||
if (!tag->contains(L"BlockEntityTag", Tag::TAG_Compound))
|
||||
tag->putCompound(L"BlockEntityTag", new CompoundTag());
|
||||
CompoundTag* bet = tag->getCompound(L"BlockEntityTag");
|
||||
|
||||
ListTag<CompoundTag>* list;
|
||||
if (bet->contains(L"Patterns"))
|
||||
{
|
||||
list = static_cast<ListTag<CompoundTag>*>(static_cast<void*>(bet->getList(L"Patterns")));
|
||||
}
|
||||
else
|
||||
{
|
||||
list = new ListTag<CompoundTag>();
|
||||
bet->put(L"Patterns", list);
|
||||
}
|
||||
|
||||
CompoundTag* entry = new CompoundTag();
|
||||
entry->putString(L"Pattern", patternId);
|
||||
entry->putInt(L"Color", dyeColor);
|
||||
list->add(entry);
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> BannerPatternRecipe::createBannerWithPattern(const wchar_t* patternId, char dyeColor, char bannerColor) {
|
||||
auto item = make_shared<ItemInstance>(Tile::standing_banner_Id, 1, bannerColor);
|
||||
addBannerPattern(item, patternId, dyeColor);
|
||||
return item;
|
||||
}
|
||||
|
||||
int BannerPatternRecipe::getBannerPatternCount(shared_ptr<ItemInstance> banner)
|
||||
{
|
||||
if (!banner->hasTag()) return 0;
|
||||
CompoundTag* tag = banner->getTag();
|
||||
if (!tag->contains(L"BlockEntityTag", Tag::TAG_Compound)) return 0;
|
||||
CompoundTag* bet = tag->getCompound(L"BlockEntityTag");
|
||||
if (!bet->contains(L"Patterns")) return 0;
|
||||
ListTag<Tag>* list = bet->getList(L"Patterns");
|
||||
return list ? list->size() : 0;
|
||||
}
|
||||
|
||||
vector<const wchar_t*> BannerPatternRecipe::getBannerPatternIds(shared_ptr<ItemInstance> banner) {
|
||||
vector<const wchar_t*> returnVector;
|
||||
|
||||
CompoundTag* tag = banner->getTag();
|
||||
if (tag != nullptr && tag->contains(L"BlockEntityTag", Tag::TAG_Compound)) {
|
||||
CompoundTag* bet = tag->getCompound(L"BlockEntityTag");
|
||||
if (bet->contains(L"Patterns")) {
|
||||
ListTag<Tag>* list = bet->getList(L"Patterns");
|
||||
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
Tag* tag = list->get(i);
|
||||
if (tag->getId() == Tag::TAG_String) { //we could also check for "Pattern" string but thats string comp
|
||||
returnVector.push_back(dynamic_cast<StringTag*>(tag)->data.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnVector;
|
||||
}
|
||||
|
||||
vector<char> BannerPatternRecipe::getBannerPatternIndexs(shared_ptr<ItemInstance> banner) {
|
||||
vector<const wchar_t*>& bannerPatternIds = getBannerPatternIds(banner);
|
||||
vector<char> bannerPatternIndexs;
|
||||
|
||||
for (const wchar_t* id : bannerPatternIds) {
|
||||
for (int i = 0; i < BannerPatternRecipe::PATTERN_COUNT; i++) {
|
||||
if (wcscmp(BannerPatternRecipe::PATTERNS[i].id, id) == 0) {
|
||||
bannerPatternIndexs.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bannerPatternIndexs;
|
||||
}
|
||||
|
||||
vector<char> BannerPatternRecipe::getBannerColorIndexs(shared_ptr<ItemInstance> banner) {
|
||||
vector<char> returnVector;
|
||||
|
||||
CompoundTag* tag = banner->getTag();
|
||||
if (tag != nullptr && tag->contains(L"BlockEntityTag", Tag::TAG_Compound)) {
|
||||
CompoundTag* bet = tag->getCompound(L"BlockEntityTag");
|
||||
if (bet->contains(L"Patterns")) {
|
||||
ListTag<Tag>* list = bet->getList(L"Patterns");
|
||||
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
Tag* tag = list->get(i);
|
||||
if (tag->getId() == Tag::TAG_Int) { //we could also check for "Color" string but thats string comp
|
||||
returnVector.push_back(dynamic_cast<IntTag*>(tag)->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnVector;
|
||||
}
|
||||
Reference in new issue
Block a user