Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Add 1.16 tree types (#757)
Dieser Commit ist enthalten in:
Ursprung
202631ca26
Commit
11f50f8b53
@ -54,14 +54,9 @@ public class ForestGenerator implements RegionFunction {
|
|||||||
BlockState block = editSession.getBlock(position);
|
BlockState block = editSession.getBlock(position);
|
||||||
BlockType t = block.getBlockType();
|
BlockType t = block.getBlockType();
|
||||||
|
|
||||||
switch (t.getInternalId()) {
|
if (t.getMaterial().isSolid()) {
|
||||||
case BlockID.GRASS_BLOCK:
|
|
||||||
case BlockID.DIRT:
|
|
||||||
case BlockID.PODZOL:
|
|
||||||
case BlockID.COARSE_DIRT:
|
|
||||||
return treeType.generate(editSession, position.add(0, 1, 0));
|
return treeType.generate(editSession, position.add(0, 1, 0));
|
||||||
default:
|
} else if (t.getMaterial().isReplacedDuringPlacement()) {
|
||||||
if (t.getMaterial().isReplacedDuringPlacement()) {
|
|
||||||
// since the implementation's tree generators generally don't generate in non-air spots,
|
// since the implementation's tree generators generally don't generate in non-air spots,
|
||||||
// we trick editsession history here in the first call
|
// we trick editsession history here in the first call
|
||||||
editSession.setBlock(position, BlockTypes.AIR.getDefaultState());
|
editSession.setBlock(position, BlockTypes.AIR.getDefaultState());
|
||||||
@ -78,4 +73,3 @@ public class ForestGenerator implements RegionFunction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -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