com.mojang.brigadier.arguments.DoubleArgumentType Java Examples
The following examples show how to use
com.mojang.brigadier.arguments.DoubleArgumentType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DoubleArgument.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
/** * A double argument with a minimum and maximum value * @param min The minimum value this argument can take (inclusive) * @param max The maximum value this argument can take (inclusive) */ public DoubleArgument(double min, double max) { super(DoubleArgumentType.doubleArg(min, max)); if(max < min) { throw new InvalidRangeException(); } }
Example #2
Source File: DoubleArgumentPropertySerializer.java From Velocity with MIT License | 5 votes |
@Override public DoubleArgumentType deserialize(ByteBuf buf) { byte flags = buf.readByte(); double minimum = (flags & HAS_MINIMUM) != 0 ? buf.readDouble() : Double.MIN_VALUE; double maximum = (flags & HAS_MAXIMUM) != 0 ? buf.readDouble() : Double.MAX_VALUE; return DoubleArgumentType.doubleArg(minimum, maximum); }
Example #3
Source File: DoubleArgumentPropertySerializer.java From Velocity with MIT License | 5 votes |
@Override public void serialize(DoubleArgumentType object, ByteBuf buf) { boolean hasMinimum = Double.compare(object.getMinimum(), Double.MIN_VALUE) != 0; boolean hasMaximum = Double.compare(object.getMaximum(), Double.MAX_VALUE) != 0; byte flag = getFlags(hasMinimum, hasMaximum); buf.writeByte(flag); if (hasMinimum) { buf.writeDouble(object.getMinimum()); } if (hasMaximum) { buf.writeDouble(object.getMaximum()); } }
Example #4
Source File: DoubleArgument.java From 1.13-Command-API with Apache License 2.0 | 4 votes |
/** * A double argument */ public DoubleArgument() { super(DoubleArgumentType.doubleArg()); }
Example #5
Source File: DoubleArgument.java From 1.13-Command-API with Apache License 2.0 | 2 votes |
/** * A double argument with a minimum value * @param min The minimum value this argument can take (inclusive) */ public DoubleArgument(double min) { super(DoubleArgumentType.doubleArg(min)); }