chore: format Minecraft.World

This commit is contained in:
Tropical
2026-03-13 17:06:56 -05:00
parent bd6284025d
commit 33d0737d1d
1511 changed files with 108661 additions and 115521 deletions

View File

@@ -5,71 +5,66 @@
#include "../Headers/net.minecraft.world.entity.player.h"
#include "RepairResultSlot.h"
RepairResultSlot::RepairResultSlot(RepairMenu *menu, int xt, int yt, int zt, std::shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x, y)
{
m_menu = menu;
this->xt = xt;
this->yt = yt;
this->zt = zt;
RepairResultSlot::RepairResultSlot(RepairMenu* menu, int xt, int yt, int zt,
std::shared_ptr<Container> container,
int slot, int x, int y)
: Slot(container, slot, x, y) {
m_menu = menu;
this->xt = xt;
this->yt = yt;
this->zt = zt;
}
bool RepairResultSlot::mayPlace(std::shared_ptr<ItemInstance> item)
{
return false;
bool RepairResultSlot::mayPlace(std::shared_ptr<ItemInstance> item) {
return false;
}
bool RepairResultSlot::mayPickup(std::shared_ptr<Player> player)
{
return (player->abilities.instabuild || player->experienceLevel >= m_menu->cost) && (m_menu->cost > 0 && hasItem());
bool RepairResultSlot::mayPickup(std::shared_ptr<Player> player) {
return (player->abilities.instabuild ||
player->experienceLevel >= m_menu->cost) &&
(m_menu->cost > 0 && hasItem());
}
void RepairResultSlot::onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried)
{
if (!player->abilities.instabuild) player->withdrawExperienceLevels(m_menu->cost);
m_menu->repairSlots->setItem(RepairMenu::INPUT_SLOT, nullptr);
if (m_menu->repairItemCountCost > 0)
{
std::shared_ptr<ItemInstance> addition = m_menu->repairSlots->getItem(RepairMenu::ADDITIONAL_SLOT);
if (addition != NULL && addition->count > m_menu->repairItemCountCost)
{
addition->count -= m_menu->repairItemCountCost;
m_menu->repairSlots->setItem(RepairMenu::ADDITIONAL_SLOT, addition);
}
else
{
m_menu->repairSlots->setItem(RepairMenu::ADDITIONAL_SLOT, nullptr);
}
}
else
{
m_menu->repairSlots->setItem(RepairMenu::ADDITIONAL_SLOT, nullptr);
}
m_menu->cost = 0;
void RepairResultSlot::onTake(std::shared_ptr<Player> player,
std::shared_ptr<ItemInstance> carried) {
if (!player->abilities.instabuild)
player->withdrawExperienceLevels(m_menu->cost);
m_menu->repairSlots->setItem(RepairMenu::INPUT_SLOT, nullptr);
if (m_menu->repairItemCountCost > 0) {
std::shared_ptr<ItemInstance> addition =
m_menu->repairSlots->getItem(RepairMenu::ADDITIONAL_SLOT);
if (addition != NULL && addition->count > m_menu->repairItemCountCost) {
addition->count -= m_menu->repairItemCountCost;
m_menu->repairSlots->setItem(RepairMenu::ADDITIONAL_SLOT, addition);
} else {
m_menu->repairSlots->setItem(RepairMenu::ADDITIONAL_SLOT, nullptr);
}
} else {
m_menu->repairSlots->setItem(RepairMenu::ADDITIONAL_SLOT, nullptr);
}
m_menu->cost = 0;
if (!player->abilities.instabuild && !m_menu->level->isClientSide && m_menu->level->getTile(xt, yt, zt) == Tile::anvil->id && player->getRandom()->nextFloat() < 0.12f)
{
int data = m_menu->level->getData(xt, yt, zt);
int dir = data & 0x3;
int dmg = data >> 2;
if (!player->abilities.instabuild && !m_menu->level->isClientSide &&
m_menu->level->getTile(xt, yt, zt) == Tile::anvil->id &&
player->getRandom()->nextFloat() < 0.12f) {
int data = m_menu->level->getData(xt, yt, zt);
int dir = data & 0x3;
int dmg = data >> 2;
if (++dmg > 2)
{
m_menu->level->setTile(xt, yt, zt, 0);
m_menu->level->levelEvent(LevelEvent::SOUND_ANVIL_BROKEN, xt, yt, zt, 0);
}
else
{
m_menu->level->setData(xt, yt, zt, dir | (dmg << 2));
m_menu->level->levelEvent(LevelEvent::SOUND_ANVIL_USED, xt, yt, zt, 0);
}
}
else if (!m_menu->level->isClientSide)
{
m_menu->level->levelEvent(LevelEvent::SOUND_ANVIL_USED, xt, yt, zt, 0);
}
if (++dmg > 2) {
m_menu->level->setTile(xt, yt, zt, 0);
m_menu->level->levelEvent(LevelEvent::SOUND_ANVIL_BROKEN, xt, yt,
zt, 0);
} else {
m_menu->level->setData(xt, yt, zt, dir | (dmg << 2));
m_menu->level->levelEvent(LevelEvent::SOUND_ANVIL_USED, xt, yt, zt,
0);
}
} else if (!m_menu->level->isClientSide) {
m_menu->level->levelEvent(LevelEvent::SOUND_ANVIL_USED, xt, yt, zt, 0);
}
}
bool RepairResultSlot::mayCombine(std::shared_ptr<ItemInstance> second)
{
return false;
bool RepairResultSlot::mayCombine(std::shared_ptr<ItemInstance> second) {
return false;
}