From 41bd8a41fadd5c6e43d59df3b8143351e2e14e9c Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 11 Nov 2015 15:51:32 +0300 Subject: [PATCH] BlockOre, BlockRotatedPillar, SoundManager, EntityPlayerSP, GuiScreen, GuiAchievements, GuiContainer, BlockModelRenderer, ContainerEnchantment, Slot updated manually and imports removed; GitSlot patch updated. --- .../net/minecraft/block/BlockOre.java.patch | 51 ++++++++ .../block/BlockRotatedPillar.java.patch | 21 ++++ .../client/audio/SoundManager.java.patch | 41 ++++++ .../client/entity/EntityPlayerSP.java.patch | 71 +++++++++++ .../minecraft/client/gui/GuiScreen.java.patch | 99 +++++++++++++++ .../minecraft/client/gui/GuiSlot.java.patch | 33 +++-- .../achievement/GuiAchievements.java.patch | 117 ++++++++++++++++++ .../gui/inventory/GuiContainer.java.patch | 57 +++++++++ .../renderer/BlockModelRenderer.java.patch | 24 ++++ .../inventory/ContainerEnchantment.java.patch | 77 ++++++++++++ .../net/minecraft/inventory/Slot.java.patch | 76 ++++++++++++ .../client/gui/GuiSlot.java.patch.rej | 19 --- 12 files changed, 659 insertions(+), 27 deletions(-) create mode 100644 patches/minecraft/net/minecraft/block/BlockOre.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch create mode 100644 patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/Slot.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch new file mode 100644 index 000000000..35a3ddd9d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOre.java +@@ -60,34 +60,40 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ } ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) + { + int i = 0; + + if (this == Blocks.coal_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); ++ i = MathHelper.getRandomIntegerInRange(rand, 0, 2); + } + else if (this == Blocks.diamond_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.emerald_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.lapis_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + else if (this == Blocks.quartz_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + +- this.dropXpOnBlockBreak(worldIn, pos, i); ++ return i; + } ++ return 0; + } + + public int getDamageValue(World worldIn, BlockPos pos) diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch new file mode 100644 index 000000000..586091cc9 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java +@@ -19,4 +19,18 @@ + { + super(p_i46385_1_, p_i46385_2_); + } ++ ++ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) ++ { ++ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); ++ for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("axis")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch new file mode 100644 index 000000000..95f78a511 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java ++++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java +@@ -70,6 +70,7 @@ + { + SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); + SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); + } + catch (SoundSystemException soundsystemexception) + { +@@ -81,6 +82,7 @@ + { + this.unloadSoundSystem(); + this.loadSoundSystem(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); + } + + private synchronized void loadSoundSystem() +@@ -319,6 +321,9 @@ + } + else + { ++ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); ++ if (sound == null) return; ++ + SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); + + if (soundeventaccessorcomposite == null) +@@ -360,10 +365,12 @@ + if (soundpoolentry.isStreamingSound()) + { + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); + } + else + { + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); + } + + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch new file mode 100644 index 000000000..41abf7b94 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java ++++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +@@ -346,6 +346,15 @@ + this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); + } + ++ private boolean isHeadspaceFree(BlockPos pos, int height) ++ { ++ for (int y = 0; y < height; y++) ++ { ++ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; ++ } ++ return true; ++ } ++ + protected boolean pushOutOfBlocks(double x, double y, double z) + { + if (this.noClip) +@@ -358,30 +367,34 @@ + double d0 = x - (double)blockpos.getX(); + double d1 = z - (double)blockpos.getZ(); + +- if (!this.isOpenBlockSpace(blockpos)) ++ int entHeight = Math.max(Math.round(this.height), 1); ++ ++ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); ++ ++ if (inTranslucentBlock) + { + int i = -1; + double d2 = 9999.0D; + +- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2) + { + d2 = d0; + i = 0; + } + +- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2) + { + d2 = 1.0D - d0; + i = 1; + } + +- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2) + { + d2 = d1; + i = 4; + } + +- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2) + { + d2 = 1.0D - d1; + i = 5; +@@ -449,6 +462,12 @@ + + public void playSound(String name, float volume, float pitch) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; ++ + this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + } + diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch new file mode 100644 index 000000000..37d51e97f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -0,0 +1,99 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java +@@ -144,7 +144,8 @@ + } + } + +- this.drawHoveringText(list, x, y); ++ FontRenderer font = stack.getItem().getFontRenderer(stack); ++ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); + } + + protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) +@@ -154,6 +155,11 @@ + + protected void drawHoveringText(List textLines, int x, int y) + { ++ drawHoveringText(textLines, x, y, fontRendererObj); ++ } ++ ++ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) ++ { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); +@@ -164,7 +170,7 @@ + + for (String s : textLines) + { +- int j = this.fontRendererObj.getStringWidth(s); ++ int j = font.getStringWidth(s); + + if (j > i) + { +@@ -209,7 +215,7 @@ + for (int k1 = 0; k1 < textLines.size(); ++k1) + { + String s1 = (String)textLines.get(k1); +- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); ++ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + + if (k1 == 0) + { +@@ -437,6 +443,7 @@ + { + this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + } ++ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; + + this.mc.thePlayer.sendChatMessage(msg); + } +@@ -451,9 +458,15 @@ + + if (guibutton.mousePressed(this.mc, mouseX, mouseY)) + { ++ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ break; ++ guibutton = event.button; + this.selectedButton = guibutton; + guibutton.playPressSound(this.mc.getSoundHandler()); + this.actionPerformed(guibutton); ++ if (this.equals(this.mc.currentScreen)) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList)); + } + } + } +@@ -483,8 +496,12 @@ + this.fontRendererObj = mc.fontRendererObj; + this.width = width; + this.height = height; ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList))) ++ { + this.buttonList.clear(); + this.initGui(); ++ } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList)); + } + + public void initGui() +@@ -497,7 +514,9 @@ + { + while (Mouse.next()) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; + this.handleMouseInput(); ++ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); + } + } + +@@ -505,7 +524,9 @@ + { + while (Keyboard.next()) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; + this.handleKeyboardInput(); ++ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 3cc9d27e2..422650fdf 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -459,4 +459,19 @@ +@@ -182,15 +182,8 @@ + 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.func_181668_a(7, DefaultVertexFormats.field_181709_i); +- worldrenderer.func_181662_b((double)this.left, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.right, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.right, (double)this.top, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.left, (double)this.top, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- 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; + +@@ -459,4 +452,18 @@ { return this.slotHeight; } @@ -10,13 +28,12 @@ + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ float f1 = 32.0F; -+ worldrenderer.startDrawingQuads(); -+ worldrenderer.setColorOpaque_I(2105376); -+ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ float f = 32.0F; ++ worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); ++ worldrenderer.func_181662_b((double)this.left, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.right, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.right, (double)this.top, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.left, (double)this.top, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); + tessellator.draw(); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch new file mode 100644 index 000000000..6551b16eb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -0,0 +1,117 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +@@ -50,6 +50,10 @@ + private boolean loadingAchievements = true; + private static final String __OBFID = "CL_00000722"; + ++ private int currentPage = -1; ++ private GuiButton button; ++ private java.util.LinkedList minecraftAchievements = new java.util.LinkedList(); ++ + public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) + { + this.parentScreen = p_i45026_1_; +@@ -58,6 +62,14 @@ + int j = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); ++ minecraftAchievements.clear(); ++ for (Achievement achievement : AchievementList.achievementList) ++ { ++ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) ++ { ++ minecraftAchievements.add(achievement); ++ } ++ } + } + + public void initGui() +@@ -65,6 +77,7 @@ + this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.buttonList.clear(); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); ++ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); + } + + protected void actionPerformed(GuiButton button) throws IOException +@@ -75,6 +88,16 @@ + { + this.mc.displayGuiScreen(this.parentScreen); + } ++ ++ if (button.id == 2) ++ { ++ currentPage++; ++ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) ++ { ++ currentPage = -1; ++ } ++ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage); ++ } + } + } + +@@ -258,7 +281,9 @@ + GlStateManager.depthFunc(518); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)i1, (float)j1, -200.0F); +- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); ++ // FIXES models rendering weirdly in the acheivements pane ++ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 ++ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); +@@ -332,11 +357,12 @@ + GlStateManager.depthFunc(515); + this.mc.getTextureManager().bindTexture(field_146561_C); + +- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) ++ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); ++ for (int j5 = 0; j5 < achievementList.size(); ++j5) + { +- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); ++ Achievement achievement1 = achievementList.get(j5); + +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) + { + int k5 = achievement1.displayColumn * 24 - i + 11; + int l5 = achievement1.displayRow * 24 - j + 11; +@@ -390,9 +416,9 @@ + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + +- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) ++ for (int i6 = 0; i6 < achievementList.size(); ++i6) + { +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); ++ Achievement achievement2 = achievementList.get(i6); + int l6 = achievement2.displayColumn * 24 - i; + int j7 = achievement2.displayRow * 24 - j; + +@@ -433,6 +459,7 @@ + + this.mc.getTextureManager().bindTexture(field_146561_C); + ++ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. + if (achievement2.getSpecial()) + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); +@@ -441,6 +468,7 @@ + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); + } ++ GlStateManager.disableBlend(); //Forge: Cleanup states we set. + + if (!this.statFileWriter.canUnlockAchievement(achievement2)) + { +@@ -449,7 +477,7 @@ + this.itemRender.func_175039_a(false); + } + +- GlStateManager.enableLighting(); ++ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GlStateManager.enableCull(); + this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); + GlStateManager.blendFunc(770, 771); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch new file mode 100644 index 000000000..b5535336b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +@@ -176,8 +176,11 @@ + GlStateManager.translate(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + this.itemRender.zLevel = 200.0F; ++ net.minecraft.client.gui.FontRenderer font = null; ++ if (stack != null) font = stack.getItem().getFontRenderer(stack); ++ if (font == null) font = fontRendererObj; + this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); +- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); ++ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); + this.zLevel = 0.0F; + this.itemRender.zLevel = 0.0F; + } +@@ -240,13 +243,12 @@ + + if (itemstack == null) + { +- String s1 = slotIn.getSlotTexture(); ++ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); + +- if (s1 != null) ++ if (textureatlassprite != null) + { +- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); + GlStateManager.disableLighting(); +- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); ++ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); + this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); + GlStateManager.enableLighting(); + flag1 = true; +@@ -464,6 +466,7 @@ + + protected void mouseReleased(int mouseX, int mouseY, int state) + { ++ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons + Slot slot = this.getSlotAtPosition(mouseX, mouseY); + int i = this.guiLeft; + int j = this.guiTop; +@@ -686,4 +689,16 @@ + this.mc.thePlayer.closeScreen(); + } + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * Returns the slot that is currently displayed under the mouse. ++ */ ++ public Slot getSlotUnderMouse() ++ { ++ return this.theSlot; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch new file mode 100644 index 000000000..9a78c5a86 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java +@@ -536,8 +536,19 @@ + @SideOnly(Side.CLIENT) + public static enum EnumNeighborInfo + { +- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), +- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), ++ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- ++ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 ++ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 ++ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), ++ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, ++ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), + NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), + SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), + WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch new file mode 100644 index 000000000..e816639eb --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java +@@ -69,9 +69,12 @@ + this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) + { + private static final String __OBFID = "CL_00002185"; ++ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); + public boolean isItemValid(ItemStack stack) + { +- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; ++ for (ItemStack ore : ores) ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; ++ return false; + } + }); + +@@ -150,6 +153,7 @@ + if (!this.worldPointer.isRemote) + { + int l = 0; ++ float power = 0; + + for (int j = -1; j <= 1; ++j) + { +@@ -157,37 +161,14 @@ + { + if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) + { +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); + if (k != 0 && j != 0) + { +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); + } + } + } +@@ -197,7 +178,7 @@ + + for (int i1 = 0; i1 < 3; ++i1) + { +- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); ++ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); + this.field_178151_h[i1] = -1; + + if (this.enchantLevels[i1] < i1 + 1) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch new file mode 100644 index 000000000..135b9fe84 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -0,0 +1,76 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Slot.java ++++ ../src-work/minecraft/net/minecraft/inventory/Slot.java +@@ -90,7 +90,7 @@ + @SideOnly(Side.CLIENT) + public String getSlotTexture() + { +- return null; ++ return backgroundName; + } + + public ItemStack decrStackSize(int amount) +@@ -113,4 +113,64 @@ + { + return true; + } ++ ++ /*========================================= FORGE START =====================================*/ ++ protected String backgroundName = null; ++ protected net.minecraft.util.ResourceLocation backgroundLocation = null; ++ protected Object backgroundMap; ++ /** ++ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. ++ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.util.ResourceLocation getBackgroundLocation() ++ { ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); ++ } ++ ++ /** ++ * Sets the texture file to use for the background image of the slot when it's empty. ++ * @param textureFilename String: Path of texture file to use, or null to use "/gui/items.png" ++ */ ++ @SideOnly(Side.CLIENT) ++ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) ++ { ++ this.backgroundLocation = texture; ++ } ++ ++ /** ++ * Sets which icon index to use as the background image of the slot when it's empty. ++ * Getter is func_178171_c ++ * @param icon The icon to use, null for none ++ */ ++ public void setBackgroundName(String name) ++ { ++ this.backgroundName = name; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() ++ { ++ String name = getSlotTexture(); ++ return name == null ? null : getBackgroundMap().getAtlasSprite(name); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() ++ { ++ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.getMinecraft().getTextureMapBlocks(); ++ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; ++ } ++ ++ /** ++ * Retrieves the index in the inventory for this slot, this value should typically not ++ * be used, but can be useful for some occasions. ++ * ++ * @return Index in associated inventory for this slot. ++ */ ++ public int getSlotIndex() ++ { ++ return slotIndex; ++ } ++ /*========================================= FORGE END =====================================*/ + } diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej deleted file mode 100644 index 79869a7b4..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej +++ /dev/null @@ -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 f1 = 32.0F; -- worldrenderer.startDrawingQuads(); -- worldrenderer.setColorOpaque_I(2105376); -- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- tessellator.draw(); -+ this.drawContainerBackground(tessellator); - int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int j1 = this.top + 4 - (int)this.amountScrolled; - -++++ END PATCH