mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Even more changes made towards a proper Vector update, as well as minor FAVS changes to accomodate for recent vector changes.
This commit is contained in:
@ -20,6 +20,8 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
@ -261,7 +263,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public Vector3 getVector(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
public Vector3 getVector3(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
@ -294,7 +296,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public Vector2 getVector2D(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
public Vector2 getVector2(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusZ;
|
||||
@ -312,7 +314,69 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
throw new ParameterException("You must either specify 1 or 2 radius values.");
|
||||
}
|
||||
return Vector2.at(radiusX, radiusZ);
|
||||
}
|
||||
} /**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = BlockVector3.class,
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public BlockVector3 getBlockVector3(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
switch (radii.length) {
|
||||
case 1:
|
||||
radiusX = radiusY = radiusZ = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[0]));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
radiusX = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[0]));
|
||||
radiusY = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[1]));
|
||||
radiusZ = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[2]));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ParameterException("You must either specify 1 or 3 radius values.");
|
||||
}
|
||||
return BlockVector3.at(radiusX, radiusY, radiusZ);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = BlockVector2.class,
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public BlockVector2 getBlockVector2(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusZ;
|
||||
switch (radii.length) {
|
||||
case 1:
|
||||
radiusX = radiusZ = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[0]));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
radiusX = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[0]));
|
||||
radiusZ = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[1]));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ParameterException("You must either specify 1 or 2 radius values.");
|
||||
}
|
||||
return BlockVector2.at(radiusX, radiusZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to parse numeric input as either a number or a mathematical expression.
|
||||
|
@ -772,7 +772,7 @@ public enum BlockTypes implements BlockType {
|
||||
String name = (name().indexOf(':') == -1 ? "minecraft:" : "") + name().toLowerCase();
|
||||
ReflectionUtils.setFailsafeFieldValue(BlockTypes.class.getDeclaredField("id"), this, name);
|
||||
}
|
||||
Settings settings = new Settings(this, id, internalId, states);
|
||||
Settings settings = new Settings((this.getTypeEnum() == BlockTypes.__RESERVED__ ? BlockTypes.AIR : this), id, internalId, states);
|
||||
ReflectionUtils.setFailsafeFieldValue(BlockTypes.class.getDeclaredField("settings"), this, settings);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
Reference in New Issue
Block a user