@@ -87,7 +87,7 @@ Boat::Boat(Level *level, double x, double y, double z) : Entity( level )
|
|||||||
|
|
||||||
double Boat::getRideHeight()
|
double Boat::getRideHeight()
|
||||||
{
|
{
|
||||||
return bbHeight * 0.0f - 0.3f;
|
return heightOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Boat::hurt(DamageSource *source, float hurtDamage)
|
bool Boat::hurt(DamageSource *source, float hurtDamage)
|
||||||
@@ -283,11 +283,11 @@ void Boat::tick()
|
|||||||
|
|
||||||
// 4J Stu - Fix for #9579 - GAMEPLAY: Boats with a player in them slowly sink under the water over time, and with no player in them they float into the sky.
|
// 4J Stu - Fix for #9579 - GAMEPLAY: Boats with a player in them slowly sink under the water over time, and with no player in them they float into the sky.
|
||||||
// Just make the boats bob up and down rather than any other client-side movement when not receiving packets from server
|
// Just make the boats bob up and down rather than any other client-side movement when not receiving packets from server
|
||||||
if (waterPercentage < 1)
|
if (waterPercentage > 0)
|
||||||
{
|
{
|
||||||
double bob = waterPercentage * 2 - 1;
|
double bob = waterPercentage * 2 - 1;
|
||||||
yd += 0.04f * bob;
|
yd += 0.04f * bob;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (yd < 0) yd /= 2;
|
if (yd < 0) yd /= 2;
|
||||||
@@ -307,15 +307,14 @@ void Boat::tick()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waterPercentage < 1)
|
if (waterPercentage > 0)
|
||||||
{
|
{
|
||||||
double bob = waterPercentage * 2 - 1;
|
double bob = waterPercentage * 2 - 1;
|
||||||
yd += 0.04f * bob;
|
yd += 0.04f * bob;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (yd < 0) yd /= 2;
|
yd = 0;
|
||||||
yd += 0.007f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1305,42 +1305,46 @@ void LivingEntity::teleportTo(double x, double y, double z)
|
|||||||
|
|
||||||
void LivingEntity::findStandUpPosition(shared_ptr<Entity> vehicle)
|
void LivingEntity::findStandUpPosition(shared_ptr<Entity> vehicle)
|
||||||
{
|
{
|
||||||
AABB *boundingBox;
|
const double vehicleX = vehicle->x;
|
||||||
double fallbackX = vehicle->x;
|
const double vehicleY = vehicle->bb->y0 + vehicle->bbHeight;
|
||||||
double fallbackY = vehicle->bb->y0 + vehicle->bbHeight;
|
const double vehicleZ = vehicle->z;
|
||||||
double fallbackZ = vehicle->z;
|
double fallbackX = vehicleX;
|
||||||
|
double fallbackY = vehicleY;
|
||||||
|
double fallbackZ = vehicleZ;
|
||||||
|
const double searchY = vehicleY;
|
||||||
|
|
||||||
for (double xDiff = -1.5; xDiff < 2; xDiff += 1.5)
|
for (double xDiff = -1.5; xDiff < 2; xDiff += 1.5)
|
||||||
{
|
{
|
||||||
for (double zDiff = -1.5; zDiff < 2; zDiff += 1.5)
|
for (double zDiff = -1.5; zDiff < 2; zDiff += 1.5)
|
||||||
{
|
{
|
||||||
if (xDiff == 0 && zDiff == 0)
|
if (xDiff == 0 && zDiff == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xToInt = (int) (x + xDiff);
|
const int xToInt = static_cast<int>(vehicleX + xDiff);
|
||||||
int zToInt = (int) (z + zDiff);
|
const int zToInt = static_cast<int>(vehicleZ + zDiff);
|
||||||
boundingBox = bb->cloneMove(xDiff, 1, zDiff);
|
AABB *boundingBox = bb->cloneMove(vehicleX + xDiff - x, searchY + 1 - y, vehicleZ + zDiff - z);
|
||||||
|
|
||||||
if (level->getTileCubes(boundingBox, true)->empty())
|
if (level->getTileCubes(boundingBox, true)->empty())
|
||||||
{
|
{
|
||||||
if (level->isTopSolidBlocking(xToInt, (int) y, zToInt))
|
if (level->isTopSolidBlocking(xToInt, static_cast<int>(searchY), zToInt))
|
||||||
{
|
{
|
||||||
teleportTo(x + xDiff, y + 1, z + zDiff);
|
teleportTo(vehicleX + xDiff, searchY + 1, vehicleZ + zDiff);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (level->isTopSolidBlocking(xToInt, (int) y - 1, zToInt) || level->getMaterial(xToInt, (int) y - 1, zToInt) == Material::water)
|
if (level->isTopSolidBlocking(xToInt, static_cast<int>(searchY) - 1, zToInt) ||
|
||||||
{
|
level->getMaterial(xToInt, static_cast<int>(searchY) - 1, zToInt) == Material::water)
|
||||||
fallbackX = x + xDiff;
|
{
|
||||||
fallbackY = y + 1;
|
fallbackX = vehicleX + xDiff;
|
||||||
fallbackZ = z + zDiff;
|
fallbackY = searchY + 1;
|
||||||
}
|
fallbackZ = vehicleZ + zDiff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
teleportTo(fallbackX, fallbackY, fallbackZ);
|
teleportTo(fallbackX, fallbackY, fallbackZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LivingEntity::shouldShowName()
|
bool LivingEntity::shouldShowName()
|
||||||
|
|||||||
Reference in New Issue
Block a user