FIX: Steve skin hand, containers open in creative, crash when downfalls is nullptr, build on android (hope)

This commit is contained in:
2026-07-21 14:43:37 +02:00
parent d7a51b09f1
commit 9a743b9aea
11 changed files with 42 additions and 22 deletions

View File

@@ -329,7 +329,10 @@ bool ChestScreen::handleAddItem(FillingContainer* from, FillingContainer* to, in
added = (takenItem.count != wantedCount);
if (added) {
item->count -= (wantedCount - takenItem.count);
if (!minecraft->isCreativeMode()) {
item->count -= (wantedCount - takenItem.count);
}
std::vector<int> changed;
std::vector<const ItemInstance*> items = getItems(toPane);
differ.getDiff(items, changed);

View File

@@ -500,6 +500,8 @@ ItemInstance FurnaceScreen::moveOver(const ItemInstance* item, int maxCount) {
setIfNotSet(doRecreatePane, newSize != oldSize);
return removed;
}
return ItemInstance();
}

View File

@@ -21,6 +21,9 @@ HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/, int texW /
texWidth = texW;
texHeight = texH;
// texWidth = 64;
// texHeight = 32;
head.setModel(this);
hair.setModel(this);
body.setModel(this);

View File

@@ -554,9 +554,9 @@ void LocalPlayer::aiStep() {
//if (onGround && abilities.flying)
// abilities.flying = false;
yBobO = yBob;
xBobO = xBob;
xBob += (xRot - xBob) * 0.5;
yBobO = yBob;
xBobO = xBob;
xBob += (xRot - xBob) * 0.5;
yBob += (yRot - yBob) * 0.5;
if (interpolateOnly())
@@ -774,22 +774,19 @@ void LocalPlayer::startCrafting(int x, int y, int z, int tableSize) {
void LocalPlayer::startStonecutting(int x, int y, int z) {
#ifndef STANDALONE_SERVER
if (!minecraft->isCreativeMode())
minecraft->setScreen( new StonecutterScreen() );
minecraft->setScreen( new StonecutterScreen() );
#endif
}
void LocalPlayer::openFurnace( FurnaceTileEntity* e ) {
#ifndef STANDALONE_SERVER
if (!minecraft->isCreativeMode())
minecraft->setScreen( new FurnaceScreen(this, e) );
minecraft->setScreen( new FurnaceScreen(this, e) );
#endif
}
void LocalPlayer::openContainer( ChestTileEntity* container ) {
#ifndef STANDALONE_SERVER
if (!minecraft->isCreativeMode())
minecraft->setScreen( new ChestScreen(this, container) );
minecraft->setScreen( new ChestScreen(this, container) );
#endif
}

View File

@@ -291,14 +291,13 @@ void ItemInHandRenderer::render( float a )
Lighting::turnOn(mc);
glPopMatrix2();
if (localPlayer) // shredder added, basically does the hand swaying animation from b1.8
{
float xrr = localPlayer->xBobO + (localPlayer->xBob - localPlayer->xBobO) * a;
float yrr = localPlayer->yBobO + (localPlayer->yBob - localPlayer->yBobO) * a;
// 4J - was using player->xRot and yRot directly here rather than interpolating between old & current with a
float yr = player->yRotO + (player->yRot - player->yRotO) * a;
glRotatef((xr - xrr) * 0.1f, 1, 0, 0);
glRotatef((yr - yrr) * 0.1f, 0, 1, 0);
if (localPlayer) { // shredder added, basically does the hand swaying animation from b1.8
float xrr = localPlayer->xBobO + (localPlayer->xBob - localPlayer->xBobO) * a;
float yrr = localPlayer->yBobO + (localPlayer->yBob - localPlayer->yBobO) * a;
// 4J - was using player->xRot and yRot directly here rather than interpolating between old & current with a
float yr = player->yRotO + (player->yRot - player->yRotO) * a;
glRotatef((xr - xrr) * 0.1f, 1, 0, 0);
glRotatef((yr - yrr) * 0.1f, 0, 1, 0);
}
float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
@@ -425,6 +424,8 @@ void ItemInHandRenderer::render( float a )
EntityRenderer* er = EntityRenderDispatcher::getInstance()->getRenderer(mc->player);
HumanoidMobRenderer* playerRenderer = (HumanoidMobRenderer*) er;
EntityRenderDispatcher::getInstance()->setModernSkin((Entity*)(player));
float ss = 1;
glScalef2(ss, ss, ss);
playerRenderer->renderHand();

View File

@@ -137,6 +137,11 @@ void EntityRenderDispatcher::render( Entity* entity, float x, float y, float z,
}
}
void EntityRenderDispatcher::setModernSkin(Entity* player) {
PlayerRenderer* rend = (PlayerRenderer*)(getRenderer(player));
rend->setModernSkin((Mob*)player);
}
EntityRenderer* EntityRenderDispatcher::getRenderer( Entity* entity )
{
EntityRendererId rendererId = entity->entityRendererId;

View File

@@ -45,6 +45,8 @@ public:
Font* getFont();
void onGraphicsReset();
void setModernSkin(Entity* player);
private:
void assign(EntityRendererId id, EntityRenderer* renderer);
public:

View File

@@ -70,13 +70,18 @@ void PlayerRenderer::renderName( Mob* mob, float x, float y, float z ){
}
}
void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot, float a) {
Mob* mob = (Mob*) mob_;
// @note fix player skin system
void PlayerRenderer::setModernSkin(Mob* mob) {
HumanoidModel* desired = isModernPlayerSkin(mob) ? playerModel64 : playerModel32;
if (model != desired || humanoidModel != desired) {
model = desired;
humanoidModel = desired;
}
}
void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot, float a) {
Mob* mob = (Mob*) mob_;
setModernSkin(mob);
/* LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n",
((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
humanoidModel->texWidth, humanoidModel->texHeight,

View File

@@ -19,6 +19,8 @@ public:
virtual void renderName(Mob* mob, float x, float y, float z);
virtual void onGraphicsReset();
void setModernSkin(Mob* mob);
private:
HumanoidModel* playerModel32;
HumanoidModel* playerModel64;

View File

@@ -162,7 +162,7 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MessageP
if (player == nullptr) return; // @todo maybe kick?
std::string msg = packet->message.C_String();
if (packet->message[0] == '/') {
if (msg[0] == '/') {
// This is a command
ChatPacket resp(minecraft->commandManager().execute(*minecraft, *player, Util::stringTrim(msg.substr(1))));

View File

@@ -44,7 +44,7 @@ int TallGrass::getColor( LevelSource* level, int x, int y, int z ) {
int d = level->getData(x, y, z);
if (d == DEAD_SHRUB); //return 0xffffff; // i removed this to make it accurate to beta 1.6.6 instead of early java release versions
float temp = level->getBiomeSource()->temperatures[0]; // shredder added
float rain = level->getBiomeSource()->downfalls[0]; // shredder added
float rain = level->getBiomeSource()->downfalls != nullptr ? level->getBiomeSource()->downfalls[0] : 0; // shredder added
if (!GrassColor::useTint && d == DEAD_SHRUB){
return 0xffffff;
}