Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Added Pattern.next(int, int, int).
This method can be used to avoid creating short-lived vectors in tight loops.
Dieser Commit ist enthalten in:
Ursprung
8610dc2c89
Commit
02a70cca4a
@ -54,10 +54,22 @@ public class ClipboardPattern implements Pattern {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BaseBlock next(Vector pos) {
|
public BaseBlock next(Vector pos) {
|
||||||
int x = Math.abs(pos.getBlockX()) % size.getBlockX();
|
return next(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||||
int y = Math.abs(pos.getBlockY()) % size.getBlockY();
|
}
|
||||||
int z = Math.abs(pos.getBlockZ()) % size.getBlockZ();
|
|
||||||
|
|
||||||
return clipboard.getPoint(new Vector(x, y, z));
|
/**
|
||||||
|
* Get next block.
|
||||||
|
*
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BaseBlock next(int x, int y, int z) {
|
||||||
|
int xp = Math.abs(x) % size.getBlockX();
|
||||||
|
int yp = Math.abs(y) % size.getBlockY();
|
||||||
|
int zp = Math.abs(z) % size.getBlockZ();
|
||||||
|
|
||||||
|
return clipboard.getPoint(new Vector(xp, yp, zp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,13 @@ public interface Pattern {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BaseBlock next(Vector pos);
|
public BaseBlock next(Vector pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a block for a position. This return value of this method does
|
||||||
|
* not have to be consistent for the same position.
|
||||||
|
*
|
||||||
|
* @param pos
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BaseBlock next(int x, int y, int z);
|
||||||
}
|
}
|
||||||
|
@ -82,4 +82,8 @@ public class RandomFillPattern implements Pattern {
|
|||||||
|
|
||||||
throw new RuntimeException("ProportionalFillPattern");
|
throw new RuntimeException("ProportionalFillPattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BaseBlock next(int x, int y, int z) {
|
||||||
|
return next(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,10 @@ public class SingleBlockPattern implements Pattern {
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BaseBlock next(int x, int y, int z) {
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block.
|
* Get the block.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren