geforkt von Mirrors/FastAsyncWorldEdit
Ursprung
117f848ec4
Commit
9ca2d28648
@ -342,6 +342,9 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 pt) {
|
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 pt) {
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
TreeType bukkitType = toBukkitTreeType(type);
|
TreeType bukkitType = toBukkitTreeType(type);
|
||||||
|
if (bukkitType == TreeType.CHORUS_PLANT) {
|
||||||
|
pt = pt.add(0, 1, 0); // bukkit skips the feature gen which does this offset normally, so we have to add it back
|
||||||
|
}
|
||||||
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
|
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
|
||||||
new EditSessionBlockChangeDelegate(editSession));
|
new EditSessionBlockChangeDelegate(editSession));
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ import javax.annotation.Nullable;
|
|||||||
/**
|
/**
|
||||||
* Tree generator.
|
* Tree generator.
|
||||||
*/
|
*/
|
||||||
public class TreeGenerator {
|
public final class TreeGenerator {
|
||||||
|
|
||||||
public enum TreeType {
|
public enum TreeType {
|
||||||
TREE("Oak tree", "oak", "tree", "regular"),
|
TREE("Oak tree", "oak", "tree", "regular"),
|
||||||
@ -82,10 +82,12 @@ public class TreeGenerator {
|
|||||||
JUNGLE_BUSH("Jungle bush", "junglebush", "jungleshrub"),
|
JUNGLE_BUSH("Jungle bush", "junglebush", "jungleshrub"),
|
||||||
RED_MUSHROOM("Red mushroom", "redmushroom", "redgiantmushroom"),
|
RED_MUSHROOM("Red mushroom", "redmushroom", "redgiantmushroom"),
|
||||||
BROWN_MUSHROOM("Brown mushroom", "brownmushroom", "browngiantmushroom"),
|
BROWN_MUSHROOM("Brown mushroom", "brownmushroom", "browngiantmushroom"),
|
||||||
|
CRIMSON_FUNGUS("Crimson fungus", "crimsonfungus", "rednethermushroom"),
|
||||||
|
WARPED_FUNGUS("Warped fungus", "warpedfungus", "greennethermushroom"),
|
||||||
RANDOM_MUSHROOM("Random mushroom", "randmushroom", "randommushroom") {
|
RANDOM_MUSHROOM("Random mushroom", "randmushroom", "randommushroom") {
|
||||||
@Override
|
@Override
|
||||||
public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException {
|
public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException {
|
||||||
TreeType[] choices = { RED_MUSHROOM, BROWN_MUSHROOM };
|
TreeType[] choices = { RED_MUSHROOM, BROWN_MUSHROOM, CRIMSON_FUNGUS, WARPED_FUNGUS };
|
||||||
return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos);
|
return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -99,6 +101,13 @@ public class TreeGenerator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
CHORUS_PLANT("Chorus plant", "chorusplant") {
|
||||||
|
@Override
|
||||||
|
public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException {
|
||||||
|
// chorus plants have to generate starting in the end stone itself, not the air above the ground
|
||||||
|
return editSession.getWorld().generateTree(this, editSession, pos.subtract(0, 1, 0));
|
||||||
|
}
|
||||||
|
},
|
||||||
RANDOM("Random tree", "rand", "random") {
|
RANDOM("Random tree", "rand", "random") {
|
||||||
@Override
|
@Override
|
||||||
public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException {
|
public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren