Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Even more changes made towards a proper Vector update, as well as minor FAVS changes to accomodate for recent vector changes.
Dieser Commit ist enthalten in:
Ursprung
628c9cc0b7
Commit
90b3439dc2
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
||||
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.thevoxelbox.voxelsniper.Message;
|
||||
import com.thevoxelbox.voxelsniper.SnipeData;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thevoxelbox.voxelsniper.brush;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.thevoxelbox.voxelsniper.Message;
|
||||
import com.thevoxelbox.voxelsniper.SnipeData;
|
||||
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thevoxelbox.voxelsniper.brush;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.thevoxelbox.voxelsniper.Message;
|
||||
import com.thevoxelbox.voxelsniper.SnipeData;
|
||||
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thevoxelbox.voxelsniper.brush;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.thevoxelbox.voxelsniper.Message;
|
||||
import com.thevoxelbox.voxelsniper.SnipeData;
|
||||
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
|
||||
|
@ -2,10 +2,10 @@ package com.thevoxelbox.voxelsniper.brush.perform;
|
||||
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
|
||||
import com.boydti.fawe.object.pattern.PatternTraverser;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.thevoxelbox.voxelsniper.Message;
|
||||
import com.thevoxelbox.voxelsniper.SnipeData;
|
||||
import org.bukkit.block.Block;
|
||||
@ -14,7 +14,6 @@ public class PatternPerformer extends vPerformer {
|
||||
private String info;
|
||||
private Pattern pattern;
|
||||
private Extent extent;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
@Override
|
||||
public void info(Message vm) {
|
||||
@ -33,9 +32,9 @@ public class PatternPerformer extends vPerformer {
|
||||
|
||||
@Override
|
||||
public void perform(AsyncBlock block) {
|
||||
mutable.setComponents(block.getX(), block.getY(), block.getZ());
|
||||
BlockVector3 bv = BlockVector3.at(block.getX(), block.getY(), block.getZ());
|
||||
try {
|
||||
pattern.apply(extent, mutable, mutable);
|
||||
pattern.apply(extent, bv, bv);
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -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();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren