few additions and bug fixes

Added Hand Sway (not an option yet) from b1,8

Fire works properly in multiplayer now and also renders on undead mobs in sunlight now

hopefully fixed bow stuck bug on touchscreen devices

Fire on entites uses updated rendering from b1.6.6

Shadow bug fix attempt the 15th

Added looking at block in debug screen

Zombie Pigman now renders his hat layer

Temporarily disabled most randomlevelsource cave, canyon and tall grass code just for this commit to test performance
This commit is contained in:
Shredder
2026-05-23 05:29:47 +05:00
parent 4b69a1240a
commit d7d887f882
17 changed files with 287 additions and 120 deletions

View File

@@ -465,6 +465,15 @@ void Entity::tick()
baseTick();
}
void Entity::setOnFire(int numberOfSeconds)
{
int newValue = numberOfSeconds * 20;
if (onFire < newValue)
{
onFire = newValue;
}
}
void Entity::baseTick()
{
TIMER_PUSH("entityBaseTick");

View File

@@ -89,6 +89,8 @@ public:
virtual bool isAlive();
virtual bool isOnFire();
virtual void setOnFire(int numberOfSeconds);
virtual bool isPlayer();
virtual bool isCreativeModeAllowed();

View File

@@ -169,7 +169,9 @@ void Mob::playAmbientSound()
level->playSound(this, ambient, getSoundVolume(), getVoicePitch());
}
}
bool Mob::isOnFire() {
return onFire > 0 || getSharedFlag(SharedFlagsInformation::FLAG_ONFIRE);
}
void Mob::baseTick()
{
oAttackAnim = attackAnim;
@@ -177,6 +179,18 @@ void Mob::baseTick()
TIMER_PUSH("mobBaseTick");
// @TODO - check if this section i added to make fire render in mp doesnt break crap - shredder
if (!level->isClientSide) {
// Server side: Tell the client if this mob/player is still burning
setSharedFlag(SharedFlagsInformation::FLAG_ONFIRE, onFire > 0);
} else {
// Client side: If the server flag says we aren't on fire, extinguish local visual timer
if (!getSharedFlag(SharedFlagsInformation::FLAG_ONFIRE)) {
onFire = 0;
}
}
// todo ends here
if (((ambientSoundTime++ & 15) == 0) && random.nextInt(2000) < ambientSoundTime) {
ambientSoundTime = -getAmbientSoundInterval();
playAmbientSound();

View File

@@ -52,6 +52,7 @@ public:
virtual bool isPickable();
virtual bool isPushable();
virtual bool isOnFire();
virtual bool isShootable();
MoveControl* getMoveControl();

View File

@@ -19,7 +19,7 @@ void Skeleton::aiStep() {
float br = getBrightness(1);
if (br > 0.5f) {
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) {
hurt(NULL, 1);
// hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder
for (int i = 0; i < 5; ++i) {
float xa = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f;
@@ -27,7 +27,7 @@ void Skeleton::aiStep() {
float za = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f;
level->addParticle(PARTICLETYPE(explode), x + random.nextFloat() * bbWidth * 2 - bbWidth, y + random.nextFloat() * bbHeight, z + random.nextFloat() * bbWidth * 2 - bbWidth, xa, ya, za);
}
//setOnFire(8); //@todo
setOnFire(8); //@todo
}
}
}

View File

@@ -55,7 +55,7 @@ void Zombie::aiStep() {
float br = getBrightness(1);
if (br > 0.5f) {
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) {
hurt(NULL, 1);
// hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder
for (int i = 0; i < 5; ++i) {
float xa = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f;
@@ -63,7 +63,7 @@ void Zombie::aiStep() {
float za = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f;
level->addParticle(PARTICLETYPE(explode), x + random.nextFloat() * bbWidth * 2 - bbWidth, y + random.nextFloat() * bbHeight, z + random.nextFloat() * bbWidth * 2 - bbWidth, xa, ya, za);
}
//setOnFire(8); //@todo
setOnFire(8); //@todo
}
}
}

View File

@@ -216,6 +216,7 @@ bool Player::checkBed() {
return (level->getTile(bedPosition.x, bedPosition.y, bedPosition.z) == Tile::bed->id);
}
void Player::tick() {
bool shouldSleep = entityData.getFlag<SharedFlagsInformation::SharedFlagsInformationType>(DATA_PLAYER_FLAGS_ID, PLAYER_SLEEP_FLAG);
if(shouldSleep != isSleeping()) {
@@ -246,11 +247,24 @@ void Player::tick() {
}
super::tick();
if (!level->isClientSide) {
// @TODO - Awful Hack Start, MCPE 0.6 doesn't deal damage with fire to players for some reason on mp, so we force it here to do it, need a better way honestly - shredder
if (level->containsFireTile(this->bb)) {
hurt(NULL, 1);
if (!isInWater()) {
if (onFire <= 0) {
onFire = 20 * 15;
}
}
}
// Awful hack ends here
foodData.tick(this);
// if (containerMenu != NULL && !containerMenu->stillValid(this)) {
// closeContainer();
// }
// if (containerMenu != NULL && !containerMenu->stillValid(this)) {
// closeContainer();
// }
}
}