GuiCreateWorld, GuiSlot, GuiUtilRenderComponents, GuiContainerCreative

This commit is contained in:
RainWarrior committed 2016-03-02 15:06:36 +03:00
1 parent 7fadb5aeb8
commit 3fd09af1d3
8 files changed
+71 -83

No files matched your search

@@ -1,6 +1,15 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -311,14 +311,7 @@
@@ -205,6 +205,8 @@
}
}
+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress();
+
WorldSettings worldsettings = new WorldSettings(i, WorldSettings.GameType.getByName(this.gameMode), this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]);
worldsettings.setWorldName(this.chunkProviderSettingsJson);
@@ -311,14 +313,7 @@
}
else if (button.id == 8)
{
@@ -16,7 +25,7 @@
}
}
}
@@ -370,7 +363,7 @@
@@ -370,7 +365,7 @@
this.btnBonusItems.visible = this.field_146344_y;
this.btnMapType.visible = this.field_146344_y;
this.btnAllowCommands.visible = this.field_146344_y;
@@ -1,21 +1,39 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java
@@ -458,4 +458,18 @@
@@ -181,15 +181,8 @@
GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getWorldRenderer();
- this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- float f = 32.0F;
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
- vertexbuffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- vertexbuffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- vertexbuffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- vertexbuffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- tessellator.draw();
+ // Forge: background rendering moved into separate method.
+ this.drawContainerBackground(tessellator);
int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int l = this.top + 4 - (int)this.amountScrolled;
@@ -458,4 +451,18 @@
{
return this.slotHeight;
}
+
+ protected void drawContainerBackground(Tessellator tessellator)
+ {
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ VertexBuffer buffer = tessellator.getWorldRenderer();
+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ float f = 32.0F;
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+ worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+ buffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ tessellator.draw();
+ }
}
@@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
@@ -73,6 +73,7 @@
s3 = s4;
}
+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping.
TextComponentString textcomponentstring2 = new TextComponentString(s3);
textcomponentstring2.setChatStyle(itextcomponent1.getChatStyle().createShallowCopy());
list1.add(j + 1, textcomponentstring2);
@@ -47,7 +47,21 @@
for (Item item : Item.itemRegistry)
{
if (item != null && item.getCreativeTab() != null)
@@ -332,7 +349,6 @@
@@ -324,7 +341,13 @@
item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
}
}
+ updateFilteredItems(guicontainercreative$containercreative);
+ }
+ //split from above for custom search tabs
+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative)
+ {
+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search
for (Enchantment enchantment : Enchantment.field_185264_b)
{
if (enchantment != null && enchantment.type != null)
@@ -332,7 +355,6 @@
Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList);
}
}
@@ -55,7 +69,7 @@
Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
String s1 = this.searchField.getText().toLowerCase();
@@ -364,7 +380,7 @@
@@ -364,7 +386,7 @@
{
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
@@ -64,7 +78,7 @@
{
GlStateManager.disableBlend();
this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
@@ -399,7 +415,7 @@
@@ -399,7 +421,7 @@
for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray)
{
@@ -73,7 +87,7 @@
{
this.setCurrentCreativeTab(creativetabs);
return;
@@ -412,11 +428,13 @@
@@ -412,11 +434,13 @@
private boolean needsScrollBars()
{
@@ -87,7 +101,7 @@
int i = selectedTabIndex;
selectedTabIndex = p_147050_1_.getTabIndex();
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
@@ -487,12 +505,14 @@
@@ -487,12 +511,14 @@
if (this.searchField != null)
{
@@ -103,7 +117,7 @@
this.updateCreativeSearch();
}
else
@@ -562,20 +582,43 @@
@@ -562,20 +588,43 @@
}
super.drawScreen(mouseX, mouseY, partialTicks);
@@ -148,7 +162,7 @@
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
}
@@ -637,16 +680,35 @@
@@ -637,16 +686,35 @@
RenderHelper.enableGUIStandardItemLighting();
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
@@ -185,7 +199,7 @@
this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
this.searchField.drawTextBox();
@@ -661,6 +723,14 @@
@@ -661,6 +729,14 @@
this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
}
@@ -200,7 +214,7 @@
this.func_147051_a(creativetabs);
if (creativetabs == CreativeTabs.tabInventory)
@@ -671,6 +741,14 @@
@@ -671,6 +747,14 @@
protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_)
{
@@ -215,7 +229,7 @@
int i = p_147049_1_.getTabColumn();
int j = 28 * i;
int k = 0;
@@ -767,6 +845,8 @@
@@ -767,6 +851,8 @@
}
GlStateManager.disableLighting();
@@ -224,7 +238,7 @@
this.drawTexturedModalRect(l, i1, j, k, 28, j1);
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
@@ -793,6 +873,15 @@
@@ -793,6 +879,15 @@
{
this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
}
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
}
}
+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress();
+
WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.gameMode);
WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]);
worldsettings.setWorldName(this.chunkProviderSettingsJson);
++++ END PATCH
@@ -1,19 +0,0 @@
++++ REJECTED PATCH 1
GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- float f = 32.0F;
- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
- worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- tessellator.draw();
+ // Forge: background rendering moved into separate method.
+ this.drawContainerBackground(tessellator);
int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int l = this.top + 4 - (int)this.amountScrolled;
++++ END PATCH
@@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
s3 = s4;
}
+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping.
ChatComponentText chatcomponenttext2 = new ChatComponentText(s3);
chatcomponenttext2.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy());
list1.add(j + 1, chatcomponenttext2);
++++ END PATCH
@@ -1,25 +0,0 @@
++++ REJECTED PATCH 2
return;
}
- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2))
+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770
{
if (clickedButton == 0)
{
++++ END PATCH
++++ REJECTED PATCH 6
item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
}
}
+ updateFilteredItems(guicontainercreative$containercreative);
+ }
+ //split from above for custom search tabs
+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative)
+ {
+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search
for (Enchantment enchantment : Enchantment.enchantmentsBookList)
{
if (enchantment != null && enchantment.type != null)
++++ END PATCH