mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-01 08:26:31 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -8,17 +8,18 @@
|
||||
#include "../Headers/net.minecraft.h"
|
||||
#include "CakeTile.h"
|
||||
|
||||
CakeTile::CakeTile(int id) : Tile(id, Material::cake, false) {
|
||||
setTicking(true);
|
||||
|
||||
CakeTile::CakeTile(int id) : Tile(id, Material::cake, false)
|
||||
{
|
||||
setTicking(true);
|
||||
|
||||
iconTop = NULL;
|
||||
iconBottom = NULL;
|
||||
iconInner = NULL;
|
||||
iconTop = NULL;
|
||||
iconBottom = NULL;
|
||||
iconInner = NULL;
|
||||
}
|
||||
|
||||
void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
|
||||
void CakeTile::updateShape(
|
||||
LevelSource* level, int x, int y, int z, int forceData,
|
||||
std::shared_ptr<TileEntity>
|
||||
forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
int d = level->getData(x, y, z);
|
||||
float r = 1 / 16.0f;
|
||||
@@ -27,15 +28,13 @@ void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceDat
|
||||
this->setShape(r2, 0, r, 1 - r, h, 1 - r);
|
||||
}
|
||||
|
||||
void CakeTile::updateDefaultShape()
|
||||
{
|
||||
void CakeTile::updateDefaultShape() {
|
||||
float r = 1 / 16.0f;
|
||||
float h = 8 / 16.0f;
|
||||
this->setShape(r, 0, r, 1 - r, h, 1 - r);
|
||||
}
|
||||
|
||||
AABB *CakeTile::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
AABB* CakeTile::getAABB(Level* level, int x, int y, int z) {
|
||||
int d = level->getData(x, y, z);
|
||||
float r = 1 / 16.0f;
|
||||
float r2 = (1 + d * 2) / 16.0f;
|
||||
@@ -43,8 +42,7 @@ AABB *CakeTile::getAABB(Level *level, int x, int y, int z)
|
||||
return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h - r, z + 1 - r);
|
||||
}
|
||||
|
||||
AABB *CakeTile::getTileAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
AABB* CakeTile::getTileAABB(Level* level, int x, int y, int z) {
|
||||
int d = level->getData(x, y, z);
|
||||
float r = 1 / 16.0f;
|
||||
float r2 = (1 + d * 2) / 16.0f;
|
||||
@@ -52,100 +50,80 @@ AABB *CakeTile::getTileAABB(Level *level, int x, int y, int z)
|
||||
return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h, z + 1 - r);
|
||||
}
|
||||
|
||||
Icon *CakeTile::getTexture(int face, int data)
|
||||
{
|
||||
Icon* CakeTile::getTexture(int face, int data) {
|
||||
if (face == Facing::UP) return iconTop;
|
||||
if (face == Facing::DOWN) return iconBottom;
|
||||
if (data > 0 && face == Facing::WEST) return iconInner;
|
||||
return icon;
|
||||
}
|
||||
|
||||
void CakeTile::registerIcons(IconRegister *iconRegister)
|
||||
{
|
||||
icon = iconRegister->registerIcon(L"cake_side");
|
||||
iconInner = iconRegister->registerIcon(L"cake_inner");
|
||||
iconTop = iconRegister->registerIcon(L"cake_top");
|
||||
iconBottom = iconRegister->registerIcon(L"cake_bottom");
|
||||
void CakeTile::registerIcons(IconRegister* iconRegister) {
|
||||
icon = iconRegister->registerIcon(L"cake_side");
|
||||
iconInner = iconRegister->registerIcon(L"cake_inner");
|
||||
iconTop = iconRegister->registerIcon(L"cake_top");
|
||||
iconBottom = iconRegister->registerIcon(L"cake_bottom");
|
||||
}
|
||||
|
||||
bool CakeTile::isCubeShaped()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool CakeTile::isCubeShaped() { return false; }
|
||||
|
||||
bool CakeTile::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool CakeTile::isSolidRender(bool isServerLevel) { return false; }
|
||||
|
||||
// 4J-PB - Adding a TestUse for tooltip display
|
||||
bool CakeTile::TestUse()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool CakeTile::TestUse() { return true; }
|
||||
|
||||
bool CakeTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
|
||||
bool CakeTile::use(Level* level, int x, int y, int z,
|
||||
std::shared_ptr<Player> player, int clickedFace,
|
||||
float clickX, float clickY, float clickZ,
|
||||
bool soundOnly /*=false*/) // 4J added soundOnly param
|
||||
{
|
||||
if( soundOnly ) return false;
|
||||
if (soundOnly) return false;
|
||||
eat(level, x, y, z, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CakeTile::attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
|
||||
{
|
||||
eat(level, x, y, z, player);
|
||||
void CakeTile::attack(Level* level, int x, int y, int z,
|
||||
std::shared_ptr<Player> player) {
|
||||
eat(level, x, y, z, player);
|
||||
}
|
||||
|
||||
void CakeTile::eat(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
|
||||
{
|
||||
if (player->canEat(false))
|
||||
{
|
||||
void CakeTile::eat(Level* level, int x, int y, int z,
|
||||
std::shared_ptr<Player> player) {
|
||||
if (player->canEat(false)) {
|
||||
player->getFoodData()->eat(2, FoodConstants::FOOD_SATURATION_POOR);
|
||||
|
||||
int d = level->getData(x, y, z) + 1;
|
||||
if (d >= 6)
|
||||
{
|
||||
if (d >= 6) {
|
||||
level->setTile(x, y, z, 0);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
level->setData(x, y, z, d);
|
||||
level->setTileDirty(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CakeTile::mayPlace(Level *level, int x, int y, int z)
|
||||
{
|
||||
bool CakeTile::mayPlace(Level* level, int x, int y, int z) {
|
||||
if (!Tile::mayPlace(level, x, y, z)) return false;
|
||||
|
||||
return canSurvive(level, x, y, z);
|
||||
}
|
||||
|
||||
void CakeTile::neighborChanged(Level *level, int x, int y, int z, int type)
|
||||
{
|
||||
if (!canSurvive(level, x, y, z))
|
||||
{
|
||||
void CakeTile::neighborChanged(Level* level, int x, int y, int z, int type) {
|
||||
if (!canSurvive(level, x, y, z)) {
|
||||
this->spawnResources(level, x, y, z, level->getData(x, y, z), 0);
|
||||
level->setTile(x, y, z, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CakeTile::canSurvive(Level *level, int x, int y, int z)
|
||||
{
|
||||
return level->getMaterial(x, y - 1, z)->isSolid();
|
||||
bool CakeTile::canSurvive(Level* level, int x, int y, int z) {
|
||||
return level->getMaterial(x, y - 1, z)->isSolid();
|
||||
}
|
||||
|
||||
int CakeTile::getResourceCount(Random *random)
|
||||
{
|
||||
return 0;
|
||||
int CakeTile::getResourceCount(Random* random) { return 0; }
|
||||
|
||||
int CakeTile::getResource(int data, Random* random, int playerBonusLevel) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CakeTile::getResource(int data, Random *random, int playerBonusLevel)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CakeTile::cloneTileId(Level *level, int x, int y, int z)
|
||||
{
|
||||
return Item::cake_Id;
|
||||
int CakeTile::cloneTileId(Level* level, int x, int y, int z) {
|
||||
return Item::cake_Id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user