22w16b with massive Component changes
This commit is contained in:
1 parent
8101abb431
commit
746c8548e9
31 files changed
+153
-162
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
# or better: https://modmuss50.me/fabric.html
|
# or better: https://modmuss50.me/fabric.html
|
||||||
minecraft_version=22w15a
|
minecraft_version=22w16b
|
||||||
loader_version=0.13.3
|
loader_version=0.13.3
|
||||||
fabric_version=0.49.4+1.19
|
fabric_version=0.49.4+1.19
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import net.minecraft.commands.CommandBuildContext;
|
|||||||
import net.minecraft.commands.CommandRuntimeException;
|
import net.minecraft.commands.CommandRuntimeException;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.item.DyeColor;
|
import net.minecraft.world.item.DyeColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ public class CounterCommand
|
|||||||
HopperCounter counter = HopperCounter.getCounter(color);
|
HopperCounter counter = HopperCounter.getCounter(color);
|
||||||
if (counter == null) throw new CommandRuntimeException(Messenger.s("Unknown wool color: "+color));
|
if (counter == null) throw new CommandRuntimeException(Messenger.s("Unknown wool color: "+color));
|
||||||
|
|
||||||
for (BaseComponent message: counter.format(source.getServer(), realtime, false))
|
for (Component message: counter.format(source.getServer(), realtime, false))
|
||||||
{
|
{
|
||||||
source.sendSuccess(message, false);
|
source.sendSuccess(message, false);
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ public class CounterCommand
|
|||||||
*/
|
*/
|
||||||
private static int listAllCounters(CommandSourceStack source, boolean realtime)
|
private static int listAllCounters(CommandSourceStack source, boolean realtime)
|
||||||
{
|
{
|
||||||
for (BaseComponent message: HopperCounter.formatAll(source.getServer(), realtime))
|
for (Component message: HopperCounter.formatAll(source.getServer(), realtime))
|
||||||
{
|
{
|
||||||
source.sendSuccess(message, false);
|
source.sendSuccess(message, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import net.minecraft.commands.CommandBuildContext;
|
|||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
|
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||||
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
||||||
@@ -42,7 +42,7 @@ public class InfoCommand
|
|||||||
dispatcher.register(command);
|
dispatcher.register(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printBlock(List<BaseComponent> messages, CommandSourceStack source, String grep)
|
public static void printBlock(List<Component> messages, CommandSourceStack source, String grep)
|
||||||
{
|
{
|
||||||
Messenger.m(source, "");
|
Messenger.m(source, "");
|
||||||
if (grep != null)
|
if (grep != null)
|
||||||
@@ -51,7 +51,7 @@ public class InfoCommand
|
|||||||
Messenger.m(source, messages.get(0));
|
Messenger.m(source, messages.get(0));
|
||||||
for (int i = 1; i<messages.size(); i++)
|
for (int i = 1; i<messages.size(); i++)
|
||||||
{
|
{
|
||||||
BaseComponent line = messages.get(i);
|
Component line = messages.get(i);
|
||||||
Matcher m = p.matcher(line.getString());
|
Matcher m = p.matcher(line.getString());
|
||||||
if (m.find())
|
if (m.find())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import net.minecraft.commands.CommandBuildContext;
|
import net.minecraft.commands.CommandBuildContext;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
import static com.mojang.brigadier.arguments.FloatArgumentType.floatArg;
|
import static com.mojang.brigadier.arguments.FloatArgumentType.floatArg;
|
||||||
@@ -94,7 +94,7 @@ public class TickCommand
|
|||||||
catch (CommandSyntaxException ignored)
|
catch (CommandSyntaxException ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
BaseComponent message = TickSpeed.tickrate_advance(player, advance, tail_command, source);
|
Component message = TickSpeed.tickrate_advance(player, advance, tail_command, source);
|
||||||
source.sendSuccess(message, false);
|
source.sendSuccess(message, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap;
|
|||||||
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
import net.minecraft.network.chat.TextColor;
|
import net.minecraft.network.chat.TextColor;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
@@ -146,13 +146,13 @@ public class HopperCounter
|
|||||||
/**
|
/**
|
||||||
* Prints all the counters to chat, nicely formatted, and you can choose whether to diplay in in game time or IRL time
|
* Prints all the counters to chat, nicely formatted, and you can choose whether to diplay in in game time or IRL time
|
||||||
*/
|
*/
|
||||||
public static List<BaseComponent> formatAll(MinecraftServer server, boolean realtime)
|
public static List<Component> formatAll(MinecraftServer server, boolean realtime)
|
||||||
{
|
{
|
||||||
List<BaseComponent> text = new ArrayList<>();
|
List<Component> text = new ArrayList<>();
|
||||||
|
|
||||||
for (HopperCounter counter : COUNTERS.values())
|
for (HopperCounter counter : COUNTERS.values())
|
||||||
{
|
{
|
||||||
List<BaseComponent> temp = counter.format(server, realtime, false);
|
List<Component> temp = counter.format(server, realtime, false);
|
||||||
if (temp.size() > 1)
|
if (temp.size() > 1)
|
||||||
{
|
{
|
||||||
if (!text.isEmpty()) text.add(Messenger.s(""));
|
if (!text.isEmpty()) text.add(Messenger.s(""));
|
||||||
@@ -170,7 +170,7 @@ public class HopperCounter
|
|||||||
* Prints a single counter's contents and timings to chat, with the option to keep it short (so no item breakdown,
|
* Prints a single counter's contents and timings to chat, with the option to keep it short (so no item breakdown,
|
||||||
* only rates). Again, realtime displays IRL time as opposed to in game time.
|
* only rates). Again, realtime displays IRL time as opposed to in game time.
|
||||||
*/
|
*/
|
||||||
public List<BaseComponent> format(MinecraftServer server, boolean realTime, boolean brief)
|
public List<Component> format(MinecraftServer server, boolean realTime, boolean brief)
|
||||||
{
|
{
|
||||||
long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getLevel(Level.OVERWORLD).getGameTime() - startTick, 1); //OW
|
long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getLevel(Level.OVERWORLD).getGameTime() - startTick, 1); //OW
|
||||||
if (startTick < 0 || ticks == 0)
|
if (startTick < 0 || ticks == 0)
|
||||||
@@ -200,7 +200,7 @@ public class HopperCounter
|
|||||||
String.format("wb %.1f ", ticks / (20.0 * 60.0)), "w min"
|
String.format("wb %.1f ", ticks / (20.0 * 60.0)), "w min"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
List<BaseComponent> items = new ArrayList<>();
|
List<Component> items = new ArrayList<>();
|
||||||
items.add(Messenger.c("w Items for ", prettyColour,
|
items.add(Messenger.c("w Items for ", prettyColour,
|
||||||
"w (",String.format("wb %.2f", ticks*1.0/(20*60)), "w min"+(realTime?" - real time":"")+"), ",
|
"w (",String.format("wb %.2f", ticks*1.0/(20*60)), "w min"+(realTime?" - real time":"")+"), ",
|
||||||
"w total: ", "wb "+total, "w , (",String.format("wb %.1f",total*1.0*(20*60*60)/ticks),"w /h):",
|
"w total: ", "wb "+total, "w , (",String.format("wb %.1f",total*1.0*(20*60*60)/ticks),"w /h):",
|
||||||
@@ -209,7 +209,7 @@ public class HopperCounter
|
|||||||
items.addAll(counter.object2LongEntrySet().stream().sorted((e, f) -> Long.compare(f.getLongValue(), e.getLongValue())).map(e ->
|
items.addAll(counter.object2LongEntrySet().stream().sorted((e, f) -> Long.compare(f.getLongValue(), e.getLongValue())).map(e ->
|
||||||
{
|
{
|
||||||
Item item = e.getKey();
|
Item item = e.getKey();
|
||||||
BaseComponent itemName = new TranslatableComponent(item.getDescriptionId());
|
MutableComponent itemName = Component.translatable(item.getDescriptionId());
|
||||||
Style itemStyle = itemName.getStyle();
|
Style itemStyle = itemName.getStyle();
|
||||||
TextColor color = guessColor(item);
|
TextColor color = guessColor(item);
|
||||||
itemName.setStyle((color != null) ? itemStyle.withColor(color) : itemStyle.withItalic(true));
|
itemName.setStyle((color != null) ? itemStyle.withColor(color) : itemStyle.withItalic(true));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
import carpet.network.ServerNetworkHandler;
|
import carpet.network.ServerNetworkHandler;
|
||||||
@@ -101,7 +101,7 @@ public class TickSpeed
|
|||||||
ServerNetworkHandler.updateTickPlayerActiveTimeoutToConnectedPlayers();
|
ServerNetworkHandler.updateTickPlayerActiveTimeoutToConnectedPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BaseComponent tickrate_advance(ServerPlayer player, int advance, String callback, CommandSourceStack source)
|
public static Component tickrate_advance(ServerPlayer player, int advance, String callback, CommandSourceStack source)
|
||||||
{
|
{
|
||||||
if (0 == advance)
|
if (0 == advance)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import carpet.utils.Messenger;
|
|||||||
import carpet.utils.SpawnReporter;
|
import carpet.utils.SpawnReporter;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundTabListPacket;
|
import net.minecraft.network.protocol.game.ClientboundTabListPacket;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -41,18 +40,18 @@ public class HUDController
|
|||||||
HUDListeners.add(listener);
|
HUDListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<ServerPlayer, List<BaseComponent>> player_huds = new HashMap<>();
|
public static Map<ServerPlayer, List<Component>> player_huds = new HashMap<>();
|
||||||
//keyed with player names so unlogged players don't hold the reference
|
//keyed with player names so unlogged players don't hold the reference
|
||||||
public static final Map<String, BaseComponent> scarpet_headers = new HashMap<>();
|
public static final Map<String, Component> scarpet_headers = new HashMap<>();
|
||||||
|
|
||||||
public static final Map<String, BaseComponent> scarpet_footers = new HashMap<>();
|
public static final Map<String, Component> scarpet_footers = new HashMap<>();
|
||||||
|
|
||||||
public static void resetScarpetHUDs() {
|
public static void resetScarpetHUDs() {
|
||||||
scarpet_headers.clear();
|
scarpet_headers.clear();
|
||||||
scarpet_footers.clear();
|
scarpet_footers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addMessage(ServerPlayer player, BaseComponent hudMessage)
|
public static void addMessage(ServerPlayer player, Component hudMessage)
|
||||||
{
|
{
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
if (!player_huds.containsKey(player))
|
if (!player_huds.containsKey(player))
|
||||||
@@ -61,13 +60,13 @@ public class HUDController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player_huds.get(player).add(new TextComponent("\n"));
|
player_huds.get(player).add(Component.literal("\n"));
|
||||||
}
|
}
|
||||||
player_huds.get(player).add(hudMessage);
|
player_huds.get(player).add(hudMessage);
|
||||||
}
|
}
|
||||||
public static void clear_player(Player player)
|
public static void clear_player(Player player)
|
||||||
{
|
{
|
||||||
FriendlyByteBuf packetData = new FriendlyByteBuf(Unpooled.buffer()).writeComponent(new TextComponent("")).writeComponent(new TextComponent(""));
|
FriendlyByteBuf packetData = new FriendlyByteBuf(Unpooled.buffer()).writeComponent(Component.literal("")).writeComponent(Component.literal(""));
|
||||||
ClientboundTabListPacket packet = new ClientboundTabListPacket(packetData);
|
ClientboundTabListPacket packet = new ClientboundTabListPacket(packetData);
|
||||||
//((PlayerListHeaderS2CPacketMixin)packet).setHeader(new LiteralText(""));
|
//((PlayerListHeaderS2CPacketMixin)packet).setHeader(new LiteralText(""));
|
||||||
//((PlayerListHeaderS2CPacketMixin)packet).setFooter(new LiteralText(""));
|
//((PlayerListHeaderS2CPacketMixin)packet).setFooter(new LiteralText(""));
|
||||||
@@ -83,7 +82,7 @@ public class HUDController
|
|||||||
player_huds.clear();
|
player_huds.clear();
|
||||||
|
|
||||||
server.getPlayerList().getPlayers().forEach(p -> {
|
server.getPlayerList().getPlayers().forEach(p -> {
|
||||||
BaseComponent scarpetFOoter = scarpet_footers.get(p.getScoreboardName());
|
Component scarpetFOoter = scarpet_footers.get(p.getScoreboardName());
|
||||||
if (scarpetFOoter != null) HUDController.addMessage(p, scarpetFOoter);
|
if (scarpetFOoter != null) HUDController.addMessage(p, scarpetFOoter);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -105,7 +104,7 @@ public class HUDController
|
|||||||
dim = Level.END; // end
|
dim = Level.END; // end
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return new BaseComponent[]{SpawnReporter.printMobcapsForDimension(server.getLevel(dim), false).get(0)};
|
return new Component[]{SpawnReporter.printMobcapsForDimension(server.getLevel(dim), false).get(0)};
|
||||||
});
|
});
|
||||||
|
|
||||||
if(LoggerRegistry.__counter)
|
if(LoggerRegistry.__counter)
|
||||||
@@ -122,7 +121,7 @@ public class HUDController
|
|||||||
for (ServerPlayer player: targets)
|
for (ServerPlayer player: targets)
|
||||||
{
|
{
|
||||||
FriendlyByteBuf packetData = new FriendlyByteBuf(Unpooled.buffer()).
|
FriendlyByteBuf packetData = new FriendlyByteBuf(Unpooled.buffer()).
|
||||||
writeComponent(scarpet_headers.getOrDefault(player.getScoreboardName(), new TextComponent(""))).
|
writeComponent(scarpet_headers.getOrDefault(player.getScoreboardName(), Component.literal(""))).
|
||||||
writeComponent(Messenger.c(player_huds.getOrDefault(player, Collections.emptyList()).toArray(new Object[0])));
|
writeComponent(Messenger.c(player_huds.getOrDefault(player, Collections.emptyList()).toArray(new Object[0])));
|
||||||
ClientboundTabListPacket packet = new ClientboundTabListPacket(packetData);
|
ClientboundTabListPacket packet = new ClientboundTabListPacket(packetData);
|
||||||
|
|
||||||
@@ -132,28 +131,28 @@ public class HUDController
|
|||||||
player.connection.send(packet);
|
player.connection.send(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static BaseComponent [] send_tps_display(MinecraftServer server)
|
private static Component [] send_tps_display(MinecraftServer server)
|
||||||
{
|
{
|
||||||
double MSPT = Mth.average(server.tickTimes) * 1.0E-6D;
|
double MSPT = Mth.average(server.tickTimes) * 1.0E-6D;
|
||||||
double TPS = 1000.0D / Math.max((TickSpeed.time_warp_start_time != 0)?0.0:TickSpeed.mspt, MSPT);
|
double TPS = 1000.0D / Math.max((TickSpeed.time_warp_start_time != 0)?0.0:TickSpeed.mspt, MSPT);
|
||||||
String color = Messenger.heatmap_color(MSPT,TickSpeed.mspt);
|
String color = Messenger.heatmap_color(MSPT,TickSpeed.mspt);
|
||||||
return new BaseComponent[]{Messenger.c(
|
return new Component[]{Messenger.c(
|
||||||
"g TPS: ", String.format(Locale.US, "%s %.1f",color, TPS),
|
"g TPS: ", String.format(Locale.US, "%s %.1f",color, TPS),
|
||||||
"g MSPT: ", String.format(Locale.US,"%s %.1f", color, MSPT))};
|
"g MSPT: ", String.format(Locale.US,"%s %.1f", color, MSPT))};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BaseComponent [] send_counter_info(MinecraftServer server, String color)
|
private static Component [] send_counter_info(MinecraftServer server, String color)
|
||||||
{
|
{
|
||||||
List <BaseComponent> res = new ArrayList<>();
|
List <Component> res = new ArrayList<>();
|
||||||
Arrays.asList(color.split(",")).forEach(c ->{
|
Arrays.asList(color.split(",")).forEach(c ->{
|
||||||
HopperCounter counter = HopperCounter.getCounter(c);
|
HopperCounter counter = HopperCounter.getCounter(c);
|
||||||
if (counter != null) res.addAll(counter.format(server, false, true));
|
if (counter != null) res.addAll(counter.format(server, false, true));
|
||||||
});
|
});
|
||||||
return res.toArray(new BaseComponent[0]);
|
return res.toArray(new Component[0]);
|
||||||
}
|
}
|
||||||
private static BaseComponent [] packetCounter()
|
private static Component [] packetCounter()
|
||||||
{
|
{
|
||||||
BaseComponent [] ret = new BaseComponent[]{
|
Component [] ret = new Component[]{
|
||||||
Messenger.c("w I/" + PacketCounter.totalIn + " O/" + PacketCounter.totalOut),
|
Messenger.c("w I/" + PacketCounter.totalIn + " O/" + PacketCounter.totalOut),
|
||||||
};
|
};
|
||||||
PacketCounter.reset();
|
PacketCounter.reset();
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package carpet.logging;
|
package carpet.logging;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class HUDLogger extends Logger
|
public class HUDLogger extends Logger
|
||||||
@@ -43,9 +44,9 @@ public class HUDLogger extends Logger
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPlayerMessage(ServerPlayer player, BaseComponent... messages)
|
public void sendPlayerMessage(ServerPlayer player, Component... messages)
|
||||||
{
|
{
|
||||||
for (BaseComponent m:messages) HUDController.addMessage(player, m);
|
for (Component m:messages) HUDController.addMessage(player, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ public class Logger
|
|||||||
* will repeat invocation for players that share the same option
|
* will repeat invocation for players that share the same option
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface lMessage { BaseComponent [] get(String playerOption, Player player);}
|
public interface lMessage { Component [] get(String playerOption, Player player);}
|
||||||
public void log(lMessage messagePromise)
|
public void log(lMessage messagePromise)
|
||||||
{
|
{
|
||||||
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
||||||
@@ -143,7 +143,7 @@ public class Logger
|
|||||||
ServerPlayer player = playerFromName(en.getKey());
|
ServerPlayer player = playerFromName(en.getKey());
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
BaseComponent [] messages = messagePromise.get(en.getValue(),player);
|
Component [] messages = messagePromise.get(en.getValue(),player);
|
||||||
if (messages != null)
|
if (messages != null)
|
||||||
sendPlayerMessage(player, messages);
|
sendPlayerMessage(player, messages);
|
||||||
}
|
}
|
||||||
@@ -155,10 +155,10 @@ public class Logger
|
|||||||
* and served the same way to all other players subscribed to the same option
|
* and served the same way to all other players subscribed to the same option
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface lMessageIgnorePlayer { BaseComponent [] get(String playerOption);}
|
public interface lMessageIgnorePlayer { Component [] get(String playerOption);}
|
||||||
public void log(lMessageIgnorePlayer messagePromise)
|
public void log(lMessageIgnorePlayer messagePromise)
|
||||||
{
|
{
|
||||||
Map<String, BaseComponent[]> cannedMessages = new HashMap<>();
|
Map<String, Component[]> cannedMessages = new HashMap<>();
|
||||||
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
||||||
{
|
{
|
||||||
ServerPlayer player = playerFromName(en.getKey());
|
ServerPlayer player = playerFromName(en.getKey());
|
||||||
@@ -169,7 +169,7 @@ public class Logger
|
|||||||
{
|
{
|
||||||
cannedMessages.put(option,messagePromise.get(option));
|
cannedMessages.put(option,messagePromise.get(option));
|
||||||
}
|
}
|
||||||
BaseComponent [] messages = cannedMessages.get(option);
|
Component [] messages = cannedMessages.get(option);
|
||||||
if (messages != null)
|
if (messages != null)
|
||||||
sendPlayerMessage(player, messages);
|
sendPlayerMessage(player, messages);
|
||||||
}
|
}
|
||||||
@@ -178,9 +178,9 @@ public class Logger
|
|||||||
/**
|
/**
|
||||||
* guarantees that message is evaluated once, so independent from the player and chosen option
|
* guarantees that message is evaluated once, so independent from the player and chosen option
|
||||||
*/
|
*/
|
||||||
public void log(Supplier<BaseComponent[]> messagePromise)
|
public void log(Supplier<Component[]> messagePromise)
|
||||||
{
|
{
|
||||||
BaseComponent [] cannedMessages = null;
|
Component [] cannedMessages = null;
|
||||||
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
||||||
{
|
{
|
||||||
ServerPlayer player = playerFromName(en.getKey());
|
ServerPlayer player = playerFromName(en.getKey());
|
||||||
@@ -192,7 +192,7 @@ public class Logger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPlayerMessage(ServerPlayer player, BaseComponent ... messages)
|
public void sendPlayerMessage(ServerPlayer player, Component ... messages)
|
||||||
{
|
{
|
||||||
Arrays.stream(messages).forEach(message -> player.sendMessage(message, Util.NIL_UUID));
|
Arrays.stream(messages).forEach(message -> player.sendMessage(message, Util.NIL_UUID));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
@@ -52,7 +52,7 @@ public class ExplosionLogHelper
|
|||||||
}
|
}
|
||||||
explosionCountInCurretGT++;
|
explosionCountInCurretGT++;
|
||||||
LoggerRegistry.getLogger("explosions").log( (option) -> {
|
LoggerRegistry.getLogger("explosions").log( (option) -> {
|
||||||
List<BaseComponent> messages = new ArrayList<>();
|
List<Component> messages = new ArrayList<>();
|
||||||
if(newTick) messages.add(c("wb tick : ", "d " + gametime));
|
if(newTick) messages.add(c("wb tick : ", "d " + gametime));
|
||||||
if ("brief".equals(option))
|
if ("brief".equals(option))
|
||||||
{
|
{
|
||||||
@@ -83,7 +83,7 @@ public class ExplosionLogHelper
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return messages.toArray(new BaseComponent[0]);
|
return messages.toArray(new Component[0]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package carpet.logging.logHelpers;
|
|||||||
|
|
||||||
import carpet.logging.LoggerRegistry;
|
import carpet.logging.LoggerRegistry;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class TNTLogHelper
|
public class TNTLogHelper
|
||||||
@@ -37,12 +37,12 @@ public class TNTLogHelper
|
|||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case "brief":
|
case "brief":
|
||||||
return new BaseComponent[]{Messenger.c(
|
return new Component[]{Messenger.c(
|
||||||
"l P ",Messenger.dblt("l",primedX,primedY,primedZ),
|
"l P ",Messenger.dblt("l",primedX,primedY,primedZ),
|
||||||
"w ",Messenger.dblt("l", primedAngle.x, primedAngle.y, primedAngle.z),
|
"w ",Messenger.dblt("l", primedAngle.x, primedAngle.y, primedAngle.z),
|
||||||
"r E ",Messenger.dblt("r",x, y, z))};
|
"r E ",Messenger.dblt("r",x, y, z))};
|
||||||
case "full":
|
case "full":
|
||||||
return new BaseComponent[]{Messenger.c(
|
return new Component[]{Messenger.c(
|
||||||
"r #" + tntCount,
|
"r #" + tntCount,
|
||||||
"m @" + gametime,
|
"m @" + gametime,
|
||||||
"g : ",
|
"g : ",
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import carpet.logging.LoggerRegistry;
|
|||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,7 +39,7 @@ public class TrajectoryLogHelper
|
|||||||
{
|
{
|
||||||
if (!doLog) return;
|
if (!doLog) return;
|
||||||
logger.log( (option) -> {
|
logger.log( (option) -> {
|
||||||
List<BaseComponent> comp = new ArrayList<>();
|
List<Component> comp = new ArrayList<>();
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case "brief":
|
case "brief":
|
||||||
@@ -71,7 +72,7 @@ public class TrajectoryLogHelper
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return comp.toArray(new BaseComponent[0]);
|
return comp.toArray(new Component[0]);
|
||||||
});
|
});
|
||||||
doLog = false;
|
doLog = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import carpet.logging.LoggerRegistry;
|
|||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
import net.minecraft.ReportedException;
|
import net.minecraft.ReportedException;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -45,7 +45,7 @@ public class MinecraftServer_updateSuppressionCrashFixMixin {
|
|||||||
private void logUpdateSuppression(BlockPos pos) {
|
private void logUpdateSuppression(BlockPos pos) {
|
||||||
if(LoggerRegistry.__updateSuppressedCrashes) {
|
if(LoggerRegistry.__updateSuppressedCrashes) {
|
||||||
LoggerRegistry.getLogger("updateSuppressedCrashes").log(() -> {
|
LoggerRegistry.getLogger("updateSuppressedCrashes").log(() -> {
|
||||||
return new BaseComponent[]{Messenger.c(
|
return new Component[]{Messenger.c(
|
||||||
"w Server crash prevented in: ",
|
"w Server crash prevented in: ",
|
||||||
"m world tick ",
|
"m world tick ",
|
||||||
"w - at: ",
|
"w - at: ",
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ public class ServerGamePacketListenerImpl_coreMixin {
|
|||||||
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
||||||
private void onPlayerDisconnect(Component reason, CallbackInfo ci) {
|
private void onPlayerDisconnect(Component reason, CallbackInfo ci) {
|
||||||
CarpetServer.onPlayerLoggedOut(this.player);
|
CarpetServer.onPlayerLoggedOut(this.player);
|
||||||
if (PLAYER_DISCONNECTS.isNeeded()) PLAYER_DISCONNECTS.onPlayerMessage(player, reason.getContents());
|
if (PLAYER_DISCONNECTS.isNeeded()) PLAYER_DISCONNECTS.onPlayerMessage(player, reason.getContents().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ import carpet.utils.Messenger;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.ReportedException;
|
import net.minecraft.ReportedException;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@@ -49,7 +49,7 @@ public abstract class ServerPlayer_updateSuppressionCrashFixMixin extends Player
|
|||||||
private void logUpdateSuppressionPlayer(BlockPos pos) {
|
private void logUpdateSuppressionPlayer(BlockPos pos) {
|
||||||
if(LoggerRegistry.__updateSuppressedCrashes) {
|
if(LoggerRegistry.__updateSuppressedCrashes) {
|
||||||
LoggerRegistry.getLogger("updateSuppressedCrashes").log(() -> {
|
LoggerRegistry.getLogger("updateSuppressedCrashes").log(() -> {
|
||||||
return new BaseComponent[]{Messenger.c(
|
return new Component[]{Messenger.c(
|
||||||
"w Server crash prevented in: ",
|
"w Server crash prevented in: ",
|
||||||
"m player tick ",
|
"m player tick ",
|
||||||
"w - at: ",
|
"w - at: ",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package carpet.mixins;
|
|||||||
|
|
||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.network.protocol.status.ServerStatus;
|
import net.minecraft.network.protocol.status.ServerStatus;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -17,7 +16,7 @@ public class ServerStatus_motdMixin
|
|||||||
{
|
{
|
||||||
if (!CarpetSettings.customMOTD.equals("_"))
|
if (!CarpetSettings.customMOTD.equals("_"))
|
||||||
{
|
{
|
||||||
cir.setReturnValue(new TextComponent(CarpetSettings.customMOTD));
|
cir.setReturnValue(Component.literal(CarpetSettings.customMOTD));
|
||||||
cir.cancel();
|
cir.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import net.minecraft.nbt.StringTag;
|
|||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ public class ServerNetworkHandler
|
|||||||
int resultCode = -1;
|
int resultCode = -1;
|
||||||
if (player.getServer() == null)
|
if (player.getServer() == null)
|
||||||
{
|
{
|
||||||
error[0] = new TextComponent("No Server");
|
error[0] = Component.literal("No Server");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -106,7 +105,7 @@ public class ServerNetworkHandler
|
|||||||
CompoundTag result = new CompoundTag();
|
CompoundTag result = new CompoundTag();
|
||||||
result.putString("id", id);
|
result.putString("id", id);
|
||||||
result.putInt("code", resultCode);
|
result.putInt("code", resultCode);
|
||||||
if (error[0] != null) result.putString("error", error[0].getContents());
|
if (error[0] != null) result.putString("error", error[0].getContents().toString());
|
||||||
ListTag outputResult = new ListTag();
|
ListTag outputResult = new ListTag();
|
||||||
for (Component line: output) outputResult.add(StringTag.valueOf(Component.Serializer.toJson(line)));
|
for (Component line: output) outputResult.add(StringTag.valueOf(Component.Serializer.toJson(line)));
|
||||||
if (!output.isEmpty()) result.put("output", outputResult);
|
if (!output.isEmpty()) result.put("output", outputResult);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import carpet.CarpetSettings;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.core.UUIDUtil;
|
import net.minecraft.core.UUIDUtil;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
|
||||||
import net.minecraft.network.protocol.PacketFlow;
|
import net.minecraft.network.protocol.PacketFlow;
|
||||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
|
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
|
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
|
||||||
@@ -80,7 +79,7 @@ public class EntityPlayerMPFake extends ServerPlayer
|
|||||||
public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player)
|
public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player)
|
||||||
{
|
{
|
||||||
player.getServer().getPlayerList().remove(player);
|
player.getServer().getPlayerList().remove(player);
|
||||||
player.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login"));
|
player.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login"));
|
||||||
ServerLevel worldIn = player.getLevel();//.getWorld(player.dimension);
|
ServerLevel worldIn = player.getLevel();//.getWorld(player.dimension);
|
||||||
GameProfile gameprofile = player.getGameProfile();
|
GameProfile gameprofile = player.getGameProfile();
|
||||||
EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true);
|
EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package carpet.patches;
|
|||||||
|
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
@@ -22,7 +22,7 @@ public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl
|
|||||||
@Override
|
@Override
|
||||||
public void disconnect(Component message)
|
public void disconnect(Component message)
|
||||||
{
|
{
|
||||||
if (message instanceof TranslatableComponent text && (text.getKey().equals("multiplayer.disconnect.idling") || text.getKey().equals("multiplayer.disconnect.duplicate_login")))
|
if (message.getContents() instanceof TranslatableContents text && (text.getKey().equals("multiplayer.disconnect.idling") || text.getKey().equals("multiplayer.disconnect.duplicate_login")))
|
||||||
{
|
{
|
||||||
((EntityPlayerMPFake) player).kill(message);
|
((EntityPlayerMPFake) player).kill(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ import net.fabricmc.loader.api.metadata.version.VersionPredicate;
|
|||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
@@ -156,7 +154,7 @@ public class CarpetScriptHost extends ScriptHost
|
|||||||
CarpetScriptHost cHost = CarpetServer.scriptServer.modules.get(hostName).retrieveOwnForExecution(ctx.getSource());
|
CarpetScriptHost cHost = CarpetServer.scriptServer.modules.get(hostName).retrieveOwnForExecution(ctx.getSource());
|
||||||
List<String> argNames = funcSpec.function.getArguments();
|
List<String> argNames = funcSpec.function.getArguments();
|
||||||
if ((argNames.size()-funcSpec.args.size()) != paramNames.size())
|
if ((argNames.size()-funcSpec.args.size()) != paramNames.size())
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Target function "+funcSpec.function.getPrettyString()+" as wrong number of arguments, required "+paramNames.size()+", found "+argNames.size()+" with "+funcSpec.args.size()+" provided")).create();
|
throw new SimpleCommandExceptionType(Component.literal("Target function "+funcSpec.function.getPrettyString()+" as wrong number of arguments, required "+paramNames.size()+", found "+argNames.size()+" with "+funcSpec.args.size()+" provided")).create();
|
||||||
List<Value> args = new ArrayList<>(argNames.size());
|
List<Value> args = new ArrayList<>(argNames.size());
|
||||||
for (String s : paramNames)
|
for (String s : paramNames)
|
||||||
{
|
{
|
||||||
@@ -630,7 +628,7 @@ public class CarpetScriptHost extends ScriptHost
|
|||||||
}
|
}
|
||||||
catch (CommandSyntaxException ignored)
|
catch (CommandSyntaxException ignored)
|
||||||
{
|
{
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Cannot run player based apps without the player context")).create();
|
throw new SimpleCommandExceptionType(Component.literal("Cannot run player based apps without the player context")).create();
|
||||||
}
|
}
|
||||||
CarpetScriptHost userHost = (CarpetScriptHost)retrieveForExecution(player.getScoreboardName());
|
CarpetScriptHost userHost = (CarpetScriptHost)retrieveForExecution(player.getScoreboardName());
|
||||||
if (userHost.errorSnooper == null) userHost.setChatErrorSnooper(source);
|
if (userHost.errorSnooper == null) userHost.setChatErrorSnooper(source);
|
||||||
@@ -1022,7 +1020,7 @@ public class CarpetScriptHost extends ScriptHost
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Creates a {@link BaseComponent} using {@link Messenger} that has the locals in the {@code line} snippet with a hover over
|
* <p>Creates a {@link Component} using {@link Messenger} that has the locals in the {@code line} snippet with a hover over
|
||||||
* tooltip with the value of the local at that location</p>
|
* tooltip with the value of the local at that location</p>
|
||||||
* @param line The line to find references to locals on
|
* @param line The line to find references to locals on
|
||||||
* @param context The {@link Context} to extract the locals from
|
* @param context The {@link Context} to extract the locals from
|
||||||
@@ -1032,7 +1030,7 @@ public class CarpetScriptHost extends ScriptHost
|
|||||||
* @implNote The implementation of this method is far from perfect, and won't detect actual references to variables, but try to find the strings
|
* @implNote The implementation of this method is far from perfect, and won't detect actual references to variables, but try to find the strings
|
||||||
* and add the hover effect to anything that equals to any variable name, so short variable names may appear on random positions
|
* and add the hover effect to anything that equals to any variable name, so short variable names may appear on random positions
|
||||||
*/
|
*/
|
||||||
private static BaseComponent withLocals(String format, String line, Context context)
|
private static Component withLocals(String format, String line, Context context)
|
||||||
{
|
{
|
||||||
format += " ";
|
format += " ";
|
||||||
List<String> stringsToFormat = new ArrayList<>();
|
List<String> stringsToFormat = new ArrayList<>();
|
||||||
|
|||||||
@@ -47,13 +47,11 @@ import net.minecraft.core.Rotations;
|
|||||||
import net.minecraft.core.particles.ParticleOptions;
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.NbtOps;
|
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.ClientboundClearTitlesPacket;
|
import net.minecraft.network.protocol.game.ClientboundClearTitlesPacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundCustomSoundPacket;
|
import net.minecraft.network.protocol.game.ClientboundCustomSoundPacket;
|
||||||
@@ -551,7 +549,7 @@ public class Auxiliary {
|
|||||||
else title = null; // Will never happen, just to make lambda happy
|
else title = null; // Will never happen, just to make lambda happy
|
||||||
if (packetGetter == null)
|
if (packetGetter == null)
|
||||||
{
|
{
|
||||||
Map<String, BaseComponent> map;
|
Map<String, Component> map;
|
||||||
if (actionString.equals("player_list_header"))
|
if (actionString.equals("player_list_header"))
|
||||||
map = HUDController.scarpet_headers;
|
map = HUDController.scarpet_headers;
|
||||||
else
|
else
|
||||||
@@ -566,7 +564,7 @@ public class Auxiliary {
|
|||||||
});
|
});
|
||||||
else
|
else
|
||||||
targetList.forEach(target -> {
|
targetList.forEach(target -> {
|
||||||
map.put(target.getScoreboardName(), (BaseComponent) title);
|
map.put(target.getScoreboardName(), (MutableComponent) title);
|
||||||
total.getAndIncrement();
|
total.getAndIncrement();
|
||||||
});
|
});
|
||||||
HUDController.update_hud(((CarpetContext)c).s.getServer(), targetList);
|
HUDController.update_hud(((CarpetContext)c).s.getServer(), targetList);
|
||||||
@@ -621,7 +619,7 @@ public class Auxiliary {
|
|||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
return ListValue.of(Value.NULL, ListValue.of(), new FormattedTextValue(new TextComponent(exc.getMessage())));
|
return ListValue.of(Value.NULL, ListValue.of(), new FormattedTextValue(Component.literal(exc.getMessage())));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.ServerScoreboard;
|
import net.minecraft.server.ServerScoreboard;
|
||||||
import net.minecraft.server.bossevents.CustomBossEvent;
|
import net.minecraft.server.bossevents.CustomBossEvent;
|
||||||
@@ -152,7 +151,7 @@ public class Scoreboards {
|
|||||||
return Value.FALSE;
|
return Value.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoreboard.addObjective(objectiveName, criterion, new TextComponent(objectiveName), criterion.getDefaultRenderType());
|
scoreboard.addObjective(objectiveName, criterion, Component.literal(objectiveName), criterion.getDefaultRenderType());
|
||||||
return Value.TRUE;
|
return Value.TRUE;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -409,7 +408,7 @@ public class Scoreboards {
|
|||||||
if(lv.size() == 1)
|
if(lv.size() == 1)
|
||||||
{
|
{
|
||||||
if(bossBarManager.get(identifier) != null) return Value.FALSE;
|
if(bossBarManager.get(identifier) != null) return Value.FALSE;
|
||||||
return StringValue.of(bossBarManager.create(identifier,new TextComponent(id)).getTextId().toString());
|
return StringValue.of(bossBarManager.create(identifier,Component.literal(id)).getTextId().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
String property = lv.get(1).getString();
|
String property = lv.get(1).getString();
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.commands.BossBarCommands;
|
import net.minecraft.server.commands.BossBarCommands;
|
||||||
@@ -111,7 +111,7 @@ public abstract class CommandArgument
|
|||||||
{
|
{
|
||||||
public static CommandSyntaxException error(String text)
|
public static CommandSyntaxException error(String text)
|
||||||
{
|
{
|
||||||
return new SimpleCommandExceptionType(new TextComponent(text)).create();
|
return new SimpleCommandExceptionType(Component.literal(text)).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final List<? extends CommandArgument> baseTypes = Lists.newArrayList(
|
private static final List<? extends CommandArgument> baseTypes = Lists.newArrayList(
|
||||||
@@ -459,7 +459,7 @@ public abstract class CommandArgument
|
|||||||
if (!caseSensitive) choseValue = choseValue.toLowerCase(Locale.ROOT);
|
if (!caseSensitive) choseValue = choseValue.toLowerCase(Locale.ROOT);
|
||||||
if (!validOptions.isEmpty() && !validOptions.contains(choseValue))
|
if (!validOptions.isEmpty() && !validOptions.contains(choseValue))
|
||||||
{
|
{
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Incorrect value for "+param+": "+choseValue+" for custom type "+suffix)).create();
|
throw new SimpleCommandExceptionType(Component.literal("Incorrect value for "+param+": "+choseValue+" for custom type "+suffix)).create();
|
||||||
}
|
}
|
||||||
return StringValue.of(choseValue);
|
return StringValue.of(choseValue);
|
||||||
}
|
}
|
||||||
@@ -610,7 +610,7 @@ public abstract class CommandArgument
|
|||||||
if (!single) return ListValue.wrap(founds.stream().map(EntityValue::new).collect(Collectors.toList()));
|
if (!single) return ListValue.wrap(founds.stream().map(EntityValue::new).collect(Collectors.toList()));
|
||||||
if (founds.size() == 0) return Value.NULL;
|
if (founds.size() == 0) return Value.NULL;
|
||||||
if (founds.size() == 1) return new EntityValue(founds.iterator().next());
|
if (founds.size() == 1) return new EntityValue(founds.iterator().next());
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Multiple entities returned while only one was requested"+" for custom type "+suffix)).create();
|
throw new SimpleCommandExceptionType(Component.literal("Multiple entities returned while only one was requested"+" for custom type "+suffix)).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -651,7 +651,7 @@ public abstract class CommandArgument
|
|||||||
int size = profiles.size();
|
int size = profiles.size();
|
||||||
if (size == 0) return Value.NULL;
|
if (size == 0) return Value.NULL;
|
||||||
if (size == 1) return StringValue.of(profiles.iterator().next().getName());
|
if (size == 1) return StringValue.of(profiles.iterator().next().getName());
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Multiple game profiles returned while only one was requested"+" for custom type "+suffix)).create();
|
throw new SimpleCommandExceptionType(Component.literal("Multiple game profiles returned while only one was requested"+" for custom type "+suffix)).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -692,7 +692,7 @@ public abstract class CommandArgument
|
|||||||
int size = holders.size();
|
int size = holders.size();
|
||||||
if (size == 0) return Value.NULL;
|
if (size == 0) return Value.NULL;
|
||||||
if (size == 1) return StringValue.of(holders.iterator().next());
|
if (size == 1) return StringValue.of(holders.iterator().next());
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Multiple score holders returned while only one was requested"+" for custom type "+suffix)).create();
|
throw new SimpleCommandExceptionType(Component.literal("Multiple score holders returned while only one was requested"+" for custom type "+suffix)).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -767,7 +767,7 @@ public abstract class CommandArgument
|
|||||||
ResourceLocation choseValue = ResourceLocationArgument.getId(context, param);
|
ResourceLocation choseValue = ResourceLocationArgument.getId(context, param);
|
||||||
if (!validOptions.isEmpty() && !validOptions.contains(choseValue))
|
if (!validOptions.isEmpty() && !validOptions.contains(choseValue))
|
||||||
{
|
{
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Incorrect value for "+param+": "+choseValue+" for custom type "+suffix)).create();
|
throw new SimpleCommandExceptionType(Component.literal("Incorrect value for "+param+": "+choseValue+" for custom type "+suffix)).create();
|
||||||
}
|
}
|
||||||
return ValueConversions.of(choseValue);
|
return ValueConversions.of(choseValue);
|
||||||
}
|
}
|
||||||
@@ -957,7 +957,7 @@ public abstract class CommandArgument
|
|||||||
int slot = net.minecraft.commands.arguments.SlotArgument.getSlot(context, param);
|
int slot = net.minecraft.commands.arguments.SlotArgument.getSlot(context, param);
|
||||||
if (restrict != null && !RESTRICTED_CONTAINERS.get(restrict).numericalIds().contains(slot))
|
if (restrict != null && !RESTRICTED_CONTAINERS.get(restrict).numericalIds().contains(slot))
|
||||||
{
|
{
|
||||||
throw new SimpleCommandExceptionType(new TextComponent("Incorrect slot restricted to "+restrict+" for custom type "+suffix)).create();
|
throw new SimpleCommandExceptionType(Component.literal("Incorrect slot restricted to "+restrict+" for custom type "+suffix)).create();
|
||||||
}
|
}
|
||||||
return ValueConversions.ofVanillaSlotResult(slot);
|
return ValueConversions.ofVanillaSlotResult(slot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import net.minecraft.nbt.ListTag;
|
|||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -937,7 +936,7 @@ public class ShapeDispatcher
|
|||||||
public Value validate(Map<String, Value> options, MinecraftServer server, Value value)
|
public Value validate(Map<String, Value> options, MinecraftServer server, Value value)
|
||||||
{
|
{
|
||||||
if (!(value instanceof FormattedTextValue))
|
if (!(value instanceof FormattedTextValue))
|
||||||
value = new FormattedTextValue(new TextComponent(value.getString()));
|
value = new FormattedTextValue(Component.literal(value.getString()));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,7 +944,7 @@ public class ShapeDispatcher
|
|||||||
public Tag toTag(Value value)
|
public Tag toTag(Value value)
|
||||||
{
|
{
|
||||||
if (!(value instanceof FormattedTextValue))
|
if (!(value instanceof FormattedTextValue))
|
||||||
value = new FormattedTextValue(new TextComponent(value.getString()));
|
value = new FormattedTextValue(Component.literal(value.getString()));
|
||||||
return StringTag.valueOf(((FormattedTextValue)value).serialize());
|
return StringTag.valueOf(((FormattedTextValue)value).serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package carpet.script.value;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
|
|
||||||
public class FormattedTextValue extends StringValue
|
public class FormattedTextValue extends StringValue
|
||||||
{
|
{
|
||||||
@@ -17,16 +16,16 @@ public class FormattedTextValue extends StringValue
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Value combine(Value left, Value right) {
|
public static Value combine(Value left, Value right) {
|
||||||
BaseComponent text;
|
MutableComponent text;
|
||||||
if (left instanceof FormattedTextValue)
|
if (left instanceof FormattedTextValue)
|
||||||
{
|
{
|
||||||
text = (BaseComponent) ((FormattedTextValue) left).getText().copy();
|
text = ((FormattedTextValue) left).getText().copy();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (left.isNull())
|
if (left.isNull())
|
||||||
return right;
|
return right;
|
||||||
text = new TextComponent(left.getString());
|
text = Component.literal(left.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (right instanceof FormattedTextValue)
|
if (right instanceof FormattedTextValue)
|
||||||
@@ -103,7 +102,7 @@ public class FormattedTextValue extends StringValue
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Component getTextByValue(Value value) {
|
public static Component getTextByValue(Value value) {
|
||||||
return (value instanceof FormattedTextValue) ? ((FormattedTextValue) value).getText() : new TextComponent(value.getString());
|
return (value instanceof FormattedTextValue) ? ((FormattedTextValue) value).getText() : Component.literal(value.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ import net.minecraft.commands.CommandBuildContext;
|
|||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.SharedSuggestionProvider;
|
import net.minecraft.commands.SharedSuggestionProvider;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.TickTask;
|
import net.minecraft.server.TickTask;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
@@ -647,7 +647,7 @@ public class SettingsManager
|
|||||||
|
|
||||||
rule.translatedExtras().forEach(s -> Messenger.m(source, "g "+s));
|
rule.translatedExtras().forEach(s -> Messenger.m(source, "g "+s));
|
||||||
|
|
||||||
List<BaseComponent> tags = new ArrayList<>();
|
List<Component> tags = new ArrayList<>();
|
||||||
tags.add(Messenger.c("w "+ tr("ui.tags", "Tags")+": "));
|
tags.add(Messenger.c("w "+ tr("ui.tags", "Tags")+": "));
|
||||||
for (String t: rule.categories)
|
for (String t: rule.categories)
|
||||||
{
|
{
|
||||||
@@ -659,7 +659,7 @@ public class SettingsManager
|
|||||||
Messenger.m(source, tags.toArray(new Object[0]));
|
Messenger.m(source, tags.toArray(new Object[0]));
|
||||||
|
|
||||||
Messenger.m(source, "w "+ tr("ui.current_value", "Current value")+": ",String.format("%s %s (%s value)",rule.getBoolValue()?"lb":"nb", rule.getAsString(),rule.isDefault()?"default":"modified"));
|
Messenger.m(source, "w "+ tr("ui.current_value", "Current value")+": ",String.format("%s %s (%s value)",rule.getBoolValue()?"lb":"nb", rule.getAsString(),rule.isDefault()?"default":"modified"));
|
||||||
List<BaseComponent> options = new ArrayList<>();
|
List<Component> options = new ArrayList<>();
|
||||||
options.add(Messenger.c("w Options: ", "y [ "));
|
options.add(Messenger.c("w Options: ", "y [ "));
|
||||||
for (String o: rule.options)
|
for (String o: rule.options)
|
||||||
{
|
{
|
||||||
@@ -708,7 +708,7 @@ public class SettingsManager
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseComponent displayInteractiveSetting(ParsedRule<?> rule)
|
private Component displayInteractiveSetting(ParsedRule<?> rule)
|
||||||
{
|
{
|
||||||
String displayName = rule.translatedName();
|
String displayName = rule.translatedName();
|
||||||
List<Object> args = new ArrayList<>();
|
List<Object> args = new ArrayList<>();
|
||||||
@@ -729,7 +729,7 @@ public class SettingsManager
|
|||||||
return Messenger.c(args.toArray(new Object[0]));
|
return Messenger.c(args.toArray(new Object[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseComponent makeSetRuleButton(ParsedRule<?> rule, String option, boolean brackets)
|
private Component makeSetRuleButton(ParsedRule<?> rule, String option, boolean brackets)
|
||||||
{
|
{
|
||||||
String style = rule.isDefault()?"g":(option.equalsIgnoreCase(rule.defaultAsString)?"e":"y");
|
String style = rule.isDefault()?"g":(option.equalsIgnoreCase(rule.defaultAsString)?"e":"y");
|
||||||
if (option.equalsIgnoreCase(rule.getAsString()))
|
if (option.equalsIgnoreCase(rule.getAsString()))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.MobSpawnType;
|
import net.minecraft.world.entity.MobSpawnType;
|
||||||
@@ -221,7 +221,7 @@ public class BlockInfo
|
|||||||
entry(Material.POWDER_SNOW , "powder_snow")
|
entry(Material.POWDER_SNOW , "powder_snow")
|
||||||
);
|
);
|
||||||
|
|
||||||
public static List<BaseComponent> blockInfo(BlockPos pos, ServerLevel world)
|
public static List<Component> blockInfo(BlockPos pos, ServerLevel world)
|
||||||
{
|
{
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
Material material = state.getMaterial();
|
Material material = state.getMaterial();
|
||||||
@@ -231,7 +231,7 @@ public class BlockInfo
|
|||||||
{
|
{
|
||||||
metastring += ", "+iproperty.getName() + '='+state.getValue(iproperty);
|
metastring += ", "+iproperty.getName() + '='+state.getValue(iproperty);
|
||||||
}
|
}
|
||||||
List<BaseComponent> lst = new ArrayList<>();
|
List<Component> lst = new ArrayList<>();
|
||||||
lst.add(Messenger.s(""));
|
lst.add(Messenger.s(""));
|
||||||
lst.add(Messenger.s("====================================="));
|
lst.add(Messenger.s("====================================="));
|
||||||
lst.add(Messenger.s(String.format("Block info for %s%s (id %d%s):",Registry.BLOCK.getKey(block),metastring, Registry.BLOCK.getId(block), metastring )));
|
lst.add(Messenger.s(String.format("Block info for %s%s (id %d%s):",Registry.BLOCK.getKey(block),metastring, Registry.BLOCK.getId(block), metastring )));
|
||||||
@@ -272,7 +272,7 @@ public class BlockInfo
|
|||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BaseComponent wander_chances(BlockPos pos, ServerLevel worldIn)
|
private static Component wander_chances(BlockPos pos, ServerLevel worldIn)
|
||||||
{
|
{
|
||||||
PathfinderMob creature = new ZombifiedPiglin(EntityType.ZOMBIFIED_PIGLIN, worldIn);
|
PathfinderMob creature = new ZombifiedPiglin(EntityType.ZOMBIFIED_PIGLIN, worldIn);
|
||||||
creature.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null, null);
|
creature.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null, null);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ public class DistanceCalculator
|
|||||||
return START_POINT_STORAGE.containsKey(source.getTextName());
|
return START_POINT_STORAGE.containsKey(source.getTextName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseComponent> findDistanceBetweenTwoPoints(Vec3 pos1, Vec3 pos2)
|
public static List<Component> findDistanceBetweenTwoPoints(Vec3 pos1, Vec3 pos2)
|
||||||
{
|
{
|
||||||
double dx = Mth.abs((float)pos1.x-(float)pos2.x);
|
double dx = Mth.abs((float)pos1.x-(float)pos2.x);
|
||||||
double dy = Mth.abs((float)pos1.y-(float)pos2.y);
|
double dy = Mth.abs((float)pos1.y-(float)pos2.y);
|
||||||
@@ -25,7 +25,7 @@ public class DistanceCalculator
|
|||||||
double manhattan = dx+dy+dz;
|
double manhattan = dx+dy+dz;
|
||||||
double spherical = Math.sqrt(dx*dx + dy*dy + dz*dz);
|
double spherical = Math.sqrt(dx*dx + dy*dy + dz*dz);
|
||||||
double cylindrical = Math.sqrt(dx*dx + dz*dz);
|
double cylindrical = Math.sqrt(dx*dx + dz*dz);
|
||||||
List<BaseComponent> res = new ArrayList<>();
|
List<Component> res = new ArrayList<>();
|
||||||
res.add(Messenger.c("w Distance between ",
|
res.add(Messenger.c("w Distance between ",
|
||||||
Messenger.tp("c",pos1),"w and ",
|
Messenger.tp("c",pos1),"w and ",
|
||||||
Messenger.tp("c",pos2),"w :"));
|
Messenger.tp("c",pos2),"w :"));
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import net.minecraft.ChatFormatting;
|
|||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.network.chat.ClickEvent;
|
import net.minecraft.network.chat.ClickEvent;
|
||||||
import net.minecraft.network.chat.HoverEvent;
|
import net.minecraft.network.chat.HoverEvent;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
import net.minecraft.network.chat.TextColor;
|
import net.minecraft.network.chat.TextColor;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.entity.MobCategory;
|
import net.minecraft.world.entity.MobCategory;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
@@ -114,11 +114,11 @@ public class Messenger
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BaseComponent getChatComponentFromDesc(String message, BaseComponent previousMessage)
|
private static MutableComponent getChatComponentFromDesc(String message, MutableComponent previousMessage)
|
||||||
{
|
{
|
||||||
if (message.equalsIgnoreCase(""))
|
if (message.equalsIgnoreCase(""))
|
||||||
{
|
{
|
||||||
return new TextComponent("");
|
return Component.literal("");
|
||||||
}
|
}
|
||||||
if (Character.isWhitespace(message.charAt(0)))
|
if (Character.isWhitespace(message.charAt(0)))
|
||||||
{
|
{
|
||||||
@@ -133,12 +133,12 @@ public class Messenger
|
|||||||
str = message.substring(limit+1);
|
str = message.substring(limit+1);
|
||||||
}
|
}
|
||||||
if (previousMessage == null) {
|
if (previousMessage == null) {
|
||||||
BaseComponent text = new TextComponent(str);
|
MutableComponent text = Component.literal(str);
|
||||||
text.setStyle(parseStyle(desc));
|
text.setStyle(parseStyle(desc));
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
Style previousStyle = previousMessage.getStyle();
|
Style previousStyle = previousMessage.getStyle();
|
||||||
BaseComponent ret = previousMessage;
|
MutableComponent ret = previousMessage;
|
||||||
previousMessage.setStyle(switch (desc.charAt(0)) {
|
previousMessage.setStyle(switch (desc.charAt(0)) {
|
||||||
case '?' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message.substring(1)));
|
case '?' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message.substring(1)));
|
||||||
case '!' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, message.substring(1)));
|
case '!' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, message.substring(1)));
|
||||||
@@ -146,31 +146,31 @@ public class Messenger
|
|||||||
case '@' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, message.substring(1)));
|
case '@' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, message.substring(1)));
|
||||||
case '&' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, message.substring(1)));
|
case '&' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, message.substring(1)));
|
||||||
default -> { // Create a new component
|
default -> { // Create a new component
|
||||||
ret = new TextComponent(str);
|
ret = Component.literal(str);
|
||||||
ret.setStyle(parseStyle(desc));
|
ret.setStyle(parseStyle(desc));
|
||||||
yield previousStyle; // no op for the previous style
|
yield previousStyle; // no op for the previous style
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
public static BaseComponent tp(String desc, Vec3 pos) { return tp(desc, pos.x, pos.y, pos.z); }
|
public static Component tp(String desc, Vec3 pos) { return tp(desc, pos.x, pos.y, pos.z); }
|
||||||
public static BaseComponent tp(String desc, BlockPos pos) { return tp(desc, pos.getX(), pos.getY(), pos.getZ()); }
|
public static Component tp(String desc, BlockPos pos) { return tp(desc, pos.getX(), pos.getY(), pos.getZ()); }
|
||||||
public static BaseComponent tp(String desc, double x, double y, double z) { return tp(desc, (float)x, (float)y, (float)z);}
|
public static Component tp(String desc, double x, double y, double z) { return tp(desc, (float)x, (float)y, (float)z);}
|
||||||
public static BaseComponent tp(String desc, float x, float y, float z)
|
public static Component tp(String desc, float x, float y, float z)
|
||||||
{
|
{
|
||||||
return getCoordsTextComponent(desc, x, y, z, false);
|
return getCoordsTextComponent(desc, x, y, z, false);
|
||||||
}
|
}
|
||||||
public static BaseComponent tp(String desc, int x, int y, int z)
|
public static Component tp(String desc, int x, int y, int z)
|
||||||
{
|
{
|
||||||
return getCoordsTextComponent(desc, (float)x, (float)y, (float)z, true);
|
return getCoordsTextComponent(desc, (float)x, (float)y, (float)z, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// to be continued
|
/// to be continued
|
||||||
public static BaseComponent dbl(String style, double double_value)
|
public static Component dbl(String style, double double_value)
|
||||||
{
|
{
|
||||||
return c(String.format("%s %.1f",style,double_value),String.format("^w %f",double_value));
|
return c(String.format("%s %.1f",style,double_value),String.format("^w %f",double_value));
|
||||||
}
|
}
|
||||||
public static BaseComponent dbls(String style, double ... doubles)
|
public static Component dbls(String style, double ... doubles)
|
||||||
{
|
{
|
||||||
StringBuilder str = new StringBuilder(style + " [ ");
|
StringBuilder str = new StringBuilder(style + " [ ");
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
@@ -182,7 +182,7 @@ public class Messenger
|
|||||||
str.append(" ]");
|
str.append(" ]");
|
||||||
return c(str.toString());
|
return c(str.toString());
|
||||||
}
|
}
|
||||||
public static BaseComponent dblf(String style, double ... doubles)
|
public static Component dblf(String style, double ... doubles)
|
||||||
{
|
{
|
||||||
StringBuilder str = new StringBuilder(style + " [ ");
|
StringBuilder str = new StringBuilder(style + " [ ");
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
@@ -194,7 +194,7 @@ public class Messenger
|
|||||||
str.append(" ]");
|
str.append(" ]");
|
||||||
return c(str.toString());
|
return c(str.toString());
|
||||||
}
|
}
|
||||||
public static BaseComponent dblt(String style, double ... doubles)
|
public static Component dblt(String style, double ... doubles)
|
||||||
{
|
{
|
||||||
List<Object> components = new ArrayList<>();
|
List<Object> components = new ArrayList<>();
|
||||||
components.add(style+" [ ");
|
components.add(style+" [ ");
|
||||||
@@ -212,7 +212,7 @@ public class Messenger
|
|||||||
return c(components.toArray(new Object[0]));
|
return c(components.toArray(new Object[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BaseComponent getCoordsTextComponent(String style, float x, float y, float z, boolean isInt)
|
private static Component getCoordsTextComponent(String style, float x, float y, float z, boolean isInt)
|
||||||
{
|
{
|
||||||
String text;
|
String text;
|
||||||
String command;
|
String command;
|
||||||
@@ -243,20 +243,20 @@ public class Messenger
|
|||||||
/*
|
/*
|
||||||
composes single line, multicomponent message, and returns as one chat messagge
|
composes single line, multicomponent message, and returns as one chat messagge
|
||||||
*/
|
*/
|
||||||
public static BaseComponent c(Object ... fields)
|
public static Component c(Object ... fields)
|
||||||
{
|
{
|
||||||
BaseComponent message = new TextComponent("");
|
MutableComponent message = Component.literal("");
|
||||||
BaseComponent previousComponent = null;
|
MutableComponent previousComponent = null;
|
||||||
for (Object o: fields)
|
for (Object o: fields)
|
||||||
{
|
{
|
||||||
if (o instanceof BaseComponent)
|
if (o instanceof MutableComponent)
|
||||||
{
|
{
|
||||||
message.append((BaseComponent)o);
|
message.append((MutableComponent)o);
|
||||||
previousComponent = (BaseComponent)o;
|
previousComponent = (MutableComponent)o;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String txt = o.toString();
|
String txt = o.toString();
|
||||||
BaseComponent comp = getChatComponentFromDesc(txt, previousComponent);
|
MutableComponent comp = getChatComponentFromDesc(txt, previousComponent);
|
||||||
if (comp != previousComponent) message.append(comp);
|
if (comp != previousComponent) message.append(comp);
|
||||||
previousComponent = comp;
|
previousComponent = comp;
|
||||||
}
|
}
|
||||||
@@ -265,13 +265,13 @@ public class Messenger
|
|||||||
|
|
||||||
//simple text
|
//simple text
|
||||||
|
|
||||||
public static BaseComponent s(String text)
|
public static Component s(String text)
|
||||||
{
|
{
|
||||||
return s(text,"");
|
return s(text,"");
|
||||||
}
|
}
|
||||||
public static BaseComponent s(String text, String style)
|
public static Component s(String text, String style)
|
||||||
{
|
{
|
||||||
BaseComponent message = new TextComponent(text);
|
MutableComponent message = Component.literal(text);
|
||||||
message.setStyle(parseStyle(style));
|
message.setStyle(parseStyle(style));
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
@@ -279,11 +279,11 @@ public class Messenger
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void send(Player player, Collection<BaseComponent> lines)
|
public static void send(Player player, Collection<Component> lines)
|
||||||
{
|
{
|
||||||
lines.forEach(message -> player.sendMessage(message, Util.NIL_UUID));
|
lines.forEach(message -> player.sendMessage(message, Util.NIL_UUID));
|
||||||
}
|
}
|
||||||
public static void send(CommandSourceStack source, Collection<BaseComponent> lines)
|
public static void send(CommandSourceStack source, Collection<Component> lines)
|
||||||
{
|
{
|
||||||
lines.stream().forEachOrdered((s) -> source.sendSuccess(s, false));
|
lines.stream().forEachOrdered((s) -> source.sendSuccess(s, false));
|
||||||
}
|
}
|
||||||
@@ -293,14 +293,14 @@ public class Messenger
|
|||||||
{
|
{
|
||||||
if (server == null)
|
if (server == null)
|
||||||
LOG.error("Message not delivered: "+message);
|
LOG.error("Message not delivered: "+message);
|
||||||
server.sendMessage(new TextComponent(message), Util.NIL_UUID);
|
server.sendMessage(Component.literal(message), Util.NIL_UUID);
|
||||||
BaseComponent txt = c("gi "+message);
|
Component txt = c("gi "+message);
|
||||||
for (Player entityplayer : server.getPlayerList().getPlayers())
|
for (Player entityplayer : server.getPlayerList().getPlayers())
|
||||||
{
|
{
|
||||||
entityplayer.sendMessage(txt, Util.NIL_UUID);
|
entityplayer.sendMessage(txt, Util.NIL_UUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void print_server_message(MinecraftServer server, BaseComponent message)
|
public static void print_server_message(MinecraftServer server, Component message)
|
||||||
{
|
{
|
||||||
if (server == null)
|
if (server == null)
|
||||||
LOG.error("Message not delivered: "+message.getString());
|
LOG.error("Message not delivered: "+message.getString());
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
@@ -104,11 +104,11 @@ public class SpawnReporter
|
|||||||
return MAGIC_NUMBER / (Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)));
|
return MAGIC_NUMBER / (Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public static List<BaseComponent> printMobcapsForDimension(ServerLevel world, boolean multiline)
|
public static List<Component> printMobcapsForDimension(ServerLevel world, boolean multiline)
|
||||||
{
|
{
|
||||||
ResourceKey<Level> dim = world.dimension();
|
ResourceKey<Level> dim = world.dimension();
|
||||||
String name = dim.location().getPath();
|
String name = dim.location().getPath();
|
||||||
List<BaseComponent> lst = new ArrayList<>();
|
List<Component> lst = new ArrayList<>();
|
||||||
if (multiline)
|
if (multiline)
|
||||||
lst.add(Messenger.s(String.format("Mobcaps for %s:",name)));
|
lst.add(Messenger.s(String.format("Mobcaps for %s:",name)));
|
||||||
NaturalSpawner.SpawnState lastSpawner = world.getChunkSource().getLastSpawnState();
|
NaturalSpawner.SpawnState lastSpawner = world.getChunkSource().getLastSpawnState();
|
||||||
@@ -159,9 +159,9 @@ public class SpawnReporter
|
|||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseComponent> recent_spawns(Level world, MobCategory creature_type)
|
public static List<Component> recent_spawns(Level world, MobCategory creature_type)
|
||||||
{
|
{
|
||||||
List<BaseComponent> lst = new ArrayList<>();
|
List<Component> lst = new ArrayList<>();
|
||||||
if ((track_spawns == 0L))
|
if ((track_spawns == 0L))
|
||||||
{
|
{
|
||||||
lst.add(Messenger.s("Spawn tracking not started"));
|
lst.add(Messenger.s("Spawn tracking not started"));
|
||||||
@@ -187,7 +187,7 @@ public class SpawnReporter
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseComponent> show_mobcaps(BlockPos pos, ServerLevel worldIn)
|
public static List<Component> show_mobcaps(BlockPos pos, ServerLevel worldIn)
|
||||||
{
|
{
|
||||||
DyeColor under = WoolTool.getWoolColorAtPosition(worldIn, pos.below());
|
DyeColor under = WoolTool.getWoolColorAtPosition(worldIn, pos.below());
|
||||||
if (under == null)
|
if (under == null)
|
||||||
@@ -281,9 +281,9 @@ public class SpawnReporter
|
|||||||
return get_type_string(get_creature_type_from_code(str));
|
return get_type_string(get_creature_type_from_code(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseComponent> printEntitiesByType(MobCategory cat, Level worldIn, boolean all) //Class<?> entityType)
|
public static List<Component> printEntitiesByType(MobCategory cat, Level worldIn, boolean all) //Class<?> entityType)
|
||||||
{
|
{
|
||||||
List<BaseComponent> lst = new ArrayList<>();
|
List<Component> lst = new ArrayList<>();
|
||||||
lst.add( Messenger.s(String.format("Loaded entities for %s class:", get_type_string(cat))));
|
lst.add( Messenger.s(String.format("Loaded entities for %s class:", get_type_string(cat))));
|
||||||
for (Entity entity : ((ServerLevel)worldIn).getEntities(EntityTypeTest.forClass(Entity.class), (e) -> e.getType().getCategory()==cat))
|
for (Entity entity : ((ServerLevel)worldIn).getEntities(EntityTypeTest.forClass(Entity.class), (e) -> e.getType().getCategory()==cat))
|
||||||
{
|
{
|
||||||
@@ -350,10 +350,10 @@ public class SpawnReporter
|
|||||||
return "("+world.location().getPath().toUpperCase(Locale.ROOT).replace("THE_","").charAt(0)+")";
|
return "("+world.location().getPath().toUpperCase(Locale.ROOT).replace("THE_","").charAt(0)+")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseComponent> tracking_report(Level worldIn)
|
public static List<Component> tracking_report(Level worldIn)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<BaseComponent> report = new ArrayList<>();
|
List<Component> report = new ArrayList<>();
|
||||||
if (track_spawns == 0L)
|
if (track_spawns == 0L)
|
||||||
{
|
{
|
||||||
report.add(Messenger.c(
|
report.add(Messenger.c(
|
||||||
@@ -439,9 +439,9 @@ public class SpawnReporter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseComponent> report(BlockPos pos, ServerLevel worldIn)
|
public static List<Component> report(BlockPos pos, ServerLevel worldIn)
|
||||||
{
|
{
|
||||||
List<BaseComponent> rep = new ArrayList<>();
|
List<Component> rep = new ArrayList<>();
|
||||||
int x = pos.getX(); int y = pos.getY(); int z = pos.getZ();
|
int x = pos.getX(); int y = pos.getY(); int z = pos.getZ();
|
||||||
ChunkAccess chunk = worldIn.getChunk(pos);
|
ChunkAccess chunk = worldIn.getChunk(pos);
|
||||||
int lc = chunk.getHeight(Heightmap.Types.WORLD_SURFACE, x, z) + 1;
|
int lc = chunk.getHeight(Heightmap.Types.WORLD_SURFACE, x, z) + 1;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.BaseComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.DyeColor;
|
import net.minecraft.world.item.DyeColor;
|
||||||
@@ -118,7 +118,7 @@ public class WoolTool
|
|||||||
HopperCounter counter = HopperCounter.getCounter(under.toString());
|
HopperCounter counter = HopperCounter.getCounter(under.toString());
|
||||||
if (counter == null) return;
|
if (counter == null) return;
|
||||||
counter.reset(placer.getServer());
|
counter.reset(placer.getServer());
|
||||||
List<BaseComponent> res = new ArrayList<>();
|
List<Component> res = new ArrayList<>();
|
||||||
res.add(Messenger.s(String.format("%s counter reset",under.toString())));
|
res.add(Messenger.s(String.format("%s counter reset",under.toString())));
|
||||||
Messenger.send(placer, res);
|
Messenger.send(placer, res);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user