mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-06 15:41:20 +01:00
Fix deprecated CuboidClipboard
This commit is contained in:
parent
59c2439c85
commit
343f117515
@ -685,20 +685,32 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void warnDeprecated(Class... alternatives) {
|
public static void warnDeprecated(Class... alternatives) {
|
||||||
StackTraceElement[] stack = new RuntimeException().getStackTrace();
|
StackTraceElement[] stacktrace = new RuntimeException().getStackTrace();
|
||||||
if (stack.length > 1) {
|
if (stacktrace.length > 1) {
|
||||||
try {
|
for (int i = 1; i < stacktrace.length; i++) {
|
||||||
StackTraceElement creatorElement = stack[stack.length - 2];
|
StackTraceElement stack = stacktrace[i];
|
||||||
String className = creatorElement.getClassName();
|
String s = stack.toString();
|
||||||
Class clazz = Class.forName(className);
|
if (s.startsWith("com.sk89q")) {
|
||||||
String creator = clazz.getSimpleName();
|
continue;
|
||||||
String packageName = clazz.getPackage().getName();
|
}
|
||||||
|
try {
|
||||||
|
StackTraceElement creatorElement = stacktrace[1];
|
||||||
|
String className = creatorElement.getClassName();
|
||||||
|
Class clazz = Class.forName(className);
|
||||||
|
String creator = clazz.getSimpleName();
|
||||||
|
String packageName = clazz.getPackage().getName();
|
||||||
|
|
||||||
StackTraceElement deprecatedElement = stack[stack.length - 1];
|
StackTraceElement deprecatedElement = stack;
|
||||||
String myName = Class.forName(deprecatedElement.getFileName()).getSimpleName();
|
String myName = Class.forName(deprecatedElement.getClassName()).getSimpleName();
|
||||||
Fawe.debug("@" + creator + " from " + packageName +": " + myName + " is deprecated.");
|
Fawe.debug("@" + creator + " used by " + myName + "." + deprecatedElement.getMethodName() + "():" + deprecatedElement.getLineNumber() + " is deprecated.");
|
||||||
Fawe.debug(" - Alternatives: " + StringMan.getString(alternatives));
|
Fawe.debug(" - Alternatives: " + StringMan.getString(alternatives));
|
||||||
} catch (Throwable ignore) {}
|
} catch (Throwable ignore) {
|
||||||
|
ignore.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.command.SchematicCommands;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
@ -93,7 +94,7 @@ public class CuboidClipboard {
|
|||||||
*/
|
*/
|
||||||
public CuboidClipboard(Vector size) {
|
public CuboidClipboard(Vector size) {
|
||||||
checkNotNull(size);
|
checkNotNull(size);
|
||||||
MainUtil.warnDeprecated(BlockArrayClipboard.class);
|
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||||
origin = new Vector();
|
origin = new Vector();
|
||||||
offset = new Vector();
|
offset = new Vector();
|
||||||
this.size = size;
|
this.size = size;
|
||||||
@ -113,6 +114,7 @@ public class CuboidClipboard {
|
|||||||
public CuboidClipboard(Vector size, Vector origin) {
|
public CuboidClipboard(Vector size, Vector origin) {
|
||||||
checkNotNull(size);
|
checkNotNull(size);
|
||||||
checkNotNull(origin);
|
checkNotNull(origin);
|
||||||
|
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.offset = new Vector();
|
this.offset = new Vector();
|
||||||
this.size = size;
|
this.size = size;
|
||||||
@ -134,6 +136,7 @@ public class CuboidClipboard {
|
|||||||
checkNotNull(size);
|
checkNotNull(size);
|
||||||
checkNotNull(origin);
|
checkNotNull(origin);
|
||||||
checkNotNull(offset);
|
checkNotNull(offset);
|
||||||
|
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
@ -433,7 +436,7 @@ public class CuboidClipboard {
|
|||||||
final int width = getWidth();
|
final int width = getWidth();
|
||||||
final int length = getLength();
|
final int length = getLength();
|
||||||
final int height = getHeight();
|
final int height = getHeight();
|
||||||
final Vector sizeRotated = size.transform2D(angle, 0, 0, 0, 0);
|
final Vector sizeRotated = size.transform2D(angle, 0, 0, 0, 0).round();
|
||||||
final int shiftX = sizeRotated.getX() < 0 ? -sizeRotated.getBlockX() - 1 : 0;
|
final int shiftX = sizeRotated.getX() < 0 ? -sizeRotated.getBlockX() - 1 : 0;
|
||||||
final int shiftZ = sizeRotated.getZ() < 0 ? -sizeRotated.getBlockZ() - 1 : 0;
|
final int shiftZ = sizeRotated.getZ() < 0 ? -sizeRotated.getBlockZ() - 1 : 0;
|
||||||
|
|
||||||
@ -443,7 +446,7 @@ public class CuboidClipboard {
|
|||||||
|
|
||||||
for (int x = 0; x < width; ++x) {
|
for (int x = 0; x < width; ++x) {
|
||||||
for (int z = 0; z < length; ++z) {
|
for (int z = 0; z < length; ++z) {
|
||||||
final Vector2D v = new Vector2D(x, z).transform2D(angle, 0, 0, shiftX, shiftZ);
|
final Vector2D v = new Vector2D(x, z).transform2D(angle, 0, 0, shiftX, shiftZ).round();
|
||||||
final int newX = v.getBlockX();
|
final int newX = v.getBlockX();
|
||||||
final int newZ = v.getBlockZ();
|
final int newZ = v.getBlockZ();
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
|
Loading…
Reference in New Issue
Block a user