@Override public SpellResult perform(CastContext context) { Entity entity = context.getEntity(); if (entity == null) { return SpellResult.ENTITY_REQUIRED; } Location targetLocation = context.getLocation(); for (int i = 0; i < 2; i++) { if (!context.allowPassThrough(targetLocation.getBlock().getType())) return SpellResult.NO_TARGET; targetLocation.setY(targetLocation.getY() + 1); } Location location = context.findPlaceToStand(targetLocation, verticalSearchDistance, true); if (location == null && !safe) { location = context.getTargetLocation(); location.setPitch(targetLocation.getPitch()); location.setYaw(targetLocation.getYaw()); verticalSearchDistance = 0; } if (location != null) { teleport(context, entity, location); return SpellResult.CAST; } return SpellResult.NO_TARGET; }