Commit a9b3f481 by Jonathan Thomas

Update UI to newest artwork from owlmaddie. Update some X,Y coordinates since a…

Update UI to newest artwork from owlmaddie. Update some X,Y coordinates since a few images changes sizes and locations.
parent 7878b835
Pipeline #11936 passed with stage
in 29 seconds
...@@ -53,7 +53,7 @@ public class ClientInit implements ClientModInitializer { ...@@ -53,7 +53,7 @@ public class ClientInit implements ClientModInitializer {
}); });
} }
public void drawTextBubbleBackground(MatrixStack matrices, Entity entity, float x, float y, float width, float height) { public void drawTextBubbleBackground(MatrixStack matrices, float x, float y, float width, float height, int friendship) {
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
...@@ -63,9 +63,15 @@ public class ClientInit implements ClientModInitializer { ...@@ -63,9 +63,15 @@ public class ClientInit implements ClientModInitializer {
BufferBuilder buffer = tessellator.getBuffer(); BufferBuilder buffer = tessellator.getBuffer();
float z = 0.01F; float z = 0.01F;
// Draw UI text background // Draw UI text background (based on friendship)
if (friendship == -3) {
RenderSystem.setShaderTexture(0, textures.GetUI("text-top-enemy"));
} else if (friendship == 3) {
RenderSystem.setShaderTexture(0, textures.GetUI("text-top-friend"));
} else {
RenderSystem.setShaderTexture(0, textures.GetUI("text-top")); RenderSystem.setShaderTexture(0, textures.GetUI("text-top"));
drawTexturePart(matrices, buffer, x, y, z, width, 40); }
drawTexturePart(matrices, buffer, x - 50, y, z, 228, 40);
RenderSystem.setShaderTexture(0, textures.GetUI("text-middle")); RenderSystem.setShaderTexture(0, textures.GetUI("text-middle"));
drawTexturePart(matrices, buffer, x, y + 40, z, width, height); drawTexturePart(matrices, buffer, x, y + 40, z, width, height);
...@@ -86,7 +92,7 @@ public class ClientInit implements ClientModInitializer { ...@@ -86,7 +92,7 @@ public class ClientInit implements ClientModInitializer {
Tessellator.getInstance().draw(); Tessellator.getInstance().draw();
} }
private void drawIcon(String ui_icon_name, MatrixStack matrices, Entity entity, float x, float y, float width, float height) { private void drawIcon(String ui_icon_name, MatrixStack matrices, float x, float y, float width, float height) {
// Draw button icon // Draw button icon
Identifier button_texture = textures.GetUI(ui_icon_name); Identifier button_texture = textures.GetUI(ui_icon_name);
RenderSystem.setShaderTexture(0, button_texture); RenderSystem.setShaderTexture(0, button_texture);
...@@ -171,11 +177,11 @@ public class ClientInit implements ClientModInitializer { ...@@ -171,11 +177,11 @@ public class ClientInit implements ClientModInitializer {
} }
private void drawEntityName(Entity entity, Matrix4f matrix, VertexConsumerProvider immediate, private void drawEntityName(Entity entity, Matrix4f matrix, VertexConsumerProvider immediate,
int fullBright, float xOffset, float yOffset) { int fullBright, float yOffset) {
if (entity.getCustomName() != null) { if (entity.getCustomName() != null) {
TextRenderer fontRenderer = MinecraftClient.getInstance().textRenderer; TextRenderer fontRenderer = MinecraftClient.getInstance().textRenderer;
String lineText = entity.getCustomName().getLiteralString(); String lineText = entity.getCustomName().getLiteralString();
fontRenderer.draw(lineText, xOffset, yOffset, 0xffffff, fontRenderer.draw(lineText, -fontRenderer.getWidth(lineText) / 2f, yOffset, 0xffffff,
false, matrix, immediate, TextLayerType.NORMAL, 0, fullBright); false, matrix, immediate, TextLayerType.NORMAL, 0, fullBright);
} }
} }
...@@ -290,23 +296,30 @@ public class ClientInit implements ClientModInitializer { ...@@ -290,23 +296,30 @@ public class ClientInit implements ClientModInitializer {
matrices.translate(0F, -scaledTextHeight + -textHeaderHeight + -textFooterHeight, 0F); matrices.translate(0F, -scaledTextHeight + -textHeaderHeight + -textFooterHeight, 0F);
// Draw Entity (Custom Name) // Draw Entity (Custom Name)
drawEntityName(entity, matrix, immediate, fullBright, -25F, 22F + DISPLAY_PADDING); drawEntityName(entity, matrix, immediate, fullBright, 24F + DISPLAY_PADDING);
// Check if conversation has started // Check if conversation has started
if (chatData.status == ChatDataManager.ChatStatus.NONE) { if (chatData.status == ChatDataManager.ChatStatus.NONE) {
// Draw 'start chat' button // Draw 'start chat' button
drawIcon("button-chat", matrices, entity, -16, textHeaderHeight, 32, 17); // TODO: This does not yet work, since the button is only visible on first sight
if (chatData.friendship == -3) {
drawIcon("button-chat-enemy", matrices, -16, textHeaderHeight, 32, 17);
} else if (chatData.friendship == 3) {
drawIcon("button-chat-friend", matrices, -16, textHeaderHeight, 32, 17);
} else {
drawIcon("button-chat", matrices, -16, textHeaderHeight, 32, 17);
}
} else if (chatData.status == ChatDataManager.ChatStatus.PENDING) { } else if (chatData.status == ChatDataManager.ChatStatus.PENDING) {
// Draw 'pending' button // Draw 'pending' button
drawIcon("button-dotdot", matrices, entity, -16, textHeaderHeight, 32, 17); drawIcon("button-dotdot", matrices, -16, textHeaderHeight, 32, 17);
} else if (chatData.sender == ChatDataManager.ChatSender.ASSISTANT) { } else if (chatData.sender == ChatDataManager.ChatSender.ASSISTANT) {
// Draw text background (no smaller than 50F tall) // Draw text background (no smaller than 50F tall)
drawTextBubbleBackground(matrices, entity, -64, 0, 128, scaledTextHeight); drawTextBubbleBackground(matrices, -64, 0, 128, scaledTextHeight, chatData.friendship);
// Draw face of entity // Draw face of entity
drawEntityIcon(matrices, entity, -59, 7, 32, 32); drawEntityIcon(matrices, entity, -82, 7, 32, 32);
// Render each line of the text // Render each line of the text
drawMessageText(matrix, lines, starting_line, ending_line, immediate, lineSpacing, fullBright, 40.0F + DISPLAY_PADDING); drawMessageText(matrix, lines, starting_line, ending_line, immediate, lineSpacing, fullBright, 40.0F + DISPLAY_PADDING);
......
...@@ -192,6 +192,7 @@ public class ModInit implements ModInitializer { ...@@ -192,6 +192,7 @@ public class ModInit implements ModInitializer {
buffer.writeInt(chatData.currentLineNumber); buffer.writeInt(chatData.currentLineNumber);
buffer.writeString(chatData.status.toString()); buffer.writeString(chatData.status.toString());
buffer.writeString(chatData.sender.toString()); buffer.writeString(chatData.sender.toString());
buffer.writeInt(chatData.friendship);
// Iterate over all players and send the packet // Iterate over all players and send the packet
for (ServerPlayerEntity player : serverInstance.getPlayerManager().getPlayerList()) { for (ServerPlayerEntity player : serverInstance.getPlayerManager().getPlayerList()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment