mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-08 22:57:25 +00:00
chore: fmt
This commit is contained in:
parent
73392fa06a
commit
aff677a995
|
|
@ -26,13 +26,9 @@ void Chunk::CreateNewThreadStorage() {
|
|||
m_tlsTileIds = new unsigned char[16 * 16 * Level::maxBuildHeight];
|
||||
}
|
||||
|
||||
void Chunk::ReleaseThreadStorage() {
|
||||
delete m_tlsTileIds;
|
||||
}
|
||||
void Chunk::ReleaseThreadStorage() { delete m_tlsTileIds; }
|
||||
|
||||
uint8_t* Chunk::GetTileIdsStorage() {
|
||||
return m_tlsTileIds;
|
||||
}
|
||||
uint8_t* Chunk::GetTileIdsStorage() { return m_tlsTileIds; }
|
||||
#else
|
||||
// 4J Stu - Don't want this when multi-threaded
|
||||
Tesselator* Chunk::t = Tesselator::getInstance();
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ int normal;
|
|||
*/
|
||||
thread_local Tesselator* Tesselator::m_tlsInstance = nullptr;
|
||||
|
||||
Tesselator* Tesselator::getInstance() {
|
||||
return m_tlsInstance;
|
||||
}
|
||||
Tesselator* Tesselator::getInstance() { return m_tlsInstance; }
|
||||
|
||||
void Tesselator::CreateNewThreadStorage(int bytes) {
|
||||
Tesselator::m_tlsInstance = new Tesselator(bytes / 4);
|
||||
|
|
@ -349,7 +347,7 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) {
|
|||
// where: cccc is a 15-bit (5 bits per x/y/z) origin position / offset
|
||||
// for the whole quad. Each
|
||||
// component is unsigned, and offset by 16
|
||||
//so has a range 0 to 31 actually representing -16 to 15
|
||||
// so has a range 0 to 31 actually representing -16 to 15
|
||||
// xx,yy,zz are 8-bit deltas from this origin to each vertex. These are
|
||||
// unsigned 1.7 fixed point, ie
|
||||
// representing a range of 0 to 1.9921875
|
||||
|
|
@ -358,14 +356,16 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) {
|
|||
// v required by the quad ud,vd are 8-bit unsigned fixed pont
|
||||
// UV deltas, which can be added to umin/vmin to get umax, vmax
|
||||
// and therefore define the 4 corners of
|
||||
//an axis aligned UV mapping
|
||||
// an axis aligned UV mapping
|
||||
// i is a code per vertex that indicates which of umin/umax
|
||||
// should be used for u, and which
|
||||
// of vmin/vmax should be used for v for
|
||||
//this vertex. The coding is: 0 - u = umin, v = vmin 1 - u = umin, v = vmax 2 -
|
||||
//u = umax, v = vmin 3 - u = umax, v = vmax 4 - not axis aligned, use uv stored
|
||||
//in the vertex data 4 on from this one ll is an 8-bit (4 bit per
|
||||
//u/v) index into the current lighting texture
|
||||
// this vertex. The coding is: 0 - u =
|
||||
// umin, v = vmin 1 - u = umin, v
|
||||
// = vmax 2 - u = umax, v = vmin
|
||||
// 3 - u = umax, v = vmax 4 - not
|
||||
// axis aligned, use uv stored in the vertex data 4 on from this one ll
|
||||
// is an 8-bit (4 bit per u/v) index into the current lighting texture
|
||||
//
|
||||
// For quads that don't have axis aligned UVs (ie have a code for 4 in i as
|
||||
// described above) the 8 byte vertex is followed by a further 8 bytes which
|
||||
|
|
@ -747,7 +747,8 @@ void packLinuxLightmapCoords(int tex2, std::int16_t& u, std::int16_t& v) {
|
|||
v = static_cast<std::int16_t>((tex2 >> 16) & 0xffff);
|
||||
|
||||
// Linux 4jlibs consumes packed UV2 values by dividing them by 256 directly
|
||||
// for chunk and other non-scaleLight draws, so offset to texel centers here.
|
||||
// for chunk and other non-scaleLight draws, so offset to texel centers
|
||||
// here.
|
||||
u += 8;
|
||||
v += 8;
|
||||
}
|
||||
|
|
@ -853,8 +854,7 @@ void Tesselator::vertex(float x, float y, float z) {
|
|||
pShortData[4] = (((int)(uu * 8192.0f)) & 0xffff);
|
||||
pShortData[5] = (((int)(v * 8192.0f)) & 0xffff);
|
||||
std::int16_t u2 = static_cast<std::int16_t>(_tex2 & 0xffff);
|
||||
std::int16_t v2 =
|
||||
static_cast<std::int16_t>((_tex2 >> 16) & 0xffff);
|
||||
std::int16_t v2 = static_cast<std::int16_t>((_tex2 >> 16) & 0xffff);
|
||||
#ifdef __linux__
|
||||
packLinuxLightmapCoords(_tex2, u2, v2);
|
||||
logLinuxPackedLightmapCoords("compact", _tex2, u2, v2);
|
||||
|
|
|
|||
|
|
@ -31,13 +31,9 @@ thread_local bool PistonBaseTile::m_tlsIgnoreUpdate = false;
|
|||
// leaving the piston in a bad (simultaneously extended & not extended) state.
|
||||
// 4J - ignoreUpdate is a static in java, implementing as TLS here to make
|
||||
// thread safe
|
||||
bool PistonBaseTile::ignoreUpdate() {
|
||||
return m_tlsIgnoreUpdate;
|
||||
}
|
||||
bool PistonBaseTile::ignoreUpdate() { return m_tlsIgnoreUpdate; }
|
||||
|
||||
void PistonBaseTile::ignoreUpdate(bool set) {
|
||||
m_tlsIgnoreUpdate = set;
|
||||
}
|
||||
void PistonBaseTile::ignoreUpdate(bool set) { m_tlsIgnoreUpdate = set; }
|
||||
|
||||
PistonBaseTile::PistonBaseTile(int id, bool isSticky)
|
||||
: Tile(id, Material::piston, false) {
|
||||
|
|
|
|||
|
|
@ -13,13 +13,9 @@ thread_local bool TheEndPortal::m_tlsAllowAnywhere = false;
|
|||
|
||||
// 4J - allowAnywhere is a static in java, implementing as TLS here to make
|
||||
// thread safe
|
||||
bool TheEndPortal::allowAnywhere() {
|
||||
return m_tlsAllowAnywhere;
|
||||
}
|
||||
bool TheEndPortal::allowAnywhere() { return m_tlsAllowAnywhere; }
|
||||
|
||||
void TheEndPortal::allowAnywhere(bool set) {
|
||||
m_tlsAllowAnywhere = set;
|
||||
}
|
||||
void TheEndPortal::allowAnywhere(bool set) { m_tlsAllowAnywhere = set; }
|
||||
|
||||
TheEndPortal::TheEndPortal(int id, Material* material)
|
||||
: BaseEntityTile(id, material, false) {
|
||||
|
|
|
|||
|
|
@ -229,13 +229,9 @@ Tile::ThreadStorage::ThreadStorage() {
|
|||
tileId = 0;
|
||||
}
|
||||
|
||||
void Tile::CreateNewThreadStorage() {
|
||||
m_tlsShape = new ThreadStorage();
|
||||
}
|
||||
void Tile::CreateNewThreadStorage() { m_tlsShape = new ThreadStorage(); }
|
||||
|
||||
void Tile::ReleaseThreadStorage() {
|
||||
delete m_tlsShape;
|
||||
}
|
||||
void Tile::ReleaseThreadStorage() { delete m_tlsShape; }
|
||||
|
||||
void Tile::staticCtor() {
|
||||
Tile::SOUND_NORMAL = new Tile::SoundType(eMaterialSoundType_STONE, 1, 1);
|
||||
|
|
@ -1918,8 +1914,7 @@ bool Tile::isFaceVisible(Level* level, int x, int y, int z, int f) {
|
|||
}
|
||||
|
||||
bool Tile::shouldRenderFace(LevelSource* level, int x, int y, int z, int face) {
|
||||
ThreadStorage* tls =
|
||||
m_tlsShape;
|
||||
ThreadStorage* tls = m_tlsShape;
|
||||
// 4J Stu - Added this so that the TLS shape is correct for this tile
|
||||
if (tls->tileId != this->id) updateDefaultShape();
|
||||
if (face == 0 && tls->yy0 > 0) return true;
|
||||
|
|
@ -2595,7 +2590,8 @@ int Tile::SoundType::getPlaceSound() const { return iPlaceSound; }
|
|||
4J: These are necessary on the PS3.
|
||||
(and 4 and Vita).
|
||||
*/
|
||||
#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined __linux__)
|
||||
#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || \
|
||||
defined __linux__)
|
||||
const int Tile::stone_Id;
|
||||
const int Tile::grass_Id;
|
||||
const int Tile::dirt_Id;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@
|
|||
const int TopSnowTile::MAX_HEIGHT = 6;
|
||||
const int TopSnowTile::HEIGHT_MASK = 7; // max 8 steps
|
||||
|
||||
TopSnowTile::TopSnowTile(int id)
|
||||
: Tile(id, Material::topSnow, false) {
|
||||
TopSnowTile::TopSnowTile(int id) : Tile(id, Material::topSnow, false) {
|
||||
setShape(0, 0, 0, 1, 2 / 16.0f, 1);
|
||||
setTicking(true);
|
||||
updateShape(0);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
#include "../Headers/net.minecraft.world.phys.h"
|
||||
#include "TripWireTile.h"
|
||||
|
||||
TripWireTile::TripWireTile(int id)
|
||||
: Tile(id, Material::decoration, false) {
|
||||
TripWireTile::TripWireTile(int id) : Tile(id, Material::decoration, false) {
|
||||
setShape(0, 0, 0, 1, 2.5f / 16.0f, 1);
|
||||
this->setTicking(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,9 +102,7 @@ void Level::enableLightingCache() {
|
|||
256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES);
|
||||
}
|
||||
|
||||
void Level::destroyLightingCache() {
|
||||
delete m_tlsLightCache;
|
||||
}
|
||||
void Level::destroyLightingCache() { delete m_tlsLightCache; }
|
||||
|
||||
inline int GetIndex(int x, int y, int z) {
|
||||
return ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
||||
|
|
@ -491,13 +489,9 @@ void Level::flushCache(lightCache_t* cache, uint64_t cacheUse,
|
|||
|
||||
// 4J - added following 2 functions to move instaBuild flag from being a class
|
||||
// member, to TLS
|
||||
bool Level::getInstaTick() {
|
||||
return m_tlsInstaTick;
|
||||
}
|
||||
bool Level::getInstaTick() { return m_tlsInstaTick; }
|
||||
|
||||
void Level::setInstaTick(bool enable) {
|
||||
m_tlsInstaTick = enable;
|
||||
}
|
||||
void Level::setInstaTick(bool enable) { m_tlsInstaTick = enable; }
|
||||
|
||||
// 4J - added
|
||||
bool Level::hasEntitiesToRemove() { return !entitiesToRemove.empty(); }
|
||||
|
|
@ -1569,8 +1563,8 @@ void Level::playStreamingMusic(const std::wstring& name, int x, int y, int z) {
|
|||
}
|
||||
}
|
||||
|
||||
void Level::playMusic(double x, double y, double z,
|
||||
const std::wstring& string, float volume) {}
|
||||
void Level::playMusic(double x, double y, double z, const std::wstring& string,
|
||||
float volume) {}
|
||||
|
||||
// 4J removed -
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -332,8 +332,8 @@ public:
|
|||
float fClipSoundDist = 16.0f);
|
||||
|
||||
void playStreamingMusic(const std::wstring& name, int x, int y, int z);
|
||||
void playMusic(double x, double y, double z,
|
||||
const std::wstring& string, float volume);
|
||||
void playMusic(double x, double y, double z, const std::wstring& string,
|
||||
float volume);
|
||||
// 4J removed - void addParticle(const std::wstring& id, double x, double y,
|
||||
// double z, double xd, double yd, double zd);
|
||||
void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd,
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ FireworksRecipe::ThreadStorage::ThreadStorage() { resultItem = nullptr; }
|
|||
|
||||
void FireworksRecipe::CreateNewThreadStorage() {
|
||||
ThreadStorage* tls = new ThreadStorage();
|
||||
|
||||
|
||||
if (m_defaultThreadStorage == nullptr) {
|
||||
m_defaultThreadStorage = tls;
|
||||
}
|
||||
|
||||
|
||||
m_tlsStorage = tls;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,8 @@ public:
|
|||
virtual const int getGroup() { return 0; }
|
||||
|
||||
// 4J-PB
|
||||
virtual bool
|
||||
requiresRecipe(int iRecipe)
|
||||
{
|
||||
return false;
|
||||
};
|
||||
virtual void
|
||||
collectRequirements(INGREDIENTS_REQUIRED* pIngReq)
|
||||
{};
|
||||
virtual bool requiresRecipe(int iRecipe) { return false; };
|
||||
virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {};
|
||||
|
||||
// 4J Added
|
||||
static void updatePossibleRecipes(
|
||||
|
|
|
|||
Loading…
Reference in a new issue