@Override public Message getSpawnMessage(Entity entity) { Controller c = entity.getController(); if (c == null) { return null; } int id = entity.getId(); int x = (int) (entity.getPosition().getX() * 32); int y = (int) (entity.getPosition().getY() * 32); int z = (int) (entity.getPosition().getZ() * 32); // FIXME: Store vehicle type in entity (VehicleEntity implementing?) class instead return new SpawnVehicleMessage(id, this.getSpawnedVehicleType(), x, y, z); }
@Override public Message[] getSpawnMessage(Entity entity) { Controller c = entity.getController(); if (c != null) { int id = entity.getId(); Vector3 pos = entity.getPosition().multiply(32).floor(); int r = (int) (entity.getYaw() * 32); int p = (int) (entity.getPitch() * 32); int headyaw = 0; if (c instanceof Living) { headyaw = ((Living) c).getHeadYaw(); } List<Parameter<?>> parameters = this.getSpawnParameters(c); return new Message[] { new SpawnMobMessage(id, this.getSpawnID(), pos, r, p, headyaw, parameters) }; } else { return null; } }
@Override public boolean shouldRun(Entity entity, VanillaActionController controller) { BlockMaterial block = entity.getWorld().getBlock(entity.getPosition()).getMaterial(); return !block.isSolid(); }