Changed Block Meta Data

This commit is contained in:
ttewrrr
2026-03-13 17:31:31 +01:00
parent 95cc0b0818
commit c68301f735
4 changed files with 26 additions and 13 deletions
+20 -7
View File
@@ -1,20 +1,33 @@
#include "stdafx.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.phys.h"
#include "net.minecraft.world.entity.h"
#include "SlimeTile.h"
SlimeTile::SlimeTile(int id) : Tile(id, Material::dirt)
SlimeTile::SlimeTile(int id) : Tile(id, Material::sand)
{
}
void SlimeTile::fallOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity, float fallDistance)
{
printf("SlimeTile::fallOn: %f\n", fallDistance);
if (fallDistance < 4.0f)
// If the entity is a living entity and sneaking (crouching) then do normal fall behavior
shared_ptr<LivingEntity> le = dynamic_pointer_cast<LivingEntity>(entity);
if (le != nullptr && le->isSneaking())
{
entity->yd = 0.0;
Tile::fallOn(level, x, y, z, entity, fallDistance);
return;
}
else
// Only apply bounce when there was fall distance (called when landing)
if (fallDistance > 0.0f)
{
entity->yd = -entity->yd * 0.8;
// Use the entity's vertical velocity to compute bounce. Use a reasonable multiplier.
float bounce = (float)(-entity->yd * 0.8f);
if (fabs(bounce) < 0.1f) bounce = 0.0f;
// Apply bounce by setting vertical velocity and reset fall distance.
// Do not call move() here — let normal physics apply the velocity next tick.
entity->yd = bounce;
entity->fallDistance = 0.0f;
}
}