Upstream changes (#717)

* Perform part of the move of //fast to //perf (#1377)

This re-adds a deprecated `//fast` and moves the current logic to
`//perf`. Later `//perf` will have its syntax reworked, when Piston
finally supports sub-commands properly!

* Names via Translation (#1268)

* Deprecate BiomeRegistry, etc.

* Update some libraries, e.g. text

* Move to new translation renderer

* Revert "Deprecate BiomeRegistry, etc."

This reverts commit 59a5d6c92aec52739a8dc68ac3d23898af7593dd.

This was not a good idea for potential mod shenanigans.

* Move BiomeData#getName to BiomeRegistry, use i18n

* Use getRichName instead of getName

* Implement getRichName for NullBiomeRegistry

* Add getRichName for blocks

* Relocate net.kyori.minecraft

* Update adapters for getRichBlockName

* Add getRichName for items

* Update adapters for getRichItemName

* Update adapters JAR for merge

(cherry picked from commit cfd26253b6fb59ff6c65a0157a6780be7db4ea5a)

* Follow-up fixes for 92f877679622a27b16b9e5cd61cfec1a6545be33

* Don't send deprecation warning and improve info message

* Fix click command for perf box

(cherry picked from commit 7ee60060c31df2f8b41212b430a0875312189339)

* update R3 adapter§

Co-authored-by: Octavia Togami <octavia.togami@gmail.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com>
Co-authored-by: Aurora <aurora@relanet.eu>
This commit is contained in:
Hannes Greule
2020-11-09 10:38:10 +01:00
committed by GitHub
parent 49052d73ce
commit 428f8e201d
42 changed files with 660 additions and 303 deletions

View File

@ -49,7 +49,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeData;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.registry.BiomeRegistry;
import org.enginehub.piston.annotation.Command;
@ -87,23 +86,19 @@ public class BiomeCommands {
@ArgFlag(name = 'p', desc = "Page number.", def = "1")
int page) {
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
BiomeRegistry biomeRegistry =
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS)
.getRegistries().getBiomeRegistry();
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
PaginationBox paginationBox = PaginationBox
.fromStrings("Available Biomes", "/biomelist -p %page%",
BiomeType.REGISTRY.values().stream().map(biomeType -> {
String id = biomeType.getId();
final BiomeData data = biomeRegistry.getData(biomeType);
if (data != null) {
String name = data.getName();
return id + " (" + name + ")";
} else {
return id;
}
}).collect(Collectors.toList()));
return paginationBox.create(page);
PaginationBox paginationBox = PaginationBox.fromComponents("Available Biomes", "/biomelist -p %page%",
BiomeType.REGISTRY.values().stream()
.map(biomeType -> TextComponent.builder()
.append(biomeType.getId())
.append(" (")
.append(biomeRegistry.getRichName(biomeType))
.append(")")
.build())
.collect(Collectors.toList()));
return paginationBox.create(page);
}, (Component) null);
}
@ -150,14 +145,11 @@ public class BiomeCommands {
messageKey = "worldedit.biomeinfo.selection";
}
List<Component> components = biomes.stream().map(biome -> {
BiomeData data = biomeRegistry.getData(biome);
if (data != null) {
return TextComponent.of(data.getName()).hoverEvent(HoverEvent.showText(TextComponent.of(biome.getId())));
} else {
return TextComponent.of(biome.getId());
}
}).collect(Collectors.toList());
List<Component> components = biomes.stream().map(biome ->
biomeRegistry.getRichName(biome).hoverEvent(
HoverEvent.showText(TextComponent.of(biome.getId()))
)
).collect(Collectors.toList());
player.printInfo(TranslatableComponent.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
}