mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
Give tools a platform-neutral world api and let modules ask each other's services
PackWorld, ValidationContext and ToolPack answer services(type) with the pack's providers. com.volmit.tooling.world lets a tool open a painter-backed world and drive its players, menus, items and block changes; ToolPack.worlds() and Sender.player() reach it. The Bukkit adapter implements it over the studio world creation with a painter slot keyed by world, one protection listener, VolmLib menus, persistent-data items and BoardSVC sidebars. Other platforms answer that tool worlds are not supported yet.
This commit is contained in:
1 parent
a81a3abb9f
commit
3691611c6c
76 files changed
+4533
-23
No files matched your search
+8
-1
@@ -22,6 +22,7 @@ import art.arcane.iris.core.tooling.SenderWorld;
|
||||
import art.arcane.iris.core.tooling.ServedPack;
|
||||
import art.arcane.iris.core.tooling.ToolingSender;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import com.volmit.tooling.world.ToolPlayer;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
@@ -29,7 +30,8 @@ import java.util.Optional;
|
||||
|
||||
/**
|
||||
* A modded source of a tooling command. It reads the world of the source when it is built, on the server thread that
|
||||
* received the command, and delivers messages on the server thread. A modded platform has no studio.
|
||||
* received the command, and delivers messages on the server thread. A modded platform has no studio and no tool
|
||||
* players yet: tool worlds are not supported there, so {@link #player()} is empty.
|
||||
*/
|
||||
final class ModdedToolingSender implements ToolingSender {
|
||||
private final CommandSourceStack source;
|
||||
@@ -70,6 +72,11 @@ final class ModdedToolingSender implements ToolingSender {
|
||||
return Optional.ofNullable(source.getEntity()).filter(type::isInstance).map(type::cast);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ToolPlayer> player() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOperator() {
|
||||
return ModdedCommandTree.GATE.test(source);
|
||||
|
||||
Reference in new issue
Block a user