mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 19:39:07 +00:00
Attempt to Fix Arabic Language
This commit is contained in:
1 parent
85fe73f368
commit
ce6e31abed
3 files changed
+59
-44
No files matched your search
@@ -5,6 +5,6 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
public interface IChatMessages {
|
||||
|
||||
public void addMessage(String message, EntityNPCInterface npc);
|
||||
public void renderMessages(double par3, double par5, double par7, float scale);
|
||||
|
||||
public void renderMessages(double par3, double par5, double par7, float scale, boolean inRange);
|
||||
|
||||
}
|
||||
@@ -17,13 +17,13 @@ import java.util.TreeMap;
|
||||
|
||||
public class RenderChatMessages implements IChatMessages{
|
||||
private Map<Long,TextBlockClient> messages = new TreeMap<Long,TextBlockClient>();
|
||||
|
||||
|
||||
private int boxLength = 46;
|
||||
private float scale = 0.5f;
|
||||
|
||||
|
||||
private String lastMessage = "";
|
||||
private long lastMessageTime = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public void addMessage(String message, EntityNPCInterface npc){
|
||||
if(!ConfigClient.EnableChatBubbles)
|
||||
@@ -41,21 +41,26 @@ public class RenderChatMessages implements IChatMessages{
|
||||
this.messages = messages;
|
||||
lastMessage = message;
|
||||
lastMessageTime = time;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMessages(double par3, double par5, double par7, float textscale){
|
||||
Map<Long,TextBlockClient> messages = getMessages();
|
||||
if(messages.isEmpty())
|
||||
return;
|
||||
@Override
|
||||
public void renderMessages(double par3, double par5, double par7, float scale, boolean inRange) {
|
||||
Map<Long,TextBlockClient> messages = getMessages();
|
||||
if(messages.isEmpty())
|
||||
return;
|
||||
if(inRange)
|
||||
render(par3, par5, par7, scale, false);
|
||||
render(par3, par5, par7, scale, true);
|
||||
}
|
||||
|
||||
public void render(double par3, double par5, double par7, float textscale, boolean depth){
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
float var13 = 1.6F;
|
||||
float var14 = 0.016666668F * var13;
|
||||
GL11.glPushMatrix();
|
||||
int size = 0;
|
||||
for(TextBlockClient block : messages.values())
|
||||
size += block.lines.size();
|
||||
|
||||
for (TextBlockClient block : messages.values())
|
||||
size += block.lines.size();
|
||||
int textYSize = (int) (size * font.FONT_HEIGHT * scale);
|
||||
GL11.glTranslatef((float)par3 + 0.0F, (float)par5 + textYSize * textscale * var14, (float)par7);
|
||||
GL11.glScalef(textscale, textscale, textscale);
|
||||
@@ -64,59 +69,69 @@ public class RenderChatMessages implements IChatMessages{
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1F, 0.0F, 0.0F);
|
||||
GL11.glScalef(-var14, -var14, var14);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
if (depth)
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
else
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
int black = depth ? 0xFF000000 : 0x55000000;
|
||||
int white = depth ? 0xBBFFFFFF : 0x44FFFFFF;
|
||||
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
drawRect(-boxLength - 2, -2, boxLength + 2, textYSize + 1, 0xBBFFFFFF, 0.11);
|
||||
|
||||
drawRect(-boxLength - 1, -3, boxLength + 1, -2, 0xFF000000, 0.1); //top
|
||||
drawRect(-boxLength - 1, textYSize + 2, -1, textYSize + 1, 0xFF000000, 0.1); //bottom1
|
||||
drawRect(3, textYSize + 2, boxLength + 1, textYSize + 1, 0xFF000000, 0.1); //bottom2
|
||||
drawRect(-boxLength - 3, -1, -boxLength - 2, textYSize, 0xFF000000, 0.1); //left
|
||||
drawRect(boxLength + 3, -1, boxLength + 2, textYSize, 0xFF000000, 0.1); //right
|
||||
drawRect(-boxLength - 2, -2, boxLength + 2, textYSize + 1, white, 0.11);
|
||||
|
||||
drawRect(-boxLength - 2, -2, -boxLength - 1, -1, 0xFF000000, 0.1);
|
||||
drawRect(boxLength + 2, -2, boxLength + 1, -1, 0xFF000000, 0.1);
|
||||
drawRect(-boxLength - 2, textYSize + 1, -boxLength - 1, textYSize, 0xFF000000, 0.1);
|
||||
drawRect(boxLength + 2, textYSize + 1, boxLength + 1, textYSize, 0xFF000000, 0.1);
|
||||
drawRect(-boxLength - 1, -3, boxLength + 1, -2, black, 0.1); // top
|
||||
drawRect(-boxLength - 1, textYSize + 2, -1, textYSize + 1, black, 0.1); // bottom1
|
||||
drawRect(3, textYSize + 2, boxLength + 1, textYSize + 1, black, 0.1); // bottom2
|
||||
drawRect(-boxLength - 3, -1, -boxLength - 2, textYSize, black, 0.1); // left
|
||||
drawRect(boxLength + 3, -1, boxLength + 2, textYSize, black, 0.1); // right
|
||||
|
||||
drawRect(0, textYSize + 1, 3, textYSize + 4, 0xBBFFFFFF, 0.11);
|
||||
drawRect(-1, textYSize + 4, 1, textYSize + 5, 0xBBFFFFFF, 0.11);
|
||||
|
||||
drawRect(-1, textYSize + 1, 0, textYSize + 4, 0xFF000000, 0.1);
|
||||
drawRect(3, textYSize + 1, 4, textYSize + 3, 0xFF000000, 0.1);
|
||||
drawRect(2, textYSize + 3, 3, textYSize + 4, 0xFF000000, 0.1);
|
||||
drawRect(1, textYSize + 4, 2, textYSize + 5, 0xFF000000, 0.1);
|
||||
drawRect(-2, textYSize + 4, -1, textYSize + 5, 0xFF000000, 0.1);
|
||||
|
||||
drawRect(-2, textYSize + 5, 1, textYSize + 6, 0xFF000000, 0.1);
|
||||
drawRect(-boxLength - 2, -2, -boxLength - 1, -1, black, 0.1);
|
||||
drawRect(boxLength + 2, -2, boxLength + 1, -1, black, 0.1);
|
||||
drawRect(-boxLength - 2, textYSize + 1, -boxLength - 1, textYSize, black, 0.1);
|
||||
drawRect(boxLength + 2, textYSize + 1, boxLength + 1, textYSize, black, 0.1);
|
||||
|
||||
drawRect(0, textYSize + 1, 3, textYSize + 4, white, 0.11);
|
||||
drawRect(-1, textYSize + 4, 1, textYSize + 5, white, 0.11);
|
||||
|
||||
drawRect(-1, textYSize + 1, 0, textYSize + 4, black, 0.1);
|
||||
drawRect(3, textYSize + 1, 4, textYSize + 3, black, 0.1);
|
||||
drawRect(2, textYSize + 3, 3, textYSize + 4, black, 0.1);
|
||||
drawRect(1, textYSize + 4, 2, textYSize + 5, black, 0.1);
|
||||
drawRect(-2, textYSize + 4, -1, textYSize + 5, black, 0.1);
|
||||
|
||||
drawRect(-2, textYSize + 5, 1, textYSize + 6, black, 0.1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
int index = 0;
|
||||
for(TextBlockClient block : messages.values()){
|
||||
for(IChatComponent chat : block.lines){
|
||||
String message = chat.getFormattedText();
|
||||
font.drawString(message, -font.getStringWidth(message) / 2, index * font.FONT_HEIGHT, 0);
|
||||
font.drawString(message, -font.getStringWidth(message) / 2, index * font.FONT_HEIGHT, black);
|
||||
index++;
|
||||
}
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void drawRect(int par0, int par1, int par2, int par3, int par4, double par5)
|
||||
{
|
||||
int j1;
|
||||
@@ -148,7 +163,7 @@ public class RenderChatMessages implements IChatMessages{
|
||||
tessellator.addVertex((double)par0, (double)par1, par5);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
private Map<Long,TextBlockClient> getMessages(){
|
||||
Map<Long,TextBlockClient> messages = new TreeMap<Long,TextBlockClient>();
|
||||
long time = System.currentTimeMillis();
|
||||
@@ -160,5 +175,5 @@ public class RenderChatMessages implements IChatMessages{
|
||||
}
|
||||
this.messages = messages;
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
float height = ((npc.baseHeight / 5f) * npc.display.modelSize);
|
||||
float offset = npc.height * (1.2f + (!npc.display.showName()?0:npc.display.title.isEmpty()?0.15f:0.25f));
|
||||
|
||||
npc.messages.renderMessages(d, d1 + offset, d2, 0.666667F * height);
|
||||
npc.messages.renderMessages(d, d1 + offset, d2, 0.666667F * height, npc.isInRange(renderManager.livingPlayer, 4));
|
||||
}
|
||||
float scale = (npc.baseHeight / 5f) * npc.display.modelSize;
|
||||
int height = 0;
|
||||
|
||||
Reference in new issue
Block a user