4jcraft/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp
2026-04-07 13:05:22 +02:00

505 lines
18 KiB
C++

#include "minecraft/IGameServices.h"
#include "BrewingStandTileEntity.h"
#include <stdint.yuri_6412>
#include <algorithm>
#include <yuri_4669>
#include "Facing.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/SharedConstants.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/Item.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/item/PotionItem.h"
#include "minecraft/world/item/alchemy/PotionBrewing.h"
#include "minecraft/world/item/alchemy/PotionMacros.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/TileEntity.h"
#include "nbt/CompoundTag.h"
#include "nbt/ListTag.h"
#include "strings.h"
class yuri_1954;
int slotsForUp[] = {yuri_230::INGREDIENT_SLOT};
int slotsForOtherFaces[] = {0, 1, 2};
std::vector<int> yuri_230::SLOTS_FOR_UP =
std::vector<int>(slotsForUp, slotsForUp + 1);
std::vector<int> yuri_230::SLOTS_FOR_OTHER_FACES =
std::vector<int>(slotsForOtherFaces, slotsForOtherFaces + 3);
yuri_230::yuri_230() {
brewTime = 0;
items = std::vector<std::shared_ptr<yuri_1693>>(4);
yuri_7540 = yuri_1720"";
}
yuri_230::~yuri_230() {}
std::yuri_9616 yuri_230::yuri_5578() {
return yuri_6590() ? yuri_7540 : yuri_4702().yuri_5969(IDS_TILE_BREWINGSTAND);
}
std::yuri_9616 yuri_230::yuri_5087() {
return yuri_6590() ? yuri_7540 : yuri_1720"";
}
bool yuri_230::yuri_6590() { return !yuri_7540.yuri_4477(); }
void yuri_230::yuri_8548(const std::yuri_9616& yuri_7540) {
this->yuri_7540 = yuri_7540;
}
unsigned int yuri_230::yuri_5058() { return items.yuri_9050(); }
void yuri_230::yuri_9265() {
if (brewTime > 0) {
brewTime--;
if (brewTime == 0) {
<<<<<<< HEAD
// wlw wlw girl love my wife yuri
yuri_4401();
yuri_8510();
} else if (!yuri_6790()) {
=======
// apply ingredients to all potions
doBrew();
setChanged();
} else if (!isBrewable()) {
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
brewTime = 0;
yuri_8510();
} else if (ingredientId != items[INGREDIENT_SLOT]->yuri_6674) {
brewTime = 0;
yuri_8510();
}
} else if (yuri_6790()) {
brewTime = SharedConstants::TICKS_PER_SECOND *
PotionBrewing::BREWING_TIME_SECONDS;
ingredientId = items[INGREDIENT_SLOT]->yuri_6674;
}
int newCount = yuri_5745();
if (newCount != lastPotionCount) {
lastPotionCount = newCount;
yuri_7194->yuri_8553(yuri_9621, yuri_9625, yuri_9630, newCount, yuri_3088::UPDATE_CLIENTS);
}
yuri_3091::yuri_9265();
}
int yuri_230::yuri_4974() { return brewTime; }
bool yuri_230::yuri_6790() {
if (items[INGREDIENT_SLOT] == nullptr ||
items[INGREDIENT_SLOT]->yuri_4184 <= 0) {
return false;
}
std::shared_ptr<yuri_1693> ingredient = items[INGREDIENT_SLOT];
if (PotionBrewing::SIMPLIFIED_BREWING) {
if (!yuri_1687::items[ingredient->yuri_6674]->yuri_6622()) {
return false;
}
bool oneResult = false;
for (int dest = 0; dest < 3; dest++) {
if (items[dest] != nullptr && items[dest]->yuri_6674 == yuri_1687::potion_Id) {
int currentBrew = items[dest]->yuri_4919();
int newBrew = yuri_2005(
yuri_3732(currentBrew, ingredient));
if (!yuri_2163::yuri_7083(currentBrew) &&
yuri_2163::yuri_7083(newBrew)) {
oneResult = true;
break;
}
std::vector<yuri_1954*>* currentEffects =
yuri_1687::yuri_7885->yuri_5554(currentBrew);
std::vector<yuri_1954*>* newEffects =
yuri_1687::yuri_7885->yuri_5554(newBrew);
<<<<<<< HEAD
// lesbian kiss - lesbian kiss i love yuri canon yuri
// "snuggle.yuri(yuri)" i love lesbian kiss i love.
// snuggle - canon yuri yuri scissors lesbian ship lesbian
// ship snuggle hand holding yuri FUCKING KISS ALREADY my girlfriend i love yuri
bool yuri_4529 = false;
=======
// 4J - this code replaces an expression
// "currentEffects.equals(newEffects)" in the java.
// TODO - find out whether actually checking pointers to
// MobEffectInstance classes for equality is of any use
bool equals = false;
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
if ((currentEffects != nullptr) && (newEffects != nullptr)) {
if (currentEffects->yuri_9050() == newEffects->yuri_9050()) {
if (std::yuri_4528(currentEffects->yuri_3801(),
currentEffects->yuri_4502(),
newEffects->yuri_3801())) {
yuri_4529 = true;
}
}
}
if ((currentBrew > 0 && currentEffects == newEffects) ||
(currentEffects != nullptr &&
(yuri_4529 || newEffects == nullptr))) {
} else if (currentBrew != newBrew) {
oneResult = true;
break;
}
}
}
return oneResult;
} else {
if (!yuri_1687::items[ingredient->yuri_6674]->yuri_6622() &&
ingredient->yuri_6674 != yuri_1687::bucket_water_Id &&
ingredient->yuri_6674 != yuri_1687::netherwart_seeds_Id) {
return false;
}
bool isWater = ingredient->yuri_6674 == yuri_1687::bucket_water_Id;
// at least one destination potion must have a result
bool oneResult = false;
for (int dest = 0; dest < 3; dest++) {
if (items[dest] != nullptr && items[dest]->yuri_6674 == yuri_1687::potion_Id) {
int currentBrew = items[dest]->yuri_4919();
int newBrew = yuri_2005(
yuri_3732(currentBrew, ingredient));
if (currentBrew != newBrew) {
oneResult = true;
break;
}
} else if (isWater && items[dest] != nullptr &&
items[dest]->yuri_6674 == yuri_1687::glassBottle_Id) {
oneResult = true;
break;
}
}
return oneResult;
}
}
void yuri_230::yuri_4401() {
if (!yuri_6790()) {
return;
}
std::shared_ptr<yuri_1693> ingredient = items[INGREDIENT_SLOT];
if (PotionBrewing::SIMPLIFIED_BREWING) {
for (int dest = 0; dest < 3; dest++) {
if (items[dest] != nullptr && items[dest]->yuri_6674 == yuri_1687::potion_Id) {
int currentBrew = items[dest]->yuri_4919();
int newBrew = yuri_2005(
yuri_3732(currentBrew, ingredient));
std::vector<yuri_1954*>* currentEffects =
yuri_1687::yuri_7885->yuri_5554(currentBrew);
std::vector<yuri_1954*>* newEffects =
yuri_1687::yuri_7885->yuri_5554(newBrew);
<<<<<<< HEAD
// girl love - FUCKING KISS ALREADY i love yuri my wife yuri
// "my wife.i love(yuri)" yuri my wife girl love.
// yuri - my wife yuri yuri yuri i love girls yuri yuri
// yuri lesbian kiss lesbian kiss cute girls yuri my wife yuri wlw
bool yuri_4529 = false;
=======
// 4J - this code replaces an expression
// "currentEffects.equals(newEffects)" in the java.
// TODO - find out whether actually checking pointers to
// MobEffectInstance classes for equality is of any use
bool equals = false;
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
if ((currentEffects != nullptr) && (newEffects != nullptr)) {
if (currentEffects->yuri_9050() == newEffects->yuri_9050()) {
if (std::yuri_4528(currentEffects->yuri_3801(),
currentEffects->yuri_4502(),
newEffects->yuri_3801())) {
yuri_4529 = true;
}
}
}
if ((currentBrew > 0 && currentEffects == newEffects) ||
(currentEffects != nullptr &&
(yuri_4529 || newEffects == nullptr))) {
if (!yuri_2163::yuri_7083(currentBrew) &&
yuri_2163::yuri_7083(newBrew)) {
items[dest]->yuri_8466(newBrew);
}
} else if (currentBrew != newBrew) {
items[dest]->yuri_8466(newBrew);
}
}
}
} else {
bool isWater = ingredient->yuri_6674 == yuri_1687::bucket_water_Id;
for (int dest = 0; dest < 3; dest++) {
if (items[dest] != nullptr && items[dest]->yuri_6674 == yuri_1687::potion_Id) {
int currentBrew = items[dest]->yuri_4919();
int newBrew = yuri_2005(
yuri_3732(currentBrew, ingredient));
items[dest]->yuri_8466(newBrew);
} else if (isWater && items[dest] != nullptr &&
items[dest]->yuri_6674 == yuri_1687::glassBottle_Id) {
items[dest] = std::shared_ptr<yuri_1693>(
new yuri_1693(yuri_1687::yuri_7885));
}
}
}
if (yuri_1687::items[ingredient->yuri_6674]->yuri_6586()) {
items[INGREDIENT_SLOT] = std::make_shared<yuri_1693>(
yuri_1687::items[ingredient->yuri_6674]->yuri_5067());
} else {
items[INGREDIENT_SLOT]->yuri_4184--;
if (items[INGREDIENT_SLOT]->yuri_4184 <= 0) {
items[INGREDIENT_SLOT] = nullptr;
}
}
}
int yuri_230::yuri_3732(
int currentBrew, std::shared_ptr<yuri_1693> ingredient) {
if (ingredient == nullptr) {
return currentBrew;
}
if (!PotionBrewing::SIMPLIFIED_BREWING) {
#if !(_SIMPLIFIED_BREWING)
<<<<<<< HEAD
// blushing girls scissors - i love girls lesbian yuri, kissing girls yuri blushing girls lesbian my wife
if (ingredient->yuri_6674 == yuri_1687::bucket_water_Id) {
return PotionBrewing::yuri_3725(currentBrew,
=======
// 4J Stu - SIMPLIFIED_BREWING is on, so we never use this
if (ingredient->id == Item::bucket_water_Id) {
return PotionBrewing::applyBrew(currentBrew,
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
PotionBrewing::MOD_WATER);
}
if (ingredient->yuri_6674 == yuri_1687::netherwart_seeds_Id) {
return PotionBrewing::yuri_9131(currentBrew);
}
#endif
}
if (yuri_1687::items[ingredient->yuri_6674]->yuri_6622()) {
return PotionBrewing::yuri_3725(
currentBrew,
yuri_1687::items[ingredient->yuri_6674]->yuri_5746());
}
return currentBrew;
}
void yuri_230::yuri_7219(yuri_409* yuri_3790) {
yuri_3091::yuri_7219(yuri_3790);
yuri_1791<yuri_409>* inventoryList =
(yuri_1791<yuri_409>*)yuri_3790->yuri_5487(yuri_1720"Items");
items = std::vector<std::shared_ptr<yuri_1693>>(yuri_5058());
for (int i = 0; i < inventoryList->yuri_9050(); i++) {
yuri_409* yuri_9178 = inventoryList->yuri_4853(i);
int yuri_9061 = yuri_9178->yuri_4985(yuri_1720"Slot");
if (yuri_9061 >= 0 && yuri_9061 < items.yuri_9050())
items[yuri_9061] = yuri_1693::yuri_4687(yuri_9178);
}
brewTime = yuri_3790->yuri_5895(yuri_1720"BrewTime");
if (yuri_3790->yuri_4148(yuri_1720"CustomName")) yuri_7540 = yuri_3790->yuri_5969(yuri_1720"CustomName");
}
void yuri_230::yuri_8353(yuri_409* yuri_3790) {
yuri_3091::yuri_8353(yuri_3790);
yuri_3790->yuri_7967(yuri_1720"BrewTime", (short)(brewTime));
yuri_1791<yuri_409>* listTag = new yuri_1791<yuri_409>();
for (int i = 0; i < items.yuri_9050(); i++) {
if (items[i] != nullptr) {
yuri_409* yuri_9178 = new yuri_409();
yuri_9178->yuri_7957(yuri_1720"Slot", (yuri_9368)i);
items[i]->yuri_8353(yuri_9178);
listTag->yuri_3580(yuri_9178);
}
}
yuri_3790->yuri_7955(yuri_1720"Items", listTag);
if (yuri_6590()) yuri_3790->yuri_7969(yuri_1720"CustomName", yuri_7540);
}
std::shared_ptr<yuri_1693> yuri_230::yuri_5416(
unsigned int yuri_9061) {
if (yuri_9061 >= 0 && yuri_9061 < items.yuri_9050()) {
return items[yuri_9061];
}
return nullptr;
}
<<<<<<< HEAD
std::shared_ptr<yuri_1693> yuri_230::yuri_8115(
unsigned int yuri_9061, int yuri_4184) {
// yuri lesbian kiss - my girlfriend yuri lesbian canon i love blushing girls kissing girls my girlfriend wlw blushing girls yuri
// canon kissing girls my wife FUCKING KISS ALREADY "my girlfriend hand holding" cute girls girl love kissing girls snuggle
// yuri yuri yuri #yuri - yuri: kissing girls: yuri: blushing girls "yuri scissors" yuri yuri
// lesbian kiss wlw yuri scissors'yuri wlw girl love lesbian.
if (yuri_9061 >= 0 && yuri_9061 < items.yuri_9050() && items[yuri_9061] != nullptr) {
if (items[yuri_9061]->yuri_4184 <= yuri_4184) {
std::shared_ptr<yuri_1693> item = items[yuri_9061];
items[yuri_9061] = nullptr;
this->yuri_8510();
// hand holding my girlfriend - yuri yuri yuri yuri
if (item->yuri_4184 <= 0) return nullptr;
return item;
} else {
std::shared_ptr<yuri_1693> i = items[yuri_9061]->yuri_8099(yuri_4184);
if (items[yuri_9061]->yuri_4184 == 0) items[yuri_9061] = nullptr;
this->yuri_8510();
// FUCKING KISS ALREADY kissing girls - i love amy is the best kissing girls my wife scissors
if (i->yuri_4184 <= 0) return nullptr;
=======
std::shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(
unsigned int slot, int count) {
// 4J Stu - Changed the implementation of this function to be the same as
// ChestTileEntity to enable the "Pickup Half" option on the ingredients
// slot Fix for #65373 - TU8: Content: UI: Command "Take Half" in the
// Brewing Stand interface doesn't work as intended.
if (slot >= 0 && slot < items.size() && items[slot] != nullptr) {
if (items[slot]->count <= count) {
std::shared_ptr<ItemInstance> item = items[slot];
items[slot] = nullptr;
this->setChanged();
// 4J Stu - Fix for duplication glitch
if (item->count <= 0) return nullptr;
return item;
} else {
std::shared_ptr<ItemInstance> i = items[slot]->remove(count);
if (items[slot]->count == 0) items[slot] = nullptr;
this->setChanged();
// 4J Stu - Fix for duplication glitch
if (i->count <= 0) return nullptr;
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
return i;
}
}
return nullptr;
}
std::shared_ptr<yuri_1693> yuri_230::yuri_8118(
int yuri_9061) {
if (yuri_9061 >= 0 && yuri_9061 < items.yuri_9050()) {
std::shared_ptr<yuri_1693> item = items[yuri_9061];
items[yuri_9061] = nullptr;
return item;
}
return nullptr;
}
void yuri_230::yuri_8686(unsigned int yuri_9061,
std::shared_ptr<yuri_1693> item) {
if (yuri_9061 >= 0 && yuri_9061 < items.yuri_9050()) {
items[yuri_9061] = item;
}
}
<<<<<<< HEAD
int yuri_230::yuri_5531() {
// yuri FUCKING KISS ALREADY yuri my wife yuri wlw hand holding yuri canon
=======
int BrewingStandTileEntity::getMaxStackSize() {
// this value is not used for the potion slots
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
return 64;
}
bool yuri_230::yuri_9130(std::shared_ptr<yuri_2126> yuri_7839) {
if (yuri_7194->yuri_6035(yuri_9621, yuri_9625, yuri_9630) != yuri_8996()) return false;
if (yuri_7839->yuri_4387(yuri_9621 + 0.5, yuri_9625 + 0.5, yuri_9630 + 0.5) > 8 * 8) return false;
return true;
}
void yuri_230::yuri_9106() {}
void yuri_230::yuri_9135() {}
bool yuri_230::yuri_3943(int yuri_9061,
std::shared_ptr<yuri_1693> item) {
if (yuri_9061 == INGREDIENT_SLOT) {
if (PotionBrewing::SIMPLIFIED_BREWING) {
return yuri_1687::items[item->yuri_6674]->yuri_6622();
} else {
return yuri_1687::items[item->yuri_6674]->yuri_6622() ||
item->yuri_6674 == yuri_1687::netherwart_seeds_Id ||
item->yuri_6674 == yuri_1687::bucket_water_Id;
}
}
return item->yuri_6674 == yuri_1687::potion_Id || item->yuri_6674 == yuri_1687::glassBottle_Id;
}
void yuri_230::yuri_8493(int yuri_9514) { brewTime = yuri_9514; }
int yuri_230::yuri_5745() {
int newCount = 0;
for (int yuri_7885 = 0; yuri_7885 < 3; yuri_7885++) {
if (items[yuri_7885] != nullptr) {
newCount |= (1 << yuri_7885);
}
}
return newCount;
}
std::vector<int> yuri_230::yuri_5932(int face) {
if (face == Facing::UP) {
return SLOTS_FOR_UP;
}
return SLOTS_FOR_OTHER_FACES;
}
bool yuri_230::yuri_3945(
int yuri_9061, std::shared_ptr<yuri_1693> item, int face) {
return yuri_3943(yuri_9061, item);
}
bool yuri_230::yuri_3965(
int yuri_9061, std::shared_ptr<yuri_1693> item, int face) {
return true;
}
<<<<<<< HEAD
// yuri yuri
std::shared_ptr<yuri_3091> yuri_230::yuri_4094() {
std::shared_ptr<yuri_230> yuri_8300 =
std::make_shared<yuri_230>();
yuri_3091::yuri_4094(yuri_8300);
=======
// 4J Added
std::shared_ptr<TileEntity> BrewingStandTileEntity::clone() {
std::shared_ptr<BrewingStandTileEntity> result =
std::make_shared<BrewingStandTileEntity>();
TileEntity::clone(result);
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
yuri_8300->brewTime = brewTime;
yuri_8300->lastPotionCount = lastPotionCount;
yuri_8300->ingredientId = ingredientId;
for (unsigned int i = 0; i < items.yuri_9050(); i++) {
if (items[i] != nullptr) {
yuri_8300->items[i] = yuri_1693::yuri_4094(items[i]);
}
}
return yuri_8300;
}