[CLEANUP] YEET legacy Abstraction Layer
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.commands;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
|
||||||
|
|
||||||
public class AbstractCommand {
|
|
||||||
|
|
||||||
public static void replySuccess(CommandContext<CommandSourceStack> stack, MutableComponent message) {
|
|
||||||
stack.getSource().sendSuccess(() -> message, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void replyFailure(CommandContext<CommandSourceStack> stack, MutableComponent message) {
|
|
||||||
stack.getSource().sendFailure(message);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.server;
|
|
||||||
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.world.phys.Vec2;
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public class AbstractFakePlayer extends CommandSourceStack {
|
|
||||||
|
|
||||||
private final UUID uuid;
|
|
||||||
|
|
||||||
public AbstractFakePlayer(MinecraftServer server, String name, MutableComponent displayName, UUID uuid) {
|
|
||||||
super(CommandSource.NULL, Vec3.ZERO, Vec2.ZERO, server.overworld(), 4, name, displayName, server, null);
|
|
||||||
this.uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(Component component, boolean bl) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendSuccess(Supplier<Component> component, boolean bl) {
|
|
||||||
this.onSuccess(component.get(), bl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendFailure(Component component) {
|
|
||||||
sendSuccess(() -> component, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,13 +0,0 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.server;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
|
|
||||||
public class AbstractFriendlyByteBuff {
|
|
||||||
|
|
||||||
public static FriendlyByteBuf write(FriendlyByteBuf buf, CompoundTag tag) {
|
|
||||||
buf.writeNbt(tag);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,16 +0,0 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.server;
|
|
||||||
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public class AbstractServer {
|
|
||||||
|
|
||||||
public static void broadcastMessage(MinecraftServer server, MutableComponent message) {
|
|
||||||
server.getPlayerList().broadcastSystemMessage(message, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void executeCommand(MinecraftServer server, CommandSourceStack stack, String command) {
|
|
||||||
server.getCommands().performPrefixedCommand(stack, command);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,23 +0,0 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.text;
|
|
||||||
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
|
||||||
import net.minecraft.network.chat.Style;
|
|
||||||
|
|
||||||
public class AbstractComponent {
|
|
||||||
|
|
||||||
public static MutableComponent literal(String component) {
|
|
||||||
return Component.literal(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MutableComponent translatable(String component) {
|
|
||||||
return Component.translatable(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Component safeCopy(Component inComponent) {
|
|
||||||
String value = inComponent.getString();
|
|
||||||
Style style = inComponent.getStyle();
|
|
||||||
return Component.literal(value).withStyle(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Reference in New Issue
Block a user