Changelings disguised as blocks shouldn't overlap real blocks

This commit is contained in:
Sollace 2020-09-27 18:49:39 +02:00
parent e8b970bd82
commit ac74b1fbd3

View file

@ -17,6 +17,7 @@ import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
@ -49,6 +50,12 @@ public class EntityBehaviour<T extends Entity> {
double y = positionOffset.y + Math.floor(from.getY()); double y = positionOffset.y + Math.floor(from.getY());
double z = positionOffset.z + Math.floor(from.getZ()) + 0.5; double z = positionOffset.z + Math.floor(from.getZ()) + 0.5;
BlockPos pos = new BlockPos(x, y, z);
if (!from.world.isAir(pos) && !from.world.isWater(pos)) {
y++;
}
to.prevX = x; to.prevX = x;
to.prevY = y; to.prevY = y;
to.prevZ = z; to.prevZ = z;