@Override public boolean test(BlockVector3 vector) { try { if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) { ((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3()); } return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0; } catch (EvaluationException e) { return false; } }
@Dynamic public static double query(RValue x, RValue y, RValue z, RValue type, RValue data) throws EvaluationException { final double xp = x.getValue(); final double yp = y.getValue(); final double zp = z.getValue(); final ExpressionEnvironment environment = Expression.getInstance().getEnvironment(); // Read values from world final double typeId = environment.getBlockType(xp, yp, zp); final double dataValue = environment.getBlockData(xp, yp, zp); return queryInternal(type, data, typeId, dataValue); }
@Dynamic public static double queryAbs(RValue x, RValue y, RValue z, RValue type, RValue data) throws EvaluationException { final double xp = x.getValue(); final double yp = y.getValue(); final double zp = z.getValue(); final ExpressionEnvironment environment = Expression.getInstance().getEnvironment(); // Read values from world final double typeId = environment.getBlockTypeAbs(xp, yp, zp); final double dataValue = environment.getBlockDataAbs(xp, yp, zp); return queryInternal(type, data, typeId, dataValue); }
@Dynamic public static double queryRel(RValue x, RValue y, RValue z, RValue type, RValue data) throws EvaluationException { final double xp = x.getValue(); final double yp = y.getValue(); final double zp = z.getValue(); final ExpressionEnvironment environment = Expression.getInstance().getEnvironment(); // Read values from world final double typeId = environment.getBlockTypeRel(xp, yp, zp); final double dataValue = environment.getBlockDataRel(xp, yp, zp); return queryInternal(type, data, typeId, dataValue); }