Merge remote-tracking branch 'smartcmd/main' into feature/plugin-api

This commit is contained in:
sylvessa 2026-04-03 17:45:38 -05:00
commit 1782f7c0d5
8 changed files with 97 additions and 21 deletions

15
BACKPORTING.md Normal file
View file

@ -0,0 +1,15 @@
# Approach to Backported Features
All backported features incorperated into MinecraftConsoles should be, when merged, functionally identical to their state in the version of the game we're currently targeting. This should be in reference to a known 4J build of LCE. Verification can either be done by doing a decompilation based match of the implementation or, alternatively, all functionality and limitations of the given feature should be compared against the version of LCE we're targeting.
# Approach to Bugfixes
Anything that does not behave in an "expected" manner, especially if its behavior is not widely accepted as a gameplay mechanic, is valid for fixing in our repository. This includes bugfixes that were made in versions past the version we target, but excludes any visual changes that may not have been included at the build we're targeting.
If you provide a visual bugfix that fixes a distinctive quirk of the LCE renderer, it should be provided in an "off by default" state that can be toggled on in-game by the user. There is no guarantee that we will merge it.
If your visual bugfix is a fix added in a future version of LCE than the one we're targeting, it should also be put behind a toggle or equivalent system for keeping it off by default.
# Targeted Version
We are currently accepting backports for up to and including TU24. Feature backports from TU25 and above will not be accepted.
# Original Codebase
MinecraftConsoles is based on a WIP build of TU19, built on top of the December 2014 codebase.

View file

@ -1,6 +1,9 @@
# Scope of Project
At the moment, this project's scope is generally limited outside of adding new content to the game (blocks, mobs, items). We are currently prioritizing stability, quality of life, and platform support over these things.
## Backporting
If you're backporting a feature, please read [BACKPORTING.md](./BACKPORTING.md)
## Parity
We are attempting to keep our version of LCE as close to visual and experience parity with the original console experience of LCE as possible. This means that we will not be accepting changes that...
- Backport things from Java Edition that did not ever exist in LCE

View file

@ -241,7 +241,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float
if (riding)
{
if(uiBitmaskOverrideAnim&(1<<eAnim_SmallModel) == 0)
if ((uiBitmaskOverrideAnim&(1<<eAnim_SmallModel)) == 0)
{
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;

View file

@ -286,6 +286,20 @@ void ItemInHandRenderer::renderItem(shared_ptr<LivingEntity> mob, shared_ptr<Ite
float xo = 0.0f;
float yo = 0.3f;
// Re position height of held item if skin is small
if (mob->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_SmallModel))
{
if (mob->isRiding())
{
std::shared_ptr<Entity> ridingEntity = mob->riding;
if (ridingEntity != nullptr) // Safety check;
{
yo += 0.3f; // reverts the change in Boat.cpp for smaller models.
}
}
}
glEnable(GL_RESCALE_NORMAL);
glTranslatef(-xo, -yo, 0);

View file

@ -199,11 +199,26 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking();
double yp = y - mob->heightOffset;
if (mob->isSneaking() && !mob->instanceof(eTYPE_LOCALPLAYER))
if (mob->isSneaking())
{
yp -= 2 / 16.0f;
}
if (mob->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_SmallModel))
{
if (mob->isRiding())
{
std::shared_ptr<Entity> ridingEntity = mob->riding;
if (ridingEntity != nullptr) // Safety check;
{
if (ridingEntity->instanceof(eTYPE_BOAT))
{
yp += 0.25f; // reverts the change in Boat.cpp for smaller models.
}
}
}
}
// Check if an idle animation is needed
if(mob->getAnimOverrideBitmask()&(1<<HumanoidModel::eAnim_HasIdle))
{

View file

@ -87,7 +87,7 @@ Boat::Boat(Level *level, double x, double y, double z) : Entity( level )
double Boat::getRideHeight()
{
return heightOffset;
return heightOffset - 0.4f;
}
bool Boat::hurt(DamageSource *source, float hurtDamage)

View file

@ -67,21 +67,8 @@ bool PortalTile::isCubeShaped()
return false;
}
bool PortalTile::trySpawnPortal(Level *level, int x, int y, int z, bool actuallySpawn)
bool PortalTile::validPortalFrame(Level* level, int x, int y, int z, int xd, int zd, bool actuallySpawn)
{
int xd = 0;
int zd = 0;
if (level->getTile(x - 1, y, z) == Tile::obsidian_Id || level->getTile(x + 1, y, z) == Tile::obsidian_Id) xd = 1;
if (level->getTile(x, y, z - 1) == Tile::obsidian_Id || level->getTile(x, y, z + 1) == Tile::obsidian_Id) zd = 1;
if (xd == zd) return false;
if (level->getTile(x - xd, y, z - zd) == 0)
{
x -= xd;
z -= zd;
}
for (int xx = -1; xx <= 2; xx++)
{
for (int yy = -1; yy <= 3; yy++)
@ -101,9 +88,7 @@ bool PortalTile::trySpawnPortal(Level *level, int x, int y, int z, bool actually
}
}
}
if( !actuallySpawn )
return true;
if (!actuallySpawn) return true;
for (int xx = 0; xx < 2; xx++)
{
@ -112,9 +97,52 @@ bool PortalTile::trySpawnPortal(Level *level, int x, int y, int z, bool actually
level->setTileAndData(x + xd * xx, y + yy, z + zd * xx, Tile::portalTile_Id, 0, Tile::UPDATE_CLIENTS);
}
}
return true;
}
bool PortalTile::trySpawnPortal(Level *level, int x, int y, int z, bool actuallySpawn)
{
int xd = 0;
int zd = 0;
if (level->getTile(x - 1, y, z) == Tile::obsidian_Id || level->getTile(x + 1, y, z) == Tile::obsidian_Id) xd = 1;
if (level->getTile(x, y, z - 1) == Tile::obsidian_Id || level->getTile(x, y, z + 1) == Tile::obsidian_Id) zd = 1;
bool twoPosible = false; // two neth portals posible (x and z direction)
if (xd == zd)
{
if (xd == 1) twoPosible = true;
else return false;
}
bool changedx = false; // changed x so it can be reverted if two portals are posible
if (level->getTile(x - xd, y, z) == 0)
{
changedx = true;
x--;
}
else if (level->getTile(x, y, z - zd) == 0 && !twoPosible)
{
z--;
}
if (!twoPosible)
{
if (!validPortalFrame(level, x, y, z, xd, zd, actuallySpawn)) return false;
}
else
{
if (!validPortalFrame(level, x, y, z, xd, 0, actuallySpawn))
{
if (changedx) x++; // revert x (this check wants to check z not x and z)
if (level->getTile(x, y, z - zd) == 0) z--;
if (!validPortalFrame(level, x, y, z, 0, zd, actuallySpawn))
return false;
}
}
return true;
}
void PortalTile::neighborChanged(Level *level, int x, int y, int z, int type)

View file

@ -13,6 +13,7 @@ public:
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual bool isSolidRender(bool isServerLevel = false);
virtual bool isCubeShaped();
virtual bool validPortalFrame(Level* level, int x, int y, int z, int xd, int zd, bool actuallySpawn);
virtual bool trySpawnPortal(Level *level, int x, int y, int z, bool actuallySpawn);
virtual void neighborChanged(Level *level, int x, int y, int z, int type);
virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face);