updated to 1.14.3 pre 2, still issues with fabric spawn tracking mappings

This commit is contained in:
gnembon committed 2019-06-07 11:51:11 -03:00
1 parent a5d83a0c53
commit f3da8b2576
31 files changed
+180 -173

No files matched your search

+51 -51
View File
@@ -5,12 +5,12 @@ import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.ChatFormat;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Formatting;
import net.minecraft.text.BaseText;
import net.minecraft.server.MinecraftServer;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.HoverEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -51,7 +51,7 @@ public class Messenger
/ = action added to the previous component
*/
private static BaseComponent _applyStyleToTextComponent(BaseComponent comp, String style)
private static BaseText _applyStyleToTextComponent(BaseText comp, String style)
{
//could be rewritten to be more efficient
comp.getStyle().setItalic(style.indexOf('i')>=0);
@@ -59,23 +59,23 @@ public class Messenger
comp.getStyle().setUnderline(style.indexOf('u')>=0);
comp.getStyle().setBold(style.indexOf('b')>=0);
comp.getStyle().setObfuscated(style.indexOf('o')>=0);
comp.getStyle().setColor(ChatFormat.WHITE);
if (style.indexOf('w')>=0) comp.getStyle().setColor(ChatFormat.WHITE); // not needed
if (style.indexOf('y')>=0) comp.getStyle().setColor(ChatFormat.YELLOW);
if (style.indexOf('m')>=0) comp.getStyle().setColor(ChatFormat.LIGHT_PURPLE);
if (style.indexOf('r')>=0) comp.getStyle().setColor(ChatFormat.RED);
if (style.indexOf('c')>=0) comp.getStyle().setColor(ChatFormat.AQUA);
if (style.indexOf('l')>=0) comp.getStyle().setColor(ChatFormat.GREEN);
if (style.indexOf('t')>=0) comp.getStyle().setColor(ChatFormat.BLUE);
if (style.indexOf('f')>=0) comp.getStyle().setColor(ChatFormat.DARK_GRAY);
if (style.indexOf('g')>=0) comp.getStyle().setColor(ChatFormat.GRAY);
if (style.indexOf('d')>=0) comp.getStyle().setColor(ChatFormat.GOLD);
if (style.indexOf('p')>=0) comp.getStyle().setColor(ChatFormat.DARK_PURPLE);
if (style.indexOf('n')>=0) comp.getStyle().setColor(ChatFormat.DARK_RED);
if (style.indexOf('q')>=0) comp.getStyle().setColor(ChatFormat.DARK_AQUA);
if (style.indexOf('e')>=0) comp.getStyle().setColor(ChatFormat.DARK_GREEN);
if (style.indexOf('v')>=0) comp.getStyle().setColor(ChatFormat.DARK_BLUE);
if (style.indexOf('k')>=0) comp.getStyle().setColor(ChatFormat.BLACK);
comp.getStyle().setColor(Formatting.WHITE);
if (style.indexOf('w')>=0) comp.getStyle().setColor(Formatting.WHITE); // not needed
if (style.indexOf('y')>=0) comp.getStyle().setColor(Formatting.YELLOW);
if (style.indexOf('m')>=0) comp.getStyle().setColor(Formatting.LIGHT_PURPLE);
if (style.indexOf('r')>=0) comp.getStyle().setColor(Formatting.RED);
if (style.indexOf('c')>=0) comp.getStyle().setColor(Formatting.AQUA);
if (style.indexOf('l')>=0) comp.getStyle().setColor(Formatting.GREEN);
if (style.indexOf('t')>=0) comp.getStyle().setColor(Formatting.BLUE);
if (style.indexOf('f')>=0) comp.getStyle().setColor(Formatting.DARK_GRAY);
if (style.indexOf('g')>=0) comp.getStyle().setColor(Formatting.GRAY);
if (style.indexOf('d')>=0) comp.getStyle().setColor(Formatting.GOLD);
if (style.indexOf('p')>=0) comp.getStyle().setColor(Formatting.DARK_PURPLE);
if (style.indexOf('n')>=0) comp.getStyle().setColor(Formatting.DARK_RED);
if (style.indexOf('q')>=0) comp.getStyle().setColor(Formatting.DARK_AQUA);
if (style.indexOf('e')>=0) comp.getStyle().setColor(Formatting.DARK_GREEN);
if (style.indexOf('v')>=0) comp.getStyle().setColor(Formatting.DARK_BLUE);
if (style.indexOf('k')>=0) comp.getStyle().setColor(Formatting.BLACK);
return comp;
}
public static String heatmap_color(double actual, double reference)
@@ -103,11 +103,11 @@ public class Messenger
return "w";
}
private static BaseComponent _getChatComponentFromDesc(String message, BaseComponent previous_message)
private static BaseText _getChatComponentFromDesc(String message, BaseText previous_message)
{
if (message.equalsIgnoreCase(""))
{
return new TextComponent("");
return new LiteralText("");
}
String parts[] = message.split("\\s", 2);
String desc = parts[0];
@@ -137,27 +137,27 @@ public class Messenger
previous_message.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, c(message.substring(1))));
return previous_message;
}
BaseComponent txt = new TextComponent(str);
BaseText txt = new LiteralText(str);
return _applyStyleToTextComponent(txt, desc);
}
public static BaseComponent tp(String desc, Vec3d 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 BaseComponent 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 BaseText tp(String desc, Vec3d pos) { return tp(desc, pos.x, pos.y, pos.z); }
public static BaseText tp(String desc, BlockPos pos) { return tp(desc, pos.getX(), pos.getY(), pos.getZ()); }
public static BaseText tp(String desc, double x, double y, double z) { return tp(desc, (float)x, (float)y, (float)z);}
public static BaseText tp(String desc, float x, float y, float z)
{
return _getCoordsTextComponent(desc, x, y, z, false);
}
public static BaseComponent tp(String desc, int x, int y, int z)
public static BaseText tp(String desc, int x, int y, int z)
{
return _getCoordsTextComponent(desc, (float)x, (float)y, (float)z, true);
}
/// to be continued
public static BaseComponent dbl(String style, double double_value)
public static BaseText dbl(String style, double 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 BaseText dbls(String style, double ... doubles)
{
StringBuilder str = new StringBuilder(style + " [ ");
String prefix = "";
@@ -169,7 +169,7 @@ public class Messenger
str.append(" ]");
return c(str.toString());
}
public static BaseComponent dblf(String style, double ... doubles)
public static BaseText dblf(String style, double ... doubles)
{
StringBuilder str = new StringBuilder(style + " [ ");
String prefix = "";
@@ -181,7 +181,7 @@ public class Messenger
str.append(" ]");
return c(str.toString());
}
public static BaseComponent dblt(String style, double ... doubles)
public static BaseText dblt(String style, double ... doubles)
{
List<Object> components = new ArrayList<>();
components.add(style+" [ ");
@@ -199,7 +199,7 @@ public class Messenger
return c(components.toArray(new Object[0]));
}
private static BaseComponent _getCoordsTextComponent(String style, float x, float y, float z, boolean isInt)
private static BaseText _getCoordsTextComponent(String style, float x, float y, float z, boolean isInt)
{
String text;
String command;
@@ -229,20 +229,20 @@ public class Messenger
/*
composes single line, multicomponent message, and returns as one chat messagge
*/
public static BaseComponent c(Object ... fields)
public static BaseText c(Object ... fields)
{
BaseComponent message = new TextComponent("");
BaseComponent previous_component = null;
BaseText message = new LiteralText("");
BaseText previous_component = null;
for (Object o: fields)
{
if (o instanceof BaseComponent)
if (o instanceof BaseText)
{
message.append((BaseComponent)o);
previous_component = (BaseComponent)o;
message.append((BaseText)o);
previous_component = (BaseText)o;
continue;
}
String txt = o.toString();
BaseComponent comp = _getChatComponentFromDesc(txt,previous_component);
BaseText comp = _getChatComponentFromDesc(txt,previous_component);
if (comp != previous_component) message.append(comp);
previous_component = comp;
}
@@ -251,13 +251,13 @@ public class Messenger
//simple text
public static BaseComponent s(String text)
public static BaseText s(String text)
{
return s(text,"");
}
public static BaseComponent s(String text, String style)
public static BaseText s(String text, String style)
{
BaseComponent message = new TextComponent(text);
BaseText message = new LiteralText(text);
_applyStyleToTextComponent(message, style);
return message;
}
@@ -265,11 +265,11 @@ public class Messenger
public static void send(PlayerEntity player, Collection<BaseComponent> lines)
public static void send(PlayerEntity player, Collection<BaseText> lines)
{
lines.forEach(player::sendMessage);
}
public static void send(ServerCommandSource source, Collection<BaseComponent> lines)
public static void send(ServerCommandSource source, Collection<BaseText> lines)
{
lines.stream().forEachOrdered((s) -> source.sendFeedback(s, false));
}
@@ -279,14 +279,14 @@ public class Messenger
{
if (server == null)
LOG.error("Message not delivered: "+message);
server.sendMessage(new TextComponent(message));
BaseComponent txt = c("gi "+message);
server.sendMessage(new LiteralText(message));
BaseText txt = c("gi "+message);
for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList())
{
entityplayer.sendMessage(txt);
}
}
public static void print_server_message(MinecraftServer server, BaseComponent message)
public static void print_server_message(MinecraftServer server, BaseText message)
{
if (server == null)
LOG.error("Message not delivered: "+message.getString());