geforkt von Mirrors/FastAsyncWorldEdit
Improved the prioritized block spawn list by adding more block types.
Dieser Commit ist enthalten in:
Ursprung
53c3c1064e
Commit
767c445f4c
@ -70,28 +70,11 @@ public class EditSession {
|
||||
* reproduction.
|
||||
*/
|
||||
private boolean queued = false;
|
||||
/**
|
||||
* List of object types to queue.
|
||||
*/
|
||||
private static final HashSet<Integer> queuedBlocks = new HashSet<Integer>();
|
||||
/**
|
||||
* Random number generator.
|
||||
*/
|
||||
private static Random prng = new Random();
|
||||
|
||||
static {
|
||||
queuedBlocks.add(50); // Torch
|
||||
queuedBlocks.add(37); // Yellow flower
|
||||
queuedBlocks.add(38); // Red rose
|
||||
queuedBlocks.add(39); // Brown mushroom
|
||||
queuedBlocks.add(40); // Red mushroom
|
||||
queuedBlocks.add(59); // Crops
|
||||
queuedBlocks.add(63); // Sign
|
||||
queuedBlocks.add(75); // Redstone torch (off)
|
||||
queuedBlocks.add(76); // Redstone torch (on)
|
||||
queuedBlocks.add(84); // Reed
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor. There is no maximum blocks limit.
|
||||
*/
|
||||
@ -200,12 +183,12 @@ public class EditSession {
|
||||
*/
|
||||
private boolean smartSetBlock(Vector pt, BaseBlock block) {
|
||||
if (queued) {
|
||||
if (!block.isAir() && queuedBlocks.contains(block.getID())
|
||||
if (!block.isAir() && BlockType.shouldPlaceLast(block.getID())
|
||||
&& rawGetBlock(pt.add(0, -1, 0)).isAir()) {
|
||||
queue.put(pt.toBlockVector(), block);
|
||||
return getBlock(pt).getID() != block.getID();
|
||||
} else if (block.isAir()
|
||||
&& queuedBlocks.contains(rawGetBlock(pt.add(0, 1, 0)).getID())) {
|
||||
&& BlockType.shouldPlaceLast(rawGetBlock(pt.add(0, 1, 0)).getID())) {
|
||||
rawSetBlock(pt.add(0, 1, 0), new BaseBlock(0)); // Prevent items from being dropped
|
||||
}
|
||||
}
|
||||
|
@ -192,4 +192,48 @@ public enum BlockType {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see whether a block should be placed last.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldPlaceLast() {
|
||||
return shouldPlaceLast(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see whether a block should be placed last.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static boolean shouldPlaceLast(int id) {
|
||||
return id == 6 // Saplings
|
||||
|| id == 37 // Yellow flower
|
||||
|| id == 38 // Red flower
|
||||
|| id == 39 // Brown mushroom
|
||||
|| id == 40 // Red mush room
|
||||
|| id == 50 // Torch
|
||||
|| id == 51 // Fire
|
||||
|| id == 55 // Redstone wire
|
||||
|| id == 59 // Crops
|
||||
|| id == 63 // Sign post
|
||||
|| id == 64 // Wooden door
|
||||
|| id == 65 // Ladder
|
||||
|| id == 66 // Minecart tracks
|
||||
|| id == 68 // Wall sign
|
||||
|| id == 69 // Lever
|
||||
|| id == 70 // Stone pressure plate
|
||||
|| id == 71 // Iron door
|
||||
|| id == 72 // Wooden pressure plate
|
||||
|| id == 75 // Redstone torch (off)
|
||||
|| id == 76 // Redstone torch (on)
|
||||
|| id == 77 // Stone button
|
||||
|| id == 78 // Snow
|
||||
|| id == 81 // Cactus
|
||||
|| id == 83 // Reed
|
||||
|| id == 90; // Portal
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren