forked from EXTERNAL/bareiron
fix mobs spawning in water
* Fixed underwater under lava mob spawn issue #17 * made comment changes * minor fix * method name change * method change * fixed
This commit is contained in:
@@ -28,6 +28,7 @@ uint8_t makeBlockChange (short x, uint8_t y, short z, uint8_t block);
|
||||
uint8_t isInstantlyMined (PlayerData *player, uint8_t block);
|
||||
uint8_t isColumnBlock (uint8_t block);
|
||||
uint8_t isPassableBlock (uint8_t block);
|
||||
uint8_t isPassableSpawnBlock (uint8_t block);
|
||||
uint8_t isReplaceableBlock (uint8_t block);
|
||||
uint32_t isCompostItem (uint16_t item);
|
||||
uint8_t getItemStackSize (uint16_t item);
|
||||
|
@@ -355,10 +355,10 @@ void handlePacket (int client_fd, int length, int packet_id, int state) {
|
||||
uint8_t b_mid = getBlockAt(mob_x, mob_y, mob_z);
|
||||
uint8_t b_top = getBlockAt(mob_x, mob_y + 1, mob_z);
|
||||
while (mob_y < 255) {
|
||||
if ( // Solid block below, non-solid at feet and above
|
||||
if ( // Solid block below, non-solid(spawnable) at feet and above
|
||||
!isPassableBlock(b_low) &&
|
||||
isPassableBlock(b_mid) &&
|
||||
isPassableBlock(b_top)
|
||||
isPassableSpawnBlock(b_mid) &&
|
||||
isPassableSpawnBlock(b_top)
|
||||
) break;
|
||||
b_low = b_mid;
|
||||
b_mid = b_top;
|
||||
|
@@ -637,6 +637,15 @@ uint8_t isPassableBlock (uint8_t block) {
|
||||
block == B_torch
|
||||
);
|
||||
}
|
||||
// Checks whether the given block is non-solid and spawnable
|
||||
uint8_t isPassableSpawnBlock (uint8_t block) {
|
||||
if ((block >= B_water && block < B_water + 8) ||
|
||||
(block >= B_lava && block < B_lava + 4))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return isPassableBlock(block);
|
||||
}
|
||||
|
||||
// Checks whether the given block can be replaced by another block
|
||||
uint8_t isReplaceableBlock (uint8_t block) {
|
||||
|
Reference in New Issue
Block a user