Skip to content

Commit

Permalink
feat: implement recently-added tree types to tree generator (#2332)
Browse files Browse the repository at this point in the history
* feat: implement recently-added tree types to tree generator

* fix: add mappings to implementation worlds

* Use later API version to fix tests

---------

Co-authored-by: Madeline Miller <mnmiller1@me.com>
  • Loading branch information
dordsor21 and me4502 committed Jun 14, 2023
1 parent 1f22906 commit 4892e05
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions worldedit-bukkit/build.gradle.kts
Expand Up @@ -42,7 +42,7 @@ dependencies {
"api"(project(":worldedit-libs:bukkit"))
// Technically this is api, but everyone should already have some form of the bukkit API
// Avoid pulling in another one, especially one so outdated.
"localImplementation"("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") {
"localImplementation"("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT") {
exclude("junit", "junit")
}

Expand All @@ -52,7 +52,7 @@ dependencies {
"localImplementation"("org.apache.logging.log4j:log4j-api")

"compileOnly"("org.jetbrains:annotations:20.1.0")
"compileOnly"("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT") {
"compileOnly"("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") {
exclude("org.slf4j", "slf4j-api")
exclude("junit", "junit")
}
Expand Down
Expand Up @@ -30,6 +30,7 @@
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.profile.PlayerProfile;

import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -144,6 +145,11 @@ public UUID getUniqueId() {
return randomUuid;
}

@Override
public PlayerProfile getPlayerProfile() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean isBanned() {
throw new UnsupportedOperationException("Not supported yet.");
Expand Down Expand Up @@ -278,4 +284,9 @@ public void decrementStatistic(Statistic statistic, EntityType entityType, int a
public void setStatistic(Statistic statistic, EntityType entityType, int newValue) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Location getLastDeathLocation() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
Expand Up @@ -108,6 +108,9 @@ public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxCha
return editSession.getWorld().generateTree(this, editSession, pos.subtract(0, 1, 0));
}
},
MANGROVE("Mangrove tree", "mangrove"),
TALL_MANGROVE("Tall mangrove tree", "tall_mangrove"),
CHERRY("Cherry blossom", "cherry"),
RANDOM("Random tree", "rand", "random") {
@Override
public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException {
Expand Down
Expand Up @@ -446,6 +446,9 @@ private List<CompletableFuture<ChunkAccess>> submitChunkLoadTasks(Region region,
case WARPED_FUNGUS -> TreeFeatures.WARPED_FUNGUS;
case CRIMSON_FUNGUS -> TreeFeatures.CRIMSON_FUNGUS;
case CHORUS_PLANT -> EndFeatures.CHORUS_PLANT;
case MANGROVE -> TreeFeatures.MANGROVE;
case TALL_MANGROVE -> TreeFeatures.TALL_MANGROVE;
case CHERRY -> TreeFeatures.CHERRY;
case RANDOM -> createTreeFeatureGenerator(TreeType.values()[ThreadLocalRandom.current().nextInt(TreeType.values().length)]);
default -> null;
};
Expand Down
Expand Up @@ -432,6 +432,9 @@ private List<CompletableFuture<ChunkAccess>> submitChunkLoadTasks(Region region,
case WARPED_FUNGUS -> TreeFeatures.WARPED_FUNGUS;
case CRIMSON_FUNGUS -> TreeFeatures.CRIMSON_FUNGUS;
case CHORUS_PLANT -> EndFeatures.CHORUS_PLANT;
case MANGROVE -> TreeFeatures.MANGROVE;
case TALL_MANGROVE -> TreeFeatures.TALL_MANGROVE;
case CHERRY -> TreeFeatures.CHERRY;
case RANDOM -> createTreeFeatureGenerator(TreeType.values()[ThreadLocalRandom.current().nextInt(TreeType.values().length)]);
default -> null;
};
Expand Down
Expand Up @@ -314,6 +314,9 @@ public boolean regenerate(Region region, Extent extent, RegenOptions options) {
case WARPED_FUNGUS -> TreeFeatures.WARPED_FUNGUS;
case CRIMSON_FUNGUS -> TreeFeatures.CRIMSON_FUNGUS;
case CHORUS_PLANT -> EndFeatures.CHORUS_PLANT;
case MANGROVE -> TreeFeatures.MANGROVE;
case TALL_MANGROVE -> TreeFeatures.TALL_MANGROVE;
case CHERRY -> TreeFeatures.CHERRY;
case RANDOM -> createTreeFeatureGenerator(TreeGenerator.TreeType.values()[ThreadLocalRandom.current().nextInt(TreeGenerator.TreeType.values().length)]);
default -> null;
};
Expand Down

0 comments on commit 4892e05

Please sign in to comment.