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:
IronApollo 2019-01-13 01:38:08 -05:00
Ursprung 628c9cc0b7
Commit 90b3439dc2
7 geänderte Dateien mit 75 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -4,8 +4,8 @@ import java.util.ArrayList;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.bukkit.wrapper.AsyncWorld; import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;

Datei anzeigen

@ -1,7 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;

Datei anzeigen

@ -1,7 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;

Datei anzeigen

@ -1,7 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;

Datei anzeigen

@ -2,10 +2,10 @@ package com.thevoxelbox.voxelsniper.brush.perform;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.object.pattern.PatternTraverser; import com.boydti.fawe.object.pattern.PatternTraverser;
import com.sk89q.worldedit.MutableBlockVector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -14,7 +14,6 @@ public class PatternPerformer extends vPerformer {
private String info; private String info;
private Pattern pattern; private Pattern pattern;
private Extent extent; private Extent extent;
private MutableBlockVector mutable = new MutableBlockVector();
@Override @Override
public void info(Message vm) { public void info(Message vm) {
@ -33,9 +32,9 @@ public class PatternPerformer extends vPerformer {
@Override @Override
public void perform(AsyncBlock block) { public void perform(AsyncBlock block) {
mutable.setComponents(block.getX(), block.getY(), block.getZ()); BlockVector3 bv = BlockVector3.at(block.getX(), block.getY(), block.getZ());
try { try {
pattern.apply(extent, mutable, mutable); pattern.apply(extent, bv, bv);
} catch (WorldEditException e) { } catch (WorldEditException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

Datei anzeigen

@ -20,6 +20,8 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; 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.Vector2;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
@ -261,7 +263,7 @@ public class FawePrimitiveBinding extends BindingHelper {
behavior = BindingBehavior.CONSUMES, behavior = BindingBehavior.CONSUMES,
consumedCount = 1, consumedCount = 1,
provideModifiers = true) 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 radiusString = context.next();
String[] radii = radiusString.split(","); String[] radii = radiusString.split(",");
final double radiusX, radiusY, radiusZ; final double radiusX, radiusY, radiusZ;
@ -294,7 +296,7 @@ public class FawePrimitiveBinding extends BindingHelper {
behavior = BindingBehavior.CONSUMES, behavior = BindingBehavior.CONSUMES,
consumedCount = 1, consumedCount = 1,
provideModifiers = true) 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 radiusString = context.next();
String[] radii = radiusString.split(","); String[] radii = radiusString.split(",");
final double radiusX, radiusZ; 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."); throw new ParameterException("You must either specify 1 or 2 radius values.");
} }
return Vector2.at(radiusX, radiusZ); 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. * Try to parse numeric input as either a number or a mathematical expression.

Datei anzeigen

@ -772,7 +772,7 @@ public enum BlockTypes implements BlockType {
String name = (name().indexOf(':') == -1 ? "minecraft:" : "") + name().toLowerCase(); String name = (name().indexOf(':') == -1 ? "minecraft:" : "") + name().toLowerCase();
ReflectionUtils.setFailsafeFieldValue(BlockTypes.class.getDeclaredField("id"), this, name); 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); ReflectionUtils.setFailsafeFieldValue(BlockTypes.class.getDeclaredField("settings"), this, settings);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();