Доброго времени суток, подскажи, как закрепить эти итемы, чтоб при изменении размера экрана не улетали?
Java:
public class BoxGui extends GuiScreen {
private static final ResourceLocation texture = new ResourceLocation("fdmod", "textures/gui/trap.png");
private ListElemetItem list = new ListElemetItem(0, 0, 0, 0, 40, 52);
@Override
public void initGui() {
//list = new ListElemetItem(offsetX, 12, w, height);
list.x = (width/2) - 83;
//list.y = 25;
list.widthList = (18*10)+10;
list.heightList = 18*4;
list.y = 88;
list.widthElemet = 16;
list.heightElemet = 16;
/*list.widthElemet = 184 / 4;
list.heightElemet = 187 / 4;*/
//list.widthElemet = 4 + 32 + 4;
//list.heightElemet = list.widthElemet + 12;
list.indent = 1;
//list.indent+Up|Down|Left|Right = 2|5|3|3;
list.hash.clear();
List<String> lore;
int id = 0;
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("");
lore.add("��� diamond_sword.");
lore.add("");
lore.add(ChatFormatting.GOLD + "��� diamond_sword.");
lore.add("");
lore.add("�a��� diamond_sword.");
list.addElemet(new ElemetItem(id++, new ItemStack(Items.diamond_sword), lore));
lore = new ArrayList<String>();
lore.add("��� potionitem.");
list.addElemet(new ElemetItem(id++, new ItemStack(Items.potionitem, 1, 8228), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
Item finditem = GameRegistry.findItem("ic2", "blockOreCopper");
if (finditem != null){
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(finditem, 1, 0), lore));
}
finditem = GameRegistry.findItem("IC2", "blockOreCopper");
if (finditem != null){
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(finditem, 1, 0), lore));
}
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("");
lore.add("��� diamond_sword.");
lore.add("");
lore.add(ChatFormatting.GOLD + "��� diamond_sword.");
lore.add("");
lore.add("�a��� diamond_sword.");
list.addElemet(new ElemetItem(id++, new ItemStack(Items.diamond_sword), lore));
lore = new ArrayList<String>();
lore.add("��� potionitem.");
list.addElemet(new ElemetItem(id++, new ItemStack(Items.potionitem, 1, 8228), lore));
lore = new ArrayList<String>();
lore.add("��� �����.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� ������� ������.");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.stone), lore));
lore = new ArrayList<String>();
lore.add("��� ����� �����.");
lore.add(ChatFormatting.BLUE + "� ��� �� �� �����?");
list.addElemet(new ElemetItem(id++, new ItemStack(Blocks.dirt), lore));
lore = new ArrayList<String>();
lore.add("��� bestpickaxe.");
list.addElemet(new ElemetItem(id++, new ItemStack(Main.bestpickaxe), lore));
lore = new ArrayList<String>();
lore.add("");
lore.add("��� diamond_sword.");
lore.add("");
lore.add(ChatFormatting.GOLD + "��� diamond_sword.");
lore.add("");
lore.add("�a��� diamond_sword.");
list.addElemet(new ElemetItem(id++, new ItemStack(Items.diamond_sword), lore));
lore = new ArrayList<String>();
lore.add("��� potionitem.");
list.addElemet(new ElemetItem(id++, new ItemStack(Items.potionitem, 1, 8228), lore));
int cont = list.widthList / (list.widthElemet + (list.indent * 2) + 3);
list.heightAll = (list.heightElemet + (list.indent * 2)) * ((list.hash.size() % cont == 0 ? 0 : 1) + (list.hash.size() / cont));
//addButton(new GuiButtonShop(0, 2, (height / 2) - 9 - (16 * 5), 140, 16, "��������� ������"));
// addButton(new GuiButtonShop(1, 2, (height / 2) - 9 - (16 * 4), 140, 16, "��������� ������"));
// addButton(new GuiButtonShop(2, 2, (height / 2) - 9 - (16 * 3), 140, 16, "��������� ����"));
// addButton(new GuiButtonShop(3, 58, (height / 2) - 7 - 22, 94, 22, "�������"));
// addButton(new GuiButtonShop(4, 58, (height / 2) - 7, 94, 22, "�������"));
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
protected void actionPerformed(GuiButton button) {
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
GL11.glPushMatrix();
GL11.glTranslatef(0F, ((float)height - (697F / 3F)) / 2F, 0F);
GL11.glEnable(GL11.GL_BLEND);
//GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(list.x-7, list.y-48, 0, 0, 176, 140);
/* func_152125_a(//Left
100, 10,//x, y
100, 100,//u, v
486, 697,//uWidth, vHeight
486 / 3, 697 / 3,//width, height
1024F, 1024F);//tileWidth, tileHeight
func_152125_a(//Center
500 / 500, 0,//x, y
486, 0,//u, v
490, 697,//uWidth, vHeight
width - ((486 + 48) / 3), 697 / 3,//width, height
1024F, 1024F);//tileWidth, tileHeight*/
func_152125_a(//Right
width - (2 / 3), 0,//x, y
1, 0,//u, v
10, 1,//uWidth, vHeight
1 / 3, 1 / 3,//width, height
1024F, 1024F);//tileWidth, tileHeight
//mc.getTextureManager().bindTexture(mc.player.getLocationSkin()); //������ ������
//drawTexturedModalRect(29 / 2, 433 / 2, 32, 32, 32, 32);
/*func_152125_a(//Right
10, 144,//x, y
32, 32,//u, v
32, 32,//uWidth, vHeight
21, 21,//width, height
256, 256);//tileWidth, tileHeight
*/
GL11.glDisable(GL11.GL_BLEND);
//GL11.glPushMatrix();
// GL11.glScalef(1.5F, 1.5F, 1.5F);
//fontRenderer.drawString("MONEY", 32, 8, 0xFFFFFF);
//fontRenderer.drawString("��������� ������", 8, 8 + 11, 0xFFFFFF);
//fontRenderer.drawString("��������� ������", 8, 8 + (11 * 2), 0xFFFFFF);
//fontRenderer.drawString("��������� ����", 8, 8 + (11 * 3), 0xFFFFFF);
//fontRenderer.drawString("�������", 60, 5 + (14 * 4), 0xFFFFFF);
//fontRenderer.drawString("�������", 60, 5 + (14 * 5), 0xFFFFFF);
//fontRenderer.drawString("INFO", 38, 10 + (9 * 10), 0xFFFFFF);
//fontRenderer.drawString("������: " + 300, 8, 13 + (9 * 11), 0xFFFFFF);
// fontRenderer.drawString("������: " + 0, 8, 13 + (9 * 12), 0xFFFFFF);
// fontRenderer.drawString("������: " + "����", 8, 13 + (9 * 13), 0xFFFFFF);
// fontRenderer.drawString("���: " + mc.player.getDisplayNameString(), 8, 14 + (9 * 14), 0xFFFFFF);
// GlStateManager.popMatrix();
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_BLEND);
// GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
super.drawScreen(mouseX, mouseY, partialTicks);
list.render(mouseX, mouseY);
GL11.glDisable(GL11.GL_BLEND);
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
super.keyTyped(typedChar, keyCode);
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
if (list.isMove && Mouse.getEventButton() == 0 && !Mouse.getEventButtonState()) {
list.isMove = false;
}
// if (mouseX >= list.x && mouseX <= list.x + list.widthList &&
// mouseY >= list.y && mouseY <= list.y + list.heightList) {
//-----------------------------------------------------------------------------------
/*if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}*/
//-----------------------------------------------------------------------------------
if (list.heightAll > list.heightList) {
int d = Mouse.getEventDWheel();
if (d != 0) {
//list.scrolY += d / 12;
if (d > 0) {
list.scrolY += 18;
}
else {
list.scrolY -= 18;
}
if (list.scrolY > 0) list.scrolY = 0;
else {
int offsetY = list.heightAll - list.heightList;
if (list.scrolY < -(offsetY)) list.scrolY = -(offsetY);
}
}
//-----------------------------------------------------------------------------------
if (list.isMove) {
list.scrolY += (int)((float)(list.mouseLastY - mouseY) * ((float)list.heightAll / (float)list.heightList));
if (list.scrolY > 0) list.scrolY = 0;
else {
int offsetY = list.heightAll - list.heightList;
if (list.scrolY < -(offsetY)) list.scrolY = -(offsetY);
}
}
if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) {
int sizeP = list.y + (int)(((float)list.heightList / (float)list.heightAll) * (float)(-list.scrolY));
if (mouseX >= list.x + list.widthList - 10 &&
mouseX < list.x + list.widthList &&
mouseY >= sizeP &&
mouseY < sizeP + (int)(((float)list.heightList / (float)list.heightAll) * (float)list.heightList)) {
list.isMove = true;
}
}
}
list.mouseLastY = mouseY;
if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) {
mouseY -= list.scrolY;
int cont = list.widthList / (list.widthElemet + (list.indent * 2) + 3);
int i = 0;
list.selectItem = -1;
for (Entry<Integer, ElemetItem> entry : list.hash.entrySet()) {
int offsetX = i % cont;
int offsetY = i / cont;
offsetX = list.x + list.indent + ((offsetX > 0 ? list.indent * 2 : 0) + list.widthElemet) * offsetX;
offsetY = list.y + list.indent + ((offsetY > 0 ? list.indent * 2 : 0) + list.heightElemet) * offsetY;
if (mouseX >= offsetX && mouseX < offsetX + list.widthElemet &&
mouseY >= offsetY && mouseY < offsetY + list.heightElemet) {
list.selectItem = entry.getValue().id;
break;
}
++i;
}
// }
//-----------------------------------------------------------------------------------
}
}
private class ListElemetItem {
public int
x, y,
widthList, heightList,
widthElemet, heightElemet,
indent,
heightAll;
public HashMap<Integer, ElemetItem> hash = new HashMap<Integer, ElemetItem>();
public int selectItem = -1;
public int scrolY = 0, mouseLastY;
public boolean isMove;
private int width;
private int height;
public ListElemetItem(final int x, final int y,
final int widthList, final int heightList,
final int widthElemet, final int heightElemet) {
this.x = x;
this.y = y;
this.widthList = widthList;
this.heightList = heightList;
this.widthElemet = widthElemet;
this.heightElemet = heightElemet;
}
public <T extends ElemetItem> T addElemet(T elemet) {
//if (hash.containsKey(elemet.id))
// hash.replace(elemet.id, elemet);//message "new item or refresh item"
// else
hash.put(elemet.id, elemet);
return elemet;
}
public void render(int mouseX, int mouseY) {
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
double scaleW = mc.displayWidth / res.getScaledWidth_double();
double scaleH = mc.displayHeight / res.getScaledHeight_double();
GL11.glScissor(
(int)(list.x * scaleW),
(int)(mc.displayHeight - ((list.heightList + list.y) * scaleH)),
(int)(list.widthList * scaleW),
(int)((list.heightList) * scaleH));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
if (heightAll > heightList) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(0.35F, 0.75F, 1F, 0.5F);
drawTexturedModalRect(x + widthList - 13, y, 0, 0, 8, heightList);
GL11.glColor4f(0F, 0.5F, 0F, 0.5F);
drawTexturedModalRect(x + widthList - 13, y + (int)(((float)heightList / (float)heightAll) * (float)(-scrolY)), 0, 0, 8,
(int)(((float)heightList / (float)heightAll) * (float)heightList));
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
/*
GlStateManager.disableTexture2D();
GlStateManager.color(1F, 0F, 1F, 0.5F);
drawTexturedModalRect(0, 0, 0, 0, width, height);
GlStateManager.enableTexture2D();
*/
GL11.glPushMatrix();
scrolY = (scrolY/18) * 18;
GL11.glTranslatef(0, scrolY, 0);
mouseY -= scrolY;
int cont = widthList / (widthElemet + (indent * 2) + 3);
int i = 0;
for (Entry<Integer, ElemetItem> entry : hash.entrySet()) {
mc.getTextureManager().bindTexture(texture);
int offsetX = i % cont;
int offsetY = i / cont;
++i;
offsetX = x + indent + ((offsetX > 0 ? indent * 2 : 0) + widthElemet) * offsetX;
offsetY = y + indent + ((offsetY > 0 ? indent * 2 : 0) + heightElemet) * offsetY;
if (offsetY + scrolY + heightElemet < y) continue;
if (offsetY + scrolY + heightElemet > y + heightList + heightElemet) break;
GL11.glColor4f(1F, 1F, 1F, 1F);
//---------------------------------------------------------------------------------
//Background element
/*func_152125_a(//Left
offsetX, offsetY,//x, y
1, 727,//u, v
182, 185,//uWidth, vHeight
182 / 4, 185 / 4,//width, height
1024F, 1024F);//tileWidth, tileHeight
/*
drawScaledCustomSizeModalRect(//Left
offsetX, offsetY,//x, y
0, 728,//u, v
184, 187,//uWidth, vHeight
184 / 4, 187 / 4,//width, height
1024F, 1024F);//tileWidth, tileHeight
*/
//---------------------------------------------------------------------------------
if (mouseX >= offsetX && mouseX < offsetX + widthElemet &&
mouseY >= offsetY && mouseY < offsetY + heightElemet) {
if (mouseX >= list.x && mouseX < list.x + list.widthList &&
mouseY + scrolY >= list.y && mouseY + scrolY < list.y + list.heightList) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(0F, 0.75F, 1F, 0.5F);
drawTexturedModalRect(offsetX, offsetY, 0, 0, widthElemet, heightElemet);
GL11.glEnable(GL11.GL_TEXTURE_2D);
entry.getValue().hover = true;
}
/*
zLevel += 200;
drawHoveringText("000", mouseX, mouseY += scrolX);
zLevel -= 200;
*/
} else {
if (entry.getValue().hover) entry.getValue().hover = false;
}
//---------------------------------------------------------------------------------
/*
if (entry.getValue().hover) {
GlStateManager.disableTexture2D();
GlStateManager.color(0F, 0.75F, 1F, 0.5F);
drawTexturedModalRect(offsetX, offsetY, 0, 0, widthElemet, heightElemet);
GlStateManager.enableTexture2D();
}
*/
/*if (list.selectItem == entry.getValue().id) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1F, 0.75F, 0.25F, 0.5F);
drawTexturedModalRect(offsetX, offsetY, 0, 0, widthElemet, heightElemet);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}*/
//---------------------------------------------------------------------------------
/*GL11.glPushMatrix();
GL11.glTranslatef(offsetX, 38 + offsetY, 0);
GL11.glScalef(0.5F, 0.5F, 0.5F);
fontRendererObj.drawString(entry.getValue().units + " ���", 10, 0, 0x0);
fontRendererObj.drawString(entry.getValue().votes + " �������", 10, 10, 0x0);
GL11.glPopMatrix(); */
//---------------------------------------------------------------------------------
}
GL11.glColor4f(1F, 1F, 1F, 1F);
//render Items
GL11.glPushMatrix();
RenderHelper.enableGUIStandardItemLighting();
i = 0;
for (Entry<Integer, ElemetItem> entry : hash.entrySet()) {
if (entry.getValue().item == null) return;
int offsetX = i % cont;
int offsetY = i / cont;
++i;
offsetX = x + indent + ((offsetX > 0 ? indent * 2 : 0) + widthElemet) * offsetX;
offsetY = y + indent + ((offsetY > 0 ? indent * 2 : 0) + heightElemet) * offsetY;
if (offsetY + scrolY + heightElemet < y) continue;
if (offsetY + scrolY + heightElemet > y + heightList + heightElemet) break;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glEnable(GL11.GL_LIGHTING);
itemRender.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, entry.getValue().item, offsetX, offsetY);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_DEPTH_TEST);
//FontRenderer font = entry.getValue().item.getItem().getFontRenderer(entry.getValue().item);
//if (font == null) font = fontRendererObj;
//itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, entry.getValue().item, (offsetX), (offsetY));
//itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, entry.getValue().item, (offsetX), (offsetY), null);
}
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_SCISSOR_TEST);
List<String> lists = new ArrayList<String>();
i = 0;
for (Entry<Integer, ElemetItem> entry : hash.entrySet()) {
int offsetX = i % cont;
int offsetY = i / cont;
++i;
offsetX = x + indent + ((offsetX > 0 ? indent * 2 : 0) + widthElemet) * offsetX;
offsetY = y + indent + ((offsetY > 0 ? indent * 2 : 0) + heightElemet) * offsetY;
if (offsetY + scrolY + heightElemet < y) continue;
if (offsetY + scrolY + heightElemet > y + heightList + heightElemet) break;
if (mouseX >= offsetX && mouseX < offsetX + widthElemet &&
mouseY >= offsetY && mouseY < offsetY + heightElemet) {
if (mouseX >= list.x && mouseX < list.x + list.widthList &&
mouseY + scrolY >= list.y && mouseY + scrolY < list.y + list.heightList) {
lists.clear();
if (entry.getValue().item.getDisplayName() != null || entry.getValue().item.getDisplayName().length() > 0)
lists.add(entry.getValue().item.getDisplayName());
ArrayList info = new ArrayList();
entry.getValue().item.getItem().addInformation(entry.getValue().item, mc.thePlayer, info, false);
if (!info.isEmpty())
lists.addAll(info);
lists.addAll(entry.getValue().lore);
drawHoveringText(lists, mouseX, mouseY + scrolY, mc.fontRenderer);
}
}
}
}
}
private class ElemetItem extends Gui {
public final int id;
public ItemStack item;
public List<String> lore;
public boolean hover;
public ElemetItem(final int id, final ItemStack item, List<String> lore) {
this.id = id;
this.item = item;
this.lore = lore;
}
}
/*
@SideOnly(Side.CLIENT)
public class GuiButtonShop extends GuiButton {
public GuiButtonShop(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
}
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
if (visible) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int i = getHoverState(hovered);
if (hovered) {
GlStateManager.disableTexture2D();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(x, y, 0, 0, width, 1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(x, y, 0, 0, 1, height);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(x + width - 1, y, 0, 0, 1, height);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(x, y + height - 1, 0, 0, width, 1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableTexture2D();
}
mouseDragged(mc, mouseX, mouseY);
int j = 14737632;
if (packedFGColour != 0)
j = packedFGColour;
else
if (!enabled) j = 10526880;
else if (hovered) j = 16777120;
//drawCenteredString(fontrenderer, displayString, x + width / 2, y + (height - 8) / 2, j);
GlStateManager.pushMatrix();
GlStateManager.scale(1.5F, 1.5F, 1.5F);
//drawString(mc.fontRenderer, displayString, (x + 20) / 2, (y + (height - 18) / 2) / 2, j);
GlStateManager.popMatrix();
}
}
}*/
}