use of net.minecraft.server.v1_16_R3.ChatComponentText in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_16_R3 method openPage.
@Override
public void openPage(Player player, com.bgsoftware.wildchests.objects.inventory.CraftWildInventory inventory) {
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
String title = inventory.getTitle();
Container container = createContainer(entityPlayer.nextContainerCounter(), entityPlayer.inventory, inventory);
container.setTitle(new ChatComponentText(title));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, container.getType(), container.getTitle()));
entityPlayer.activeContainer = container;
entityPlayer.activeContainer.addSlotListener(entityPlayer);
}
use of net.minecraft.server.v1_16_R3.ChatComponentText in project TheAPI by TheDevTec.
the class v1_10_R1 method toIChatBaseComponents.
@Override
public Object toIChatBaseComponents(Component c) {
List<IChatBaseComponent> chat = new ArrayList<>();
chat.add(new ChatComponentText(""));
while (c != null) {
if (c.getText() == null || c.getText().isEmpty()) {
c = c.getExtra();
continue;
}
ChatComponentText current = new ChatComponentText(c.getText());
chat.add(current);
ChatModifier modif = current.getChatModifier();
if (c.getColor() != null && !c.getColor().isEmpty()) {
modif = modif.setColor(EnumChatFormat.a(c.getColor().charAt(0)));
}
if (c.getClickEvent() != null)
modif = modif.setChatClickable(new ChatClickable(EnumClickAction.valueOf(c.getClickEvent().getAction().name()), c.getClickEvent().getValue()));
if (c.getHoverEvent() != null)
modif = modif.setChatHoverable(new ChatHoverable(EnumHoverAction.valueOf(c.getHoverEvent().getAction().name()), (IChatBaseComponent) toIChatBaseComponent(c.getHoverEvent().getValue())));
modif = modif.setBold(c.isBold());
modif = modif.setItalic(c.isItalic());
modif = modif.setRandom(c.isObfuscated());
modif = modif.setUnderline(c.isUnderlined());
modif = modif.setStrikethrough(c.isStrikethrough());
current.setChatModifier(modif);
c = c.getExtra();
}
return chat.toArray(new IChatBaseComponent[0]);
}
use of net.minecraft.server.v1_16_R3.ChatComponentText in project TheAPI by TheDevTec.
the class v1_10_R1 method toIChatBaseComponent.
@Override
public Object toIChatBaseComponent(Component c) {
ChatComponentText main = new ChatComponentText("");
while (c != null) {
if (c.getText() == null || c.getText().isEmpty()) {
c = c.getExtra();
continue;
}
ChatComponentText current = new ChatComponentText(c.getText());
main.addSibling(current);
ChatModifier modif = current.getChatModifier();
if (c.getColor() != null && !c.getColor().isEmpty()) {
modif = modif.setColor(EnumChatFormat.a(c.getColor().charAt(0)));
}
if (c.getClickEvent() != null)
modif = modif.setChatClickable(new ChatClickable(EnumClickAction.valueOf(c.getClickEvent().getAction().name()), c.getClickEvent().getValue()));
if (c.getHoverEvent() != null)
modif = modif.setChatHoverable(new ChatHoverable(EnumHoverAction.valueOf(c.getHoverEvent().getAction().name()), (IChatBaseComponent) toIChatBaseComponent(c.getHoverEvent().getValue())));
modif = modif.setBold(c.isBold());
modif = modif.setItalic(c.isItalic());
modif = modif.setRandom(c.isObfuscated());
modif = modif.setUnderline(c.isUnderlined());
modif = modif.setStrikethrough(c.isStrikethrough());
current.setChatModifier(modif);
c = c.getExtra();
}
return main.a().isEmpty() ? empty : main;
}
use of net.minecraft.server.v1_16_R3.ChatComponentText in project TheAPI by TheDevTec.
the class v1_12_R1 method toIChatBaseComponents.
@Override
public Object toIChatBaseComponents(Component c) {
List<IChatBaseComponent> chat = new ArrayList<>();
chat.add(new ChatComponentText(""));
while (c != null) {
if (c.getText() == null || c.getText().isEmpty()) {
c = c.getExtra();
continue;
}
ChatComponentText current = new ChatComponentText(c.getText());
chat.add(current);
ChatModifier modif = current.getChatModifier();
if (c.getColor() != null && !c.getColor().isEmpty()) {
modif = modif.setColor(EnumChatFormat.a(c.getColor().charAt(0)));
}
if (c.getClickEvent() != null)
modif = modif.setChatClickable(new ChatClickable(EnumClickAction.valueOf(c.getClickEvent().getAction().name()), c.getClickEvent().getValue()));
if (c.getHoverEvent() != null)
modif = modif.setChatHoverable(new ChatHoverable(EnumHoverAction.valueOf(c.getHoverEvent().getAction().name()), (IChatBaseComponent) toIChatBaseComponent(c.getHoverEvent().getValue())));
modif = modif.setBold(c.isBold());
modif = modif.setItalic(c.isItalic());
modif = modif.setRandom(c.isObfuscated());
modif = modif.setUnderline(c.isUnderlined());
modif = modif.setStrikethrough(c.isStrikethrough());
current.setChatModifier(modif);
c = c.getExtra();
}
return chat.toArray(new IChatBaseComponent[0]);
}
use of net.minecraft.server.v1_16_R3.ChatComponentText in project TheAPI by TheDevTec.
the class v1_12_R1 method toIChatBaseComponent.
@Override
public Object toIChatBaseComponent(List<Component> cc) {
ChatComponentText main = new ChatComponentText("");
for (Component c : cc) {
if (c.getText() == null || c.getText().isEmpty()) {
c = c.getExtra();
continue;
}
ChatComponentText current = new ChatComponentText(c.getText());
main.addSibling(current);
ChatModifier modif = current.getChatModifier();
if (c.getColor() != null && !c.getColor().isEmpty()) {
modif = modif.setColor(EnumChatFormat.a(c.getColor().charAt(0)));
}
if (c.getClickEvent() != null)
modif = modif.setChatClickable(new ChatClickable(EnumClickAction.valueOf(c.getClickEvent().getAction().name()), c.getClickEvent().getValue()));
if (c.getHoverEvent() != null)
modif = modif.setChatHoverable(new ChatHoverable(EnumHoverAction.valueOf(c.getHoverEvent().getAction().name()), (IChatBaseComponent) toIChatBaseComponent(c.getHoverEvent().getValue())));
modif = modif.setBold(c.isBold());
modif = modif.setItalic(c.isItalic());
modif = modif.setRandom(c.isObfuscated());
modif = modif.setUnderline(c.isUnderlined());
modif = modif.setStrikethrough(c.isStrikethrough());
current.setChatModifier(modif);
}
return main.a().isEmpty() ? empty : main;
}
Aggregations