diff --git a/.gitignore b/.gitignore index 8140ac31e..2e2f5df59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ *.DS_Store -/fml/ /logs/ /*.pyc /forge-*/ /patches-old/ /mcp/ -/eclipse/ \ No newline at end of file +/eclipse/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..5f6c2e7c9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "fml"] + path = fml + url = https://github.com/MinecraftForge/FML.git diff --git a/GnuWin32/README.txt b/GnuWin32/README.txt deleted file mode 100644 index 6485c4102..000000000 --- a/GnuWin32/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -These files are taken from the GnuWin32 page, for simplicity's sake. -Honestly, I dont understand why windows doesn't have the equivently of these programs, but whatever. -These are only used in the git repo, and not in the released version, so they are not shipped anywhere outside the git. - -http://gnuwin32.sourceforge.net/packages/wget.htm -http://gnuwin32.sourceforge.net/packages/unzip.htm \ No newline at end of file diff --git a/GnuWin32/unzip.exe b/GnuWin32/unzip.exe deleted file mode 100644 index b10387734..000000000 Binary files a/GnuWin32/unzip.exe and /dev/null differ diff --git a/GnuWin32/unzip32.dll b/GnuWin32/unzip32.dll deleted file mode 100644 index 4a7d52371..000000000 Binary files a/GnuWin32/unzip32.dll and /dev/null differ diff --git a/GnuWin32/wget.exe b/GnuWin32/wget.exe deleted file mode 100644 index 54b372e6b..000000000 Binary files a/GnuWin32/wget.exe and /dev/null differ diff --git a/build.bat b/build.bat deleted file mode 100644 index cea5edaf5..000000000 --- a/build.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -fml\python\python_fml build.py %* diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index d32735d19..982bb0d32 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -35,188 +35,10 @@ import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; public class ForgeHooksClient { - private static class TesKey implements Comparable - { - public final int texture, subid; - public TesKey(int textureID, int subID) - { - texture = textureID; - subid = subID; - } - - public int compareTo(TesKey key) - { - if (subid == key.subid) - { - return texture - key.texture; - } - return subid - key.subid; - } - - public boolean equals(Object obj) - { - return compareTo((TesKey)obj) == 0; - } - - public int hashCode() - { - return texture + 31 * subid; - } - } - - public static HashMap tessellators = new HashMap(); - public static HashMap textures = new HashMap(); - public static TreeSet renderTextures = new TreeSet(); - public static Tessellator defaultTessellator = null; - public static boolean inWorld = false; - public static HashMap renderHandlers = new HashMap(); - public static IRenderContextHandler unbindContext = null; - - protected static void registerRenderContextHandler(String texture, int subID, IRenderContextHandler handler) - { - Integer texID = textures.get(texture); - if (texID == null) - { - texID = engine().getTexture(texture); - textures.put(texture, texID); - } - renderHandlers.put(new TesKey(texID, subID), handler); - } - static RenderEngine engine() { return FMLClientHandler.instance().getClient().renderEngine; } - public static void bindTexture(String texture, int subID) - { - Integer texID = textures.get(texture); - if (texID == null) - { - texID = engine().getTexture(texture); - textures.put(texture, texID); - } - if (!inWorld) - { - if (unbindContext != null) - { - unbindContext.afterRenderContext(); - unbindContext = null; - } - if (Tessellator.instance.isDrawing) - { - int mode = Tessellator.instance.drawMode; - Tessellator.instance.draw(); - Tessellator.instance.startDrawing(mode); - } - GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID); - unbindContext = renderHandlers.get(new TesKey(texID, subID)); - if (unbindContext != null) - { - unbindContext.beforeRenderContext(); - } - return; - } - bindTessellator(texID, subID); - } - - public static void unbindTexture() - { - if (inWorld) - { - Tessellator.instance = defaultTessellator; - } - else - { - if (Tessellator.instance.isDrawing) - { - int mode = Tessellator.instance.drawMode; - Tessellator.instance.draw(); - if (unbindContext != null) - { - unbindContext.afterRenderContext(); - unbindContext = null; - } - Tessellator.instance.startDrawing(mode); - } - GL11.glBindTexture(GL11.GL_TEXTURE_2D, engine().getTexture("/terrain.png")); - return; - } - } - - protected static void bindTessellator(int texture, int subID) - { - TesKey key = new TesKey(texture, subID); - Tessellator tess = tessellators.get(key); - - if (tess == null) - { - tess = new Tessellator(); - tess.textureID = texture; - tessellators.put(key, tess); - } - - if (inWorld && !renderTextures.contains(key)) - { - renderTextures.add(key); - tess.startDrawingQuads(); - tess.setTranslation(defaultTessellator.xOffset, defaultTessellator.yOffset, defaultTessellator.zOffset); - } - - Tessellator.instance = tess; - } - - static int renderPass = -1; - public static void beforeRenderPass(int pass) - { - renderPass = pass; - defaultTessellator = Tessellator.instance; - Tessellator.renderingWorldRenderer = true; - GL11.glBindTexture(GL11.GL_TEXTURE_2D, engine().getTexture("/terrain.png")); - renderTextures.clear(); - inWorld = true; - } - - public static void afterRenderPass(int pass) - { - renderPass = -1; - inWorld = false; - for (TesKey info : renderTextures) - { - IRenderContextHandler handler = renderHandlers.get(info); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, info.texture); - Tessellator tess = tessellators.get(info); - if (handler == null) - { - tess.draw(); - } - else - { - Tessellator.instance = tess; - handler.beforeRenderContext(); - tess.draw(); - handler.afterRenderContext(); - } - } - GL11.glBindTexture(GL11.GL_TEXTURE_2D, engine().getTexture("/terrain.png")); - Tessellator.renderingWorldRenderer = false; - Tessellator.instance = defaultTessellator; - } - - public static void beforeBlockRender(Block block, RenderBlocks render) - { - if (!block.isDefaultTexture && render.overrideBlockTexture == -1) - { - bindTexture(block.getTextureFile(), 0); - } - } - - public static void afterBlockRender(Block block, RenderBlocks render) - { - if (!block.isDefaultTexture && render.overrideBlockTexture == -1) - { - unbindTexture(); - } - } public static String getArmorTexture(ItemStack armor, String _default) { @@ -247,7 +69,7 @@ public class ForgeHooksClient if (item.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[item.itemID].getRenderType()))) { - engine.bindTexture(engine.getTexture(item.getItem().getTextureFile())); + engine.func_98187_b("/terrain.png"); int renderType = Block.blocksList[item.itemID].getRenderType(); float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F); @@ -279,7 +101,7 @@ public class ForgeHooksClient } else { - engine.bindTexture(engine.getTexture(item.getItem().getTextureFile())); + engine.func_98187_b("/gui/items.png"); GL11.glScalef(0.5F, 0.5F, 0.5F); customRenderer.renderItem(ENTITY, item, renderBlocks, entity); } @@ -294,7 +116,7 @@ public class ForgeHooksClient return false; } - engine.bindTexture(engine.getTexture(Item.itemsList[item.itemID].getTextureFile())); + engine.func_98187_b("/gui/items.png"); if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK)) { GL11.glPushMatrix(); @@ -422,6 +244,7 @@ public class ForgeHooksClient } } + static int renderPass = -1; public static void setRenderPass(int pass) { renderPass = pass; diff --git a/client/net/minecraftforge/client/GuiControlsScrollPanel.java b/client/net/minecraftforge/client/GuiControlsScrollPanel.java index d5d69f8fe..17b62cf6c 100644 --- a/client/net/minecraftforge/client/GuiControlsScrollPanel.java +++ b/client/net/minecraftforge/client/GuiControlsScrollPanel.java @@ -9,6 +9,7 @@ import net.minecraft.client.gui.GuiControls; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.EnumChatFormatting; public class GuiControlsScrollPanel extends GuiSlot { @@ -90,7 +91,7 @@ public class GuiControlsScrollPanel extends GuiSlot boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height; int k = (flag ? 2 : 1); - GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/gui.png")); + mc.renderEngine.func_98187_b("/gui/gui.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height); controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height); @@ -105,8 +106,9 @@ public class GuiControlsScrollPanel extends GuiSlot break; } } - String str = (conflict ? "\247c" : "") + options.getOptionDisplayString(index); - str = (index == selected ? "\247f> \247e??? \247f<" : str); + + String str = (conflict ? EnumChatFormatting.RED : "") + options.getOptionDisplayString(index); + str = (index == selected ? EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<" : str); controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF); } diff --git a/client/net/minecraftforge/client/MinecraftForgeClient.java b/client/net/minecraftforge/client/MinecraftForgeClient.java index e1da0a0d5..31de16ea8 100644 --- a/client/net/minecraftforge/client/MinecraftForgeClient.java +++ b/client/net/minecraftforge/client/MinecraftForgeClient.java @@ -18,20 +18,6 @@ import net.minecraftforge.common.MinecraftForge; public class MinecraftForgeClient { - /** Register a new render context handler. A render context is a block - * of rendering performed with similar OpenGL modes, for example, - * texture name. - * @param texture The name of the texture for this render context. - * @param subid The subid of this render context. 0 is the default pass - * for normal rendering, higher subids render later. All subids of 0 - * will render before all subids of 1, etc. - * @param handler The handler to register. - */ - public static void registerRenderContextHandler(String texture, int subid, IRenderContextHandler handler) - { - ForgeHooksClient.registerRenderContextHandler(texture, subid, handler); - } - /** * Preload a texture. Textures must be preloaded before the first * use, or they will cause visual anomalies. @@ -41,23 +27,6 @@ public class MinecraftForgeClient ForgeHooksClient.engine().getTexture(texture); } - /** Render a block. Render a block which may have a custom texture. - */ - public static void renderBlock(RenderBlocks render, Block block, int x, int y, int z) - { - ForgeHooksClient.beforeBlockRender(block, render); - render.renderBlockByRenderType(block, x, y, z); - ForgeHooksClient.afterBlockRender(block, render); - } - - /** - * Get the current render pass. - */ - public static int getRenderPass() - { - return ForgeHooksClient.renderPass; - } - private static IItemRenderer[] customItemRenderers = new IItemRenderer[Item.itemsList.length]; /** @@ -82,4 +51,9 @@ public class MinecraftForgeClient } return null; } + + public static int getRenderPass() + { + return ForgeHooksClient.renderPass; + } } diff --git a/common/forge_at.cfg b/common/forge_at.cfg index 660c5736c..d28722018 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -1,134 +1,130 @@ #Main Forge Access Transformer configuration file -# RailLogic.getNAdjacentTracks -public als.a(Lals;)I #MD:RailLogic/func_73650_a # Tessellator -public-f baz.a #FD:Tessellator/field_78398_a #instance -public baz.u #FD:Tessellator/field_78409_u #drawMode -public baz.v #FD:Tessellator/field_78408_v #xOffset -public baz.w #FD:Tessellator/field_78407_w #yOffset -public baz.x #FD:Tessellator/field_78417_x #zOffset -public baz.z #FD:Tessellator/field_78415_z #isDrawing +public-f bfx.a #FD:Tessellator/field_78398_a #instance +public bfx.u #FD:Tessellator/field_78409_u #drawMode +public bfx.v #FD:Tessellator/field_78408_v #xOffset +public bfx.w #FD:Tessellator/field_78407_w #yOffset +public bfx.x #FD:Tessellator/field_78417_x #zOffset +public bfx.z #FD:Tessellator/field_78415_z #isDrawing # ItemPickaxe -public uy.(ILuq;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f uy.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst +public wo.(ILwf;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f wo.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst # ItemAxe -public un.(ILuq;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f un.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst +public wc.(ILwf;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f wc.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst # ItemSpade -public vj.(ILuq;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f vj.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst +public wz.(ILwf;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f wz.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst # ItemTool -public tw.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial -public tw.co #FD:ItemTool/field_77865_bY #damageVsEntity +public vl.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial +public vl.d #FD:ItemTool/field_77865_bY #damageVsEntity # EntityEnderman -public qd.d #FD:EntityEnderman/field_70827_d #carriableBlocks +public rp.d #FD:EntityEnderman/field_70827_d #carriableBlocks +# RenderEngine +public bfy.f(Ljava/lang/String;)I #MD:RenderEngine/func_78341_b #getTexture +public bfy.i #FD:RenderEngine/field_94154_l #terrainTextureMap +public bfy.j #FD:RenderEngine/field_94155_m #itemTextureMap # RenderGlobal -public bav.h #FD:RenderGlobal/field_72769_h #theWorld -public bav.i #FD:RenderGlobal/field_72770_i #renderEngine -public bav.q #FD:RenderGlobal/field_72777_q #mc -public bav.r #FD:RenderGlobal/field_72776_r #globalRenderBlocks -public bav.E #FD:RenderGlobal/field_72738_E #damagedBlocks +public bfs.h #FD:RenderGlobal/field_72769_h #theWorld +public bfs.i #FD:RenderGlobal/field_72770_i #renderEngine +public bfs.q #FD:RenderGlobal/field_72777_q #mc +public bfs.r #FD:RenderGlobal/field_72776_r #globalRenderBlocks +public bfs.E #FD:RenderGlobal/field_72738_E #damagedBlocks # SoundManager -public bev.a #FD:SoundManager/field_77381_a #sndSystem -public bev.b #FD:SoundManager/field_77379_b #soundPoolSounds -public bev.c #FD:SoundManager/field_77380_c #soundPoolStreaming -public bev.d #FD:SoundManager/field_77377_d #soundPoolMusic +public bjw.a #FD:SoundManager/field_77381_a #sndSystem +public bjw.b #FD:SoundManager/field_77379_b #soundPoolSounds +public bjw.c #FD:SoundManager/field_77380_c #soundPoolStreaming +public bjw.d #FD:SoundManager/field_77377_d #soundPoolMusic # EntityMinecart -protected py.* #FD:EntityMinecart/* # All private -> protected -public py.h()Z #MD:EntityMinecart/func_70490_h #isMinecartPowered +protected rc.* #FD:EntityMinecart/* # All private -> protected +# -- MISSING MAPPING public py.h()Z #MD:EntityMinecart/func_70490_h #isMinecartPowered # Block -public amq.(ILagi;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor -public amq.(IILagi;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor -public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify -public amq.a(Lamu;)Lamq; #MD:Block/func_71884_a #setStepSound -public amq.b(F)Lamq; #MD:Block/func_71894_b #setResistance -public amq.c(F)Lamq; #MD:Block/func_71848_c #setHardness -public amq.h(I)Lamq; #MD:Block/func_71868_h #setLightOpacity -public amq.a(F)Lamq; #MD:Block/func_71900_a #setLightValue -public amq.s()Lamq; #MD:Block/func_71875_q #setBlockUnbreakable -public amq.b(Z)Lamq; #MD:Block/func_71907_b #setTickRandomly -public amq.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds +public aou.(ILahz;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor +public aou.(IILahz;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor +# -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify +public aou.a(Laoy;)Laou; #MD:Block/func_71884_a #setStepSound +public aou.b(F)Laou; #MD:Block/func_71894_b #setResistance +public aou.c(F)Laou; #MD:Block/func_71848_c #setHardness +public aou.k(I)Laou; #MD:Block/func_71868_h #setLightOpacity +public aou.a(F)Laou; #MD:Block/func_71900_a #setLightValue +public aou.r()Laou; #MD:Block/func_71875_q #setBlockUnbreakable +public aou.b(Z)Laou; #MD:Block/func_71907_b #setTickRandomly +public aou.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds # NetServerHandler -public iv.g #FD:NetServerHandler/field_72572_g #playerInAirTime +public jh.f #FD:NetServerHandler/field_72572_g #playerInAirTime # TileEntity -public any.k #FD:TileEntity/field_70331_k #worldObj +public aqj.k #FD:TileEntity/field_70331_k #worldObj # BlockLeavesBase -public amy.c #FD:BlockLeavesBase/field_72131_c #graphicsLevel +public apc.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel # Item -public up.(I)V #MD:Item/(I) #Constructor -public up.e(I)Lup; #MD:Item/func_77656_e #setMaxDamage -public-f up.h(Lur;)I #MD:Item/func_77650_f #getIconIndex +public we.(I)V #MD:Item/(I) #Constructor +public we.e(I)Lwe; #MD:Item/func_77656_e #setMaxDamage +public-f we.h(Lwg;)Llx; #MD:Item/func_77650_f #getIconIndex # RailLogic -public als #CL:RailLogic -public als.a(Lals;)I #MD:RailLogic/func_73650_a #getNAdjacentTiles +public akw #CL:BlockBaseRailLogic +public akw.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles # EntityPlayer -public qx.a(Lpx;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld -public qx.i()V #MD:EntityPlayer/func_71053_j #closeScreen +public sk.a(Lrb;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld +public sk.h()V #MD:EntityPlayer/func_71053_j #closeScreen # EntityPlayerMP -public ays.a(Lpx;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld +public bdp.a(Lrb;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld # World Gen Chests Related -public kw.* #FD:WeightedRandomChestContent/* #all -public in.S #FD:WorldServer/field_73069_S #bonusChestContent -public acp.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents -public adt.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple -public adu.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents -public adu.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents -public aee.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents -public aei.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents -public aen.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents -public afo.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents +public lp.* #FD:WeightedRandomChestContent/* #all +public iz.S #FD:WorldServer/field_73069_S #bonusChestContent +public aeg.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents +public afk.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple +public afl.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents +public afl.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents +public afv.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents +public afz.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents +public age.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents +public ahf.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents # AnvilChunkLoader.chunkSaveLocation -public aam.d #FD:AnvilChunkLoader/field_75825_d +public acd.d #FD:AnvilChunkLoader/field_75825_d # ChunkProviderServer.currentChunkLoader -public im.e #FD:ChunkProviderServer/field_73247_e +public iy.e #FD:ChunkProviderServer/field_73247_e # PlayerManager -public ik.a(IIZ)Lil; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher +public iw.a(IIZ)Lix; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher # PlayerInstance -public il #CL:PlayerInstance +public ix #CL:PlayerInstance # World -public-f yc.B #FD:World/field_72982_D #villageCollectionObj -public yc.G #FD:World/field_72993_I #activeChunkSet +public-f zv.A #FD:World/field_72982_D #villageCollectionObj +public zv.G #FD:World/field_72993_I #activeChunkSet # EntityLiving -public md.bd #FD:EntityLiving/field_70728_aV #experienceValue +public ng.be #FD:EntityLiving/field_70728_aV #experienceValue # GuiFlatPresets -public aug.a(Ljava/lang/String;ILyy;Ljava/util/List;[Lacl;)V #MD:GuiFlatPresets/func_82294_a -public aug.a(Ljava/lang/String;ILyy;[Lacl;)V #MD:GuiFlatPresets/func_82297_a +public axg.a(Ljava/lang/String;ILaap;Ljava/util/List;[Laec;)V #MD:GuiFlatPresets/func_82294_a +public axg.a(Ljava/lang/String;ILaap;[Laec;)V #MD:GuiFlatPresets/func_82297_a # BiomeGenBase -public yy.*() #MD:BiomeGenBase/* #Everything protected->public +public aap.*() #MD:BiomeGenBase/* #Everything protected->public # MapGenVillage -public-f afc.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes +public-f agt.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes # ShapedRecipes -public+f wq.d #FD:ShapedRecipes/field_77574_d #recipeItems -public+f wq.b #FD:ShapedRecipes/field_77576_b #recipeWidth -public+f wq.c #FD:ShapedRecipes/field_77577_c #recipeHeight +public+f yh.d #FD:ShapedRecipes/field_77574_d #recipeItems +public+f yh.b #FD:ShapedRecipes/field_77576_b #recipeWidth +public+f yh.c #FD:ShapedRecipes/field_77577_c #recipeHeight # ShapelessRecipes -public wr.b #FD:ShapelessRecipes/field_77579_b #recipeItems +public yi.b #FD:ShapelessRecipes/field_77579_b #recipeItems # GuiContainer -protected avf.a(Lsr;)V #MD:GuiContainer/func_74192_a #drawSlotInventory +protected ayf.a(Luf;)V #MD:GuiContainer/func_74192_a #drawSlotInventory # BlockButton -protected ajf.o(Lyc;III)V #MD:BlockButton/func_82535_o #checkActivation -protected-f ajf.a #FD:BlockButton/field_82537_a #sensible +protected alc.n(Lzv;III)V #MD:BlockButton/func_82535_o #checkActivation +protected-f alc.a #FD:BlockButton/field_82537_a #sensible # BiomeDecorator -public zc.* #FD:BiomeDecorator/* # All private -> protected +public aat.* #FD:BiomeDecorator/* # All private -> protected # CreativeTabs -public-f tj.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final +public-f uy.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final # Packet -public ef.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping +public ei.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping # SaveHandler -public ahv.b()Ljava/io/File; #MD:SaveHandler/func_75765_b +public ajn.b()Ljava/io/File; #MD:SaveHandler/func_75765_b # World stuff -public yc.b(Llq;)V #MD:World/func_72847_b #releaseEntitySkin -public yc.m #FD:World/field_73003_n #prevRainingStrength -public yc.n #FD:World/field_73004_o #rainingStrength -public yc.p #FD:World/field_73017_q #thunderingStrength -public yc.o #FD:World/field_73018_p #prevThunderingStrength +public zv.b(Lmp;)V #MD:World/func_72847_b #releaseEntitySkin +public zv.m #FD:World/field_73003_n #prevRainingStrength +public zv.n #FD:World/field_73004_o #rainingStrength +public zv.p #FD:World/field_73017_q #thunderingStrength +public zv.o #FD:World/field_73018_p #prevThunderingStrength #WorldClient -public ayp.b(Llq;)V #MD:WorldClient/func_72847_b #releaseEntitySkin +public bdm.b(Lmp;)V #MD:WorldClient/func_72847_b #releaseEntitySkin #WorldServer -public in.b(Llq;)V #MD:WorldServer/func_72847_b #releaseEntitySkin -public in.N #FD:WorldServer/field_73068_P #allPlayersSleeping -# ChunkCache -public ys.e # FD:ChunkCache/field_72815_e # worldObj -# InventoryLargeChest -public kz.c #FD:InventoryLargeChest/field_70478_c #lowerChest -public kz.b #FD:InventoryLargeChest/field_70477_b #upperChest \ No newline at end of file +public iz.b(Lmp;)V #MD:WorldServer/func_72847_b #releaseEntitySkin diff --git a/common/net/minecraftforge/common/ConfigCategory.java b/common/net/minecraftforge/common/ConfigCategory.java index 38d1af99a..5af16b2a9 100644 --- a/common/net/minecraftforge/common/ConfigCategory.java +++ b/common/net/minecraftforge/common/ConfigCategory.java @@ -1,5 +1,8 @@ package net.minecraftforge.common; +import static net.minecraftforge.common.Configuration.NEW_LINE; +import static net.minecraftforge.common.Configuration.allowedProperties; + import java.io.BufferedWriter; import java.io.IOException; import java.util.ArrayList; @@ -7,11 +10,10 @@ import java.util.Collection; import java.util.Map; import java.util.Set; import java.util.TreeMap; - +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import com.google.common.base.Splitter; -import static net.minecraftforge.common.Configuration.*; - public class ConfigCategory implements Map { private String name; @@ -19,6 +21,7 @@ public class ConfigCategory implements Map private ArrayList children = new ArrayList(); private Map properties = new TreeMap(); public final ConfigCategory parent; + private boolean changed = false; public ConfigCategory(String name) { @@ -68,7 +71,7 @@ public class ConfigCategory implements Map public Map getValues() { - return properties; + return ImmutableMap.copyOf(properties); } public void setComment(String comment) @@ -86,39 +89,48 @@ public class ConfigCategory implements Map return properties.get(key); } - public void set(String key, Property value) + private void write(BufferedWriter out, String... data) throws IOException { - properties.put(key, value); + write(out, true, data); + } + + private void write(BufferedWriter out, boolean new_line, String... data) throws IOException + { + for (int x = 0; x < data.length; x++) + { + out.write(data[x]); + } + if (new_line) out.write(NEW_LINE); } public void write(BufferedWriter out, int indent) throws IOException { - String pad = getIndent(indent); + String pad0 = getIndent(indent); + String pad1 = getIndent(indent + 1); + String pad2 = getIndent(indent + 2); - out.write(pad + "####################" + NEW_LINE); - out.write(pad + "# " + name + NEW_LINE); + write(out, pad0, "####################"); + write(out, pad0, "# ", name); if (comment != null) { - out.write(pad + "#===================" + NEW_LINE); + write(out, pad0, "#==================="); Splitter splitter = Splitter.onPattern("\r?\n"); for (String line : splitter.split(comment)) { - out.write(pad + "# " + line + NEW_LINE); + write(out, pad0, "# ", line); } } - out.write(pad + "####################" + NEW_LINE + NEW_LINE); + write(out, pad0, "####################", NEW_LINE); if (!allowedProperties.matchesAllOf(name)) { name = '"' + name + '"'; } - out.write(pad + name + " {" + NEW_LINE); - - pad = getIndent(indent + 1); + write(out, pad0, name, " {"); Property[] props = properties.values().toArray(new Property[properties.size()]); @@ -136,7 +148,7 @@ public class ConfigCategory implements Map Splitter splitter = Splitter.onPattern("\r?\n"); for (String commentLine : splitter.split(prop.comment)) { - out.write(pad + "# " + commentLine + NEW_LINE); + write(out, pad1, "# ", commentLine); } } @@ -149,23 +161,25 @@ public class ConfigCategory implements Map if (prop.isList()) { - out.write(String.format(pad + "%s:%s <" + NEW_LINE, prop.getType().getID(), propName)); - pad = getIndent(indent + 2); + char type = prop.getType().getID(); + + write(out, pad1, String.valueOf(type), ":", propName, " <"); - for (String line : prop.valueList) + for (String line : prop.getStringList()) { - out.write(pad + line + NEW_LINE); + write(out, pad2, line); } - out.write(getIndent(indent + 1) + " >" + NEW_LINE); + write(out, pad1, " >"); } else if (prop.getType() == null) { - out.write(String.format(pad + "%s=%s" + NEW_LINE, propName, prop.value)); + write(out, pad1, propName, "=", prop.getString()); } else { - out.write(String.format(pad + "%s:%s=%s" + NEW_LINE, prop.getType().getID(), propName, prop.value)); + char type = prop.getType().getID(); + write(out, pad1, String.valueOf(type), ":", propName, "=", prop.getString()); } } @@ -174,7 +188,7 @@ public class ConfigCategory implements Map child.write(out, indent + 1); } - out.write(getIndent(indent) + "}" + NEW_LINE + NEW_LINE); + write(out, pad0, "}", NEW_LINE); } private String getIndent(int indent) @@ -187,6 +201,25 @@ public class ConfigCategory implements Map return buf.toString(); } + public boolean hasChanged() + { + if (changed) return true; + for (Property prop : properties.values()) + { + if (prop.hasChanged()) return true; + } + return false; + } + + void resetChangedState() + { + changed = false; + for (Property prop : properties.values()) + { + prop.resetChangedState(); + } + } + //Map bouncer functions for compatibility with older mods, to be removed once all mods stop using it. @Override public int size(){ return properties.size(); } @@ -194,12 +227,33 @@ public class ConfigCategory implements Map @Override public boolean containsKey(Object key) { return properties.containsKey(key); } @Override public boolean containsValue(Object value){ return properties.containsValue(value); } @Override public Property get(Object key) { return properties.get(key); } - @Override public Property put(String key, Property value) { return properties.put(key, value); } - @Override public Property remove(Object key) { return properties.remove(key); } - @Override public void putAll(Map m) { properties.putAll(m); } - @Override public void clear() { properties.clear(); } + @Override public Property put(String key, Property value) + { + changed = true; + return properties.put(key, value); + } + @Override public Property remove(Object key) + { + changed = true; + return properties.remove(key); + } + @Override public void putAll(Map m) + { + changed = true; + properties.putAll(m); + } + @Override public void clear() + { + changed = true; + properties.clear(); + } @Override public Set keySet() { return properties.keySet(); } @Override public Collection values() { return properties.values(); } - @Override public Set> entrySet() { return properties.entrySet(); } + + @Override //Immutable copy, changes will NOT be reflected in this category + public Set> entrySet() + { + return ImmutableSet.copyOf(properties.entrySet()); + } } \ No newline at end of file diff --git a/common/net/minecraftforge/common/Configuration.java b/common/net/minecraftforge/common/Configuration.java index b3911a8ca..fc6237cf6 100644 --- a/common/net/minecraftforge/common/Configuration.java +++ b/common/net/minecraftforge/common/Configuration.java @@ -5,31 +5,41 @@ package net.minecraftforge.common; -import java.io.*; -import java.text.DateFormat; +import static net.minecraftforge.common.Property.Type.BOOLEAN; +import static net.minecraftforge.common.Property.Type.DOUBLE; +import static net.minecraftforge.common.Property.Type.INTEGER; +import static net.minecraftforge.common.Property.Type.STRING; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PushbackInputStream; +import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; -import java.util.Date; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.google.common.base.CharMatcher; -import com.google.common.base.Splitter; -import com.google.common.collect.Maps; +import net.minecraft.block.Block; +import net.minecraft.item.Item; + +import com.google.common.base.CharMatcher; +import com.google.common.collect.ImmutableSet; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.FMLInjectionData; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import static net.minecraftforge.common.Property.Type.*; - /** * This class offers advanced configurations capabilities, allowing to provide * various categories for configuration variables. @@ -54,13 +64,14 @@ public class Configuration File file; - public Map categories = new TreeMap(); + private Map categories = new TreeMap(); private Map children = new TreeMap(); private boolean caseSensitiveCustomCategories; public String defaultEncoding = DEFAULT_ENCODING; private String fileName = null; public boolean isChild = false; + private boolean changed = false; static { @@ -148,7 +159,7 @@ public class Configuration if (Block.blocksList[defaultID] == null && !configMarkers[defaultID]) { - prop.value = Integer.toString(defaultID); + prop.set(defaultID); configMarkers[defaultID] = true; return prop; } @@ -158,7 +169,7 @@ public class Configuration { if (Block.blocksList[j] == null && !configMarkers[j]) { - prop.value = Integer.toString(j); + prop.set(j); configMarkers[j] = true; return prop; } @@ -196,7 +207,7 @@ public class Configuration if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length) { - prop.value = Integer.toString(defaultID); + prop.set(defaultID); configMarkers[defaultShift] = true; return prop; } @@ -206,7 +217,7 @@ public class Configuration { if (Item.itemsList[x] == null && !configMarkers[x]) { - prop.value = Integer.toString(x - ITEM_SHIFT); + prop.set(x - ITEM_SHIFT); configMarkers[x] = true; return prop; } @@ -227,7 +238,7 @@ public class Configuration Property prop = get(category, key, Integer.toString(defaultValue), comment, INTEGER); if (!prop.isIntValue()) { - prop.value = Integer.toString(defaultValue); + prop.set(defaultValue); } return prop; } @@ -242,7 +253,7 @@ public class Configuration Property prop = get(category, key, Boolean.toString(defaultValue), comment, BOOLEAN); if (!prop.isBooleanValue()) { - prop.value = Boolean.toString(defaultValue); + prop.set(defaultValue); } return prop; } @@ -257,7 +268,7 @@ public class Configuration Property prop = get(category, key, Double.toString(defaultValue), comment, DOUBLE); if (!prop.isDoubleValue()) { - prop.value = Double.toString(defaultValue); + prop.set(defaultValue); } return prop; } @@ -298,7 +309,7 @@ public class Configuration Property prop = get(category, key, values, comment, INTEGER); if (!prop.isIntList()) { - prop.valueList = values; + prop.set(values); } return prop; @@ -321,7 +332,7 @@ public class Configuration if (!prop.isDoubleList()) { - prop.valueList = values; + prop.set(values); } return prop; @@ -344,7 +355,7 @@ public class Configuration if (!prop.isBooleanList()) { - prop.valueList = values; + prop.set(values); } return prop; @@ -365,8 +376,8 @@ public class Configuration if (prop.getType() == null) { - prop = new Property(prop.getName(), prop.value, type); - cat.set(key, prop); + prop = new Property(prop.getName(), prop.getString(), type); + cat.put(key, prop); } prop.comment = comment; @@ -375,7 +386,8 @@ public class Configuration else if (defaultValue != null) { Property prop = new Property(key, defaultValue, type); - cat.set(key, prop); + prop.set(defaultValue); //Set and mark as dirty to signify it should save + cat.put(key, prop); prop.comment = comment; return prop; } @@ -400,8 +412,8 @@ public class Configuration if (prop.getType() == null) { - prop = new Property(prop.getName(), prop.value, type); - cat.set(key, prop); + prop = new Property(prop.getName(), prop.getString(), type); + cat.put(key, prop); } prop.comment = comment; @@ -412,7 +424,7 @@ public class Configuration { Property prop = new Property(key, defaultValue, type); prop.comment = comment; - cat.set(key, prop); + cat.put(key, prop); return prop; } else @@ -569,7 +581,7 @@ public class Configuration Property prop = new Property(name, line.substring(i + 1), type, true); i = line.length(); - currentCat.set(name, prop); + currentCat.put(name, prop); break; @@ -603,7 +615,7 @@ public class Configuration throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum)); } - currentCat.set(name, new Property(name, tmpList.toArray(new String[tmpList.size()]), type)); + currentCat.put(name, new Property(name, tmpList.toArray(new String[tmpList.size()]), type)); name = null; tmpList = null; type = null; @@ -647,6 +659,8 @@ public class Configuration } catch (IOException e){} } } + + resetChangedState(); } public void save() @@ -701,29 +715,7 @@ public class Configuration } private void save(BufferedWriter out) throws IOException - { - //For compatiblitties sake just in case, Thanks Atomic, to be removed next MC version - //TO-DO: Remove next MC version - Object[] categoryArray = categories.values().toArray(); - for (Object o : categoryArray) - { - if (o instanceof TreeMap) - { - TreeMap treeMap = (TreeMap)o; - ConfigCategory converted = new ConfigCategory(file.getName()); - FMLLog.warning("Forge found a Treemap saved for Configuration file " + file.getName() + ", this is deprecated behaviour!"); - - for (Object key : treeMap.keySet()) - { - FMLLog.warning("Converting Treemap to ConfigCategory, key: " + key + ", property value: " + ((Property)treeMap.get(key)).value); - converted.set((String)key, (Property)treeMap.get(key)); - } - - categories.values().remove(o); - categories.put(file.getName(), converted); - } - } - + { for (ConfigCategory cat : categories.values()) { if (!cat.isChild()) @@ -749,6 +741,7 @@ public class Configuration { parent = new ConfigCategory(hierarchy[0]); categories.put(parent.getQualifiedName(), parent); + changed = true; } for (int i = 1; i < hierarchy.length; i++) @@ -760,6 +753,7 @@ public class Configuration { child = new ConfigCategory(hierarchy[i], parent); categories.put(name, child); + changed = true; } ret = child; @@ -770,6 +764,7 @@ public class Configuration { ret = new ConfigCategory(category); categories.put(category, ret); + changed = true; } } @@ -788,12 +783,14 @@ public class Configuration if (!children.containsKey(name)) { children.put(name, child); + changed = true; } else { Configuration old = children.get(name); child.categories = old.categories; child.fileName = old.fileName; + old.changed = true; } } @@ -873,4 +870,40 @@ public class Configuration input.close(); } } + + public boolean hasChanged() + { + if (changed) return true; + + for (ConfigCategory cat : categories.values()) + { + if (cat.hasChanged()) return true; + } + + for (Configuration child : children.values()) + { + if (child.hasChanged()) return true; + } + + return false; + } + + private void resetChangedState() + { + changed = false; + for (ConfigCategory cat : categories.values()) + { + cat.resetChangedState(); + } + + for (Configuration child : children.values()) + { + child.resetChangedState(); + } + } + + public Set getCategoryNames() + { + return ImmutableSet.copyOf(categories.keySet()); + } } diff --git a/common/net/minecraftforge/common/DimensionManager.java b/common/net/minecraftforge/common/DimensionManager.java index 14e4f062c..2db3643c7 100644 --- a/common/net/minecraftforge/common/DimensionManager.java +++ b/common/net/minecraftforge/common/DimensionManager.java @@ -239,7 +239,7 @@ public class DimensionManager ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); - WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler)); + WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler, overworld.func_98180_V())); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) diff --git a/common/net/minecraftforge/common/FakePlayer.java b/common/net/minecraftforge/common/FakePlayer.java new file mode 100644 index 000000000..2c118f9f8 --- /dev/null +++ b/common/net/minecraftforge/common/FakePlayer.java @@ -0,0 +1,22 @@ +package net.minecraftforge.common; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +//Preliminary, simple Fake Player class +public class FakePlayer extends EntityPlayer +{ + public FakePlayer(World world, String name) + { + super(world); + this.username = name; + } + + public void sendChatToPlayer(String s){} + public boolean canCommandSenderUseCommand(int i, String s){ return false; } + public ChunkCoordinates getPlayerCoordinates() + { + return new ChunkCoordinates(0,0,0); + } +} diff --git a/common/net/minecraftforge/common/FakePlayerFactory.java b/common/net/minecraftforge/common/FakePlayerFactory.java new file mode 100644 index 000000000..80b334c25 --- /dev/null +++ b/common/net/minecraftforge/common/FakePlayerFactory.java @@ -0,0 +1,18 @@ +package net.minecraftforge.common; + +import net.minecraft.world.World; + +//To be expanded for generic Mod fake players? +public class FakePlayerFactory +{ + private static FakePlayer MINECRAFT_PLAYER = null; + + public static FakePlayer getMinecraft(World world) + { + if (MINECRAFT_PLAYER == null) + { + MINECRAFT_PLAYER = new FakePlayer(world, "[Minecraft]"); + } + return MINECRAFT_PLAYER; + } +} diff --git a/common/net/minecraftforge/common/ForgeChunkManager.java b/common/net/minecraftforge/common/ForgeChunkManager.java index ae45c5a73..b12ba052d 100644 --- a/common/net/minecraftforge/common/ForgeChunkManager.java +++ b/common/net/minecraftforge/common/ForgeChunkManager.java @@ -775,7 +775,7 @@ public class ForgeChunkManager static void loadConfiguration() { - for (String mod : config.categories.keySet()) + for (String mod : config.getCategoryNames()) { if (mod.equals("Forge") || mod.equals("defaults")) { @@ -786,7 +786,10 @@ public class ForgeChunkManager ticketConstraints.put(mod, modTC.getInt(200)); chunkConstraints.put(mod, modCPT.getInt(25)); } - config.save(); + if (config.hasChanged()) + { + config.save(); + } } /** @@ -953,7 +956,7 @@ public class ForgeChunkManager sampleTC.comment = "Maximum ticket count for the mod. Zero disables chunkloading capabilities."; sampleTC = config.get("Forge", "maximumChunksPerTicket", 25); sampleTC.comment = "Maximum chunks per ticket for the mod."; - for (String mod : config.categories.keySet()) + for (String mod : config.getCategoryNames()) { if (mod.equals("Forge") || mod.equals("defaults")) { @@ -965,12 +968,12 @@ public class ForgeChunkManager } - public static Map getConfigMapFor(Object mod) + public static ConfigCategory getConfigFor(Object mod) { ModContainer container = getContainer(mod); if (container != null) { - return config.getCategory(container.getModId()).getValues(); + return config.getCategory(container.getModId()); } return null; @@ -981,8 +984,8 @@ public class ForgeChunkManager ModContainer container = getContainer(mod); if (container != null) { - Map props = config.getCategory(container.getModId()).getValues(); - props.put(propertyName, new Property(propertyName, value, type)); + ConfigCategory cat = config.getCategory(container.getModId()); + cat.put(propertyName, new Property(propertyName, value, type)); } } } diff --git a/common/net/minecraftforge/common/ForgeDummyContainer.java b/common/net/minecraftforge/common/ForgeDummyContainer.java index 8a3dffe0e..73f6b4914 100644 --- a/common/net/minecraftforge/common/ForgeDummyContainer.java +++ b/common/net/minecraftforge/common/ForgeDummyContainer.java @@ -26,6 +26,7 @@ import static net.minecraftforge.common.ForgeVersion.*; public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer { public static int clumpingThreshold = 64; + public static boolean legacyFurnaceSides = false; public ForgeDummyContainer() { @@ -44,7 +45,22 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces meta.screenshots = new String[0]; meta.logoFile = "/forge_logo.png"; - Configuration config = new Configuration(new File(Loader.instance().getConfigDir(), "forge.cfg")); + Configuration config = null; + File cfgFile = new File(Loader.instance().getConfigDir(), "forge.cfg"); + try + { + config = new Configuration(cfgFile); + } + catch (Exception e) + { + System.out.println("Error loading forge.cfg, deleting file and resetting: "); + e.printStackTrace(); + + if (cfgFile.exists()) + cfgFile.delete(); + + config = new Configuration(cfgFile); + } if (!config.isChild) { config.load(); @@ -60,9 +76,17 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces if (clumpingThreshold > 1024 || clumpingThreshold < 64) { clumpingThreshold = 64; - clumpingThresholdProperty.value = "64"; + clumpingThresholdProperty.set(64); + } + + Property furnaceOutput = config.get(Configuration.CATEGORY_GENERAL, "legacyFurnceOutput", false); + furnaceOutput.comment = "Controls the sides of vanilla furnaces for Forge's ISidedInventroy, Vanilla defines the output as the bottom, but mods/Forge define it as the sides. Settings this to true will restore the old side relations."; + legacyFurnaceSides = furnaceOutput.getBoolean(false); + + if (config.hasChanged()) + { + config.save(); } - config.save(); } @Override diff --git a/common/net/minecraftforge/common/ForgeHooks.java b/common/net/minecraftforge/common/ForgeHooks.java index dbbbdc147..524fc3732 100644 --- a/common/net/minecraftforge/common/ForgeHooks.java +++ b/common/net/minecraftforge/common/ForgeHooks.java @@ -63,7 +63,7 @@ public class ForgeHooks { return; } - world.setBlockAndMetadataWithNotify(x, y, z, grass.block.blockID, grass.metadata); + world.setBlockAndMetadataWithNotify(x, y, z, grass.block.blockID, grass.metadata, 3); } public static ItemStack getGrassSeed(World world) @@ -147,7 +147,7 @@ public class ForgeHooks } else { - return player.getCurrentPlayerStrVsBlock(block, metadata) / hardness / 30F; + return player.getCurrentPlayerStrVsBlock(block, false, metadata) / hardness / 30F; } } @@ -215,22 +215,6 @@ public class ForgeHooks MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing, "pickaxe"); } - public static String getTexture(String _default, Object obj) - { - if (obj instanceof Item) - { - return ((Item)obj).getTextureFile(); - } - else if (obj instanceof Block) - { - return ((Block)obj).getTextureFile(); - } - else - { - return _default; - } - } - public static int getTotalArmorValue(EntityPlayer player) { int ret = 0; diff --git a/common/net/minecraftforge/common/ForgeInternalHandler.java b/common/net/minecraftforge/common/ForgeInternalHandler.java index 91fb5d777..0a46ff07e 100644 --- a/common/net/minecraftforge/common/ForgeInternalHandler.java +++ b/common/net/minecraftforge/common/ForgeInternalHandler.java @@ -19,14 +19,7 @@ public class ForgeInternalHandler { if (!event.world.isRemote) { - if (event.entity.getPersistentID() == null) - { - event.entity.generatePersistentID(); - } - else - { - ForgeChunkManager.loadEntity(event.entity); - } + ForgeChunkManager.loadEntity(event.entity); } Entity entity = event.entity; diff --git a/common/net/minecraftforge/common/ForgeVersion.java b/common/net/minecraftforge/common/ForgeVersion.java index d8d391c16..6f1c0ac99 100644 --- a/common/net/minecraftforge/common/ForgeVersion.java +++ b/common/net/minecraftforge/common/ForgeVersion.java @@ -8,11 +8,11 @@ package net.minecraftforge.common; public class ForgeVersion { //This number is incremented every time we remove deprecated code/major API changes, never reset - public static final int majorVersion = 6; + public static final int majorVersion = 7; //This number is incremented every minecraft release, never reset - public static final int minorVersion = 6; + public static final int minorVersion = 7; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version - public static final int revisionVersion = 2; + public static final int revisionVersion = 0; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0; diff --git a/common/net/minecraftforge/common/ISidedInventory.java b/common/net/minecraftforge/common/ISidedInventory.java index 54bef29a6..028b09c2a 100644 --- a/common/net/minecraftforge/common/ISidedInventory.java +++ b/common/net/minecraftforge/common/ISidedInventory.java @@ -10,6 +10,7 @@ import net.minecraft.inventory.IInventory; /** Inventory ranges mapped by side. This class is implemented by TileEntities * that provide different inventory slot ranges to different sides. */ +@Deprecated //A equivalent Interface is now in Minecraft Vanilla will be removed next major MC version public interface ISidedInventory extends IInventory { @@ -17,12 +18,14 @@ public interface ISidedInventory extends IInventory * Get the start of the side inventory. * @param side The global side to get the start of range. */ + @Deprecated int getStartInventorySide(ForgeDirection side); /** * Get the size of the side inventory. * @param side The global side. */ + @Deprecated int getSizeInventorySide(ForgeDirection side); } diff --git a/common/net/minecraftforge/common/MinecartRegistry.java b/common/net/minecraftforge/common/MinecartRegistry.java deleted file mode 100644 index 43cfd23d6..000000000 --- a/common/net/minecraftforge/common/MinecartRegistry.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.minecraftforge.common; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class MinecartRegistry -{ - private static Map itemForMinecart = new HashMap(); - private static Map minecartForItem = new HashMap(); - /** - * Registers a custom minecart and its corresponding item. - * This should be the item used to place the minecart by the user, - * not the item dropped by the cart. - * @param cart The minecart. - * @param item The item used to place the cart. - */ - public static void registerMinecart(Class cart, ItemStack item) - { - registerMinecart(cart, 0, item); - } - - /** - * Registers a minecart and its corresponding item. - * This should be the item used to place the minecart by the user, - * not the item dropped by the cart. - * @param minecart The minecart. - * @param type The minecart type, used to differentiate carts that have the same class. - * @param item The item used to place the cart. - */ - public static void registerMinecart(Class minecart, int type, ItemStack item) - { - MinecartKey key = new MinecartKey(minecart, type); - itemForMinecart.put(key, item); - minecartForItem.put(item, key); - } - - /** - * Removes a previously registered Minecart. Useful for replacing the vanilla minecarts. - * @param minecart - * @param type - */ - public static void removeMinecart(Class minecart, int type) - { - MinecartKey key = new MinecartKey(minecart, type); - ItemStack item = itemForMinecart.remove(key); - if (item != null) - { - minecartForItem.remove(item); - } - } - - /** - * This function returns an ItemStack that represents this cart. - * The player should be able to use this item to place the minecart. - * This is the item that was registered with the cart via the registerMinecart function, - * but is not necessary the item the cart drops when destroyed. - * @param minecart The cart class - * @return An ItemStack that can be used to place the cart. - */ - public static ItemStack getItemForCart(Class minecart) - { - return getItemForCart(minecart, 0); - } - - /** - * This function returns an ItemStack that represents this cart. - * The player should be able to use this item to place the minecart. - * This is the item that was registered with the cart via the registerMinecart function, - * but is not necessary the item the cart drops when destroyed. - * @param minecart The cart class - * @param type The minecartType value - * @return An ItemStack that can be used to place the cart. - */ - public static ItemStack getItemForCart(Class minecart, int type) - { - ItemStack item = itemForMinecart.get(new MinecartKey(minecart, type)); - if (item == null) - { - return null; - } - return item.copy(); - } - - /** - * This function returns an ItemStack that represents this cart. - * The player should be able to use this item to place the minecart. - * This is the item that was registered with the cart via the registerMinecart function, - * but is not necessary the item the cart drops when destroyed. - * @param cart The cart entity - * @return An ItemStack that can be used to place the cart. - */ - public static ItemStack getItemForCart(EntityMinecart cart) - { - return getItemForCart(cart.getClass(), cart.getMinecartType()); - } - - /** - * The function will return the cart class for a given item. - * If the item was not registered via the registerMinecart function it will return null. - * @param item The item to test. - * @return Cart if mapping exists, null if not. - */ - public static Class getCartClassForItem(ItemStack item) - { - MinecartKey key = null; - for (Map.Entry entry : minecartForItem.entrySet()) - { - if (entry.getKey().isItemEqual(item)) - { - key = entry.getValue(); - break; - } - } - if (key != null) - { - return key.minecart; - } - return null; - } - - /** - * The function will return the cart type for a given item. - * Will return -1 if the mapping doesn't exist. - * If the item was not registered via the registerMinecart function it will return null. - * @param item The item to test. - * @return the cart minecartType value. - */ - public static int getCartTypeForItem(ItemStack item) - { - MinecartKey key = null; - for (Map.Entry entry : minecartForItem.entrySet()) - { - if (entry.getKey().isItemEqual(item)) - { - key = entry.getValue(); - break; - } - } - if (key != null) - { - return key.type; - } - return -1; - } - - /** - * Will return a set of all registered minecart items. - * @return a copy of the set of all minecart items - */ - public static Set getAllCartItems() - { - Set ret = new HashSet(); - for (ItemStack item : minecartForItem.keySet()) - { - ret.add(item.copy()); - } - return ret; - } - - static - { - registerMinecart(EntityMinecart.class, 0, new ItemStack(Item.minecartEmpty)); - registerMinecart(EntityMinecart.class, 1, new ItemStack(Item.minecartCrate)); - registerMinecart(EntityMinecart.class, 2, new ItemStack(Item.minecartPowered)); - } - - public static class MinecartKey - { - public final Class minecart; - public final int type; - - public MinecartKey(Class cls, int typtID) - { - minecart = cls; - type = typtID; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - - if (getClass() != obj.getClass()) - { - return false; - } - - final MinecartKey other = (MinecartKey)obj; - if (this.minecart != other.minecart && (this.minecart == null || !this.minecart.equals(other.minecart))) - { - return false; - } - - return (this.type == other.type); - } - - @Override - public int hashCode() - { - int hash = 7; - hash = 59 * hash + (this.minecart != null ? this.minecart.hashCode() : 0); - hash = 59 * hash + this.type; - return hash; - } - } -} diff --git a/common/net/minecraftforge/common/MinecraftForge.java b/common/net/minecraftforge/common/MinecraftForge.java index 48a6d22fa..b07c957d4 100644 --- a/common/net/minecraftforge/common/MinecraftForge.java +++ b/common/net/minecraftforge/common/MinecraftForge.java @@ -7,9 +7,13 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.ModContainer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.crash.CrashReport; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -33,8 +37,6 @@ public class MinecraftForge public static final EventBus EVENT_BUS = new EventBus(); public static final EventBus TERRAIN_GEN_BUS = new EventBus(); public static final EventBus ORE_GEN_BUS = new EventBus(); - @Deprecated //Vanilla feature now - public static boolean SPAWNER_ALLOW_ON_INVERTED = false; private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler(); @@ -183,10 +185,14 @@ public class MinecraftForge System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion()); FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion()); - Block filler = new Block(0, Material.air); + Block filler = new Block(0, Material.air) + { + @SideOnly(Side.CLIENT) public void func_94332_a(IconRegister register){} + }; Block.blocksList[0] = null; Block.opaqueCubeLookup[0] = false; Block.lightOpacity[0] = 0; + filler.setUnlocalizedName("ForgeFiller"); for (int x = 256; x < 4096; x++) { @@ -202,6 +208,9 @@ public class MinecraftForge EVENT_BUS.register(INTERNAL_HANDLER); OreDictionary.getOreName(0); + + //Force these classes to be defined, Should prevent derp error hiding. + new CrashReport("ThisIsFake", new Exception("Not real")); } public static String getBrandingVersion() diff --git a/common/net/minecraftforge/common/Property.java b/common/net/minecraftforge/common/Property.java index 1220fe90b..00b117505 100644 --- a/common/net/minecraftforge/common/Property.java +++ b/common/net/minecraftforge/common/Property.java @@ -40,13 +40,14 @@ public class Property } private String name; - public String value; + private String value; public String comment; - public String[] valueList; + private String[] values; private final boolean wasRead; private final boolean isList; private final Type type; + private boolean changed = false; public Property() { @@ -77,10 +78,20 @@ public class Property Property(String name, String[] values, Type type, boolean read) { setName(name); - this.type = type; - valueList = values; - wasRead = read; - isList = true; + this.type = type; + this.values = values; + wasRead = read; + isList = true; + } + + /** + * Returns the value in this property as it's raw string. + * + * @return current value + */ + public String getString() + { + return value; } /** @@ -197,6 +208,11 @@ public class Property } } + public String[] getStringList() + { + return values; + } + /** * Returns the integer value of all values that can * be parsed in the list. @@ -207,7 +223,7 @@ public class Property { ArrayList nums = new ArrayList(); - for (String value : valueList) + for (String value : values) { try { @@ -232,7 +248,7 @@ public class Property */ public boolean isIntList() { - for (String value : valueList) + for (String value : values) { try { @@ -254,21 +270,21 @@ public class Property */ public boolean[] getBooleanList() { - ArrayList values = new ArrayList(); - for (String value : valueList) + ArrayList tmp = new ArrayList(); + for (String value : values) { try { - values.add(Boolean.parseBoolean(value)); + tmp.add(Boolean.parseBoolean(value)); } catch (NumberFormatException e){} } - boolean[] primitives = new boolean[values.size()]; + boolean[] primitives = new boolean[tmp.size()]; - for (int i = 0; i < values.size(); i++) + for (int i = 0; i < tmp.size(); i++) { - primitives[i] = values.get(i); + primitives[i] = tmp.get(i); } return primitives; @@ -280,7 +296,7 @@ public class Property */ public boolean isBooleanList() { - for (String value : valueList) + for (String value : values) { if (!"true".equalsIgnoreCase(value) && !"false".equalsIgnoreCase(value)) { @@ -299,21 +315,21 @@ public class Property */ public double[] getDoubleList() { - ArrayList values = new ArrayList(); - for (String value : valueList) + ArrayList tmp = new ArrayList(); + for (String value : values) { try { - values.add(Double.parseDouble(value)); + tmp.add(Double.parseDouble(value)); } catch (NumberFormatException e) {} } - double[] primitives = new double[values.size()]; + double[] primitives = new double[tmp.size()]; - for (int i = 0; i < values.size(); i++) + for (int i = 0; i < tmp.size(); i++) { - primitives[i] = values.get(i); + primitives[i] = tmp.get(i); } return primitives; @@ -325,7 +341,7 @@ public class Property */ public boolean isDoubleList() { - for (String value : valueList) + for (String value : values) { try { @@ -371,4 +387,23 @@ public class Property { return isList; } + + public boolean hasChanged(){ return changed; } + void resetChangedState(){ changed = false; } + + public void set(String value) + { + this.value = value; + changed = true; + } + + public void set(String[] values) + { + this.values = values; + changed = true; + } + + public void set(int value){ set(Integer.toString(value)); } + public void set(boolean value){ set(Boolean.toString(value)); } + public void set(double value){ set(Double.toString(value)); } } diff --git a/common/net/minecraftforge/event/ForgeEventFactory.java b/common/net/minecraftforge/event/ForgeEventFactory.java index 0210321f5..48f774204 100644 --- a/common/net/minecraftforge/event/ForgeEventFactory.java +++ b/common/net/minecraftforge/event/ForgeEventFactory.java @@ -1,16 +1,22 @@ package net.minecraftforge.event; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.entity.living.LivingSpawnEvent; -import net.minecraftforge.event.entity.living.LivingSpecialSpawnEvent; -import net.minecraftforge.event.entity.player.*; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; +import net.minecraftforge.event.world.WorldEvent; @SuppressWarnings("deprecation") public class ForgeEventFactory @@ -49,14 +55,16 @@ public class ForgeEventFactory public static boolean doSpecialSpawn(EntityLiving entity, World world, float x, float y, float z) { - boolean result = MinecraftForge.EVENT_BUS.post(new LivingSpecialSpawnEvent(entity, world, x, y, z)); - LivingSpawnEvent.SpecialSpawn nEvent = new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z); + return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z)); + } - if (result) //For the time being, copy the canceled state from the old legacy event - { // Remove when we remove LivingSpecialSpawnEvent. - nEvent.setCanceled(true); + public static List getPotentialSpawns(WorldServer world, EnumCreatureType type, int x, int y, int z, List oldList) + { + WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, x, y, z, oldList); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return null; } - - return MinecraftForge.EVENT_BUS.post(nEvent); + return event.list; } } diff --git a/common/net/minecraftforge/event/entity/living/LivingSpecialSpawnEvent.java b/common/net/minecraftforge/event/entity/living/LivingSpecialSpawnEvent.java deleted file mode 100644 index d8c2d4d25..000000000 --- a/common/net/minecraftforge/event/entity/living/LivingSpecialSpawnEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.minecraftforge.event.entity.living; - -import net.minecraft.entity.EntityLiving; -import net.minecraft.world.World; -import net.minecraftforge.event.Cancelable; - -@Deprecated //Remove next MC Version -@Cancelable -public class LivingSpecialSpawnEvent extends LivingEvent -{ - public final World world; - public final float x; - public final float y; - public final float z; - private boolean handeled = false; - - public LivingSpecialSpawnEvent(EntityLiving entity, World world, float x, float y, float z) - { - super(entity); - this.world = world; - this.x = x; - this.y = y; - this.z = z; - } -} diff --git a/common/net/minecraftforge/event/world/WorldEvent.java b/common/net/minecraftforge/event/world/WorldEvent.java index 4e1565128..6ebbffbdd 100644 --- a/common/net/minecraftforge/event/world/WorldEvent.java +++ b/common/net/minecraftforge/event/world/WorldEvent.java @@ -1,6 +1,12 @@ package net.minecraftforge.event.world; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.World; +import net.minecraft.world.biome.SpawnListEntry; +import net.minecraftforge.event.Cancelable; import net.minecraftforge.event.Event; public class WorldEvent extends Event @@ -26,4 +32,35 @@ public class WorldEvent extends Event { public Save(World world) { super(world); } } + + /** + * Called by WorldServer to gather a list of all possible entities that can spawn at the specified location. + * Canceling the event will result in a empty list, meaning no entity will be spawned. + */ + @Cancelable + public static class PotentialSpawns extends WorldEvent + { + public final EnumCreatureType type; + public final int x; + public final int y; + public final int z; + public final List list; + + public PotentialSpawns(World world, EnumCreatureType type, int x, int y, int z, List oldList) + { + super(world); + this.x = x; + this.y = y; + this.z = z; + this.type = type; + if (oldList != null) + { + this.list = (List)oldList; + } + else + { + this.list = new ArrayList(); + } + } + } } diff --git a/common/net/minecraftforge/liquids/LiquidStack.java b/common/net/minecraftforge/liquids/LiquidStack.java index 345dfdf0d..4de20b3a1 100644 --- a/common/net/minecraftforge/liquids/LiquidStack.java +++ b/common/net/minecraftforge/liquids/LiquidStack.java @@ -1,9 +1,13 @@ package net.minecraftforge.liquids; +import static cpw.mods.fml.relauncher.Side.CLIENT; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.Icon; /** * ItemStack substitute for liquids @@ -84,7 +88,7 @@ public class LiquidStack { return true; } - + return isLiquidEqual(LiquidContainerRegistry.getLiquidForFilledItem(other)); } @@ -108,4 +112,19 @@ public class LiquidStack liquidstack.readFromNBT(nbt); return liquidstack.itemID == 0 ? null : liquidstack; } + + @SideOnly(CLIENT) + private Icon renderingIcon; + + @SideOnly(CLIENT) + public Icon getRenderingIcon() + { + return renderingIcon; + } + + @SideOnly(CLIENT) + public void setRenderingIcon(Icon icon) + { + this.renderingIcon = icon; + } } diff --git a/common/net/minecraftforge/transformers/EventTransformer.java b/common/net/minecraftforge/transformers/EventTransformer.java index ae04b08e4..149f30df2 100644 --- a/common/net/minecraftforge/transformers/EventTransformer.java +++ b/common/net/minecraftforge/transformers/EventTransformer.java @@ -20,7 +20,7 @@ public class EventTransformer implements IClassTransformer } @Override - public byte[] transform(String name, byte[] bytes) + public byte[] transform(String name, String transformedName, byte[] bytes) { if (bytes == null || name.equals("net.minecraftforge.event.Event") || name.startsWith("net.minecraft.") || name.indexOf('.') == -1) { @@ -162,5 +162,4 @@ public class EventTransformer implements IClassTransformer classNode.methods.add(method); return true; } - } diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index 0b8057d66..3567dfea5 100644 Binary files a/eclipse-workspace-dev.zip and b/eclipse-workspace-dev.zip differ diff --git a/fml b/fml new file mode 160000 index 000000000..0419b9d97 --- /dev/null +++ b/fml @@ -0,0 +1 @@ +Subproject commit 0419b9d9751ade4497343aefaf2ca43703eb479a diff --git a/fml-src-1.4.7-4.7.35.556-master.zip b/fml-src-1.4.7-4.7.35.556-master.zip deleted file mode 100644 index 2b0d129ab..000000000 Binary files a/fml-src-1.4.7-4.7.35.556-master.zip and /dev/null differ diff --git a/forge.py b/forge.py index 4e9de37c3..0615bc06e 100644 --- a/forge.py +++ b/forge.py @@ -64,7 +64,7 @@ def zip_folder(path, key, zip): zip_folder(file_path, file_key, zip) else: if not file_key.replace(os.sep, '/') in zip.NameToInfo: - print file_key + print ' ' + file_key zip.write(file_path, file_key) def zip_create(path, key, zip_name): @@ -77,6 +77,7 @@ def zip_create(path, key, zip_name): def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True): sys.path.append(fml_dir) + sys.path.append(os.path.join(fml_dir, 'install')) from fml import copytree, apply_patches #patch files @@ -100,6 +101,7 @@ def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0): shutil.rmtree(src_dir) sys.path.append(fml_dir) + sys.path.append(os.path.join(fml_dir, 'install')) from fml import copytree print 'src_work -> src' @@ -114,11 +116,18 @@ def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0): error_level = 0 try: sys.path.append(mcp_dir) - from runtime.recompile import recompile + from runtime.commands import Commands, CLIENT, SERVER, CalledProcessError + from runtime.mcp import recompile_side os.chdir(mcp_dir) reset_logger() - recompile(None, True, False) + + commands = Commands(None, verify=True) + try: + recompile_side(commands, CLIENT) + except CalledProcessError as e: + error_level = 1 + pass reset_logger() os.chdir(forge_dir) except SystemExit, e: diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 825f8573d..81b8f6da2 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,15 +1,20 @@ --- ../src_base/minecraft/net/minecraft/block/Block.java +++ ../src_work/minecraft/net/minecraft/block/Block.java -@@ -2,13 +2,17 @@ +@@ -1,15 +1,20 @@ + package net.minecraft.block; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; +-import cpw.mods.fml.relauncher.Side; +-import cpw.mods.fml.relauncher.SideOnly; ++import static net.minecraftforge.common.ForgeDirection.DOWN; ++import static net.minecraftforge.common.ForgeDirection.UP; + +import java.util.ArrayList; import java.util.List; import java.util.Random; ++ import net.minecraft.block.material.Material; +import net.minecraft.client.particle.EffectRenderer; + import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -18,24 +23,28 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; -@@ -24,17 +28,27 @@ - import net.minecraft.item.ItemSlab; +@@ -26,8 +31,10 @@ + import net.minecraft.item.ItemSnow; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntitySign; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; + import net.minecraft.util.Icon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; - import net.minecraft.util.Vec3; +@@ -35,9 +42,20 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.WorldProviderEnd; -+ -+import net.minecraftforge.common.*; -+import static net.minecraftforge.common.ForgeDirection.*; ++import net.minecraftforge.common.EnumPlantType; ++import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.ForgeHooks; ++import net.minecraftforge.common.IPlantable; ++import cpw.mods.fml.relauncher.Side; ++import cpw.mods.fml.relauncher.SideOnly; public class Block { @@ -46,7 +55,7 @@ /** * used as foreach item, if item.tab = current tab, display it on the screen */ -@@ -321,6 +335,7 @@ +@@ -332,6 +350,7 @@ lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0; canBlockGrass[par1] = !par2Material.getCanBlockGrass(); } @@ -54,7 +63,7 @@ } /** -@@ -459,9 +474,10 @@ +@@ -454,9 +473,10 @@ return this.needsRandomTick; } @@ -66,7 +75,7 @@ } /** -@@ -484,7 +500,7 @@ +@@ -479,7 +499,7 @@ */ public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -75,7 +84,7 @@ } @SideOnly(Side.CLIENT) -@@ -494,7 +510,7 @@ +@@ -489,7 +509,7 @@ */ public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -84,7 +93,7 @@ } @SideOnly(Side.CLIENT) -@@ -639,7 +655,13 @@ +@@ -639,7 +659,13 @@ /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ @@ -99,49 +108,48 @@ /** * Returns the quantity of items to drop on block destruction. -@@ -663,8 +685,7 @@ - */ +@@ -664,7 +690,7 @@ public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) { -- float var6 = this.getBlockHardness(par2World, par3, par4, par5); -- return var6 < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? 1.0F / var6 / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this) / var6 / 30.0F); + float f = this.getBlockHardness(par2World, par3, par4, par5); +- return f < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? par1EntityPlayer.getCurrentPlayerStrVsBlock(this, false) / f / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this, true) / f / 30.0F); + return ForgeHooks.blockStrength(this, par1EntityPlayer, par2World, par3, par4, par5); } /** -@@ -682,18 +703,13 @@ +@@ -682,18 +708,13 @@ { if (!par1World.isRemote) { -- int var8 = this.quantityDroppedWithBonus(par7, par1World.rand); +- int j1 = this.quantityDroppedWithBonus(par7, par1World.rand); - -- for (int var9 = 0; var9 < var8; ++var9) +- for (int k1 = 0; k1 < j1; ++k1) + ArrayList items = getBlockDropped(par1World, par2, par3, par4, par5, par7); + + for (ItemStack item : items) { if (par1World.rand.nextFloat() <= par6) { -- int var10 = this.idDropped(par5, par1World.rand, par7); +- int l1 = this.idDropped(par5, par1World.rand, par7); - -- if (var10 > 0) +- if (l1 > 0) - { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5))); +- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(l1, 1, this.damageDropped(par5))); - } + this.dropBlockAsItem_do(par1World, par2, par3, par4, item); } } } -@@ -1081,7 +1097,7 @@ +@@ -1086,7 +1107,7 @@ par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addExhaustion(0.025F); - if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) + if (this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { - ItemStack var8 = this.createStackedBlock(par6); + ItemStack itemstack = this.createStackedBlock(par6); -@@ -1097,12 +1113,13 @@ +@@ -1102,12 +1123,13 @@ } } @@ -156,7 +164,7 @@ } /** -@@ -1364,4 +1381,864 @@ +@@ -1414,4 +1436,871 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -237,6 +245,10 @@ + boolean flipped = ((meta & 4) != 0); + return ((meta & 3) + side.ordinal() == 5) || (side == UP && flipped); + } ++ else if (this instanceof BlockHopper && side == UP) ++ { ++ return true; ++ } + return isBlockNormalCube(world, x, y, z); + } + @@ -319,7 +331,7 @@ + */ + public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) + { -+ return world.setBlockWithNotify(x, y, z, 0); ++ return world.func_94571_i(x, y, z); + } + + /** @@ -422,6 +434,7 @@ + blockFlammability[id] = flammability; + } + ++ private boolean isTileProvider = this instanceof ITileEntityProvider; + /** + * Called throughout the code as a replacement for block instanceof BlockContainer + * Moving this to the Block base class allows for mods that wish to extend vinella @@ -434,22 +447,22 @@ + */ + public boolean hasTileEntity(int metadata) + { -+ return isBlockContainer; ++ return isTileProvider; + } + + /** -+ * Called throughout the code as a replacement for BlockContainer.getBlockEntity ++ * Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity + * Return the same thing you would from that function. -+ * This will fall back to BlockContainer.getBlockEntity if this block is a BlockContainer. ++ * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider + * + * @param metadata The Metadata of the current block + * @return A instance of a class extending TileEntity + */ + public TileEntity createTileEntity(World world, int metadata) + { -+ if (this instanceof BlockContainer) ++ if (isTileProvider) + { -+ return ((BlockContainer)this).createNewTileEntity(world, metadata); ++ return ((ITileEntityProvider)this).createNewTileEntity(world); + } + return null; + } @@ -688,9 +701,11 @@ + * @param x X Position + * @param y Y Position + * @param z Z Position ++ * @param target The generic target block the gen is looking for, Standards define stone ++ * for overworld generation, and neatherack for the nether. + * @return True to allow this block to be replaced by a ore + */ -+ public boolean isGenMineableReplaceable(World world, int x, int y, int z) ++ public boolean isGenMineableReplaceable(World world, int x, int y, int z, int target) + { + return blockID == stone.blockID; + } @@ -927,12 +942,12 @@ + /** + * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. + * Modder may implement this for custom plants. -+ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, ++ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, + * so the source location is specified. + * Currently this just changes the block to dirt if it was grass. -+ * ++ * + * Note: This happens DURING the generation, the generation may not be complete when this is called. -+ * ++ * + * @param world Current world + * @param x Soil X + * @param y Soil Y @@ -945,7 +960,7 @@ + { + if (blockID == grass.blockID) + { -+ world.setBlock(x, y, z, dirt.blockID); ++ world.setBlockAndMetadataWithNotify(x, y, z, dirt.blockID, 0, 2); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch b/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch new file mode 100644 index 000000000..62413eb6e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch @@ -0,0 +1,70 @@ +--- ../src_base/minecraft/net/minecraft/block/BlockBaseRailLogic.java ++++ ../src_work/minecraft/net/minecraft/block/BlockBaseRailLogic.java +@@ -14,6 +14,8 @@ + private final boolean field_94512_f; + private List field_94513_g; + ++ private final boolean canMakeSlopes; ++ + final BlockRailBase field_94518_a; + + public BlockBaseRailLogic(BlockRailBase par1, World par2, int par3, int par4, int par5) +@@ -25,17 +27,11 @@ + this.field_94514_d = par4; + this.field_94515_e = par5; + int l = par2.getBlockId(par3, par4, par5); +- int i1 = par2.getBlockMetadata(par3, par4, par5); +- +- if (((BlockRailBase)Block.blocksList[l]).isPowered) +- { +- this.field_94512_f = true; +- i1 &= -9; +- } +- else +- { +- this.field_94512_f = false; +- } ++ ++ BlockRailBase target = (BlockRailBase)Block.blocksList[l]; ++ int i1 = target.getBasicRailMetadata(par2, null, par3, par4, par5); ++ field_94512_f = !target.isFlexibleRail(par2, par3, par4, par5); ++ canMakeSlopes = target.canMakeSlopes(par2, par3, par4, par5); + + this.func_94504_a(i1); + } +@@ -227,7 +223,7 @@ + } + } + +- if (b0 == 0) ++ if (b0 == 0 && canMakeSlopes) + { + if (BlockRailBase.isRailBlockAt(this.field_94516_b, this.field_94517_c, this.field_94514_d + 1, this.field_94515_e - 1)) + { +@@ -240,7 +236,7 @@ + } + } + +- if (b0 == 1) ++ if (b0 == 1 && canMakeSlopes) + { + if (BlockRailBase.isRailBlockAt(this.field_94516_b, this.field_94517_c + 1, this.field_94514_d + 1, this.field_94515_e)) + { +@@ -385,7 +381,7 @@ + } + } + +- if (b0 == 0) ++ if (b0 == 0 && canMakeSlopes) + { + if (BlockRailBase.isRailBlockAt(this.field_94516_b, this.field_94517_c, this.field_94514_d + 1, this.field_94515_e - 1)) + { +@@ -398,7 +394,7 @@ + } + } + +- if (b0 == 1) ++ if (b0 == 1 && canMakeSlopes) + { + if (BlockRailBase.isRailBlockAt(this.field_94516_b, this.field_94517_c + 1, this.field_94514_d + 1, this.field_94515_e)) + { diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index 4ae2f5fca..f5ca96a7f 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -1,16 +1,16 @@ --- ../src_base/minecraft/net/minecraft/block/BlockButton.java +++ ../src_work/minecraft/net/minecraft/block/BlockButton.java -@@ -11,6 +11,9 @@ +@@ -14,6 +14,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; +import static net.minecraftforge.common.ForgeDirection.*; + - public class BlockButton extends Block + public abstract class BlockButton extends Block { /** Whether this button is sensible to arrows, used by wooden buttons. */ -@@ -63,7 +66,11 @@ +@@ -66,7 +69,11 @@ */ public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { @@ -23,7 +23,7 @@ } /** -@@ -71,7 +78,10 @@ +@@ -74,7 +81,10 @@ */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { @@ -35,9 +35,9 @@ } /** -@@ -83,19 +93,22 @@ - int var11 = var10 & 8; - var10 &= 7; +@@ -86,19 +96,22 @@ + int k1 = j1 & 8; + j1 &= 7; - if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) + @@ -45,24 +45,24 @@ + + if (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) { - var10 = 4; + j1 = 4; } - else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) + else if (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) { - var10 = 3; + j1 = 3; } - else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) + else if (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) { - var10 = 2; + j1 = 2; } - else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) + else if (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) { - var10 = 1; + j1 = 1; } -@@ -112,7 +125,11 @@ +@@ -115,7 +128,11 @@ */ private int getOrientation(World par1World, int par2, int par3, int par4) { @@ -75,30 +75,30 @@ } /** -@@ -126,22 +143,22 @@ - int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7; - boolean var7 = false; +@@ -129,22 +146,22 @@ + int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7; + boolean flag = false; -- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && var6 == 1) +- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1) { - var7 = true; + flag = true; } -- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2) -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && var6 == 2) +- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2) { - var7 = true; + flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && var6 == 3) +- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3) { - var7 = true; + flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && var6 == 4) +- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4) { - var7 = true; + flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index 7699dad7e..b4e992cf1 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/block/BlockCactus.java +++ ../src_work/minecraft/net/minecraft/block/BlockCactus.java -@@ -10,7 +10,11 @@ - import net.minecraft.util.DamageSource; +@@ -12,7 +12,11 @@ + import net.minecraft.util.Icon; import net.minecraft.world.World; -public class BlockCactus extends Block @@ -11,20 +11,20 @@ + +public class BlockCactus extends Block implements IPlantable { - protected BlockCactus(int par1, int par2) - { -@@ -149,7 +153,7 @@ + @SideOnly(Side.CLIENT) + private Icon field_94380_a; +@@ -158,7 +162,7 @@ else { - int var5 = par1World.getBlockId(par2, par3 - 1, par4); -- return var5 == Block.cactus.blockID || var5 == Block.sand.blockID; -+ return blocksList[var5] != null && blocksList[var5].canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this); + int l = par1World.getBlockId(par2, par3 - 1, par4); +- return l == Block.cactus.blockID || l == Block.sand.blockID; ++ return blocksList[l] != null && blocksList[l].canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this); } } -@@ -160,4 +164,22 @@ - { - par5Entity.attackEntityFrom(DamageSource.cactus, 1); +@@ -177,4 +181,22 @@ + this.field_94380_a = par1IconRegister.func_94245_a("cactus_top"); + this.field_94379_b = par1IconRegister.func_94245_a("cactus_bottom"); } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index df104847f..2076a0d5d 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockChest.java +++ ../src_work/minecraft/net/minecraft/block/BlockChest.java -@@ -21,6 +21,8 @@ +@@ -23,6 +23,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -8,46 +8,46 @@ + public class BlockChest extends BlockContainer { - private Random random = new Random(); -@@ -427,7 +429,7 @@ + private final Random random = new Random(); +@@ -436,7 +438,7 @@ { - return true; + return null; } - else if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) + else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) { - return true; + return null; } -@@ -435,19 +437,19 @@ +@@ -444,19 +446,19 @@ { - return true; + return null; } - else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) - { -- return true; +- return null; - } - else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) - { -- return true; +- return null; - } - else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) - { -- return true; +- return null; - } - else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) + else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) + { -+ return true; ++ return null; + } + else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) + { -+ return true; ++ return null; + } + else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) + { -+ return true; ++ return null; + } + else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) { - return true; + return null; } diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 60c3158ab..08b7bf4a7 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -8,12 +8,12 @@ +import java.util.ArrayList; import java.util.Random; import net.minecraft.block.material.Material; - import net.minecraft.entity.EntityLiving; -@@ -175,7 +177,14 @@ + import net.minecraft.client.renderer.texture.IconRegister; +@@ -202,7 +204,14 @@ */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { -- int var8 = func_72219_c(par5); +- int j1 = func_72219_c(par5); + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); + } + @@ -21,13 +21,13 @@ + public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) + { + ArrayList dropped = super.getBlockDropped(world, x, y, z, metadata, fortune); -+ int var8 = func_72219_c(metadata); - byte var9 = 1; ++ int j1 = func_72219_c(metadata); + byte b0 = 1; - if (var8 >= 2) -@@ -185,8 +194,9 @@ + if (j1 >= 2) +@@ -212,8 +221,9 @@ - for (int var10 = 0; var10 < var9; ++var10) + for (int k1 = 0; k1 < b0; ++k1) { - this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3)); - } @@ -37,9 +37,9 @@ } @SideOnly(Side.CLIENT) -@@ -206,4 +216,10 @@ - { - return 3; +@@ -244,4 +254,10 @@ + this.field_94469_b[i] = par1IconRegister.func_94245_a(field_94470_a[i]); + } } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockContainer.java.patch b/patches/minecraft/net/minecraft/block/BlockContainer.java.patch deleted file mode 100644 index 4b2f718ab..000000000 --- a/patches/minecraft/net/minecraft/block/BlockContainer.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/block/BlockContainer.java -+++ ../src_work/minecraft/net/minecraft/block/BlockContainer.java -@@ -24,7 +24,7 @@ - public void onBlockAdded(World par1World, int par2, int par3, int par4) - { - super.onBlockAdded(par1World, par2, par3, par4); -- par1World.setBlockTileEntity(par2, par3, par4, this.createNewTileEntity(par1World)); -+ par1World.setBlockTileEntity(par2, par3, par4, this.createTileEntity(par1World, par1World.getBlockMetadata(par2, par3, par4))); - } - - /** -@@ -40,6 +40,12 @@ - * Returns a new instance of a block's tile entity class. Called on placing the block. - */ - public abstract TileEntity createNewTileEntity(World var1); -+ -+ -+ public TileEntity createNewTileEntity(World world, int metadata) -+ { -+ return createNewTileEntity(world); -+ } - - /** - * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 668b1dbc3..66a57d160 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,35 +1,36 @@ --- ../src_base/minecraft/net/minecraft/block/BlockCrops.java +++ ../src_work/minecraft/net/minecraft/block/BlockCrops.java -@@ -2,11 +2,14 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.Random; + import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; +@@ -10,6 +11,7 @@ + import net.minecraft.util.Icon; + import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; public class BlockCrops extends BlockFlower { -@@ -92,11 +95,11 @@ - int var19 = par1World.getBlockId(var17, par3 - 1, var18); - float var20 = 0.0F; +@@ -103,11 +105,11 @@ + int j3 = par1World.getBlockId(l2, par3 - 1, i3); + float f1 = 0.0F; -- if (var19 == Block.tilledField.blockID) -+ if (blocksList[var19] != null && blocksList[var19].canSustainPlant(par1World, var17, par3 - 1, var18, ForgeDirection.UP, this)) +- if (j3 == Block.tilledField.blockID) ++ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this)) { - var20 = 1.0F; + f1 = 1.0F; -- if (par1World.getBlockMetadata(var17, par3 - 1, var18) > 0) -+ if (blocksList[var19].isFertile(par1World, var17, par3 - 1, var18)) +- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0) ++ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3)) { - var20 = 3.0F; + f1 = 3.0F; } -@@ -162,22 +165,25 @@ +@@ -175,22 +177,25 @@ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); @@ -48,9 +49,9 @@ + { + for (int n = 0; n < 3 + fortune; n++) { -- int var8 = 3 + par7; +- int j1 = 3 + par7; - -- for (int var9 = 0; var9 < var8; ++var9) +- for (int k1 = 0; k1 < j1; ++k1) - { - if (par1World.rand.nextInt(15) <= par5) - { diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index 13046b8e3..89cc41566 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src_work/minecraft/net/minecraft/block/BlockDoor.java -@@ -268,7 +268,7 @@ +@@ -296,7 +296,7 @@ { if (this.blockMaterial == Material.iron) { diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch index fa07b081c..55a9cb1cb 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src_work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -8,6 +8,9 @@ - import net.minecraft.entity.player.EntityPlayer; +@@ -10,6 +10,9 @@ import net.minecraft.util.AxisAlignedBB; + import net.minecraft.util.Icon; import net.minecraft.world.World; + +import net.minecraftforge.common.ForgeDirection; @@ -10,12 +10,12 @@ public class BlockFarmland extends Block { -@@ -107,7 +110,8 @@ +@@ -115,7 +118,8 @@ { - int var8 = par1World.getBlockId(var6, par3 + 1, var7); + int j1 = par1World.getBlockId(l, par3 + 1, i1); -- if (var8 == Block.crops.blockID || var8 == Block.melonStem.blockID || var8 == Block.pumpkinStem.blockID || var8 == Block.potato.blockID || var8 == Block.carrot.blockID) -+ Block plant = blocksList[var8]; +- if (j1 == Block.crops.blockID || j1 == Block.melonStem.blockID || j1 == Block.pumpkinStem.blockID || j1 == Block.potato.blockID || j1 == Block.carrot.blockID) ++ Block plant = blocksList[j1]; + if (plant instanceof IPlantable && canSustainPlant(par1World, par2, par3, par4, ForgeDirection.UP, (IPlantable)plant)) { return true; diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 938813761..0fa2c859c 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockFire.java +++ ../src_work/minecraft/net/minecraft/block/BlockFire.java -@@ -9,6 +9,9 @@ +@@ -11,6 +11,9 @@ import net.minecraft.world.World; import net.minecraft.world.WorldProviderEnd; @@ -10,7 +10,7 @@ public class BlockFire extends Block { /** The chance this block will encourage nearby blocks to catch on fire */ -@@ -32,6 +35,8 @@ +@@ -36,6 +39,8 @@ */ public void initializeBlock() { @@ -19,7 +19,7 @@ this.setBurnRate(Block.planks.blockID, 5, 20); this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20); this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20); -@@ -56,8 +61,7 @@ +@@ -60,8 +65,7 @@ */ private void setBurnRate(int par1, int par2, int par3) { @@ -29,72 +29,72 @@ } /** -@@ -117,12 +121,8 @@ +@@ -121,12 +125,8 @@ { if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick")) { -- boolean var6 = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; +- boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; - - if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID) - { -- var6 = true; +- flag = true; - } + Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; -+ boolean var6 = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP)); ++ boolean flag = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP)); if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) { -@@ -151,7 +151,7 @@ - par1World.setBlockWithNotify(par2, par3, par4, 0); +@@ -155,7 +155,7 @@ + par1World.func_94571_i(par2, par3, par4); } } -- else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && var7 == 15 && par5Random.nextInt(4) == 0) -+ else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && var7 == 15 && par5Random.nextInt(4) == 0) +- else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && l == 15 && par5Random.nextInt(4) == 0) ++ else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && l == 15 && par5Random.nextInt(4) == 0) { - par1World.setBlockWithNotify(par2, par3, par4, 0); + par1World.func_94571_i(par2, par3, par4); } -@@ -165,12 +165,12 @@ - var9 = -50; +@@ -169,12 +169,12 @@ + b0 = -50; } -- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7); -- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7); -- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7); -- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7); -- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7); -- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7); -+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7, WEST ); -+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7, EAST ); -+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7, UP ); -+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7, DOWN ); -+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7, SOUTH); -+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7, NORTH); +- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l); +- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l); +- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l); +- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l); +- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l); +- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l); ++ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, WEST ); ++ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, EAST ); ++ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, UP ); ++ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, DOWN ); ++ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, SOUTH); ++ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, NORTH); - for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10) + for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1) { -@@ -224,9 +224,20 @@ +@@ -228,9 +228,20 @@ return false; } + @Deprecated private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) { -- int var8 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; +- int j1 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; + tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP); + } + + private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face) + { -+ int var8 = 0; ++ int j1 = 0; + Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)]; + if (block != null) + { -+ var8 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face); ++ j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face); + } - if (par6Random.nextInt(par5) < var8) + if (par6Random.nextInt(par5) < j1) { -@@ -260,7 +271,12 @@ +@@ -264,7 +275,12 @@ */ private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) { @@ -108,26 +108,26 @@ } /** -@@ -276,12 +292,12 @@ +@@ -280,12 +296,12 @@ } else { -- int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5); -- var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6); -- var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6); -- var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6); -- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6); -- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6); -+ int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5, WEST); -+ var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6, EAST); -+ var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6, UP); -+ var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6, DOWN); -+ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6, SOUTH); -+ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6, NORTH); - return var6; +- int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0); +- l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l); +- l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l); +- l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l); +- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l); +- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l); ++ int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, WEST); ++ l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, EAST); ++ l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, UP); ++ l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, DOWN); ++ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, SOUTH); ++ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, NORTH); + return l; } } -@@ -296,21 +312,24 @@ +@@ -300,21 +316,24 @@ /** * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z @@ -151,15 +151,15 @@ + @Deprecated public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5) { -- int var6 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)]; -- return var6 > par5 ? var6 : par5; +- int i1 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)]; +- return i1 > par5 ? i1 : par5; + return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP); } /** -@@ -368,9 +387,9 @@ - float var8; - float var9; +@@ -372,9 +391,9 @@ + float f1; + float f2; - if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4)) - { @@ -168,47 +168,47 @@ + { + if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST)) { - for (var6 = 0; var6 < 2; ++var6) + for (l = 0; l < 2; ++l) { -@@ -381,7 +400,7 @@ +@@ -385,7 +404,7 @@ } } - if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4)) + if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST)) { - for (var6 = 0; var6 < 2; ++var6) + for (l = 0; l < 2; ++l) { -@@ -392,7 +411,7 @@ +@@ -396,7 +415,7 @@ } } - if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1)) + if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH)) { - for (var6 = 0; var6 < 2; ++var6) + for (l = 0; l < 2; ++l) { -@@ -403,7 +422,7 @@ +@@ -407,7 +426,7 @@ } } - if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1)) + if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH)) { - for (var6 = 0; var6 < 2; ++var6) + for (l = 0; l < 2; ++l) { -@@ -414,7 +433,7 @@ +@@ -418,7 +437,7 @@ } } - if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4)) + if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN)) { - for (var6 = 0; var6 < 2; ++var6) + for (l = 0; l < 2; ++l) { -@@ -436,4 +455,46 @@ - } - } +@@ -462,4 +481,46 @@ + { + return this.field_94439_c[0]; } + + /** diff --git a/patches/minecraft/net/minecraft/block/BlockFlower.java.patch b/patches/minecraft/net/minecraft/block/BlockFlower.java.patch index ea87db049..f8d50aa08 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlower.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFlower.java.patch @@ -12,9 +12,9 @@ + +public class BlockFlower extends Block implements IPlantable { - protected BlockFlower(int par1, int par2, Material par3Material) + protected BlockFlower(int par1, Material par2Material) { -@@ -28,7 +33,7 @@ +@@ -27,7 +32,7 @@ */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { @@ -23,7 +23,7 @@ } /** -@@ -72,7 +77,9 @@ +@@ -71,7 +76,9 @@ */ public boolean canBlockStay(World par1World, int par2, int par3, int par4) { @@ -34,7 +34,7 @@ } /** -@@ -108,4 +115,32 @@ +@@ -107,4 +114,32 @@ { return 1; } diff --git a/patches/minecraft/net/minecraft/block/BlockFluid.java.patch b/patches/minecraft/net/minecraft/block/BlockFluid.java.patch index aadc035ab..5c0bfbc93 100644 --- a/patches/minecraft/net/minecraft/block/BlockFluid.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFluid.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/block/BlockFluid.java +++ ../src_work/minecraft/net/minecraft/block/BlockFluid.java -@@ -54,7 +54,7 @@ +@@ -59,7 +59,7 @@ { - for (int var9 = -1; var9 <= 1; ++var9) + for (int l1 = -1; l1 <= 1; ++l1) { -- int var10 = par1IBlockAccess.getBiomeGenForCoords(par2 + var9, par4 + var8).waterColorMultiplier; -+ int var10 = par1IBlockAccess.getBiomeGenForCoords(par2 + var9, par4 + var8).getWaterColorMultiplier(); - var5 += (var10 & 16711680) >> 16; - var6 += (var10 & 65280) >> 8; - var7 += var10 & 255; +- int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).waterColorMultiplier; ++ int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).getWaterColorMultiplier(); + l += (i2 & 16711680) >> 16; + i1 += (i2 & 65280) >> 8; + j1 += i2 & 255; diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch index f04373b10..3e8cd751d 100644 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src_work/minecraft/net/minecraft/block/BlockGrass.java -@@ -100,7 +100,7 @@ +@@ -44,7 +44,7 @@ { if (!par1World.isRemote) { - if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) + if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2) { - par1World.setBlockWithNotify(par2, par3, par4, Block.dirt.blockID); + par1World.func_94575_c(par2, par3, par4, Block.dirt.blockID); } -@@ -113,7 +113,7 @@ - int var9 = par4 + par5Random.nextInt(3) - 1; - int var10 = par1World.getBlockId(var7, var8 + 1, var9); +@@ -57,7 +57,7 @@ + int k1 = par4 + par5Random.nextInt(3) - 1; + int l1 = par1World.getBlockId(i1, j1 + 1, k1); -- if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2) -+ if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && par1World.getBlockLightOpacity(var7, var8 + 1, var9) <= 2) +- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2) ++ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) { - par1World.setBlockWithNotify(var7, var8, var9, Block.grass.blockID); + par1World.func_94575_c(i1, j1, k1, Block.grass.blockID); } diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index 41a9637fc..30a35a1f3 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -24,57 +24,57 @@ /** @@ -114,22 +120,22 @@ { - int var10 = par9; + int j1 = par9; - if ((par9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1)) -+ if ((var10 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ++ if ((j1 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) { - var10 = 2; + j1 = 2; } -- if ((var10 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1)) -+ if ((var10 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) +- if ((j1 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if ((j1 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) { - var10 = 3; + j1 = 3; } -- if ((var10 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4)) -+ if ((var10 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) +- if ((j1 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if ((j1 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) { - var10 = 4; + j1 = 4; } -- if ((var10 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4)) -+ if ((var10 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) +- if ((j1 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if ((j1 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) { - var10 = 5; + j1 = 5; } @@ -146,22 +152,22 @@ - int var6 = par1World.getBlockMetadata(par2, par3, par4); - boolean var7 = false; + int i1 = par1World.getBlockMetadata(par2, par3, par4); + boolean flag = false; -- if (var6 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) -+ if (var6 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) +- if (i1 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if (i1 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) { - var7 = true; + flag = true; } -- if (var6 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) -+ if (var6 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) +- if (i1 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if (i1 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) { - var7 = true; + flag = true; } -- if (var6 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) -+ if (var6 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) +- if (i1 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if (i1 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) { - var7 = true; + flag = true; } -- if (var6 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) -+ if (var6 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) +- if (i1 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if (i1 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) { - var7 = true; + flag = true; } @@ -182,4 +188,10 @@ { diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index a6136c8be..e77f91ab6 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -9,7 +9,7 @@ import java.util.List; import java.util.Random; import net.minecraft.block.material.Material; -@@ -14,7 +16,9 @@ +@@ -16,7 +18,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -18,38 +18,38 @@ + +public class BlockLeaves extends BlockLeavesBase implements IShearable { - /** - * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can + public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; + public static final String[][] field_94396_b = new String[][] {{"leaves", "leaves_spruce", "leaves", "leaves_jungle"}, {"leaves_opaque", "leaves_spruce_opaque", "leaves_opaque", "leaves_jungle_opaque"}}; @@ -107,10 +111,9 @@ { - int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); + int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); -- if (var12 == Block.leaves.blockID) -+ if (Block.blocksList[var12] != null) +- if (j2 == Block.leaves.blockID) ++ if (Block.blocksList[j2] != null) { -- int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); -- par1World.setBlockMetadata(par2 + var9, par3 + var10, par4 + var11, var13 | 8); -+ Block.blocksList[var12].beginLeavesDecay(par1World, par2 + var9, par3 + var10, par4 + var11); +- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2); +- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4); ++ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); } } } @@ -156,11 +159,13 @@ { - var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14); + k2 = par1World.getBlockId(par2 + l1, par3 + i2, par4 + j2); -- if (var15 == Block.wood.blockID) -+ Block block = Block.blocksList[var15]; +- if (k2 == Block.wood.blockID) ++ Block block = Block.blocksList[k2]; + -+ if (block != null && block.canSustainLeaves(par1World, par2 + var12, par3 + var13, par4 + var14)) ++ if (block != null && block.canSustainLeaves(par1World, par2 + l1, par3 + i2, par4 + j2)) { - this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0; + this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0; } -- else if (var15 == Block.leaves.blockID) -+ else if (block != null && block.isLeaves(par1World, par2 + var12, par3 + var13, par4 + var14)) +- else if (k2 == Block.leaves.blockID) ++ else if (block != null && block.isLeaves(par1World, par2 + l1, par3 + i2, par4 + j2)) { - this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2; + this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; } -@@ -303,15 +308,7 @@ +@@ -325,15 +330,7 @@ */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { @@ -66,9 +66,9 @@ } /** -@@ -371,4 +368,30 @@ - { - return new ItemStack(this.blockID, 1, par1 & 3); +@@ -409,4 +406,30 @@ + } + } } + + @Override @@ -88,7 +88,7 @@ + @Override + public void beginLeavesDecay(World world, int x, int y, int z) + { -+ world.setBlockMetadata(x, y, z, world.getBlockMetadata(x, y, z) | 8); ++ world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4); + } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index c45b97c26..b3678dd23 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockLever.java +++ ../src_work/minecraft/net/minecraft/block/BlockLever.java -@@ -7,6 +7,9 @@ +@@ -10,6 +10,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -9,8 +9,8 @@ + public class BlockLever extends Block { - protected BlockLever(int par1, int par2) -@@ -54,7 +57,13 @@ + protected BlockLever(int par1) +@@ -57,7 +60,13 @@ */ public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { @@ -25,7 +25,7 @@ } /** -@@ -62,7 +71,12 @@ +@@ -65,7 +74,12 @@ */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { @@ -39,121 +39,121 @@ } /** -@@ -74,32 +88,32 @@ - int var10 = par9 & 7; - var10 = -1; +@@ -77,32 +91,32 @@ + int k1 = par9 & 7; + byte b0 = -1; - if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4)) + if (par5 == 0 && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) { - var10 = par1World.rand.nextBoolean() ? 0 : 7; + b0 = 0; } - if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) + if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP)) { - var10 = 5 + par1World.rand.nextInt(2); + b0 = 5; } - if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) + if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) { - var10 = 4; + b0 = 4; } - if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) + if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) { - var10 = 3; + b0 = 3; } - if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) + if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) { - var10 = 2; + b0 = 2; } - if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) + if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) { - var10 = 1; + b0 = 1; } -@@ -142,42 +156,42 @@ - int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7; - boolean var7 = false; +@@ -178,42 +192,42 @@ + int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7; + boolean flag = false; -- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1) +- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2) +- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3) +- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4) +- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && var6 == 5) +- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 5) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && var6 == 6) +- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 6) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && var6 == 0) +- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 0) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && var6 == 7) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && var6 == 1) +- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 7) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && var6 == 2) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && var6 == 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && var6 == 4) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && var6 == 5) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 5) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && var6 == 6) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 6) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && var6 == 0) ++ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 0) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && var6 == 7) ++ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 7) { - var7 = true; + flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index a309b05f7..020f84efd 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,25 +1,25 @@ --- ../src_base/minecraft/net/minecraft/block/BlockLog.java +++ ../src_work/minecraft/net/minecraft/block/BlockLog.java -@@ -63,14 +63,9 @@ +@@ -69,14 +69,9 @@ { - int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); + int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); -- if (var12 == Block.leaves.blockID) -+ if (Block.blocksList[var12] != null) +- if (j2 == Block.leaves.blockID) ++ if (Block.blocksList[j2] != null) { -- int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); +- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2); - -- if ((var13 & 8) == 0) +- if ((k2 & 8) == 0) - { -- par1World.setBlockMetadata(par2 + var9, par3 + var10, par4 + var11, var13 | 8); +- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4); - } -+ Block.blocksList[var12].beginLeavesDecay(par1World, par2 + var9, par3 + var10, par4 + var11); ++ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); } } } -@@ -151,4 +146,16 @@ - { - return new ItemStack(this.blockID, 1, limitToValidMetadata(par1)); +@@ -171,4 +166,16 @@ + this.field_94390_c[i] = par1IconRegister.func_94245_a(field_94389_b[i]); + } } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index b454f9cc6..113f9af07 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src_work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -3,6 +3,8 @@ - import java.util.Random; +@@ -6,6 +6,8 @@ + import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenBigMushroom; + @@ -9,13 +9,13 @@ public class BlockMushroom extends BlockFlower { -@@ -96,7 +98,9 @@ +@@ -102,7 +104,9 @@ if (par3 >= 0 && par3 < 256) { - int var5 = par1World.getBlockId(par2, par3 - 1, par4); -- return var5 == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(var5); -+ Block soil = Block.blocksList[var5]; -+ return (var5 == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13) && + int l = par1World.getBlockId(par2, par3 - 1, par4); +- return l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(l); ++ Block soil = Block.blocksList[l]; ++ return (l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13) && + (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); } else diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch index 0dcfb1f52..98400eb5b 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/block/BlockMycelium.java +++ ../src_work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -55,7 +55,7 @@ +@@ -41,7 +41,7 @@ { if (!par1World.isRemote) { - if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) + if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2) { - par1World.setBlockWithNotify(par2, par3, par4, Block.dirt.blockID); + par1World.func_94575_c(par2, par3, par4, Block.dirt.blockID); } -@@ -68,7 +68,7 @@ - int var9 = par4 + par5Random.nextInt(3) - 1; - int var10 = par1World.getBlockId(var7, var8 + 1, var9); +@@ -54,7 +54,7 @@ + int k1 = par4 + par5Random.nextInt(3) - 1; + int l1 = par1World.getBlockId(i1, j1 + 1, k1); -- if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2) -+ if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && par1World.getBlockLightOpacity(var7, var8 + 1, var9) <= 2) +- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2) ++ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) { - par1World.setBlockWithNotify(var7, var8, var9, this.blockID); + par1World.func_94575_c(i1, j1, k1, this.blockID); } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch index f73cb9f91..e6054b4e7 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch @@ -1,21 +1,23 @@ --- ../src_base/minecraft/net/minecraft/block/BlockNetherStalk.java +++ ../src_work/minecraft/net/minecraft/block/BlockNetherStalk.java -@@ -2,11 +2,14 @@ +@@ -2,6 +2,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + +import java.util.ArrayList; import java.util.Random; + import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.item.Item; +@@ -9,6 +11,7 @@ import net.minecraft.item.ItemStack; + import net.minecraft.util.Icon; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; public class BlockNetherStalk extends BlockFlower { -@@ -33,7 +36,8 @@ +@@ -39,7 +42,8 @@ */ public boolean canBlockStay(World par1World, int par2, int par3, int par4) { @@ -25,25 +27,25 @@ } /** -@@ -73,25 +77,7 @@ +@@ -81,25 +85,7 @@ */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { - if (!par1World.isRemote) - { -- int var8 = 1; +- int j1 = 1; - - if (par5 >= 3) - { -- var8 = 2 + par1World.rand.nextInt(3); +- j1 = 2 + par1World.rand.nextInt(3); - - if (par7 > 0) - { -- var8 += par1World.rand.nextInt(par7 + 1); +- j1 += par1World.rand.nextInt(par7 + 1); - } - } - -- for (int var9 = 0; var9 < var8; ++var9) +- for (int k1 = 0; k1 < j1; ++k1) - { - this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds)); - } @@ -52,9 +54,9 @@ } /** -@@ -119,4 +105,23 @@ - { - return Item.netherStalkSeeds.itemID; +@@ -138,4 +124,23 @@ + this.field_94372_b[i] = par1IconRegister.func_94245_a(field_94373_a[i]); + } } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index fe373cbc7..57b314c2c 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,29 +1,29 @@ --- ../src_base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src_work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -380,7 +380,7 @@ +@@ -426,7 +426,7 @@ return false; } -- return !(Block.blocksList[par0] instanceof BlockContainer); +- return !(Block.blocksList[par0] instanceof ITileEntityProvider); + return !par1World.blockHasTileEntity(par2, par3, par4); } } -@@ -398,7 +398,7 @@ +@@ -444,7 +444,7 @@ { - if (var8 < 13) + if (l1 < 13) { -- if (var6 <= 0 || var6 >= 255) -+ if (var6 <= 0 || var6 >= par0World.getHeight() - 1) +- if (j1 <= 0 || j1 >= 255) ++ if (j1 <= 0 || j1 >= par0World.getHeight() - 1) { return false; } -@@ -448,7 +448,7 @@ +@@ -494,7 +494,7 @@ - if (var9 < 13) + if (l1 < 13) { -- if (var7 <= 0 || var7 >= 255) -+ if (var7 <= 0 || var7 >= par1World.getHeight() - 1) +- if (j1 <= 0 || j1 >= 255) ++ if (j1 <= 0 || j1 >= par1World.getHeight() - 1) { return false; } diff --git a/patches/minecraft/net/minecraft/block/BlockRail.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/block/BlockRail.java.patch rename to patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 90d683369..02b9ccd42 100644 --- a/patches/minecraft/net/minecraft/block/BlockRail.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,6 +1,6 @@ ---- ../src_base/minecraft/net/minecraft/block/BlockRail.java -+++ ../src_work/minecraft/net/minecraft/block/BlockRail.java -@@ -3,12 +3,16 @@ +--- ../src_base/minecraft/net/minecraft/block/BlockRailBase.java ++++ ../src_work/minecraft/net/minecraft/block/BlockRailBase.java +@@ -3,6 +3,7 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -8,34 +8,16 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; -+ - public class BlockRail extends Block - { - /** Power related rails have this field at true. */ -@@ -21,7 +25,7 @@ - public static final boolean isRailBlockAt(World par0World, int par1, int par2, int par3) - { - int var4 = par0World.getBlockId(par1, par2, par3); -- return var4 == Block.rail.blockID || var4 == Block.railPowered.blockID || var4 == Block.railDetector.blockID; -+ return isRailBlock(var4); - } - - /** -@@ -29,7 +33,7 @@ +@@ -28,7 +29,7 @@ */ public static final boolean isRailBlock(int par0) { -- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID; -+ return Block.blocksList[par0] instanceof BlockRail; +- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID || par0 == Block.field_94337_cv.blockID; ++ return Block.blocksList[par0] instanceof BlockRailBase; } - protected BlockRail(int par1, int par2, boolean par3) -@@ -126,7 +130,7 @@ + protected BlockRailBase(int par1, boolean par2) +@@ -105,7 +106,7 @@ */ public int getRenderType() { @@ -44,63 +26,12 @@ } /** -@@ -142,7 +146,7 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) - { -- return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); -+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP); +@@ -242,4 +243,107 @@ + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, par5); + } } - - /** -@@ -179,27 +183,27 @@ - - boolean var8 = false; - -- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) -+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP)) - { - var8 = true; - } - -- if (var7 == 2 && !par1World.doesBlockHaveSolidTopSurface(par2 + 1, par3, par4)) -+ if (var7 == 2 && !par1World.isBlockSolidOnSide(par2 + 1, par3, par4, UP)) - { - var8 = true; - } - -- if (var7 == 3 && !par1World.doesBlockHaveSolidTopSurface(par2 - 1, par3, par4)) -+ if (var7 == 3 && !par1World.isBlockSolidOnSide(par2 - 1, par3, par4, UP)) - { - var8 = true; - } - -- if (var7 == 4 && !par1World.doesBlockHaveSolidTopSurface(par2, par3, par4 - 1)) -+ if (var7 == 4 && !par1World.isBlockSolidOnSide(par2, par3, par4 - 1, UP)) - { - var8 = true; - } - -- if (var7 == 5 && !par1World.doesBlockHaveSolidTopSurface(par2, par3, par4 + 1)) -+ if (var7 == 5 && !par1World.isBlockSolidOnSide(par2, par3, par4 + 1, UP)) - { - var8 = true; - } -@@ -400,9 +404,135 @@ - - /** - * Return true if the blocks passed is a power related rail. -- */ -+ * @deprecated -+ * This function is no longer called by Minecraft -+ */ -+ @Deprecated - static boolean isPoweredBlockRail(BlockRail par0BlockRail) - { - return par0BlockRail.isPowered; - } -+ -+ /** ++ ++ /** + * Return true if the rail can make corners. + * Used by placement logic. + * @param world The world. @@ -129,7 +60,7 @@ + } + + /** -+ * Return the rails metadata (without the power bit if the rail uses one). ++ * Return the rail's metadata (without the power bit if the rail uses one). + * Can be used to make the cart think the rail something other than it is, + * for example when making diamond junctions or switches. + * The cart parameter will often be null unless it it called from EntityMinecart. @@ -146,10 +77,6 @@ + * 0x8: EastSouth corner (connecting West and North) + * 0x9: WestSouth corner (connecting East and North) + * -+ * All directions are Notch defined. -+ * In MC Beta 1.8.3 the Sun rises in the North. -+ * In MC 1.0.0 the Sun rises in the East. -+ * + * @param world The world. + * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart. + * @param y The rail X coordinate. @@ -192,23 +119,7 @@ + */ + public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z) + { -+ } -+ -+ /** -+ * Return true if this rail uses the 4th bit as a power bit. -+ * Avoid using this function when getBasicRailMetadata() can be used instead. -+ * The only reason to use this function is if you wish to change the rails metadata. -+ * @param world The world. -+ * @param x The rail X coordinate. -+ * @param y The rail Y coordinate. -+ * @param z The rail Z coordinate. -+ * @return True if the 4th bit is a power bit. -+ */ -+ public boolean hasPowerBit(World world, int x, int y, int z) -+ { -+ return isPowered; -+ } -+ ++ } + + /** + * Forge: Moved render type to a field and a setter. diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch index 2798c9d28..b51a49dac 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src_work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -565,7 +565,7 @@ +@@ -473,7 +473,7 @@ } - else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID) + else if (!Block.redstoneRepeaterIdle.func_94487_f(i1)) { -- return Block.blocksList[var5].canProvidePower() && par4 != -1; -+ return (Block.blocksList[var5] != null && Block.blocksList[var5].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4)); +- return Block.blocksList[i1].canProvidePower() && par4 != -1; ++ return (Block.blocksList[i1] != null && Block.blocksList[i1].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4)); } else { diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index 2a8eb46a8..908cab4cd 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -11,20 +11,20 @@ + +public class BlockReed extends Block implements IPlantable { - protected BlockReed(int par1, int par2) + protected BlockReed(int par1) { -@@ -55,8 +59,8 @@ +@@ -54,8 +58,8 @@ */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- int var5 = par1World.getBlockId(par2, par3 - 1, par4); -- return var5 == this.blockID ? true : (var5 != Block.grass.blockID && var5 != Block.dirt.blockID && var5 != Block.sand.blockID ? false : (par1World.getBlockMaterial(par2 - 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2 + 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2, par3 - 1, par4 - 1) == Material.water ? true : par1World.getBlockMaterial(par2, par3 - 1, par4 + 1) == Material.water)))); +- int l = par1World.getBlockId(par2, par3 - 1, par4); +- return l == this.blockID ? true : (l != Block.grass.blockID && l != Block.dirt.blockID && l != Block.sand.blockID ? false : (par1World.getBlockMaterial(par2 - 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2 + 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2, par3 - 1, par4 - 1) == Material.water ? true : par1World.getBlockMaterial(par2, par3 - 1, par4 + 1) == Material.water)))); + Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; + return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); } /** -@@ -139,4 +143,22 @@ +@@ -138,4 +142,22 @@ { return Item.reed.itemID; } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index cba8037a7..59c0b4a06 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src_work/minecraft/net/minecraft/block/BlockSapling.java -@@ -13,6 +13,8 @@ - import net.minecraft.world.gen.feature.WorldGenTaiga2; +@@ -16,6 +16,8 @@ import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; -+ -+import net.minecraftforge.event.terraingen.TerrainGen; ++import net.minecraftforge.event.terraingen.TerrainGen; ++ public class BlockSapling extends BlockFlower { -@@ -65,6 +67,8 @@ + public static final String[] WOOD_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; +@@ -77,6 +79,8 @@ */ public void growTree(World par1World, int par2, int par3, int par4, Random par5Random) { + if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return; + - int var6 = par1World.getBlockMetadata(par2, par3, par4) & 3; - Object var7 = null; - int var8 = 0; + int l = par1World.getBlockMetadata(par2, par3, par4) & 3; + Object object = null; + int i1 = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch index 76ba9e477..4b4bbd040 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -8,8 +8,8 @@ +import java.util.ArrayList; import java.util.Random; import net.minecraft.block.material.Material; - import net.minecraft.entity.EntityLiving; -@@ -133,11 +135,6 @@ + import net.minecraft.client.renderer.texture.IconRegister; +@@ -135,11 +137,6 @@ } /** @@ -21,8 +21,8 @@ * Called when the block is attempted to be harvested */ public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) -@@ -148,6 +145,8 @@ - par1World.setBlockMetadataWithNotify(par2, par3, par4, par5); +@@ -150,6 +147,8 @@ + par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4); } + dropBlockAsItem(par1World, par2, par3, par4, par5, 0); @@ -30,28 +30,13 @@ super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); } -@@ -156,24 +155,30 @@ +@@ -158,24 +157,30 @@ */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote) - { - if ((par6 & 8) == 0) -- { -- ItemStack var7 = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(par1World, par2, par3, par4)); -- TileEntitySkull var8 = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4); -- -- if (var8.getSkullType() == 3 && var8.getExtraType() != null && var8.getExtraType().length() > 0) -- { -- var7.setTagCompound(new NBTTagCompound()); -- var7.getTagCompound().setString("SkullOwner", var8.getExtraType()); -- } -- -- this.dropBlockAsItem_do(par1World, par2, par3, par4, var7); -- } -- -- super.breakBlock(par1World, par2, par3, par4, par5, par6); -- } + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + @@ -61,19 +46,32 @@ + ArrayList drops = new ArrayList(); + if ((metadata & 8) == 0) + { -+ ItemStack var7 = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(world, x, y, z)); -+ TileEntitySkull var8 = (TileEntitySkull)world.getBlockTileEntity(x, y, z); ++ ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(world, x, y, z)); ++ TileEntitySkull tileentityskull = (TileEntitySkull)world.getBlockTileEntity(x, y, z); + -+ if (var8 == null) -+ { ++ if (tileentityskull == null) + { +- ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(par1World, par2, par3, par4)); +- TileEntitySkull tileentityskull = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4); +- +- if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) +- { +- itemstack.setTagCompound(new NBTTagCompound()); +- itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType()); +- } +- +- this.dropBlockAsItem_do(par1World, par2, par3, par4, itemstack); + return drops; -+ } -+ if (var8.getSkullType() == 3 && var8.getExtraType() != null && var8.getExtraType().length() > 0) + } +- +- super.breakBlock(par1World, par2, par3, par4, par5, par6); +- } ++ if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) + { -+ var7.setTagCompound(new NBTTagCompound()); -+ var7.getTagCompound().setString("SkullOwner", var8.getExtraType()); ++ itemstack.setTagCompound(new NBTTagCompound()); ++ itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType()); + } -+ drops.add(var7); ++ drops.add(itemstack); + } + return drops; } diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index 41df77ecc..af0fb05f4 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,36 +1,42 @@ --- ../src_base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src_work/minecraft/net/minecraft/block/BlockSnow.java -@@ -67,7 +67,8 @@ +@@ -88,8 +88,12 @@ + */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { - int var5 = par1World.getBlockId(par2, par3 - 1, par4); -- return var5 != 0 && (var5 == Block.leaves.blockID || Block.blocksList[var5].isOpaqueCube()) ? par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement() : false; -+ Block block = Block.blocksList[var5]; -+ return block != null && (block.isLeaves(par1World, par2, par3 - 1, par4) || Block.blocksList[var5].isOpaqueCube()) ? par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement() : false; +- int l = par1World.getBlockId(par2, par3 - 1, par4); +- return l == 0 ? false : (l == this.blockID && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7 ? true : (l != Block.leaves.blockID && !Block.blocksList[l].isOpaqueCube() ? false : par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement())); ++ int l = par1World.getBlockId(par2, par3 - 1, par4); ++ Block block = Block.blocksList[l]; ++ if (block == null) return false; ++ if (block == this && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7) return true; ++ if (block.isLeaves(par1World, par2, par3 - 1, par4) && Block.blocksList[l].isOpaqueCube()) return false; ++ return par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement(); } /** -@@ -86,7 +87,6 @@ +@@ -108,7 +112,6 @@ { if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) { - this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlockWithNotify(par2, par3, par4, 0); + par1World.func_94571_i(par2, par3, par4); return false; } -@@ -102,10 +102,8 @@ +@@ -124,11 +127,8 @@ */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { -- int var7 = Item.snowball.itemID; -- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(var7, 1, 0)); +- int i1 = Item.snowball.itemID; +- int j1 = par6 & 7; +- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(i1, j1 + 1, 0)); + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - par1World.setBlockWithNotify(par3, par4, par5, 0); + par1World.func_94571_i(par3, par4, par5); - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); } /** -@@ -121,7 +119,7 @@ +@@ -144,7 +144,7 @@ */ public int quantityDropped(Random par1Random) { @@ -39,11 +45,22 @@ } /** -@@ -131,7 +129,6 @@ +@@ -154,7 +154,6 @@ { if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) { - this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlockWithNotify(par2, par3, par4, 0); + par1World.func_94571_i(par2, par3, par4); } } +@@ -169,4 +168,10 @@ + { + return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } ++ ++ @Override ++ public int quantityDropped(int meta, int fortune, Random random) ++ { ++ return (meta & 7) + 1; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index b7e7578c8..3e8e0ad06 100644 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -7,9 +7,9 @@ + +import java.util.ArrayList; import java.util.Random; + import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.item.Item; -@@ -9,6 +11,8 @@ +@@ -12,6 +14,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -18,38 +18,38 @@ public class BlockStem extends BlockFlower { /** Defines if it is a Melon or a Pumpkin that the stem is producing. */ -@@ -101,7 +105,8 @@ +@@ -106,7 +110,8 @@ - int var11 = par1World.getBlockId(var9, par3 - 1, var10); + int l1 = par1World.getBlockId(j1, par3 - 1, k1); -- if (par1World.getBlockId(var9, par3, var10) == 0 && (var11 == Block.tilledField.blockID || var11 == Block.dirt.blockID || var11 == Block.grass.blockID)) -+ boolean isSoil = (blocksList[var11] != null && blocksList[var11].canSustainPlant(par1World, var9, par3 - 1, var10, ForgeDirection.UP, this)); -+ if (par1World.getBlockId(var9, par3, var10) == 0 && (isSoil || var11 == Block.dirt.blockID || var11 == Block.grass.blockID)) +- if (par1World.getBlockId(j1, par3, k1) == 0 && (l1 == Block.tilledField.blockID || l1 == Block.dirt.blockID || l1 == Block.grass.blockID)) ++ boolean isSoil = (blocksList[l1] != null && blocksList[l1].canSustainPlant(par1World, j1, par3 - 1, k1, ForgeDirection.UP, this)); ++ if (par1World.getBlockId(j1, par3, k1) == 0 && (isSoil || l1 == Block.dirt.blockID || l1 == Block.grass.blockID)) { - par1World.setBlockWithNotify(var9, par3, var10, this.fruitType.blockID); + par1World.func_94575_c(j1, par3, k1, this.fruitType.blockID); } -@@ -137,11 +142,11 @@ - int var19 = par1World.getBlockId(var17, par3 - 1, var18); - float var20 = 0.0F; +@@ -149,11 +154,11 @@ + int j3 = par1World.getBlockId(l2, par3 - 1, i3); + float f1 = 0.0F; -- if (var19 == Block.tilledField.blockID) -+ if (blocksList[var19] != null && blocksList[var19].canSustainPlant(par1World, var17, par3 - 1, var18, ForgeDirection.UP, this)) +- if (j3 == Block.tilledField.blockID) ++ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this)) { - var20 = 1.0F; + f1 = 1.0F; -- if (par1World.getBlockMetadata(var17, par3 - 1, var18) > 0) -+ if (blocksList[var19].isFertile(par1World, var17, par3 - 1, var18)) +- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0) ++ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3)) { - var20 = 3.0F; + f1 = 3.0F; } -@@ -241,29 +246,22 @@ +@@ -245,29 +250,22 @@ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); - - if (!par1World.isRemote) - { -- Item var8 = null; +- Item item = null; - - if (this.fruitType == Block.pumpkin) + } @@ -63,20 +63,20 @@ + { + if (world.rand.nextInt(15) <= metadata) { -- var8 = Item.pumpkinSeeds; +- item = Item.pumpkinSeeds; + ret.add(new ItemStack(fruitType == pumpkin ? Item.pumpkinSeeds : Item.melonSeeds)); } - - if (this.fruitType == Block.melon) - { -- var8 = Item.melonSeeds; +- item = Item.melonSeeds; - } - -- for (int var9 = 0; var9 < 3; ++var9) +- for (int j1 = 0; j1 < 3; ++j1) - { - if (par1World.rand.nextInt(15) <= par5) - { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var8)); +- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(item)); - } - } - } diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index cc3b61a75..c51652dfb 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -9,7 +9,7 @@ import java.util.List; import java.util.Random; import net.minecraft.block.material.Material; -@@ -15,7 +17,10 @@ +@@ -17,7 +19,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -19,9 +19,9 @@ + +public class BlockTallGrass extends BlockFlower implements IShearable { - protected BlockTallGrass(int par1, int par2) - { -@@ -37,7 +42,7 @@ + private static final String[] field_94367_a = new String[] {"deadbush", "tallgrass", "fern"}; + @SideOnly(Side.CLIENT) +@@ -50,7 +55,7 @@ */ public int idDropped(int par1, Random par2Random, int par3) { @@ -30,7 +30,7 @@ } /** -@@ -54,15 +59,7 @@ +@@ -67,15 +72,7 @@ */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { @@ -47,8 +47,8 @@ } @SideOnly(Side.CLIENT) -@@ -115,4 +112,35 @@ - par3List.add(new ItemStack(par1, 1, var4)); +@@ -139,4 +136,35 @@ + this.field_94366_b[i] = par1IconRegister.func_94245_a(field_94367_a[i]); } } + diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index 0077ed901..4e058172e 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -9,13 +9,13 @@ + public class BlockTorch extends Block { - protected BlockTorch(int par1, int par2) + protected BlockTorch(int par1) @@ -65,7 +68,7 @@ else { - int var5 = par1World.getBlockId(par2, par3, par4); -- return var5 == Block.fence.blockID || var5 == Block.netherFence.blockID || var5 == Block.glass.blockID || var5 == Block.cobblestoneWall.blockID; -+ return (Block.blocksList[var5] != null && Block.blocksList[var5].canPlaceTorchOnTop(par1World, par2, par3, par4)); + int l = par1World.getBlockId(par2, par3, par4); +- return l == Block.fence.blockID || l == Block.netherFence.blockID || l == Block.glass.blockID || l == Block.cobblestoneWall.blockID; ++ return (Block.blocksList[l] != null && Block.blocksList[l].canPlaceTorchOnTop(par1World, par2, par3, par4)); } } @@ -33,31 +33,31 @@ /** @@ -89,22 +96,22 @@ - var10 = 5; + j1 = 5; } - if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) + if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) { - var10 = 4; + j1 = 4; } - if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) + if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) { - var10 = 3; + j1 = 3; } - if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) + if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true)) { - var10 = 2; + j1 = 2; } - if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) + if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true)) { - var10 = 1; + j1 = 1; } @@ -132,19 +139,19 @@ { @@ -66,59 +66,59 @@ - if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) + if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 1); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2); } - else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) + else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 2); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); } - else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) + else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 3); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); } - else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) + else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); } -@@ -168,22 +175,22 @@ - int var6 = par1World.getBlockMetadata(par2, par3, par4); - boolean var7 = false; +@@ -173,22 +180,22 @@ + int i1 = par1World.getBlockMetadata(par2, par3, par4); + boolean flag = false; -- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && var6 == 1) +- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && i1 == 1) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && var6 == 2) +- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && i1 == 2) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && var6 == 3) +- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && i1 == 3) - { -- var7 = true; +- flag = true; - } - -- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && var6 == 4) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) && var6 == 1) +- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && i1 == 4) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) && i1 == 1) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) && var6 == 2) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) && i1 == 2) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) && var6 == 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) && i1 == 3) + { -+ var7 = true; ++ flag = true; + } + -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) && var6 == 4) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) && i1 == 4) { - var7 = true; + flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index 4e3f5678a..630288778 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -14,16 +14,16 @@ protected BlockTrapDoor(int par1, Material par2Material) { super(par1, par2Material); -@@ -201,7 +206,7 @@ - --var7; +@@ -194,7 +199,7 @@ + --j1; } -- if (!isValidSupportBlock(par1World.getBlockId(var7, par3, var8))) -+ if (!(isValidSupportBlock(par1World.getBlockId(var7, par3, var8)) || par1World.isBlockSolidOnSide(var7, par3, var8, ForgeDirection.getOrientation((var6 & 3) + 2)))) +- if (!isValidSupportBlock(par1World.getBlockId(j1, par3, k1))) ++ if (!(isValidSupportBlock(par1World.getBlockId(j1, par3, k1)) || par1World.isBlockSolidOnSide(j1, par3, k1, ForgeDirection.getOrientation((i1 & 3) + 2)))) { - par1World.setBlockWithNotify(par2, par3, par4, 0); - this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); -@@ -266,6 +271,10 @@ + par1World.func_94571_i(par2, par3, par4); + this.dropBlockAsItem(par1World, par2, par3, par4, i1, 0); +@@ -259,6 +264,10 @@ */ public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { @@ -34,7 +34,7 @@ if (par5 == 0) { return false; -@@ -296,7 +305,7 @@ +@@ -289,7 +298,7 @@ --par2; } @@ -43,7 +43,7 @@ } } -@@ -311,6 +320,10 @@ +@@ -304,6 +313,10 @@ */ private static boolean isValidSupportBlock(int par0) { diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch index 0fbaceabd..626228d4d 100644 --- a/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch @@ -37,64 +37,64 @@ /** @@ -82,22 +92,22 @@ { - byte var10 = 0; + byte b0 = 0; - if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) + if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, WEST, true)) { - var10 = 2; + b0 = 2; } - if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) + if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, EAST, true)) { - var10 = 0; + b0 = 0; } - if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) + if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, NORTH, true)) { - var10 = 1; + b0 = 1; } - if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) + if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, SOUTH, true)) { - var10 = 3; + b0 = 3; } @@ -127,22 +137,22 @@ - int var7 = var6 & 3; - boolean var8 = false; + int j1 = i1 & 3; + boolean flag = false; -- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var7 == 3) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, SOUTH) && var7 == 3) +- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && j1 == 3) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, SOUTH) && j1 == 3) { - var8 = true; + flag = true; } -- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var7 == 1) -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, NORTH) && var7 == 1) +- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && j1 == 1) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, NORTH) && j1 == 1) { - var8 = true; + flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var7 == 0) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, EAST) && var7 == 0) +- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && j1 == 0) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, EAST) && j1 == 0) { - var8 = true; + flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var7 == 2) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, WEST) && var7 == 2) +- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && j1 == 2) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, WEST) && j1 == 2) { - var8 = true; + flag = true; } @@ -163,7 +173,7 @@ - boolean var12 = (par6 & 8) == 8; - boolean var13 = par5 == Block.tripWireSource.blockID; - boolean var14 = false; -- boolean var15 = !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); -+ boolean var15 = !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP); - int var16 = Direction.offsetX[var10]; - int var17 = Direction.offsetZ[var10]; - int var18 = 0; + boolean flag2 = (par6 & 8) == 8; + boolean flag3 = par5 == Block.tripWireSource.blockID; + boolean flag4 = false; +- boolean flag5 = !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); ++ boolean flag5 = !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP); + int i2 = Direction.offsetX[l1]; + int j2 = Direction.offsetZ[l1]; + int k2 = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index cefc92bc4..3a004fc5d 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -33,7 +33,6 @@ - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } -- } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + @@ -55,5 +54,5 @@ + public boolean isLadder(World world, int x, int y, int z) + { + return true; -+ } + } } diff --git a/patches/minecraft/net/minecraft/block/RailLogic.java.patch b/patches/minecraft/net/minecraft/block/RailLogic.java.patch deleted file mode 100644 index bb15e0c1a..000000000 --- a/patches/minecraft/net/minecraft/block/RailLogic.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/block/RailLogic.java -+++ ../src_work/minecraft/net/minecraft/block/RailLogic.java -@@ -20,6 +20,7 @@ - private List connectedTracks; - - final BlockRail rail; -+ private final boolean canMakeSlopes; - - public RailLogic(BlockRail par1BlockRail, World par2World, int par3, int par4, int par5) - { -@@ -30,18 +31,11 @@ - this.trackY = par4; - this.trackZ = par5; - int var6 = par2World.getBlockId(par3, par4, par5); -- int var7 = par2World.getBlockMetadata(par3, par4, par5); -- -- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[var6])) -- { -- this.isPoweredRail = true; -- var7 &= -9; -- } -- else -- { -- this.isPoweredRail = false; -- } -- -+ -+ BlockRail target = (BlockRail)Block.blocksList[var6]; -+ int var7 = target.getBasicRailMetadata(par2World, null, par3, par4, par5); -+ isPoweredRail = !target.isFlexibleRail(par2World, par3, par4, par5); -+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5); - this.setConnections(var7); - } - -@@ -260,7 +254,7 @@ - } - } - -- if (var6 == 0) -+ if (var6 == 0 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1)) - { -@@ -273,7 +267,7 @@ - } - } - -- if (var6 == 1) -+ if (var6 == 1 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ)) - { -@@ -424,7 +418,7 @@ - } - } - -- if (var7 == 0) -+ if (var7 == 0 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1)) - { -@@ -437,7 +431,7 @@ - } - } - -- if (var7 == 1) -+ if (var7 == 1 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ)) - { diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 8fb8de5f7..a456d29d0 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,61 +1,46 @@ --- ../src_base/minecraft/net/minecraft/client/Minecraft.java +++ ../src_work/minecraft/net/minecraft/client/Minecraft.java -@@ -128,6 +128,12 @@ +@@ -123,6 +123,10 @@ import com.google.common.collect.MapDifference; +import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -+import net.minecraftforge.event.world.WorldEvent; + @SideOnly(Side.CLIENT) public abstract class Minecraft implements Runnable, IPlayerUsage { -@@ -1253,7 +1259,7 @@ +@@ -1237,7 +1241,7 @@ - if (this.thePlayer.canCurrentToolHarvestBlock(var3, var4, var5)) + if (this.thePlayer.canCurrentToolHarvestBlock(j, k, l)) { -- this.effectRenderer.addBlockHitEffects(var3, var4, var5, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(var3, var4, var5, this.objectMouseOver); +- this.effectRenderer.addBlockHitEffects(j, k, l, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(j, k, l, this.objectMouseOver); this.thePlayer.swingItem(); } } -@@ -1319,7 +1325,8 @@ +@@ -1303,7 +1307,8 @@ { - int var8 = var3 != null ? var3.stackSize : 0; + int j1 = itemstack != null ? itemstack.stackSize : 0; -- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec)) -+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, var4, var5, var6, var7).isCanceled(); -+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec)) +- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, i1, this.objectMouseOver.hitVec)) ++ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, j, k, l, i1).isCanceled(); ++ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, i1, this.objectMouseOver.hitVec)) { - var2 = false; + flag = false; this.thePlayer.swingItem(); -@@ -1345,7 +1352,8 @@ +@@ -1329,7 +1334,8 @@ { - ItemStack var9 = this.thePlayer.inventory.getCurrentItem(); + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); -- if (var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9)) +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled(); -+ if (result && var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9)) ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -@@ -2026,6 +2034,12 @@ - - if (par1WorldClient == null) - { -+ -+ if (theWorld != null) -+ { -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(theWorld)); -+ } -+ - NetClientHandler var3 = this.getSendQueue(); - - if (var3 != null) -@@ -2041,6 +2055,18 @@ +@@ -2026,6 +2032,18 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); @@ -74,103 +59,111 @@ } this.theIntegratedServer = null; -@@ -2350,95 +2376,12 @@ +@@ -2353,103 +2371,12 @@ if (this.objectMouseOver != null) { - boolean var1 = this.thePlayer.capabilities.isCreativeMode; -- int var3 = 0; -- boolean var4 = false; -- int var2; - int var5; + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- int j; + int k; - if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE) - { -- var5 = this.objectMouseOver.blockX; -- int var6 = this.objectMouseOver.blockY; -- int var7 = this.objectMouseOver.blockZ; -- Block var8 = Block.blocksList[this.theWorld.getBlockId(var5, var6, var7)]; +- k = this.objectMouseOver.blockX; +- int l = this.objectMouseOver.blockY; +- int i1 = this.objectMouseOver.blockZ; +- Block block = Block.blocksList[this.theWorld.getBlockId(k, l, i1)]; - -- if (var8 == null) +- if (block == null) - { - return; - } - -- var2 = var8.idPicked(this.theWorld, var5, var6, var7); +- j = block.idPicked(this.theWorld, k, l, i1); - -- if (var2 == 0) +- if (j == 0) - { - return; - } - -- var4 = Item.itemsList[var2].getHasSubtypes(); -- int var9 = var2 < 256 && !Block.blocksList[var8.blockID].func_82505_u_() ? var2 : var8.blockID; -- var3 = Block.blocksList[var9].getDamageValue(this.theWorld, var5, var6, var7); +- flag1 = Item.itemsList[j].getHasSubtypes(); +- int j1 = j < 256 && !Block.blocksList[block.blockID].func_82505_u_() ? j : block.blockID; +- i = Block.blocksList[j1].getDamageValue(this.theWorld, k, l, i1); - } - else - { -- if (this.objectMouseOver.typeOfHit != EnumMovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !var1) +- if (this.objectMouseOver.typeOfHit != EnumMovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) - { - return; - } - - if (this.objectMouseOver.entityHit instanceof EntityPainting) - { -- var2 = Item.painting.itemID; +- j = Item.painting.itemID; - } - else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) - { -- EntityItemFrame var10 = (EntityItemFrame)this.objectMouseOver.entityHit; +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; - -- if (var10.getDisplayedItem() == null) +- if (entityitemframe.getDisplayedItem() == null) - { -- var2 = Item.itemFrame.itemID; +- j = Item.itemFrame.itemID; - } - else - { -- var2 = var10.getDisplayedItem().itemID; -- var3 = var10.getDisplayedItem().getItemDamage(); -- var4 = true; +- j = entityitemframe.getDisplayedItem().itemID; +- i = entityitemframe.getDisplayedItem().getItemDamage(); +- flag1 = true; - } - } - else if (this.objectMouseOver.entityHit instanceof EntityMinecart) - { -- EntityMinecart var11 = (EntityMinecart)this.objectMouseOver.entityHit; +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; - -- if (var11.minecartType == 2) +- if (entityminecart.func_94087_l() == 2) - { -- var2 = Item.minecartPowered.itemID; +- j = Item.minecartPowered.itemID; - } -- else if (var11.minecartType == 1) +- else if (entityminecart.func_94087_l() == 1) - { -- var2 = Item.minecartCrate.itemID; +- j = Item.minecartCrate.itemID; +- } +- else if (entityminecart.func_94087_l() == 3) +- { +- j = Item.field_94582_cb.itemID; +- } +- else if (entityminecart.func_94087_l() == 5) +- { +- j = Item.field_96600_cc.itemID; - } - else - { -- var2 = Item.minecartEmpty.itemID; +- j = Item.minecartEmpty.itemID; - } - } - else if (this.objectMouseOver.entityHit instanceof EntityBoat) - { -- var2 = Item.boat.itemID; +- j = Item.boat.itemID; - } - else - { -- var2 = Item.monsterPlacer.itemID; -- var3 = EntityList.getEntityID(this.objectMouseOver.entityHit); -- var4 = true; +- j = Item.monsterPlacer.itemID; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; - -- if (var3 <= 0 || !EntityList.entityEggs.containsKey(Integer.valueOf(var3))) +- if (i <= 0 || !EntityList.entityEggs.containsKey(Integer.valueOf(i))) - { - return; - } - } - } - -- this.thePlayer.inventory.setCurrentItem(var2, var3, var4, var1); +- this.thePlayer.inventory.setCurrentItem(j, i, flag1, flag); + if (!ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) + { + return; + } - if (var1) + if (flag) { diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 924a38e2f..50a91c5ce 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -39,67 +39,67 @@ + ModCompatibilityClient.audioModAddCodecs(); + MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this)); sndSystem = new SoundSystem(); - this.options.soundVolume = var1; - this.options.musicVolume = var2; + this.options.soundVolume = f; + this.options.musicVolume = f1; @@ -177,10 +187,12 @@ } - SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound(); -+ var1 = ModCompatibilityClient.audioModPickBackgroundMusic(this, var1); -+ var1 = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, var1)); + SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound(); ++ soundpoolentry = ModCompatibilityClient.audioModPickBackgroundMusic(this, soundpoolentry); ++ soundpoolentry = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, soundpoolentry)); - if (var1 != null) + if (soundpoolentry != null) { - this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000; + this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL; - sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false); + sndSystem.backgroundMusic("BgMusic", soundpoolentry.soundUrl, soundpoolentry.soundName, false); sndSystem.setVolume("BgMusic", this.options.musicVolume); sndSystem.play("BgMusic"); @@ -247,6 +259,7 @@ if (par1Str != null) { - SoundPoolEntry var6 = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str); -+ var6 = SoundEvent.getResult(new PlayStreamingEvent(this, var6, par1Str, par2, par3, par4)); + SoundPoolEntry soundpoolentry = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str); ++ soundpoolentry = SoundEvent.getResult(new PlayStreamingEvent(this, soundpoolentry, par1Str, par2, par3, par4)); - if (var6 != null) + if (soundpoolentry != null) { @@ -258,6 +271,7 @@ - float var7 = 16.0F; - sndSystem.newStreamingSource(true, var5, var6.soundUrl, var6.soundName, false, par2, par3, par4, 2, var7 * 4.0F); - sndSystem.setVolume(var5, 0.5F * this.options.soundVolume); -+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, var5, par2, par3, par4)); - sndSystem.play(var5); + float f3 = 16.0F; + sndSystem.newStreamingSource(true, s1, soundpoolentry.soundUrl, soundpoolentry.soundName, false, par2, par3, par4, 2, f3 * 4.0F); + sndSystem.setVolume(s1, 0.5F * this.options.soundVolume); ++ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, s1, par2, par3, par4)); + sndSystem.play(s1); } } @@ -437,6 +451,7 @@ if (loaded && this.options.soundVolume != 0.0F) { - SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); -+ var7 = SoundEvent.getResult(new PlaySoundEvent(this, var7, par1Str, par2, par3, par4, par5, par6)); + SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); ++ soundpoolentry = SoundEvent.getResult(new PlaySoundEvent(this, soundpoolentry, par1Str, par2, par3, par4, par5, par6)); - if (var7 != null && par5 > 0.0F) + if (soundpoolentry != null && par5 > 0.0F) { @@ -458,6 +473,7 @@ } - sndSystem.setVolume(var8, par5 * this.options.soundVolume); -+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, var8, par2, par3, par4)); - sndSystem.play(var8); + sndSystem.setVolume(s1, par5 * this.options.soundVolume); ++ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, s1, par2, par3, par4)); + sndSystem.play(s1); } } @@ -472,6 +488,7 @@ if (loaded && this.options.soundVolume != 0.0F) { - SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); -+ var4 = SoundEvent.getResult(new PlaySoundEffectEvent(this, var4, par1Str, par2, par3)); + SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); ++ soundpoolentry = SoundEvent.getResult(new PlaySoundEffectEvent(this, soundpoolentry, par1Str, par2, par3)); - if (var4 != null) + if (soundpoolentry != null) { @@ -487,6 +504,7 @@ par2 *= 0.25F; - sndSystem.setPitch(var5, par3); - sndSystem.setVolume(var5, par2 * this.options.soundVolume); -+ MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, var5)); - sndSystem.play(var5); + sndSystem.setPitch(s1, par3); + sndSystem.setVolume(s1, par2 * this.options.soundVolume); ++ MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, s1)); + sndSystem.play(s1); } } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch index 9adb38052..996a89563 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch @@ -34,20 +34,20 @@ + { try { - String var3 = par1Str; + String s1 = par1Str; @@ -56,13 +77,13 @@ this.nameToSoundPoolEntriesMapping.put(par1Str, new ArrayList()); } -- SoundPoolEntry var4 = new SoundPoolEntry(var3, par2File.toURI().toURL()); -+ SoundPoolEntry var4 = new SoundPoolEntry(var3, url); - ((List)this.nameToSoundPoolEntriesMapping.get(par1Str)).add(var4); - this.allSoundPoolEntries.add(var4); +- SoundPoolEntry soundpoolentry = new SoundPoolEntry(s1, par2File.toURI().toURL()); ++ SoundPoolEntry soundpoolentry = new SoundPoolEntry(s1, url); + ((List)this.nameToSoundPoolEntriesMapping.get(par1Str)).add(soundpoolentry); + this.allSoundPoolEntries.add(soundpoolentry); ++this.numberOfSoundPoolEntries; - return var4; + return soundpoolentry; } -- catch (MalformedURLException var5) -+ catch (Exception var5) +- catch (MalformedURLException malformedurlexception) ++ catch (Exception malformedurlexception) { - var5.printStackTrace(); - throw new RuntimeException(var5); + malformedurlexception.printStackTrace(); + throw new RuntimeException(malformedurlexception); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch index c34aa49ab..15351f39a 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch @@ -1,15 +1,15 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiControls.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiControls.java -@@ -5,6 +5,8 @@ - import net.minecraft.client.settings.GameSettings; +@@ -6,6 +6,8 @@ import net.minecraft.client.settings.KeyBinding; + import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringTranslate; + +import net.minecraftforge.client.GuiControlsScrollPanel; @SideOnly(Side.CLIENT) public class GuiControls extends GuiScreen -@@ -23,6 +25,8 @@ +@@ -24,6 +26,8 @@ /** The ID of the button that has been pressed. */ private int buttonId = -1; @@ -18,34 +18,36 @@ public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings) { this.parentScreen = par1GuiScreen; -@@ -39,15 +43,12 @@ +@@ -40,15 +44,10 @@ */ public void initGui() { + scrollPane = new GuiControlsScrollPanel(this, options, mc); - StringTranslate var1 = StringTranslate.getInstance(); - int var2 = this.func_73907_g(); - -- for (int var3 = 0; var3 < this.options.keyBindings.length; ++var3) + StringTranslate stringtranslate = StringTranslate.getInstance(); +- int i = this.func_73907_g(); +- +- for (int j = 0; j < this.options.keyBindings.length; ++j) - { -- this.controlList.add(new GuiSmallButton(var3, var2 + var3 % 2 * 160, this.height / 6 + 24 * (var3 >> 1), 70, 20, this.options.getOptionDisplayString(var3))); +- this.buttonList.add(new GuiSmallButton(j, i + j % 2 * 160, this.height / 6 + 24 * (j >> 1), 70, 20, this.options.getOptionDisplayString(j))); - } - -- this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done"))); -+ this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, var1.translateKey("gui.done"))); -+ scrollPane.registerScrollButtons(controlList, 7, 8); - this.screenTitle = var1.translateKey("controls.title"); +- this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, stringtranslate.translateKey("gui.done"))); ++ this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, stringtranslate.translateKey("gui.done"))); ++ scrollPane.registerScrollButtons(buttonList, 7, 8); + this.screenTitle = stringtranslate.translateKey("controls.title"); } -@@ -56,19 +57,9 @@ +@@ -56,20 +55,10 @@ + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). */ protected void actionPerformed(GuiButton par1GuiButton) - { -- for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2) +- { +- for (int i = 0; i < this.options.keyBindings.length; ++i) - { -- ((GuiButton)this.controlList.get(var2)).displayString = this.options.getOptionDisplayString(var2); +- ((GuiButton)this.buttonList.get(i)).displayString = this.options.getOptionDisplayString(i); - } - ++ { if (par1GuiButton.id == 200) { this.mc.displayGuiScreen(this.parentScreen); @@ -57,14 +59,14 @@ } } -@@ -77,17 +68,7 @@ +@@ -78,17 +67,7 @@ */ protected void mouseClicked(int par1, int par2, int par3) { - if (this.buttonId >= 0) - { - this.options.setKeyBinding(this.buttonId, -100 + par3); -- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); +- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); - this.buttonId = -1; - KeyBinding.resetKeyBindingArrayAndHash(); - } @@ -76,14 +78,14 @@ } /** -@@ -95,14 +76,7 @@ +@@ -96,14 +75,7 @@ */ protected void keyTyped(char par1, int par2) { - if (this.buttonId >= 0) - { - this.options.setKeyBinding(this.buttonId, par2); -- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); +- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); - this.buttonId = -1; - KeyBinding.resetKeyBindingArrayAndHash(); - } @@ -92,53 +94,22 @@ { super.keyTyped(par1, par2); } -@@ -114,47 +88,8 @@ +@@ -115,6 +87,7 @@ public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); -- this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); -- int var4 = this.func_73907_g(); -- int var5 = 0; -- -- while (var5 < this.options.keyBindings.length) -- { -- boolean var6 = false; -- int var7 = 0; -- -- while (true) -- { -- if (var7 < this.options.keyBindings.length) -- { -- if (var7 == var5 || this.options.keyBindings[var5].keyCode != this.options.keyBindings[var7].keyCode) -- { -- ++var7; -- continue; -- } -- -- var6 = true; -- } -- -- if (this.buttonId == var5) -- { -- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7f> \u00a7e??? \u00a7f<"; -- } -- else if (var6) -- { -- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7c" + this.options.getOptionDisplayString(var5); -- } -- else -- { -- ((GuiButton)this.controlList.get(var5)).displayString = this.options.getOptionDisplayString(var5); -- } -- -- this.drawString(this.fontRenderer, this.options.getKeyBindingDescription(var5), var4 + var5 % 2 * 160 + 70 + 6, this.height / 6 + 24 * (var5 >> 1) + 7, -1); -- ++var5; -- break; -- } -- } -- ++ /* Forge Start: Moved all rendering to GuiControlsScrollPanel + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); + int k = this.func_73907_g(); + int l = 0; +@@ -155,6 +128,10 @@ + break; + } + } ++ */ + scrollPane.drawScreen(par1, par2, par3); + drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff); ++ //Forge End + super.drawScreen(par1, par2, par3); } - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index acf40ed96..f5d3ee699 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,20 +1,21 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -375,7 +375,7 @@ +@@ -377,7 +377,7 @@ } else if (par1GuiButton.id == 8) { -- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.field_82290_a)); +- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse)); + WorldType.worldTypes[this.worldTypeId].onCustomizeButton(this.mc, this); } } } -@@ -393,7 +393,7 @@ +@@ -395,7 +395,8 @@ this.buttonBonusItems.drawButton = this.moreOptions; this.buttonWorldType.drawButton = this.moreOptions; this.buttonAllowCommands.drawButton = this.moreOptions; - this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT; + this.buttonCustomize.drawButton = this.moreOptions && (WorldType.worldTypes[this.worldTypeId].isCustomizable()); - StringTranslate var2; ++ + StringTranslate stringtranslate; if (this.moreOptions) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch index e5afd60c3..e8fa229d8 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiIngame.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiIngame.java -@@ -26,6 +26,8 @@ +@@ -34,6 +34,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -9,12 +9,12 @@ @SideOnly(Side.CLIENT) public class GuiIngame extends Gui { -@@ -159,7 +161,7 @@ +@@ -170,7 +172,7 @@ - var47 = var7 - 39; - var22 = var47 - 10; -- var23 = this.mc.thePlayer.getTotalArmorValue(); -+ var23 = ForgeHooks.getTotalArmorValue(mc.thePlayer); - var24 = -1; + k3 = l - 39; + l2 = k3 - 10; +- k2 = this.mc.thePlayer.getTotalArmorValue(); ++ k2 = ForgeHooks.getTotalArmorValue(mc.thePlayer); + i3 = -1; if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 3208f0186..fdca2ca10 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -12,20 +12,20 @@ @@ -332,16 +334,7 @@ GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); - Tessellator var18 = Tessellator.instance; -- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/background.png")); + Tessellator tessellator = Tessellator.instance; +- this.mc.renderEngine.func_98187_b("/gui/background.png"); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -- float var17 = 32.0F; -- var18.startDrawingQuads(); -- var18.setColorOpaque_I(2105376); -- var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.amountScrolled) / var17)); -- var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.amountScrolled) / var17)); -- var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.amountScrolled) / var17)); -- var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.amountScrolled) / var17)); -- var18.draw(); -+ drawContainerBackground(var18); - var9 = this.width / 2 - 92 - 16; - var10 = this.top + 4 - (int)this.amountScrolled; +- float f1 = 32.0F; +- tessellator.startDrawingQuads(); +- tessellator.setColorOpaque_I(2105376); +- tessellator.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- tessellator.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- tessellator.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- tessellator.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- tessellator.draw(); ++ drawContainerBackground(tessellator); + j1 = this.width / 2 - 92 - 16; + k1 = this.top + 4 - (int)this.amountScrolled; @@ -470,10 +463,10 @@ /** @@ -34,20 +34,20 @@ - private void overlayBackground(int par1, int par2, int par3, int par4) + protected void overlayBackground(int par1, int par2, int par3, int par4) { - Tessellator var5 = Tessellator.instance; -- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/background.png")); -+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(BACKGROUND_IMAGE)); + Tessellator tessellator = Tessellator.instance; +- this.mc.renderEngine.func_98187_b("/gui/background.png"); ++ this.mc.renderEngine.func_98187_b(BACKGROUND_IMAGE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - float var6 = 32.0F; - var5.startDrawingQuads(); + float f = 32.0F; + tessellator.startDrawingQuads(); @@ -485,4 +478,18 @@ - var5.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / var6)); - var5.draw(); + tessellator.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / f)); + tessellator.draw(); } + + protected void drawContainerBackground(Tessellator tess) + { -+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(BACKGROUND_IMAGE)); ++ this.mc.renderEngine.func_98187_b(BACKGROUND_IMAGE); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float height = 32.0F; + tess.startDrawingQuads(); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index c307523eb..207acf878 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -10,7 +10,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -@@ -19,6 +22,8 @@ +@@ -20,6 +23,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -19,21 +19,21 @@ @SideOnly(Side.CLIENT) public class GuiAchievements extends GuiScreen { -@@ -55,6 +60,10 @@ - /** Whether the Mouse Button is down or not */ +@@ -57,6 +62,10 @@ private int isMouseButtonDown = 0; private StatFileWriter statFileWriter; -+ + + private int currentPage = -1; + private GuiSmallButton button; + private LinkedList minecraftAchievements = new LinkedList(); - ++ public GuiAchievements(StatFileWriter par1StatFileWriter) { -@@ -63,6 +72,14 @@ - short var3 = 141; - this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - var2 / 2 - 12); - this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - var3 / 2); + this.statFileWriter = par1StatFileWriter; +@@ -64,6 +73,14 @@ + short short2 = 141; + this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12); + this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2); + minecraftAchievements.clear(); + for (Object achievement : AchievementList.achievementList) + { @@ -45,15 +45,15 @@ } /** -@@ -72,6 +89,7 @@ +@@ -73,6 +90,7 @@ { - this.controlList.clear(); - this.controlList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done"))); -+ this.controlList.add(button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); + this.buttonList.clear(); + this.buttonList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done"))); ++ this.buttonList.add(button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); } /** -@@ -83,6 +101,16 @@ +@@ -84,6 +102,16 @@ { this.mc.displayGuiScreen((GuiScreen)null); this.mc.setIngameFocus(); @@ -70,34 +70,34 @@ } super.actionPerformed(par1GuiButton); -@@ -307,11 +335,12 @@ - int var27; - int var30; +@@ -306,11 +334,12 @@ + int i4; + int j4; -- for (var22 = 0; var22 < AchievementList.achievementList.size(); ++var22) +- for (i3 = 0; i3 < AchievementList.achievementList.size(); ++i3) - { -- Achievement var33 = (Achievement)AchievementList.achievementList.get(var22); +- Achievement achievement = (Achievement)AchievementList.achievementList.get(i3); - -- if (var33.parentAchievement != null) +- if (achievement.parentAchievement != null) + List achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (var22 = 0; var22 < achievementList.size(); ++var22) ++ for (i3 = 0; i3 < achievementList.size(); ++i3) + { -+ Achievement var33 = achievementList.get(var22); ++ Achievement achievement = achievementList.get(i3); + -+ if (var33.parentAchievement != null && achievementList.contains(var33.parentAchievement)) ++ if (achievement.parentAchievement != null && achievementList.contains(achievement.parentAchievement)) { - var24 = var33.displayColumn * 24 - var4 + 11 + var10; - var25 = var33.displayRow * 24 - var5 + 11 + var11; -@@ -345,9 +374,9 @@ - int var42; - int var41; + k3 = achievement.displayColumn * 24 - k + 11 + k1; + j3 = achievement.displayRow * 24 - l + 11 + l1; +@@ -344,9 +373,9 @@ + int l4; + int i5; -- for (var24 = 0; var24 < AchievementList.achievementList.size(); ++var24) +- for (k3 = 0; k3 < AchievementList.achievementList.size(); ++k3) - { -- Achievement var35 = (Achievement)AchievementList.achievementList.get(var24); -+ for (var24 = 0; var24 < achievementList.size(); ++var24) +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(k3); ++ for (k3 = 0; k3 < achievementList.size(); ++k3) + { -+ Achievement var35 = achievementList.get(var24); - var26 = var35.displayColumn * 24 - var4; - var27 = var35.displayRow * 24 - var5; ++ Achievement achievement2 = (Achievement)achievementList.get(k3); + j4 = achievement2.displayColumn * 24 - k; + l3 = achievement2.displayRow * 24 - l; diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch deleted file mode 100644 index d330fa6f7..000000000 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -+++ ../src_work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -333,7 +333,7 @@ - if (var6 >= 0) - { - GL11.glDisable(GL11.GL_LIGHTING); -- this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/gui/items.png")); -+ this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(par1Slot.getBackgroundIconTexture())); - this.drawTexturedModalRect(var2, var3, var6 % 16 * 16, var6 / 16 * 16, 16, 16); - GL11.glEnable(GL11.GL_LIGHTING); - var5 = true; diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 6520db4c6..14dd0556f 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +++ ../src_work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -55,6 +55,8 @@ +@@ -56,6 +56,8 @@ private Slot field_74235_v = null; private boolean field_74234_w = false; private CreativeCrafting field_82324_x; @@ -9,48 +9,39 @@ public GuiContainerCreative(EntityPlayer par1EntityPlayer) { -@@ -137,7 +139,7 @@ - return; - } - -- if (var7 != null && var8 != null && var7.isItemEqual(var8)) -+ if (var7 != null && var8 != null && var7.isItemEqual(var8) && ItemStack.areItemStackTagsEqual(var7, var8)) - { - if (par3 == 0) - { -@@ -229,6 +231,13 @@ - this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[var1]); +@@ -274,6 +276,13 @@ + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); this.field_82324_x = new CreativeCrafting(this.mc); this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_82324_x); + int tabCount = CreativeTabs.creativeTabArray.length; + if (tabCount > 12) + { -+ controlList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); -+ controlList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); ++ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); ++ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); + maxPages = ((tabCount - 12) / 10) + 1; + } } else { -@@ -363,7 +372,7 @@ +@@ -408,7 +417,7 @@ { - CreativeTabs var3 = CreativeTabs.creativeTabArray[selectedTabIndex]; + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; -- if (var3.drawInForegroundOfTab()) -+ if (var3 != null && var3.drawInForegroundOfTab()) +- if (creativetabs.drawInForegroundOfTab()) ++ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) { - this.fontRenderer.drawString(var3.getTranslatedTabLabel(), 8, 6, 4210752); + this.fontRenderer.drawString(creativetabs.getTranslatedTabLabel(), 8, 6, 4210752); } -@@ -385,7 +394,7 @@ +@@ -457,7 +466,7 @@ { - CreativeTabs var9 = var6[var8]; + CreativeTabs creativetabs = acreativetabs[k1]; -- if (this.func_74232_a(var9, var4, var5)) -+ if (var9 != null && func_74232_a(var9, var4, var5)) +- if (this.func_74232_a(creativetabs, l, i1)) ++ if (creativetabs != null && func_74232_a(creativetabs, l, i1)) { - this.setCurrentCreativeTab(var9); + this.setCurrentCreativeTab(creativetabs); return; -@@ -401,11 +410,17 @@ +@@ -473,11 +482,17 @@ */ private boolean needsScrollBars() { @@ -65,28 +56,28 @@ + return; + } + - int var2 = selectedTabIndex; + int i = selectedTabIndex; selectedTabIndex = par1CreativeTabs.getTabIndex(); - ContainerCreative var3 = (ContainerCreative)this.inventorySlots; -@@ -575,21 +590,42 @@ + ContainerCreative containercreative = (ContainerCreative)this.inventorySlots; +@@ -648,21 +663,42 @@ super.drawScreen(par1, par2, par3); - CreativeTabs[] var11 = CreativeTabs.creativeTabArray; -- int var12 = var11.length; + CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; +- int i2 = acreativetabs.length; - -- for (int var13 = 0; var13 < var12; ++var13) +- for (int j2 = 0; j2 < i2; ++j2) + int start = tabPage * 10; -+ int var12 = Math.min(var11.length, ((tabPage + 1) * 10) + 2); ++ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); + if (tabPage != 0) start += 2; + boolean rendered = false; + -+ for (int var13 = start; var13 < var12; ++var13) ++ for (int j2 = start; j2 < i2; ++j2) { - CreativeTabs var14 = var11[var13]; + CreativeTabs creativetabs = acreativetabs[j2]; -- if (this.renderCreativeInventoryHoveringText(var14, par1, par2)) +- if (this.renderCreativeInventoryHoveringText(creativetabs, par1, par2)) - { -+ if (var14 != null && renderCreativeInventoryHoveringText(var14, par1, par2)) ++ if (creativetabs != null && renderCreativeInventoryHoveringText(creativetabs, par1, par2)) + { + rendered = true; break; @@ -116,57 +107,57 @@ } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -@@ -610,14 +646,32 @@ - int var8 = var7.length; - int var9; +@@ -681,14 +717,32 @@ + int k = acreativetabs.length; + int l; -- for (var9 = 0; var9 < var8; ++var9) +- for (l = 0; l < k; ++l) + int start = tabPage * 10; -+ var8 = Math.min(var7.length, ((tabPage + 1) * 10 + 2)); ++ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); + if (tabPage != 0) start += 2; + -+ for (var9 = start; var9 < var8; ++var9) ++ for (l = start; l < k; ++l) { - CreativeTabs var10 = var7[var9]; - this.mc.renderEngine.bindTexture(var4); + CreativeTabs creativetabs1 = acreativetabs[l]; + this.mc.renderEngine.func_98187_b("/gui/allitems.png"); -- if (var10.getTabIndex() != selectedTabIndex) -+ if (var10 != null && var10.getTabIndex() != selectedTabIndex) +- if (creativetabs1.getTabIndex() != selectedTabIndex) ++ if (creativetabs1 != null && creativetabs1.getTabIndex() != selectedTabIndex) { - this.renderCreativeTab(var10); + this.renderCreativeTab(creativetabs1); + } + } + + if (tabPage != 0) + { -+ if (var5 != CreativeTabs.tabAllSearch) ++ if (creativetabs != CreativeTabs.tabAllSearch) + { -+ mc.renderEngine.bindTexture(var4); ++ mc.renderEngine.func_98187_b("/gui/allitems.png"); + renderCreativeTab(CreativeTabs.tabAllSearch); + } -+ if (var5 != CreativeTabs.tabInventory) ++ if (creativetabs != CreativeTabs.tabInventory) + { -+ mc.renderEngine.bindTexture(var4); ++ mc.renderEngine.func_98187_b("/gui/allitems.png"); + renderCreativeTab(CreativeTabs.tabInventory); } } -@@ -635,6 +689,14 @@ - this.drawTexturedModalRect(var11, var8 + (int)((float)(var9 - var8 - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); +@@ -706,6 +760,14 @@ + this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } -+ if (var5 == null || var5.getTabPage() != tabPage) ++ if (creativetabs == null || creativetabs.getTabPage() != tabPage) + { -+ if (var5 != CreativeTabs.tabAllSearch && var5 != CreativeTabs.tabInventory) ++ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) + { + return; + } + } + - this.renderCreativeTab(var5); + this.renderCreativeTab(creativetabs); - if (var5 == CreativeTabs.tabInventory) -@@ -645,6 +707,15 @@ + if (creativetabs == CreativeTabs.tabInventory) +@@ -716,6 +778,15 @@ protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3) { @@ -179,19 +170,19 @@ + } + } + - int var4 = par1CreativeTabs.getTabColumn(); - int var5 = 28 * var4; - byte var6 = 0; -@@ -759,7 +830,7 @@ - var8 += 8 + (var3 ? 1 : -1); + int k = par1CreativeTabs.getTabColumn(); + int l = 28 * k; + byte b0 = 0; +@@ -830,7 +901,7 @@ + i1 += 8 + (flag1 ? 1 : -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); -- ItemStack var10 = new ItemStack(par1CreativeTabs.getTabIconItem()); -+ ItemStack var10 = par1CreativeTabs.getIconItemStack(); - itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, var10, var7, var8); - itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, var10, var7, var8); +- ItemStack itemstack = new ItemStack(par1CreativeTabs.getTabIconItem()); ++ ItemStack itemstack = par1CreativeTabs.getIconItemStack(); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, l, i1); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, l, i1); GL11.glDisable(GL11.GL_LIGHTING); -@@ -781,6 +852,15 @@ +@@ -852,6 +923,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); } diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index 085037c48..a6a05697e 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -15,4 +15,4 @@ + @SideOnly(Side.CLIENT) public void render(Tessellator par1Tessellator, float par2) { - for (int var3 = 0; var3 < this.quadList.length; ++var3) + for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index 2a1d95a69..64bbb6bcd 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -11,9 +11,9 @@ public class ChunkProviderClient implements IChunkProvider @@ -75,6 +77,7 @@ { - Chunk var3 = new Chunk(this.worldObj, par1, par2); - this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(par1, par2), var3); -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(var3)); - var3.isChunkLoaded = true; - return var3; + Chunk chunk = new Chunk(this.worldObj, par1, par2); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(par1, par2), chunk); ++ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(chunk)); + chunk.isChunkLoaded = true; + return chunk; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch index 0f3a05d18..e14ae7ac4 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java +++ ../src_work/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java -@@ -160,6 +160,11 @@ +@@ -176,6 +176,11 @@ import net.minecraft.world.storage.MapStorage; import org.lwjgl.input.Keyboard; @@ -12,7 +12,7 @@ @SideOnly(Side.CLIENT) public class NetClientHandler extends NetHandler { -@@ -744,7 +749,7 @@ +@@ -762,7 +767,7 @@ public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) { @@ -20,8 +20,8 @@ + this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason); this.disconnected = true; this.mc.loadWorld((WorldClient)null); - this.mc.displayGuiScreen(new GuiDisconnected("disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason})); -@@ -810,7 +815,11 @@ + +@@ -844,7 +849,11 @@ public void handleChat(Packet3Chat par1Packet3Chat) { par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat); @@ -34,13 +34,13 @@ } public void handleAnimation(Packet18Animation par1Packet18Animation) -@@ -1192,6 +1201,10 @@ +@@ -1278,6 +1287,10 @@ { - var2.readFromNBT(par1Packet132TileEntityData.customParam1); + tileentity.readFromNBT(par1Packet132TileEntityData.customParam1); } + else + { -+ var2.onDataPacket(netManager, par1Packet132TileEntityData); ++ tileentity.onDataPacket(netManager, par1Packet132TileEntityData); + } } } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 52bef39c0..807224e4d 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -11,7 +11,7 @@ @SideOnly(Side.CLIENT) public class PlayerControllerMP { -@@ -121,6 +125,12 @@ +@@ -124,6 +128,12 @@ */ public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4) { @@ -24,42 +24,34 @@ if (this.currentGameType.isAdventure() && !this.mc.thePlayer.canCurrentToolHarvestBlock(par1, par2, par3)) { return false; -@@ -138,7 +148,7 @@ +@@ -141,7 +151,7 @@ { - var5.playAuxSFX(2001, par1, par2, par3, var6.blockID + (var5.getBlockMetadata(par1, par2, par3) << 12)); - int var7 = var5.getBlockMetadata(par1, par2, par3); -- boolean var8 = var5.setBlockWithNotify(par1, par2, par3, 0); -+ boolean var8 = var6.removeBlockByPlayer(var5, mc.thePlayer, par1, par2, par3); + worldclient.playAuxSFX(2001, par1, par2, par3, block.blockID + (worldclient.getBlockMetadata(par1, par2, par3) << 12)); + int i1 = worldclient.getBlockMetadata(par1, par2, par3); +- boolean flag = worldclient.func_94571_i(par1, par2, par3); ++ boolean flag = block.removeBlockByPlayer(worldclient, mc.thePlayer, par1, par2, par3); - if (var8) + if (flag) { -@@ -334,6 +344,12 @@ - float var11 = (float)par8Vec3.zCoord - (float)par6; - boolean var12 = false; - int var13; +@@ -342,6 +352,12 @@ + float f2 = (float)par8Vec3.zCoord - (float)par6; + boolean flag = false; + int i1; + if (par3ItemStack != null && + par3ItemStack.getItem() != null && -+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11)) ++ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2)) + { + return true; + } if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) { -@@ -344,6 +360,7 @@ - var12 = true; - } - } -+ - - if (!var12 && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock) - { -@@ -376,7 +393,15 @@ +@@ -384,7 +400,15 @@ } else { -- return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11); -+ if (!par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11)) +- return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2); ++ if (!par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2)) + { + return false; + } @@ -71,15 +63,15 @@ } } -@@ -398,9 +423,10 @@ +@@ -406,9 +430,10 @@ { - par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = var5; + par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = itemstack1; -- if (var5.stackSize == 0) -+ if (var5.stackSize <= 0) +- if (itemstack1.stackSize == 0) ++ if (itemstack1.stackSize <= 0) { par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(par1EntityPlayer, var5)); ++ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(par1EntityPlayer, itemstack1)); } return true; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index 44a83b758..124915f7f 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src_work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -27,6 +27,9 @@ +@@ -29,6 +29,9 @@ import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.storage.SaveHandlerMP; @@ -10,8 +10,8 @@ @SideOnly(Side.CLIENT) public class WorldClient extends World { -@@ -57,8 +60,11 @@ - super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(par3), par2WorldSettings, par5Profiler); +@@ -59,8 +62,11 @@ + super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(par3), par2WorldSettings, par5Profiler, par6ILogAgent); this.sendQueue = par1NetClientHandler; this.difficultySetting = par4; + this.mapStorage = par1NetClientHandler.mapStorage; @@ -23,7 +23,7 @@ } /** -@@ -289,6 +295,12 @@ +@@ -291,6 +297,12 @@ */ protected void updateWeather() { diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index edd4ba9c2..2c83d010a 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,196 +1,63 @@ --- ../src_base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src_work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -3,16 +3,25 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.util.ArrayList; -+import java.util.Iterator; - import java.util.List; -+import java.util.Map.Entry; - import java.util.Random; - import net.minecraft.block.Block; - import net.minecraft.client.renderer.ActiveRenderInfo; - import net.minecraft.client.renderer.RenderEngine; +@@ -11,6 +11,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; -+import net.minecraft.item.Item; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -+ -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.common.ForgeHooks; -+import com.google.common.collect.ArrayListMultimap; -+import com.google.common.collect.Multimap; - @SideOnly(Side.CLIENT) - public class EffectRenderer -@@ -25,6 +34,8 @@ - /** RNG. */ - private Random rand = new Random(); - -+ private Multimap effectList = ArrayListMultimap.create(); -+ - public EffectRenderer(World par1World, RenderEngine par2RenderEngine) - { - if (par1World != null) -@@ -59,12 +70,27 @@ - for (int var2 = 0; var2 < this.fxLayers[var1].size(); ++var2) +@@ -59,9 +60,13 @@ + for (int j = 0; j < this.fxLayers[i].size(); ++j) { - EntityFX var3 = (EntityFX)this.fxLayers[var1].get(var2); -- var3.onUpdate(); + EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); +- entityfx.onUpdate(); - -- if (var3.isDead) +- if (entityfx.isDead) + -+ if (var3 != null) ++ if (entityfx != null) + { -+ var3.onUpdate(); ++ entityfx.onUpdate(); + } + -+ if (var3 == null || var3.isDead) ++ if (entityfx == null || entityfx.isDead) { - this.fxLayers[var1].remove(var2--); + this.fxLayers[i].remove(j--); } -+ } -+ } -+ -+ Iterator> itr = effectList.entries().iterator(); -+ while (itr.hasNext()) -+ { -+ EntityFX fx = itr.next().getValue(); -+ fx.onUpdate(); -+ if (fx.isDead) -+ { -+ itr.remove(); - } - } - } -@@ -115,6 +141,7 @@ - for (int var11 = 0; var11 < this.fxLayers[var8].size(); ++var11) +@@ -111,6 +116,7 @@ + for (int j = 0; j < this.fxLayers[i].size(); ++j) { - EntityFX var12 = (EntityFX)this.fxLayers[var8].get(var11); -+ if (var12 == null) continue; - var10.setBrightness(var12.getBrightnessForRender(par2)); - var12.renderParticle(var10, par2, var3, var7, var4, var5, var6); + EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); ++ if (entityfx == null) continue; + tessellator.setBrightness(entityfx.getBrightnessForRender(par2)); + entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4); } -@@ -123,6 +150,27 @@ - GL11.glDisable(GL11.GL_BLEND); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - } -+ } -+ -+ for (String key : effectList.keySet()) -+ { -+ ForgeHooksClient.bindTexture(key, 0); -+ for (EntityFX entry : effectList.get(key)) -+ { -+ if (entry == null) continue; -+ Tessellator tessallator = Tessellator.instance; -+ //GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderer.getTexture(key)); -+ tessallator.startDrawingQuads(); -+ -+ if (entry.getFXLayer() != 3) -+ { -+ tessallator.setBrightness(entry.getBrightnessForRender(par2)); -+ entry.renderParticle(tessallator, par2, var3, var7, var4, var5, var6); -+ } -+ -+ tessallator.draw(); -+ } -+ ForgeHooksClient.unbindTexture(); - } - } - -@@ -142,6 +190,7 @@ - for (int var11 = 0; var11 < this.fxLayers[var9].size(); ++var11) +@@ -139,6 +145,7 @@ + for (int i = 0; i < this.fxLayers[b0].size(); ++i) { - EntityFX var12 = (EntityFX)this.fxLayers[var9].get(var11); -+ if (var12 == null) continue; - var10.setBrightness(var12.getBrightnessForRender(par2)); - var12.renderParticle(var10, par2, var4, var8, var5, var6, var7); + EntityFX entityfx = (EntityFX)this.fxLayers[b0].get(i); ++ if (entityfx == null) continue; + tessellator.setBrightness(entityfx.getBrightnessForRender(par2)); + entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4); } -@@ -156,13 +205,15 @@ - { - this.fxLayers[var2].clear(); - } -+ -+ effectList.clear(); - } +@@ -157,9 +164,9 @@ public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5) { - if (par4 != 0) - { -- Block var6 = Block.blocksList[par4]; -+ Block var6 = Block.blocksList[par4]; -+ if (var6 != null && !var6.addBlockDestroyEffects(worldObj, par1, par2, par3, par5, this)) +- Block block = Block.blocksList[par4]; ++ Block block = Block.blocksList[par4]; ++ if (block != null && !block.addBlockDestroyEffects(worldObj, par1, par2, par3, par5, this)) + { - byte var7 = 4; + byte b0 = 4; - for (int var8 = 0; var8 < var7; ++var8) -@@ -175,7 +226,7 @@ - double var13 = (double)par2 + ((double)var9 + 0.5D) / (double)var7; - double var15 = (double)par3 + ((double)var10 + 0.5D) / (double)var7; - int var17 = this.rand.nextInt(6); -- this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_70596_a(par1, par2, par3)); -+ this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_70596_a(par1, par2, par3), var6); - } - } - } -@@ -227,12 +278,60 @@ - var8 = (double)par1 + var6.getBlockBoundsMaxX() + (double)var7; - } - -- this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_70596_a(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); -+ this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_70596_a(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F), var6); - } - } - - public String getStatistics() + for (int j1 = 0; j1 < b0; ++j1) +@@ -232,4 +239,13 @@ { -- return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); -+ int size = 0; -+ for (List x : fxLayers) -+ { -+ size += x.size(); -+ } -+ size += effectList.size(); -+ return Integer.toString(size); -+ } -+ -+ public void addEffect(EntityFX effect, Object obj) -+ { -+ if (obj == null || !(obj instanceof Block || obj instanceof Item)) -+ { -+ addEffect(effect); -+ return; -+ } -+ -+ if (obj instanceof Item && ((Item)obj).isDefaultTexture) -+ { -+ addEffect(effect); -+ return; -+ } -+ -+ if (obj instanceof Block && ((Block)obj).isDefaultTexture) -+ { -+ addEffect(effect); -+ return; -+ } -+ -+ String texture = "/terrain.png"; -+ if (effect.getFXLayer() == 0) -+ { -+ texture = "/particles.png"; -+ } -+ else if (effect.getFXLayer() == 2) -+ { -+ texture = "/gui/items.png"; -+ } -+ texture = ForgeHooks.getTexture(texture, obj); -+ effectList.put(texture, effect); -+ } + return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); + } + + public void addBlockHitEffects(int x, int y, int z, MovingObjectPosition target) + { @@ -199,5 +66,5 @@ + { + addBlockHitEffects(x, y, z, target.sideHit); + } - } ++ } } diff --git a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch index 9c29c2e06..ba17cfd40 100644 --- a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch @@ -1,17 +1,17 @@ --- ../src_base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java +++ ../src_work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java -@@ -10,20 +10,22 @@ +@@ -11,20 +11,22 @@ public class EntityDiggingFX extends EntityFX { private Block blockInstance; + private int side; - public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16) + public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16, RenderEngine par17RenderEngine) { super(par1World, par2, par4, par6, par8, par10, par12); this.blockInstance = par14Block; -- this.setParticleTextureIndex(par14Block.getBlockTextureFromSideAndMetadata(0, par16)); -+ this.setParticleTextureIndex(par14Block.getBlockTextureFromSideAndMetadata(par15, par16)); +- this.func_94052_a(par17RenderEngine, par14Block.getBlockTextureFromSideAndMetadata(0, par16)); ++ this.func_94052_a(par17RenderEngine, par14Block.getBlockTextureFromSideAndMetadata(par15, par16)); this.particleGravity = par14Block.blockParticleGravity; this.particleRed = this.particleGreen = this.particleBlue = 0.6F; this.particleScale /= 2.0F; diff --git a/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch index 1c6cae400..74db91f85 100644 --- a/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch @@ -2,15 +2,15 @@ +++ ../src_work/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java @@ -30,11 +30,11 @@ { - this.field_92039_az = par15NBTTagCompound.getTagList("Explosions"); + this.fireworkExplosions = par15NBTTagCompound.getTagList("Explosions"); -- if (this.field_92039_az.tagCount() == 0) -+ if (this.field_92039_az != null && this.field_92039_az.tagCount() == 0) +- if (this.fireworkExplosions.tagCount() == 0) ++ if (this.fireworkExplosions != null && this.fireworkExplosions.tagCount() == 0) { - this.field_92039_az = null; + this.fireworkExplosions = null; } - else -+ else if (this.field_92039_az != null) ++ else if (this.fireworkExplosions != null) { - this.particleMaxAge = this.field_92039_az.tagCount() * 2 - 1; + this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1; diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 047c2833e..21ee96ffd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -12,16 +12,16 @@ @SideOnly(Side.CLIENT) public class EntityRenderer { -@@ -333,8 +338,15 @@ +@@ -339,8 +344,15 @@ */ private void updateFovModifierHand() { -- EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity; -- this.fovMultiplierTemp = var1.getFOVMultiplier(); +- EntityPlayerSP entityplayersp = (EntityPlayerSP)this.mc.renderViewEntity; +- this.fovMultiplierTemp = entityplayersp.getFOVMultiplier(); + if (mc.renderViewEntity instanceof EntityPlayerSP) + { -+ EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity; -+ this.fovMultiplierTemp = var1.getFOVMultiplier(); ++ EntityPlayerSP entityplayersp = (EntityPlayerSP)this.mc.renderViewEntity; ++ this.fovMultiplierTemp = entityplayersp.getFOVMultiplier(); + } + else + { @@ -29,81 +29,81 @@ + } this.fovModifierHandPrev = this.fovModifierHand; this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F; - } -@@ -350,7 +362,7 @@ + +@@ -366,7 +378,7 @@ } else { -- EntityPlayer var3 = (EntityPlayer)this.mc.renderViewEntity; -+ EntityLiving var3 = (EntityLiving)this.mc.renderViewEntity; - float var4 = 70.0F; +- EntityPlayer entityplayer = (EntityPlayer)this.mc.renderViewEntity; ++ EntityLiving entityplayer = (EntityLiving)this.mc.renderViewEntity; + float f1 = 70.0F; if (par2) -@@ -437,15 +449,7 @@ +@@ -453,15 +465,7 @@ if (!this.mc.gameSettings.debugCamEnable) { -- int var10 = this.mc.theWorld.getBlockId(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); +- int i = this.mc.theWorld.getBlockId(MathHelper.floor_double(entityliving.posX), MathHelper.floor_double(entityliving.posY), MathHelper.floor_double(entityliving.posZ)); - -- if (var10 == Block.bed.blockID) +- if (i == Block.bed.blockID) - { -- int var11 = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); -- int var12 = var11 & 3; -- GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F); +- int j = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entityliving.posX), MathHelper.floor_double(entityliving.posY), MathHelper.floor_double(entityliving.posZ)); +- int k = j & 3; +- GL11.glRotatef((float)(k * 90), 0.0F, 1.0F, 0.0F); - } - -+ ForgeHooksClient.orientBedCamera(mc, var2); - GL11.glRotatef(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); - GL11.glRotatef(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); ++ ForgeHooksClient.orientBedCamera(mc, entityliving); + GL11.glRotatef(entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); + GL11.glRotatef(entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); } -@@ -1124,7 +1128,9 @@ +@@ -1142,7 +1146,9 @@ { RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); + ForgeHooksClient.setRenderPass(0); - var5.renderEntities(var4.getPosition(par1), var14, par1); + renderglobal.renderEntities(entityliving.getPosition(par1), frustrum, par1); + ForgeHooksClient.setRenderPass(-1); this.enableLightmap((double)par1); this.mc.mcProfiler.endStartSection("litParticles"); - var6.renderLitParticles(var4, par1); -@@ -1139,8 +1145,11 @@ - var17 = (EntityPlayer)var4; + effectrenderer.renderLitParticles(entityliving, par1); +@@ -1157,8 +1163,11 @@ + entityplayer = (EntityPlayer)entityliving; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); -- var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); -- var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); -+ if (!ForgeHooksClient.onDrawBlockHighlight(var5, var17, mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1)) +- renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); +- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); ++ if (!ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1)) + { -+ var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); -+ var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); ++ renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); ++ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); + } GL11.glEnable(GL11.GL_ALPHA_TEST); } } -@@ -1194,6 +1203,13 @@ - this.mc.mcProfiler.endStartSection("water"); - var5.sortAndRender(var4, 1, (double)par1); +@@ -1213,6 +1222,13 @@ + renderglobal.sortAndRender(entityliving, 1, (double)par1); } -+ + + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + ForgeHooksClient.setRenderPass(1); -+ var5.renderEntities(var4.getPosition(par1), var14, par1); ++ renderglobal.renderEntities(entityliving.getPosition(par1), frustrum, par1); + ForgeHooksClient.setRenderPass(-1); + RenderHelper.disableStandardItemLighting(); - ++ GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); -@@ -1204,15 +1220,18 @@ - var17 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_BLEND); +@@ -1222,15 +1238,18 @@ + entityplayer = (EntityPlayer)entityliving; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); -- var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); -- var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); -+ if (!ForgeHooksClient.onDrawBlockHighlight(var5, var17, mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1)) +- renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); +- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); ++ if (!ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1)) + { -+ var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); -+ var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1); ++ renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); ++ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); + } GL11.glEnable(GL11.GL_ALPHA_TEST); } @@ -111,18 +111,18 @@ this.mc.mcProfiler.endStartSection("destroyProgress"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); -- var5.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)var4, par1); -+ var5.drawBlockDamageTexture(Tessellator.instance, var4, par1); +- renderglobal.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)entityliving, par1); ++ renderglobal.drawBlockDamageTexture(Tessellator.instance, entityliving, par1); GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.endStartSection("weather"); this.renderRainSnow(par1); -@@ -1222,6 +1241,9 @@ - { - this.renderCloudsCheck(var5, par1); +@@ -1248,6 +1267,9 @@ + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + this.renderHand(par1, j); } + + this.mc.mcProfiler.endStartSection("FRenderLast"); -+ ForgeHooksClient.dispatchRenderLast(var5, par1); - - this.mc.mcProfiler.endStartSection("hand"); ++ ForgeHooksClient.dispatchRenderLast(renderglobal, par1); + if (!this.mc.gameSettings.anaglyph) + { diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index a1d9fbbc8..059307415 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,118 +1,104 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -15,11 +15,19 @@ +@@ -14,6 +14,8 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; + import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; - import net.minecraft.world.storage.MapData; +@@ -21,6 +23,12 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -+ + +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; +import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; +import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; - ++ @SideOnly(Side.CLIENT) public class ItemRenderer -@@ -54,27 +62,21 @@ + { +@@ -53,8 +61,21 @@ + public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) { GL11.glPushMatrix(); - -- Block var4 = null; -- if (par2ItemStack.itemID < Block.blocksList.length) -- { -- var4 = Block.blocksList[par2ItemStack.itemID]; -- } - -- if (var4 != null && RenderBlocks.renderItemIn3d(var4.getRenderType())) -- { -- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); -- this.renderBlocksInstance.renderBlockAsItem(var4, par2ItemStack.getItemDamage(), 1.0F); -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED); +- if (par2ItemStack.func_94608_d() == 0 && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) ++ ++ Block block = null; ++ if (par2ItemStack.getItem() instanceof ItemBlock && par2ItemStack.itemID < Block.blocksList.length) ++ { ++ block = Block.blocksList[par2ItemStack.itemID]; ++ } + ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED); ++ + if (customRenderer != null) + { -+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile())); ++ this.mc.renderEngine.func_98187_b(par2ItemStack.func_94608_d() == 0 ? "/terrain.png" : "/gui/items.png"); + ForgeHooksClient.renderEquippedItem(customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack); + } -+ else if (par2ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) -+ { -+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile())); -+ this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); - } - else ++ else if (block != null && par2ItemStack.func_94608_d() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) { -- if (var4 != null) -- { -- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); -- } -- else -- { -- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png")); -- } -+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile())); + this.mc.renderEngine.func_98187_b("/terrain.png"); + this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); +@@ -272,7 +293,7 @@ + Render render; + RenderPlayer renderplayer; - Tessellator var5 = Tessellator.instance; - int var6 = par1EntityLiving.getItemIcon(par2ItemStack, par3); -@@ -279,8 +281,9 @@ - Render var24; - RenderPlayer var26; - -- if (var17 != null && var17.itemID == Item.map.itemID) -- { -+ if (var17 != null && var17.getItem() instanceof ItemMap) -+ { -+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(var17, FIRST_PERSON_MAP); +- if (itemstack != null && itemstack.itemID == Item.map.itemID) ++ if (itemstack != null && itemstack.getItem() instanceof ItemMap) + { GL11.glPushMatrix(); - var7 = 0.8F; - var20 = var3.getSwingProgress(par1); -@@ -346,11 +349,17 @@ - var28.addVertexWithUV((double)(128 + var27), (double)(0 - var27), 0.0D, 1.0D, 0.0D); - var28.addVertexWithUV((double)(0 - var27), (double)(0 - var27), 0.0D, 0.0D, 0.0D); - var28.draw(); -- MapData var16 = Item.map.getMapData(var17, this.mc.theWorld); + f4 = 0.8F; +@@ -340,11 +361,20 @@ + tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D); + tessellator.draw(); +- MapData mapdata = Item.map.getMapData(itemstack, this.mc.theWorld); - -- if (var16 != null) +- if (mapdata != null) - { -- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var16); -+ MapData var16 = ((ItemMap)var17.getItem()).getMapData(var17, this.mc.theWorld); +- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata); ++ ++ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); ++ MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld); ++ + if (custom == null) + { -+ if (var16 != null) ++ if (mapdata != null) + { -+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var16); ++ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata); + } + } + else + { -+ custom.renderItem(FIRST_PERSON_MAP, var17, mc.thePlayer, mc.renderEngine, var16); ++ custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.renderEngine, mapdata); } GL11.glPopMatrix(); -@@ -453,12 +462,15 @@ - if (var17.getItem().requiresMultipleRenderPasses()) +@@ -447,12 +477,15 @@ + if (itemstack.getItem().requiresMultipleRenderPasses()) { - this.renderItem(var3, var17, 0); -- int var25 = Item.itemsList[var17.itemID].getColorFromItemStack(var17, 1); -- var13 = (float)(var25 >> 16 & 255) / 255.0F; -- var14 = (float)(var25 >> 8 & 255) / 255.0F; -- var15 = (float)(var25 & 255) / 255.0F; -- GL11.glColor4f(var6 * var13, var6 * var14, var6 * var15, 1.0F); -- this.renderItem(var3, var17, 1); -+ for (int x = 1; x < var17.getItem().getRenderPasses(var17.getItemDamage()); x++) + this.renderItem(entityclientplayermp, itemstack, 0); +- int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 1); +- f10 = (float)(i1 >> 16 & 255) / 255.0F; +- f11 = (float)(i1 >> 8 & 255) / 255.0F; +- f12 = (float)(i1 & 255) / 255.0F; +- GL11.glColor4f(f3 * f10, f3 * f11, f3 * f12, 1.0F); +- this.renderItem(entityclientplayermp, itemstack, 1); ++ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) + { -+ int var25 = Item.itemsList[var17.itemID].getColorFromItemStack(var17, x); -+ var13 = (float)(var25 >> 16 & 255) / 255.0F; -+ var14 = (float)(var25 >> 8 & 255) / 255.0F; -+ var15 = (float)(var25 & 255) / 255.0F; -+ GL11.glColor4f(var6 * var13, var6 * var14, var6 * var15, 1.0F); -+ this.renderItem(var3, var17, x); ++ int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, x); ++ f10 = (float)(i1 >> 16 & 255) / 255.0F; ++ f11 = (float)(i1 >> 8 & 255) / 255.0F; ++ f12 = (float)(i1 & 255) / 255.0F; ++ GL11.glColor4f(f3 * f10, f3 * f11, f3 * f12, 1.0F); ++ this.renderItem(entityclientplayermp, itemstack, x); + } } else diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch index d5c7d1c8d..5179933a6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch @@ -1,165 +1,93 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderBlocks.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderBlocks.java -@@ -37,6 +37,8 @@ - import net.minecraft.world.World; +@@ -44,6 +44,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -+ -+import static net.minecraftforge.common.ForgeDirection.*; ++import static net.minecraftforge.common.ForgeDirection.*; ++ @SideOnly(Side.CLIENT) public class RenderBlocks -@@ -620,9 +622,8 @@ + { +@@ -608,9 +610,8 @@ public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4) { - Tessellator var5 = Tessellator.instance; -- int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); -- int var7 = BlockBed.getDirection(var6); -- boolean var8 = BlockBed.isBlockHeadOfBed(var6); -+ int var7 = par1Block.getBedDirection(blockAccess, par2, par3, par4); -+ boolean var8 = par1Block.isBedFoot(blockAccess, par2, par3, par4); - float var9 = 0.5F; - float var10 = 1.0F; - float var11 = 0.8F; -@@ -631,6 +632,7 @@ - var5.setBrightness(var25); - var5.setColorOpaque_F(var9, var9, var9); - int var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 0); -+ if (overrideBlockTexture >= 0) var27 = overrideBlockTexture; //BugFix Proper breaking texture on underside - int var28 = (var27 & 15) << 4; - int var29 = var27 & 240; - double var30 = (double)((float)var28 / 256.0F); -@@ -649,6 +651,7 @@ - var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); - var5.setColorOpaque_F(var10, var10, var10); - var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 1); -+ if (overrideBlockTexture >= 0) var27 = overrideBlockTexture; //BugFix Proper breaking texture on top - var28 = (var27 & 15) << 4; - var29 = var27 & 240; - var30 = (double)((float)var28 / 256.0F); -@@ -2387,7 +2390,7 @@ - double var28; - double var30; + Tessellator tessellator = Tessellator.instance; +- int l = this.blockAccess.getBlockMetadata(par2, par3, par4); +- int i1 = BlockBed.getDirection(l); +- boolean flag = BlockBed.isBlockHeadOfBed(l); ++ int i1 = par1Block.getBedDirection(blockAccess, par2, par3, par4); ++ boolean flag = par1Block.isBedFoot(blockAccess, par2, par3, par4); + float f = 0.5F; + float f1 = 1.0F; + float f2 = 0.8F; +@@ -619,6 +620,7 @@ + tessellator.setBrightness(j1); + tessellator.setColorOpaque_F(f, f, f); + Icon icon = this.func_94170_a(par1Block, this.blockAccess, par2, par3, par4, 0); ++ if (func_94167_b()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside + double d0 = (double)icon.func_94209_e(); + double d1 = (double)icon.func_94212_f(); + double d2 = (double)icon.func_94206_g(); +@@ -635,6 +637,7 @@ + tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); + tessellator.setColorOpaque_F(f1, f1, f1); + icon = this.func_94170_a(par1Block, this.blockAccess, par2, par3, par4, 1); ++ if (func_94167_b()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside + d0 = (double)icon.func_94209_e(); + d1 = (double)icon.func_94212_f(); + d2 = (double)icon.func_94206_g(); +@@ -2426,7 +2429,7 @@ + double d9; + double d10; - if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4)) + if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, UP)) { - float var36 = 0.2F; - float var19 = 0.0625F; -@@ -2407,7 +2410,7 @@ - var9 = var20; + float f1 = 0.2F; + float f2 = 0.0625F; +@@ -2446,7 +2449,7 @@ + d0 = d5; } - if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4)) + if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, EAST)) { - var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var11, var13); - var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var11, var15); -@@ -2419,7 +2422,7 @@ - var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var11, var13); + tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1); + tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3); +@@ -2458,7 +2461,7 @@ + tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1); } - if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4)) + if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, WEST)) { - var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var13); - var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); -@@ -2431,7 +2434,7 @@ - var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var13); + tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1); + tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3); +@@ -2470,7 +2473,7 @@ + tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1); } - if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1)) + if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, SOUTH)) { - var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var11, var13); - var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var11, var15); -@@ -2443,7 +2446,7 @@ - var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var11, var13); + tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1); + tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d2, d3); +@@ -2482,7 +2485,7 @@ + tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1); } - if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1)) + if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, NORTH)) { - var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var13); - var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var9, var15); -@@ -2455,7 +2458,7 @@ - var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var13); + tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1); + tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d0, d3); +@@ -2494,7 +2497,7 @@ + tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1); } - if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4)) + if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, DOWN)) { - var20 = (double)par2 + 0.5D + 0.5D; - var22 = (double)par2 + 0.5D - 0.5D; -@@ -4654,7 +4657,7 @@ - var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2); - this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var27); - -- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) - { - this.colorRedTopLeft *= par5; - this.colorRedBottomLeft *= par5; -@@ -4777,7 +4780,7 @@ - var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3); - this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3)); - -- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) - { - this.colorRedTopLeft *= par5; - this.colorRedBottomLeft *= par5; -@@ -4900,7 +4903,7 @@ - var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4); - this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var27); - -- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) - { - this.colorRedTopLeft *= par5; - this.colorRedBottomLeft *= par5; -@@ -5023,7 +5026,7 @@ - var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5); - this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var27); - -- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0) - { - this.colorRedTopLeft *= par5; - this.colorRedBottomLeft *= par5; -@@ -5135,7 +5138,7 @@ - var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2); - this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var28); - -- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) - { - var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7); - this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, 38); -@@ -5151,7 +5154,7 @@ - var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3); - this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, var28); - -- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) - { - var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7); - this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, 38); -@@ -5167,7 +5170,7 @@ - var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4); - this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var28); - -- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) - { - var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7); - this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, 38); -@@ -5183,7 +5186,7 @@ - var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5); - this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var28); - -- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) - { - var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7); - this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, 38); + d5 = (double)par2 + 0.5D + 0.5D; + d6 = (double)par2 + 0.5D - 0.5D; diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch index 74bd1b68f..42c2ac90c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch @@ -1,27 +1,27 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderEngine.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderEngine.java -@@ -29,6 +29,8 @@ - import net.minecraft.util.IntHashMap; +@@ -28,6 +28,8 @@ import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GL12; +import net.minecraftforge.client.ForgeHooksClient; + @SideOnly(Side.CLIENT) public class RenderEngine { -@@ -172,6 +174,7 @@ +@@ -186,6 +188,7 @@ - try - { -+ ForgeHooksClient.onTextureLoadPre(par1Str); - this.singleIntBuffer.clear(); - GLAllocation.generateTextureNames(this.singleIntBuffer); - int var3 = this.singleIntBuffer.get(0); -@@ -217,6 +220,7 @@ + try + { ++ ForgeHooksClient.onTextureLoadPre(par1Str); + int i = GLAllocation.generateTextureNames(); + boolean flag = par1Str.startsWith("%blur%"); + +@@ -215,6 +218,7 @@ + } + + this.textureMap.put(s1, Integer.valueOf(i)); ++ ForgeHooksClient.onTextureLoad(par1Str, texturePack.getSelectedTexturePack()); + return i; } - - this.textureMap.put(par1Str, Integer.valueOf(var3)); -+ ForgeHooksClient.onTextureLoad(par1Str, var6); - return var3; - } - catch (Exception var5) + catch (Exception exception) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 293eb743a..c4764253d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -62,6 +62,9 @@ +@@ -65,6 +65,9 @@ import org.lwjgl.opengl.ARBOcclusionQuery; import org.lwjgl.opengl.GL11; @@ -10,110 +10,89 @@ @SideOnly(Side.CLIENT) public class RenderGlobal implements IWorldAccess { -@@ -439,62 +442,72 @@ +@@ -443,35 +446,47 @@ */ public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3) { + int pass = MinecraftForgeClient.getRenderPass(); if (this.renderEntitiesStartupCounter > 0) { -+ if(pass > 0) ++ if (pass > 0) ++ { + return; -+ ++ } --this.renderEntitiesStartupCounter; } else { this.theWorld.theProfiler.startSection("prepare"); - TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); -- RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.gameSettings, par3); +- RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.field_96291_i, this.mc.gameSettings, par3); - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; -- EntityLiving var4 = this.mc.renderViewEntity; -- RenderManager.renderPosX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)par3; -- RenderManager.renderPosY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)par3; -- RenderManager.renderPosZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)par3; -- TileEntityRenderer.staticPlayerX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)par3; -- TileEntityRenderer.staticPlayerY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)par3; -- TileEntityRenderer.staticPlayerZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)par3; -+ List var5 = this.theWorld.getLoadedEntityList(); -+ if(pass == 0) +- EntityLiving entityliving = this.mc.renderViewEntity; +- RenderManager.renderPosX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; +- RenderManager.renderPosY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; +- RenderManager.renderPosZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; +- TileEntityRenderer.staticPlayerX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; +- TileEntityRenderer.staticPlayerY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; +- TileEntityRenderer.staticPlayerZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; ++ if (pass == 0) + { + TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); -+ RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.gameSettings, par3); ++ RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.field_96291_i, this.mc.gameSettings, par3); + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; -+ EntityLiving var4 = this.mc.renderViewEntity; -+ RenderManager.renderPosX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)par3; -+ RenderManager.renderPosY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)par3; -+ RenderManager.renderPosZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)par3; -+ TileEntityRenderer.staticPlayerX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)par3; -+ TileEntityRenderer.staticPlayerY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)par3; -+ TileEntityRenderer.staticPlayerZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)par3; -+ this.countEntitiesTotal = var5.size(); ++ EntityLiving entityliving = this.mc.renderViewEntity; ++ RenderManager.renderPosX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; ++ RenderManager.renderPosY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; ++ RenderManager.renderPosZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; ++ TileEntityRenderer.staticPlayerX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; ++ TileEntityRenderer.staticPlayerY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; ++ TileEntityRenderer.staticPlayerZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; + } this.mc.entityRenderer.enableLightmap((double)par3); this.theWorld.theProfiler.endStartSection("global"); -- List var5 = this.theWorld.getLoadedEntityList(); -- this.countEntitiesTotal = var5.size(); - int var6; - Entity var7; - - for (var6 = 0; var6 < this.theWorld.weatherEffects.size(); ++var6) - { - var7 = (Entity)this.theWorld.weatherEffects.get(var6); -- ++this.countEntitiesRendered; -- -- if (var7.isInRangeToRenderVec3D(par1Vec3)) -- { -- RenderManager.instance.renderEntity(var7, par3); -- } -- } -- -- this.theWorld.theProfiler.endStartSection("entities"); -- -- for (var6 = 0; var6 < var5.size(); ++var6) -- { -- var7 = (Entity)var5.get(var6); -- -- if (var7.isInRangeToRenderVec3D(par1Vec3) && (var7.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(var7.boundingBox) || var7.riddenByEntity == this.mc.thePlayer) && (var7 != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView != 0 || this.mc.renderViewEntity.isPlayerSleeping()) && this.theWorld.blockExists(MathHelper.floor_double(var7.posX), 0, MathHelper.floor_double(var7.posZ))) -+ -+ if (var7.shouldRenderInPass(pass) && var7.isInRangeToRenderVec3D(par1Vec3)) - { - ++this.countEntitiesRendered; - RenderManager.instance.renderEntity(var7, par3); - } - } - -+ this.theWorld.theProfiler.endStartSection("entities"); -+ -+ for (var6 = 0; var6 < var5.size(); ++var6) + List list = this.theWorld.getLoadedEntityList(); +- this.countEntitiesTotal = list.size(); ++ if (pass == 0) + { -+ var7 = (Entity)var5.get(var6); -+ -+ if (var7.shouldRenderInPass(pass) && var7.isInRangeToRenderVec3D(par1Vec3) && (var7.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(var7.boundingBox) || var7.riddenByEntity == this.mc.thePlayer) && (var7 != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView != 0 || this.mc.renderViewEntity.isPlayerSleeping()) && this.theWorld.blockExists(MathHelper.floor_double(var7.posX), 0, MathHelper.floor_double(var7.posZ))) -+ { -+ ++this.countEntitiesRendered; -+ RenderManager.instance.renderEntity(var7, par3); -+ } ++ this.countEntitiesTotal = list.size(); + } -+ - this.theWorld.theProfiler.endStartSection("tileentities"); - RenderHelper.enableStandardItemLighting(); + int i; + Entity entity; -+ TileEntity te; - for (var6 = 0; var6 < this.tileEntities.size(); ++var6) + for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) { -- TileEntityRenderer.instance.renderTileEntity((TileEntity)this.tileEntities.get(var6), par3); -+ te = (TileEntity)this.tileEntities.get(var6); -+ if(par2ICamera.isBoundingBoxInFrustum(te.getRenderBoundingBox()) && te.shouldRenderInPass(pass)) -+ TileEntityRenderer.instance.renderTileEntity(te, par3); + entity = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity.isInRangeToRenderVec3D(par1Vec3)) +@@ -485,6 +500,7 @@ + for (i = 0; i < list.size(); ++i) + { + entity = (Entity)list.get(i); ++ if (!entity.shouldRenderInPass(pass)) continue; + + if (entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer) && (entity != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView != 0 || this.mc.renderViewEntity.isPlayerSleeping()) && this.theWorld.blockExists(MathHelper.floor_double(entity.posX), 0, MathHelper.floor_double(entity.posZ))) + { +@@ -498,7 +514,11 @@ + + for (i = 0; i < this.tileEntities.size(); ++i) + { +- TileEntityRenderer.instance.renderTileEntity((TileEntity)this.tileEntities.get(i), par3); ++ TileEntity tile = (TileEntity)tileEntities.get(i); ++ if (tile.shouldRenderInPass(pass) && par2ICamera.isBoundingBoxInFrustum(tile.getRenderBoundingBox())) ++ { ++ TileEntityRenderer.instance.renderTileEntity(tile, par3); ++ } } this.mc.entityRenderer.disableLightmap((double)par3); -@@ -929,6 +942,12 @@ +@@ -933,6 +953,12 @@ */ public void renderSky(float par1) { @@ -126,7 +105,7 @@ if (this.mc.theWorld.provider.dimensionId == 1) { GL11.glDisable(GL11.GL_FOG); -@@ -1167,6 +1186,13 @@ +@@ -1171,6 +1197,13 @@ public void renderClouds(float par1) { @@ -140,7 +119,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.fancyGraphics) -@@ -1596,6 +1622,11 @@ +@@ -1599,6 +1632,11 @@ } public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3) @@ -150,51 +129,5 @@ + + public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLiving par2EntityPlayer, float par3) { - double var4 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3; - double var6 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3; -@@ -1873,6 +1904,7 @@ - double var17 = this.mc.renderViewEntity.posY - par4; - double var19 = this.mc.renderViewEntity.posZ - par6; - EntityFX var21 = null; -+ Object effectObject = null; - - if (par1Str.equals("hugeexplosion")) - { -@@ -2009,6 +2041,7 @@ - else if (par1Str.equals("snowballpoof")) - { - var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.snowball); -+ effectObject = Item.snowball; - } - else if (par1Str.equals("dripWater")) - { -@@ -2025,6 +2058,7 @@ - else if (par1Str.equals("slime")) - { - var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.slimeBall); -+ effectObject = Item.slimeBall; - } - else if (par1Str.equals("heart")) - { -@@ -2046,6 +2080,7 @@ - { - int var27 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1)); - var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[var27]); -+ effectObject = Item.itemsList[var27]; - } - else if (par1Str.startsWith("tilecrack_")) - { -@@ -2053,11 +2088,12 @@ - int var25 = Integer.parseInt(var28[1]); - int var26 = Integer.parseInt(var28[2]); - var21 = (new EntityDiggingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Block.blocksList[var25], 0, var26)).applyRenderColor(var26); -+ effectObject = Block.blocksList[var25]; - } - - if (var21 != null) - { -- this.mc.effectRenderer.addEffect((EntityFX)var21); -+ this.mc.effectRenderer.addEffect((EntityFX)var21, effectObject); - } - - return (EntityFX)var21; + double d0 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3; + double d1 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3; diff --git a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch index 29511973e..a735c65ef 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch @@ -152,7 +152,7 @@ + rawBuffer = null; } - int var1 = this.rawBufferIndex * 4; + int i = this.rawBufferIndex * 4; @@ -442,6 +470,19 @@ */ public void addVertex(double par1, double par3, double par5) diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 9b0c33314..2329907e8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -19,51 +19,49 @@ public int posY; @@ -192,15 +194,16 @@ GL11.glTranslatef(-8.0F, -8.0F, -8.0F); - GL11.glScalef(var19, var19, var19); + GL11.glScalef(f, f, f); GL11.glTranslatef(8.0F, 8.0F, 8.0F); - tessellator.startDrawingQuads(); - tessellator.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); -+ ForgeHooksClient.beforeRenderPass(var11); ++ //ForgeHooksClient.beforeRenderPass(l1); Noop fo now, TODO: Event if anyone needs + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); } - Block var23 = Block.blocksList[var18]; + Block block = Block.blocksList[l2]; - if (var23 != null) + if (block != null) { -- if (var11 == 0 && var23.hasTileEntity()) -+ if (var11 == 0 && var23.hasTileEntity(var9.getBlockMetadata(var17, var15, var16))) +- if (l1 == 0 && block.hasTileEntity()) ++ if (l1 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(k2, i2, j2))) { - TileEntity var20 = var9.getBlockTileEntity(var17, var15, var16); + TileEntity tileentity = chunkcache.getBlockTileEntity(k2, i2, j2); -@@ -212,14 +215,17 @@ +@@ -212,14 +215,15 @@ - int var24 = var23.getRenderBlockPass(); + int i3 = block.getRenderBlockPass(); -- if (var24 != var11) -+ if (var24 > var11) +- if (i3 != l1) ++ if (i3 > l1) { - var12 = true; + flag = true; } -- else if (var24 == var11) -+ if (!var23.canRenderInPass(var11)) +- else if (i3 == l1) ++ if (!block.canRenderInPass(l1)) { -- var13 |= var10.renderBlockByRenderType(var23, var17, var15, var16); +- flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2); + continue; } -+ ForgeHooksClient.beforeBlockRender(var23, var10); -+ var13 |= var10.renderBlockByRenderType(var23, var17, var15, var16); -+ ForgeHooksClient.afterBlockRender(var23, var10); ++ flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2); } } } -@@ -228,10 +234,11 @@ +@@ -228,10 +232,11 @@ - if (var14) + if (flag2) { - this.bytesDrawn += tessellator.draw(); -+ ForgeHooksClient.afterRenderPass(var11); ++ //ForgeHooksClient.afterRenderPass(l1); Noop fo now, TODO: Event if anyone needs + this.bytesDrawn += Tessellator.instance.draw(); GL11.glPopMatrix(); GL11.glEndList(); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index 7ae7e0a84..c35035a6d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -17,50 +17,50 @@ @SideOnly(Side.CLIENT) public class RenderBiped extends RenderLiving @@ -59,7 +65,7 @@ - if (var5 instanceof ItemArmor) + if (item instanceof ItemArmor) { - ItemArmor var6 = (ItemArmor)var5; -- this.loadTexture("/armor/" + bipedArmorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(var4, "/armor/" + bipedArmorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png")); - ModelBiped var7 = par2 == 2 ? this.field_82425_h : this.field_82423_g; - var7.bipedHead.showModel = par2 == 0; - var7.bipedHeadwear.showModel = par2 == 0; + ItemArmor itemarmor = (ItemArmor)item; +- this.loadTexture("/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); ++ this.loadTexture(ForgeHooksClient.getArmorTexture(itemstack, "/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png")); + ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g; + modelbiped.bipedHead.showModel = par2 == 0; + modelbiped.bipedHeadwear.showModel = par2 == 0; @@ -174,9 +180,12 @@ GL11.glPushMatrix(); this.modelBipedMain.bipedHead.postRender(0.0625F); -- if (var5.getItem().itemID < 256) +- if (itemstack1.getItem().itemID < 256) - { -- if (RenderBlocks.renderItemIn3d(Block.blocksList[var5.itemID].getRenderType())) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var5, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var5, BLOCK_3D)); +- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); + -+ if (var5.getItem() instanceof ItemBlock) ++ if (itemstack1.getItem() instanceof ItemBlock) + { -+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var5.itemID].getRenderType())) ++ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) { - var6 = 0.625F; + f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); @@ -218,7 +227,10 @@ this.modelBipedMain.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); -- if (var4.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType())) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var4, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var4, BLOCK_3D)); +- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); + -+ if (var4.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType()))) ++ if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))) { - var6 = 0.5F; + f2 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); @@ -265,7 +277,10 @@ - if (var4.getItem().requiresMultipleRenderPasses()) + if (itemstack.getItem().requiresMultipleRenderPasses()) { -- this.renderManager.itemRenderer.renderItem(par1EntityLiving, var4, 1); -+ for (int x = 1; x < var4.getItem().getRenderPasses(var4.getItemDamage()); x++) +- this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 1); ++ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) + { -+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, var4, x); ++ this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 4e3defb63..1683ddfec 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -1,12 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -13,11 +13,14 @@ - import net.minecraft.entity.Entity; - import net.minecraft.entity.item.EntityItem; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemStack; - import net.minecraft.util.MathHelper; +@@ -19,6 +19,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -15,209 +9,149 @@ @SideOnly(Side.CLIENT) public class RenderItem extends Render { -@@ -48,39 +51,22 @@ - if (var10.getItem() != null) +@@ -49,29 +51,9 @@ + if (itemstack.getItem() != null) { GL11.glPushMatrix(); -- float var11 = MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F; -+ float var11 = shouldBob() ? MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F; - float var12 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI); -- byte var13 = 1; +- float f2 = MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F; ++ float f2 = shouldBob() ? MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F; + float f3 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI); +- byte b0 = 1; - - if (par1EntityItem.getEntityItem().stackSize > 1) - { -- var13 = 2; +- b0 = 2; - } - - if (par1EntityItem.getEntityItem().stackSize > 5) - { -- var13 = 3; +- b0 = 3; - } - - if (par1EntityItem.getEntityItem().stackSize > 20) - { -- var13 = 4; +- b0 = 4; - } - - if (par1EntityItem.getEntityItem().stackSize > 40) - { -- var13 = 5; +- b0 = 5; - } -+ byte var13 = getMiniBlockCountForItemStack(var10); ++ byte b0 = getMiniBlockCount(itemstack); - GL11.glTranslatef((float)par2, (float)par4 + var11, (float)par6); + GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); -- Block var14 = Block.blocksList[var10.itemID]; - int var16; - float var19; - float var20; - float var24; +@@ -80,9 +62,18 @@ + float f5; + float f6; -- if (var14 != null && RenderBlocks.renderItemIn3d(var14.getRenderType())) -+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, var10, var11, var12, random, renderManager.renderEngine, renderBlocks)) +- if (itemstack.func_94608_d() == 0 && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) +- { +- Block block = Block.blocksList[itemstack.itemID]; ++ Block block = null; ++ if (itemstack.itemID < Block.blocksList.length) ++ { ++ block = Block.blocksList[itemstack.itemID]; ++ } ++ ++ if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks)) + { + ; + } -+ else if (var10.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType())) - { - GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F); ++ else if (itemstack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ { + GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); -@@ -91,9 +77,9 @@ - GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - } + if (field_82407_g) +@@ -138,10 +129,10 @@ -- this.loadTexture("/terrain.png"); -+ this.loadTexture(Block.blocksList[var10.itemID].getTextureFile()); - float var22 = 0.25F; -- var16 = var14.getRenderType(); -+ var16 = Block.blocksList[var10.itemID].getRenderType(); + this.loadTexture("/gui/items.png"); - if (var16 == 1 || var16 == 19 || var16 == 12 || var16 == 2) - { -@@ -115,7 +101,7 @@ - } - - var24 = 1.0F; -- this.itemRenderBlocks.renderBlockAsItem(var14, var10.getItemDamage(), var24); -+ this.itemRenderBlocks.renderBlockAsItem(Block.blocksList[var10.itemID], var10.getItemDamage(), var24); - GL11.glPopMatrix(); - } - } -@@ -136,12 +122,12 @@ - GL11.glScalef(0.5F, 0.5F, 0.5F); - } - -- this.loadTexture("/gui/items.png"); -- -- for (var15 = 0; var15 <= 1; ++var15) -- { -+ -+ for (var15 = 0; var15 < var10.getItem().getRenderPasses(var10.getItemDamage()); ++var15) -+ { -+ this.loadTexture(Item.itemsList[var10.itemID].getTextureFile()); +- for (int k = 0; k <= 1; ++k) ++ for (int k = 0; k <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) + { this.random.setSeed(187L); -- var16 = var10.getItem().getIconFromDamageForRenderPass(var10.getItemDamage(), var15); -+ var16 = var10.getItem().getIconIndex(var10, var15); - var17 = 1.0F; +- Icon icon = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), k); ++ Icon icon = itemstack.getItem().getIcon(itemstack, k); + f8 = 1.0F; if (this.field_77024_a) -@@ -173,14 +159,7 @@ - - var15 = var10.getIconIndex(); - -- if (var14 != null) -- { -- this.loadTexture("/terrain.png"); -- } -- else -- { -- this.loadTexture("/gui/items.png"); -- } -+ this.loadTexture(var10.getItem().getTextureFile()); - - if (this.field_77024_a) - { -@@ -232,39 +211,27 @@ - var17 = 0.021875F; - ItemStack var18 = par1EntityItem.getEntityItem(); - int var19 = var18.stackSize; -- byte var24; +@@ -241,32 +232,26 @@ + f11 = 0.021875F; + ItemStack itemstack = par1EntityItem.getEntityItem(); + int j = itemstack.stackSize; +- byte b0; - -- if (var19 < 2) +- if (j < 2) - { -- var24 = 1; +- b0 = 1; - } -- else if (var19 < 16) +- else if (j < 16) - { -- var24 = 2; +- b0 = 2; - } -- else if (var19 < 32) +- else if (j < 32) - { -- var24 = 3; +- b0 = 3; - } - else - { -- var24 = 4; +- b0 = 4; - } -+ byte var24 = getMiniItemCountForItemStack(var18); -+ ++ byte b0 = getMiniItemCount(itemstack); - GL11.glTranslatef(-var14, -var15, -((var16 + var17) * (float)var24 / 2.0F)); + GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float)b0 / 2.0F)); - for (int var20 = 0; var20 < var24; ++var20) + for (int k = 0; k < b0; ++k) { -- GL11.glTranslatef(0.0F, 0.0F, var16 + var17); +- GL11.glTranslatef(0.0F, 0.0F, f12 + f11); - -- if (Block.blocksList[var18.itemID] != null) -- { -- this.loadTexture("/terrain.png"); +- if (itemstack.func_94608_d() == 0 && Block.blocksList[itemstack.itemID] != null) + // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... -+ if (var20 > 0 && shouldSpreadItems()) ++ if (k > 0 && shouldSpreadItems()) + { + float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; + float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; + float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; -+ GL11.glTranslatef(x, y, var16 + var17); - } - else - { -- this.loadTexture("/gui/items.png"); -- } -+ GL11.glTranslatef(0f, 0f, var16 + var17); ++ GL11.glTranslatef(x, y, f12 + f11); ++ } ++ else ++ { ++ GL11.glTranslatef(0f, 0f, f12 + f11); + } + -+ this.loadTexture(Item.itemsList[var18.itemID].getTextureFile()); ++ if (itemstack.func_94608_d() == 0 && itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null) + { + this.loadTexture("/terrain.png"); + } +@@ -356,10 +341,11 @@ + float f1; + float f2; - GL11.glColor4f(par5, par6, par7, 1.0F); - ItemRenderer.renderItemIn2D(var8, var10, var11, var9, var12, var16); -@@ -348,10 +315,10 @@ - float var13; - float var16; - -- if (var6 < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var6].getRenderType())) -- { -- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png")); -+ if (par3ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par3ItemStack.itemID].getRenderType())) -+ { - Block var15 = Block.blocksList[var6]; -+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(var15.getTextureFile())); +- if (par3ItemStack.func_94608_d() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType())) ++ Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null); ++ ++ if (par3ItemStack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType())) + { + par2RenderEngine.func_98187_b("/terrain.png"); +- Block block = Block.blocksList[k]; GL11.glPushMatrix(); GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); -@@ -382,11 +349,11 @@ - if (Item.itemsList[var6].requiresMultipleRenderPasses()) - { +@@ -392,9 +378,9 @@ GL11.glDisable(GL11.GL_LIGHTING); -- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png")); -- -- for (var9 = 0; var9 <= 1; ++var9) + par2RenderEngine.func_98187_b("/gui/items.png"); + +- for (j1 = 0; j1 <= 1; ++j1) - { -- var10 = Item.itemsList[var6].getIconFromDamageForRenderPass(var7, var9); -+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Item.itemsList[var6].getTextureFile())); -+ -+ for (var9 = 0; var9 < Item.itemsList[var6].getRenderPasses(var7); ++var9) +- Icon icon1 = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1); ++ for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) + { -+ var10 = Item.itemsList[var6].getIconIndex(par3ItemStack, var9); - int var11 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, var9); - var12 = (float)(var11 >> 16 & 255) / 255.0F; - var13 = (float)(var11 >> 8 & 255) / 255.0F; -@@ -406,14 +373,7 @@ - { - GL11.glDisable(GL11.GL_LIGHTING); - -- if (var6 < 256) -- { -- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png")); -- } -- else -- { -- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png")); -- } -+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(par3ItemStack.getItem().getTextureFile())); - - var9 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, 0); - float var17 = (float)(var9 >> 16 & 255) / 255.0F; -@@ -440,7 +400,10 @@ ++ Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1); + int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); + f = (float)(k1 >> 16 & 255) / 255.0F; + f1 = (float)(k1 >> 8 & 255) / 255.0F; +@@ -453,7 +439,10 @@ { if (par3ItemStack != null) { @@ -227,14 +161,13 @@ + this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); + } - if (par3ItemStack != null && par3ItemStack.hasEffect()) + if (par3ItemStack.hasEffect()) { -@@ -578,4 +541,77 @@ +@@ -590,4 +579,47 @@ { this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); } + -+ /* ==== Forge start ===== */ + /** + * Items should spread out when rendered in 3d? + * @return @@ -253,29 +186,14 @@ + return true; + } + -+ public byte getMiniBlockCountForItemStack(ItemStack stack) ++ public byte getMiniBlockCount(ItemStack stack) + { -+ byte var13 = 1; -+ if (stack.stackSize > 1) -+ { -+ var13 = 2; -+ } -+ -+ if (stack.stackSize > 5) -+ { -+ var13 = 3; -+ } -+ -+ if (stack.stackSize > 20) -+ { -+ var13 = 4; -+ } -+ -+ if (stack.stackSize > 40) -+ { -+ var13 = 5; -+ } -+ return var13; ++ byte ret = 1; ++ if (stack.stackSize > 1 ) ret = 2; ++ if (stack.stackSize > 5 ) ret = 3; ++ if (stack.stackSize > 20) ret = 4; ++ if (stack.stackSize > 40) ret = 5; ++ return ret; + } + + /** @@ -284,26 +202,12 @@ + * @param stack + * @return + */ -+ public byte getMiniItemCountForItemStack(ItemStack stack) ++ public byte getMiniItemCount(ItemStack stack) + { -+ byte var24; -+ int var19 = stack.stackSize; -+ if (var19 < 2) -+ { -+ var24 = 1; -+ } -+ else if (var19 < 16) -+ { -+ var24 = 2; -+ } -+ else if (var19 < 32) -+ { -+ var24 = 3; -+ } -+ else -+ { -+ var24 = 4; -+ } -+ return var24; ++ byte ret = 1; ++ if (stack.stackSize > 1) ret = 2; ++ if (stack.stackSize > 15) ret = 3; ++ if (stack.stackSize > 31) ret = 4; ++ return ret; + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index e8ddd9abd..3bf896870 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,12 +1,12 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -213,12 +213,14 @@ +@@ -221,12 +221,14 @@ if (par4EntityLiving.isPlayerSleeping()) { -- int var7 = par1World.getBlockId(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ)); +- int i = par1World.getBlockId(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ)); - -- if (var7 == Block.bed.blockID) +- if (i == Block.bed.blockID) + int x = MathHelper.floor_double(par4EntityLiving.posX); + int y = MathHelper.floor_double(par4EntityLiving.posY); + int z = MathHelper.floor_double(par4EntityLiving.posZ); @@ -14,9 +14,9 @@ + + if (block != null && block.isBed(par1World, x, y, z, par4EntityLiving)) { -- int var8 = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ)); -- int var9 = var8 & 3; -+ int var9 = block.getBedDirection(par1World, x, y, z);; - this.playerViewY = (float)(var9 * 90 + 180); +- int j = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ)); +- int k = j & 3; ++ int k = block.getBedDirection(par1World, x, y, z);; + this.playerViewY = (float)(k * 90 + 180); this.playerViewX = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 048f95aa3..dc8c2d612 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,24 +1,20 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -16,10 +16,17 @@ - import net.minecraft.item.EnumAction; - import net.minecraft.item.EnumArmorMaterial; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemArmor; - import net.minecraft.item.ItemStack; +@@ -19,7 +19,13 @@ + import net.minecraft.scoreboard.ScoreObjective; + import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.MathHelper; - import org.lwjgl.opengl.GL11; -+ -+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; -+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; ++import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; -+import net.minecraftforge.client.ForgeHooksClient; + import org.lwjgl.opengl.GL11; ++import net.minecraft.item.ItemBlock; ++import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; ++import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; @SideOnly(Side.CLIENT) public class RenderPlayer extends RenderLiving -@@ -28,6 +35,8 @@ +@@ -28,6 +34,8 @@ private ModelBiped modelArmorChestplate; private ModelBiped modelArmor; public static String[] armorFilenamePrefix = new String[] {"cloth", "chain", "iron", "diamond", "gold"}; @@ -27,67 +23,58 @@ public RenderPlayer() { -@@ -51,7 +60,7 @@ - if (var5 instanceof ItemArmor) +@@ -56,7 +64,7 @@ + if (item instanceof ItemArmor) { - ItemArmor var6 = (ItemArmor)var5; -- this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(var4, "/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png")); - ModelBiped var7 = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; - var7.bipedHead.showModel = par2 == 0; - var7.bipedHeadwear.showModel = par2 == 0; -@@ -120,7 +129,7 @@ - if (var5 instanceof ItemArmor) + ItemArmor itemarmor = (ItemArmor)item; +- this.loadTexture("/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); ++ this.loadTexture(ForgeHooksClient.getArmorTexture(itemstack, "/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png")); + ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; + modelbiped.bipedHead.showModel = par2 == 0; + modelbiped.bipedHeadwear.showModel = par2 == 0; +@@ -125,7 +133,7 @@ + if (item instanceof ItemArmor) { - ItemArmor var6 = (ItemArmor)var5; -- this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(var4, "/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png")); - float var7 = 1.0F; - GL11.glColor3f(var7, var7, var7); + ItemArmor itemarmor = (ItemArmor)item; +- this.loadTexture("/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png"); ++ this.loadTexture(ForgeHooksClient.getArmorTexture(itemstack, "/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png")); + float f1 = 1.0F; + GL11.glColor3f(f1, f1, f1); } -@@ -172,7 +181,7 @@ - float var8 = 1.6F; - float var9 = 0.016666668F * var8; - double var10 = par1EntityPlayer.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float var12 = par1EntityPlayer.isSneaking() ? 32.0F : 64.0F; -+ float var12 = par1EntityPlayer.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (var10 < (double)(var12 * var12)) - { -@@ -239,9 +248,12 @@ +@@ -184,9 +192,12 @@ this.modelBipedMain.bipedHead.postRender(0.0625F); - float var5; + float f2; -- if (var4.getItem().itemID < 256) +- if (itemstack.getItem().itemID < 256) - { -- if (RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType())) -+ if (var4 != null && var4.getItem() instanceof ItemBlock) +- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ if (itemstack != null && itemstack.getItem() instanceof ItemBlock) + { -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var4, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var4, BLOCK_3D)); ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); + -+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType())) ++ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) { - var5 = 0.625F; + f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -359,7 +371,10 @@ - var23 = var21.getItemUseAction(); +@@ -304,7 +315,10 @@ + enumaction = itemstack1.getItemUseAction(); } -- if (var21.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var21, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var21, BLOCK_3D)); +- if (itemstack1.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); + -+ if (var21.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType()))) ++ if (itemstack1.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))) { - var7 = 0.5F; + f3 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -416,7 +431,7 @@ +@@ -361,7 +375,7 @@ - if (var21.getItem().requiresMultipleRenderPasses()) + if (itemstack1.getItem().requiresMultipleRenderPasses()) { -- for (var27 = 0; var27 <= 1; ++var27) -+ for (var27 = 0; var27 < var21.getItem().getRenderPasses(var21.getItemDamage()); ++var27) +- for (j = 0; j <= 1; ++j) ++ for (j = 0; j < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++j) { - int var26 = var21.getItem().getColorFromItemStack(var21, var27); - var28 = (float)(var26 >> 16 & 255) / 255.0F; + int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j); + f12 = (float)(k >> 16 & 255) / 255.0F; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch index a3b7e504e..bbf94b4ea 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch @@ -17,19 +17,19 @@ public class RenderSnowMan extends RenderLiving @@ -31,12 +37,15 @@ super.renderEquippedItems(par1EntitySnowman, par2); - ItemStack var3 = new ItemStack(Block.pumpkin, 1); + ItemStack itemstack = new ItemStack(Block.pumpkin, 1); -- if (var3 != null && var3.getItem().itemID < 256) -+ if (var3 != null && var3.getItem() instanceof ItemBlock) +- if (itemstack != null && itemstack.getItem().itemID < 256) ++ if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { GL11.glPushMatrix(); this.snowmanModel.head.postRender(0.0625F); -- if (RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D)); +- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); + -+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())) ++ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) { - float var4 = 0.625F; + float f1 = 0.625F; GL11.glTranslatef(0.0F, -0.34375F, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch new file mode 100644 index 000000000..a0ca96d31 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -0,0 +1,50 @@ +--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java ++++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java +@@ -66,17 +66,42 @@ + + public List func_94266_e(String par1Str) + { ++ return createNewTexture(par1Str, par1Str, null); ++ } ++ ++ public List createNewTexture(String textureName, String textureFile, TextureStitched stitched) ++ { ++ String par1Str = textureFile; + ArrayList arraylist = new ArrayList(); + ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); + + try + { +- BufferedImage bufferedimage = ImageIO.read(itexturepack.getResourceAsStream("/" + par1Str)); +- int i = bufferedimage.getHeight(); +- int j = bufferedimage.getWidth(); +- String s1 = this.func_98146_d(par1Str); ++ BufferedImage bufferedimage = null; ++ int i = 0; ++ int j = 0; ++ FileNotFoundException fnfe = null; ++ try ++ { ++ bufferedimage = ImageIO.read(itexturepack.getResourceAsStream("/" + textureFile)); ++ i = bufferedimage.getHeight(); ++ j = bufferedimage.getWidth(); ++ } ++ catch (FileNotFoundException e) ++ { ++ fnfe = e; ++ } ++ String s1 = textureName; + +- if (this.func_98147_a(par1Str, itexturepack)) ++ if (stitched != null && stitched.loadTexture(this, itexturepack, textureName, textureFile, bufferedimage, arraylist)) ++ { ++ ; ++ } ++ else if (fnfe != null) ++ { ++ throw fnfe; ++ } ++ else if (this.func_98147_a(par1Str, itexturepack)) + { + int k = j; + int l = j; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch new file mode 100644 index 000000000..d7c3455ba --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -0,0 +1,98 @@ +--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java ++++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +@@ -90,13 +90,22 @@ + StitchHolder stitchholder = new StitchHolder(texture); + stitcher.func_94312_a(stitchholder); + hashmap.put(stitchholder, Arrays.asList(new Texture[] {texture})); +- Iterator iterator = this.field_94256_j.keySet().iterator(); +- +- while (iterator.hasNext()) +- { +- String s = (String)iterator.next(); +- String s1 = this.field_94254_c + s + this.field_94251_d; +- List list = TextureManager.func_94267_b().func_94266_e(s1); ++ ++ for (Map.Entry entry : ((Map)field_94256_j).entrySet()) ++ { ++ String name = entry.getKey(); ++ String path; ++ if (name.indexOf(':') == -1) ++ { ++ path = this.field_94254_c + name + this.field_94251_d; ++ } ++ else ++ { ++ String domain = name.substring(0,name.indexOf(':')); ++ String file = name.substring(name.indexOf(':')+1); ++ path = "mods/" + domain +"/" + field_94254_c + file + field_94251_d; ++ } ++ List list = TextureManager.func_94267_b().createNewTexture(name, path, entry.getValue()); + + if (!list.isEmpty()) + { +@@ -116,7 +125,7 @@ + } + + this.field_94257_h = stitcher.func_94306_e(); +- iterator = stitcher.func_94309_g().iterator(); ++ Iterator iterator = stitcher.func_94309_g().iterator(); + + while (iterator.hasNext()) + { +@@ -150,7 +159,17 @@ + if (list1.size() > 1) + { + this.field_94258_i.add(texturestitched); +- String s3 = this.field_94254_c + s2 + ".txt"; ++ String s3; ++ if (s2.indexOf(':') == -1) ++ { ++ s3 = field_94254_c + s2 + ".txt"; ++ } ++ else ++ { ++ String domain = s2.substring(0, s2.indexOf(':')); ++ String file = s2.substring(s2.indexOf(':') + 1); ++ s3 = "mods/" + domain + "/" + field_94254_c + file + ".txt"; ++ } + ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); + boolean flag1 = !itexturepack.func_98138_b("/" + this.field_94254_c + s2 + ".png", false); + +@@ -218,4 +237,37 @@ + { + return this.field_94250_g; + } ++ ++ //=================================================================================================== ++ // Forge Start ++ //=================================================================================================== ++ /** ++ * Grabs the registered entry for the specified name, returning null if there was not a entry. ++ * Opposed to func_94245_a, this will not instantiate the entry, useful to test if a maping exists. ++ * ++ * @param name The name of the entry to find ++ * @return The registered entry, null if nothing was registered. ++ */ ++ public TextureStitched getTextureExtry(String name) ++ { ++ return (TextureStitched)field_94256_j.get(name); ++ } ++ ++ /** ++ * Adds a texture registry entry to this map for the specified name if one does not already exist. ++ * Returns false if the map already contains a entry for the specified name. ++ * ++ * @param name Entry name ++ * @param entry Entry instance ++ * @return True if the entry was added to the map, false otherwise. ++ */ ++ public boolean setTextureEntry(String name, TextureStitched entry) ++ { ++ if (!field_94256_j.containsKey(name)) ++ { ++ field_94256_j.put(name, entry); ++ return true; ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch new file mode 100644 index 000000000..5f8cfb09e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch @@ -0,0 +1,45 @@ +--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java ++++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java +@@ -2,9 +2,13 @@ + + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++ ++import java.awt.image.BufferedImage; + import java.io.BufferedReader; + import java.util.ArrayList; + import java.util.List; ++ ++import net.minecraft.client.texturepacks.ITexturePack; + import net.minecraft.util.Icon; + import net.minecraft.util.Tuple; + +@@ -196,4 +200,28 @@ + this.field_94236_i = arraylist; + } + } ++ ++ //=================================================================================================== ++ // Forge Start ++ //=================================================================================================== ++ /** ++ * Called when texture packs are refreshed, from TextureManager.createNewTexture, ++ * allows for finer control over loading the animation lists and verification of the image. ++ * If the return value from this is true, no further loading will be done by vanilla code. ++ * ++ * You need to add all Texture's to the textures argument. At the end of this function at least one ++ * entry should be in that argument, or a error should of been thrown. ++ * ++ * @param manager The invoking manager ++ * @param texturepack Current texture pack ++ * @param name The name of the texture ++ * @param fileName Resource path for this texture ++ * @param image Buffered image of the loaded resource ++ * @param textures ArrayList of element type Texture, split textures should be added to this list for the stitcher to handle. ++ * @return Return true to skip further vanilla texture loading for this texture ++ */ ++ public boolean loadTexture(TextureManager manager, ITexturePack texturepack, String name, String fileName, BufferedImage image, ArrayList textures) ++ { ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch index 46392dd59..14ac1a9e6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch @@ -7,20 +7,20 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Calendar; -@@ -50,7 +51,15 @@ +@@ -52,7 +53,15 @@ - if (var10 != null && var9 == 0) + if (block instanceof BlockChest && i == 0) { -- ((BlockChest)var10).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); +- ((BlockChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); + try + { -+ ((BlockChest)var10).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); ++ ((BlockChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); + } + catch (ClassCastException e) + { + FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", + par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); + } - var9 = par1TileEntityChest.getBlockMetadata(); + i = par1TileEntityChest.getBlockMetadata(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java.patch deleted file mode 100644 index 83793e274..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java -@@ -12,6 +12,8 @@ - import net.minecraft.tileentity.TileEntityPiston; - import net.minecraft.world.World; - import org.lwjgl.opengl.GL11; -+ -+import net.minecraftforge.client.ForgeHooksClient; - - @SideOnly(Side.CLIENT) - public class TileEntityRendererPiston extends TileEntitySpecialRenderer -@@ -41,6 +43,7 @@ - GL11.glShadeModel(GL11.GL_FLAT); - } - -+ ForgeHooksClient.beforeBlockRender(var9, blockRenderer); - var10.startDrawingQuads(); - var10.setTranslation((double)((float)par2 - (float)par1TileEntityPiston.xCoord + par1TileEntityPiston.getOffsetX(par8)), (double)((float)par4 - (float)par1TileEntityPiston.yCoord + par1TileEntityPiston.getOffsetY(par8)), (double)((float)par6 - (float)par1TileEntityPiston.zCoord + par1TileEntityPiston.getOffsetZ(par8))); - var10.setColorOpaque(1, 1, 1); -@@ -64,6 +67,7 @@ - - var10.setTranslation(0.0D, 0.0D, 0.0D); - var10.draw(); -+ ForgeHooksClient.afterBlockRender(var9, blockRenderer); - RenderHelper.enableStandardItemLighting(); - } - } diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index b904a8cff..a54a0df8b 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src_work/minecraft/net/minecraft/command/CommandHandler.java -@@ -10,6 +10,9 @@ - import java.util.Map.Entry; +@@ -11,6 +11,9 @@ import net.minecraft.entity.player.EntityPlayerMP; + import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.CommandEvent; @@ -10,20 +10,20 @@ public class CommandHandler implements ICommandManager { /** Map of Strings to the ICommand objects they represent */ -@@ -40,6 +43,16 @@ +@@ -44,6 +47,16 @@ - if (var5.canCommandSenderUseCommand(par1ICommandSender)) + if (icommand.canCommandSenderUseCommand(par1ICommandSender)) { -+ CommandEvent event = new CommandEvent(var5, par1ICommandSender, var3); ++ CommandEvent event = new CommandEvent(icommand, par1ICommandSender, astring); + if (MinecraftForge.EVENT_BUS.post(event)) + { + if (event.exception != null) + { + throw event.exception; + } -+ return; ++ return 1; + } + - if (var6 > -1) + if (i > -1) { - EntityPlayerMP[] var7 = PlayerSelector.matchPlayers(par1ICommandSender, var3[var6]); + EntityPlayerMP[] aentityplayermp = PlayerSelector.matchPlayers(par1ICommandSender, astring[i]); diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index 9c038a7e9..fec57d5c5 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -55,23 +55,23 @@ @@ -149,11 +172,41 @@ { - Item var5 = var2[var4]; + Item item = aitem[j]; -- if (var5 != null && var5.getCreativeTab() == this) +- if (item != null && item.getCreativeTab() == this) - { -- var5.getSubItems(var5.itemID, this, par1List); +- item.getSubItems(item.itemID, this, par1List); - } - } -+ if (var5 == null) ++ if (item == null) + { + continue; + } + -+ for(CreativeTabs tab : var5.getCreativeTabs()) ++ for(CreativeTabs tab : item.getCreativeTabs()) + { + if (tab == this) + { -+ var5.getSubItems(var5.itemID, this, par1List); ++ item.getSubItems(item.itemID, this, par1List); + } + } + } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 0d145fc26..303845dac 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -37,4 +37,4 @@ + static { - ArrayList var0 = new ArrayList(); + ArrayList arraylist = new ArrayList(); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 2d121e7ac..8aebb7f5a 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -2,10 +2,10 @@ +++ ../src_work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java @@ -463,7 +463,7 @@ { - Enchantment var8 = var5[var7]; + Enchantment enchantment = aenchantment[k]; -- if (var8 != null && (var8.type.canEnchantItem(var2) || var4)) -+ if (var8 != null && (var8.canApplyAtEnchantingTable(par1ItemStack) || var4)) +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment != null && (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag)) { - for (int var9 = var8.getMinLevel(); var9 <= var8.getMaxLevel(); ++var9) + for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 0456f20c0..fde11d73b 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,19 +1,14 @@ --- ../src_base/minecraft/net/minecraft/entity/Entity.java +++ ../src_work/minecraft/net/minecraft/entity/Entity.java -@@ -2,8 +2,12 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.List; import java.util.Random; -+import java.util.UUID; -+ - import net.minecraft.block.Block; - import net.minecraft.block.BlockFluid; - import net.minecraft.block.StepSound; -@@ -12,8 +16,13 @@ + import java.util.UUID; +@@ -13,8 +14,13 @@ import net.minecraft.crash.CrashReportCategory; import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.effect.EntityLightningBolt; @@ -27,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagDouble; -@@ -24,6 +33,7 @@ +@@ -25,6 +31,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.Direction; import net.minecraft.util.MathHelper; @@ -35,9 +30,9 @@ import net.minecraft.util.ReportedException; import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; -@@ -222,6 +232,11 @@ - protected int field_82152_aq; +@@ -225,6 +232,11 @@ private boolean invulnerable; + private UUID field_96093_i; public EnumEntitySize myEntitySize; + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; @@ -47,7 +42,7 @@ public Entity(World par1World) { -@@ -543,7 +558,7 @@ +@@ -554,7 +566,7 @@ if (!this.worldObj.isRemote) { this.setFlag(0, this.fire > 0); @@ -56,71 +51,50 @@ } this.firstUpdate = false; -@@ -847,6 +862,8 @@ - par5 = var27; - this.boundingBox.setBB(var29); - } -+ /* Fixes a vanilla bug where the player view would dip when stepping between certain blocks -+ * https://mojang.atlassian.net/browse/MC-1594 - else - { - double var40 = this.boundingBox.minY - (double)((int)this.boundingBox.minY); -@@ -856,6 +873,7 @@ - this.ySize = (float)((double)this.ySize + var40 + 0.01D); - } - } -+ */ - } - - this.worldObj.theProfiler.endSection(); -@@ -1514,6 +1532,15 @@ - par1NBTTagCompound.setInteger("Dimension", this.dimension); - par1NBTTagCompound.setBoolean("Invulnerable", this.invulnerable); +@@ -1534,6 +1546,10 @@ par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); -+ if (persistentID != null) -+ { -+ par1NBTTagCompound.setLong("PersistentIDMSB", persistentID.getMostSignificantBits()); -+ par1NBTTagCompound.setLong("PersistentIDLSB", persistentID.getLeastSignificantBits()); -+ } + par1NBTTagCompound.setLong("UUIDMost", this.field_96093_i.getMostSignificantBits()); + par1NBTTagCompound.setLong("UUIDLeast", this.field_96093_i.getLeastSignificantBits()); + if (customEntityData != null) + { + par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData); + } this.writeEntityToNBT(par1NBTTagCompound); - } - catch (Throwable var5) -@@ -1568,6 +1595,14 @@ - this.timeUntilPortal = par1NBTTagCompound.getInteger("PortalCooldown"); + + if (this.ridingEntity != null) +@@ -1604,6 +1620,15 @@ + this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); + if (par1NBTTagCompound.hasKey("ForgeData")) + { + customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData"); + } ++ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly + if (par1NBTTagCompound.hasKey("PersistentIDMSB") && par1NBTTagCompound.hasKey("PersistentIDLSB")) + { -+ persistentID = new UUID(par1NBTTagCompound.getLong("PersistentIDMSB"), par1NBTTagCompound.getLong("PersistentIDLSB")); ++ this.field_96093_i = new UUID(par1NBTTagCompound.getLong("PersistentIDMSB"), par1NBTTagCompound.getLong("PersistentIDLSB")); + } this.readEntityFromNBT(par1NBTTagCompound); } - catch (Throwable var5) -@@ -1662,7 +1697,14 @@ + catch (Throwable throwable) +@@ -1698,7 +1723,14 @@ { - EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); - var3.delayBeforeCanPickup = 10; -- this.worldObj.spawnEntityInWorld(var3); + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); + entityitem.delayBeforeCanPickup = 10; +- this.worldObj.spawnEntityInWorld(entityitem); + if (captureDrops) + { -+ capturedDrops.add(var3); ++ capturedDrops.add(entityitem); + } + else + { -+ this.worldObj.spawnEntityInWorld(var3); ++ this.worldObj.spawnEntityInWorld(entityitem); + } - return var3; + return entityitem; } -@@ -2021,7 +2063,7 @@ +@@ -2056,7 +2088,7 @@ */ public boolean isRiding() { @@ -129,18 +103,18 @@ } /** -@@ -2359,7 +2401,7 @@ +@@ -2400,7 +2432,7 @@ - public float func_82146_a(Explosion par1Explosion, Block par2Block, int par3, int par4, int par5) + public float func_82146_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) { -- return par2Block.getExplosionResistance(this); -+ return par2Block.getExplosionResistance(this, worldObj, par3, par4, par5, posX, posY + (double)getEyeHeight(), posZ); +- return par6Block.getExplosionResistance(this); ++ return par6Block.getExplosionResistance(this, par2World, par3, par4, par5, posX, posY + (double)getEyeHeight(), posZ); } - public int func_82143_as() -@@ -2399,4 +2441,97 @@ + public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) +@@ -2455,4 +2487,89 @@ { - return this.isBurning(); + return this.getEntityName(); } + + /* ================================== Forge Start =====================================*/ @@ -212,15 +186,7 @@ + + public UUID getPersistentID() + { -+ return persistentID; -+ } -+ -+ public synchronized void generatePersistentID() -+ { -+ if (persistentID == null) -+ { -+ persistentID = UUID.randomUUID(); -+ } ++ return field_96093_i; + } + + /** diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 9ec2bcecd..050311ee9 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -8,7 +8,7 @@ import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; -@@ -45,6 +46,11 @@ +@@ -47,6 +48,11 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -20,7 +20,7 @@ public abstract class EntityLiving extends Entity { /** -@@ -387,6 +393,7 @@ +@@ -395,6 +401,7 @@ public void setAttackTarget(EntityLiving par1EntityLiving) { this.attackTarget = par1EntityLiving; @@ -28,15 +28,15 @@ } /** -@@ -483,6 +490,7 @@ +@@ -491,6 +498,7 @@ { this.entityLivingToAttack = par1EntityLiving; - this.revengeTimer = this.entityLivingToAttack != null ? 60 : 0; + this.revengeTimer = this.entityLivingToAttack != null ? 100 : 0; + ForgeHooks.onLivingSetAttackTarget(this, par1EntityLiving); } protected void entityInit() -@@ -792,6 +800,11 @@ +@@ -802,6 +810,11 @@ */ public void onUpdate() { @@ -48,7 +48,7 @@ super.onUpdate(); if (!this.worldObj.isRemote) -@@ -977,6 +990,11 @@ +@@ -987,6 +1000,11 @@ */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { @@ -60,7 +60,7 @@ if (this.isEntityInvulnerable()) { return false; -@@ -1188,6 +1206,11 @@ +@@ -1224,6 +1242,11 @@ { if (!this.isEntityInvulnerable()) { @@ -71,8 +71,8 @@ + } par2 = this.applyArmorCalculations(par1DamageSource, par2); par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); - this.health -= par2; -@@ -1252,6 +1275,11 @@ + int j = this.getHealth(); +@@ -1290,6 +1313,11 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -81,37 +81,37 @@ + return; + } + - Entity var2 = par1DamageSource.getEntity(); + Entity entity = par1DamageSource.getEntity(); + EntityLiving entityliving = this.func_94060_bK(); - if (this.scoreValue >= 0 && var2 != null) -@@ -1274,6 +1302,10 @@ - { - var3 = EnchantmentHelper.getLootingModifier((EntityLiving)var2); +@@ -1314,6 +1342,10 @@ + i = EnchantmentHelper.getLootingModifier((EntityLiving)entity); } -+ + + captureDrops = true; + capturedDrops.clear(); -+ int var4 = 0; - ++ int j = 0; ++ if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { -@@ -1282,7 +1314,7 @@ + this.dropFewItems(this.recentlyHit > 0, i); +@@ -1321,7 +1353,7 @@ if (this.recentlyHit > 0) { -- int var4 = this.rand.nextInt(200) - var3; -+ var4 = this.rand.nextInt(200) - var3; +- int j = this.rand.nextInt(200) - i; ++ j = this.rand.nextInt(200) - i; - if (var4 < 5) + if (j < 5) { -@@ -1290,6 +1322,16 @@ +@@ -1329,6 +1361,16 @@ } } } + + captureDrops = false; + -+ if (!ForgeHooks.onLivingDrops(this, par1DamageSource, capturedDrops, var3, recentlyHit > 0, var4)) ++ if (!ForgeHooks.onLivingDrops(this, par1DamageSource, capturedDrops, i, recentlyHit > 0, j)) + { + for (EntityItem item : capturedDrops) + { @@ -121,7 +121,7 @@ } this.worldObj.setEntityState(this, (byte)3); -@@ -1334,6 +1376,12 @@ +@@ -1373,6 +1415,12 @@ */ protected void fall(float par1) { @@ -132,18 +132,18 @@ + } + super.fall(par1); - int var2 = MathHelper.ceiling_float_int(par1 - 3.0F); + int i = MathHelper.ceiling_float_int(par1 - 3.0F); -@@ -1536,7 +1584,7 @@ - int var2 = MathHelper.floor_double(this.boundingBox.minY); - int var3 = MathHelper.floor_double(this.posZ); - int var4 = this.worldObj.getBlockId(var1, var2, var3); -- return var4 == Block.ladder.blockID || var4 == Block.vine.blockID; -+ return ForgeHooks.isLivingOnLadder(Block.blocksList[var4], worldObj, var1, var2, var3); +@@ -1575,7 +1623,7 @@ + int j = MathHelper.floor_double(this.boundingBox.minY); + int k = MathHelper.floor_double(this.posZ); + int l = this.worldObj.getBlockId(i, j, k); +- return l == Block.ladder.blockID || l == Block.vine.blockID; ++ return ForgeHooks.isLivingOnLadder(Block.blocksList[l], worldObj, i, j, k); } /** -@@ -1949,6 +1997,7 @@ +@@ -1997,6 +2045,7 @@ } this.isAirBorne = true; @@ -151,7 +151,7 @@ } /** -@@ -2486,8 +2535,6 @@ +@@ -2534,8 +2583,6 @@ return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; } @@ -160,9 +160,9 @@ /** * Remove the speified potion effect from this entity. */ -@@ -2944,4 +2991,42 @@ +@@ -3059,4 +3106,42 @@ { - this.dataWatcher.updateObject(10, Byte.valueOf((byte)par1)); + this.canPickUpLoot = par1; } + + /*** diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index 6c7a261d2..d18329e26 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,17 +1,17 @@ --- ../src_base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src_work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -530,10 +530,11 @@ - for (int var12 = var4; var12 <= var7; ++var12) +@@ -531,10 +531,11 @@ + for (int i2 = k; i2 <= j1; ++i2) { - int var13 = this.worldObj.getBlockId(var10, var11, var12); + int j2 = this.worldObj.getBlockId(k1, l1, i2); - -- if (var13 != 0) -+ Block block = Block.blocksList[var13]; +- if (j2 != 0) ++ Block block = Block.blocksList[j2]; + + if (block != null) { -- if (var13 != Block.obsidian.blockID && var13 != Block.whiteStone.blockID && var13 != Block.bedrock.blockID) -+ if (block.canDragonDestroy(worldObj, var10, var11, var12)) +- if (j2 != Block.obsidian.blockID && j2 != Block.whiteStone.blockID && j2 != Block.bedrock.blockID) ++ if (block.canDragonDestroy(worldObj, k1, l1, i2)) { - var9 = true; - this.worldObj.setBlockWithNotify(var10, var11, var12, 0); + flag1 = this.worldObj.func_94571_i(k1, l1, i2) || flag1; + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 745c1cac4..8275ba624 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -27,7 +27,7 @@ @@ -49,6 +59,7 @@ { this(par1World, par2, par4, par6); - this.func_92058_a(par8ItemStack); + this.setEntityItemStack(par8ItemStack); + this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); } @@ -42,7 +42,7 @@ + if (!this.worldObj.isRemote && this.age >= lifespan) + { + if (item != null) -+ { ++ { + ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); + if (MinecraftForge.EVENT_BUS.post(event)) + { @@ -63,7 +63,7 @@ { this.setDead(); } -@@ -263,6 +296,7 @@ +@@ -270,6 +303,7 @@ { par1NBTTagCompound.setShort("Health", (short)((byte)this.health)); par1NBTTagCompound.setShort("Age", (short)this.age); @@ -71,9 +71,9 @@ if (this.getEntityItem() != null) { -@@ -280,10 +314,17 @@ - NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item"); - this.func_92058_a(ItemStack.loadItemStackFromNBT(var2)); +@@ -287,10 +321,17 @@ + NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)); - if (this.getEntityItem() == null) + ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); @@ -90,7 +90,7 @@ } /** -@@ -293,10 +334,22 @@ +@@ -300,10 +341,22 @@ { if (!this.worldObj.isRemote) { @@ -106,11 +106,11 @@ + return; + } + - ItemStack var2 = this.getEntityItem(); - int var3 = var2.stackSize; + ItemStack itemstack = this.getEntityItem(); + int i = itemstack.stackSize; -- if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(var2)) -+ if (this.delayBeforeCanPickup <= 0 && (event.getResult() == Result.ALLOW || var3 <= 0 || par1EntityPlayer.inventory.addItemStackToInventory(var2))) +- if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(itemstack)) ++ if (this.delayBeforeCanPickup <= 0 && (event.getResult() == Result.ALLOW || i <= 0 || par1EntityPlayer.inventory.addItemStackToInventory(itemstack))) { - if (var2.itemID == Block.wood.blockID) + if (itemstack.itemID == Block.wood.blockID) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index a59863f88..f0bf828ae 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,72 +1,38 @@ --- ../src_base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src_work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -2,6 +2,8 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+ -+import java.util.ArrayList; - import java.util.List; - import net.minecraft.block.Block; - import net.minecraft.block.BlockRail; -@@ -23,6 +25,11 @@ +@@ -21,6 +21,10 @@ + import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; - +import net.minecraftforge.common.IMinecartCollisionHandler; -+import net.minecraftforge.common.MinecartRegistry; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.minecart.*; -+ - public class EntityMinecart extends Entity implements IInventory ++import net.minecraftforge.event.entity.minecart.MinecartCollisionEvent; ++import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent; + + public abstract class EntityMinecart extends Entity { - /** Array of item stacks stored in minecart (for storage minecarts). */ -@@ -54,6 +61,25 @@ +@@ -45,6 +49,20 @@ @SideOnly(Side.CLIENT) protected double velocityZ; + /* Forge: Minecart Compatibility Layer Integration. */ -+ public static float defaultMaxSpeedRail = 0.4f; -+ public static float defaultMaxSpeedGround = 0.4f; + public static float defaultMaxSpeedAirLateral = 0.4f; + public static float defaultMaxSpeedAirVertical = -1f; -+ public static double defaultDragRidden = 0.996999979019165D; -+ public static double defaultDragEmpty = 0.9599999785423279D; + public static double defaultDragAir = 0.94999998807907104D; + protected boolean canUseRail = true; + protected boolean canBePushed = true; + private static IMinecartCollisionHandler collisionHandler = null; + + /* Instance versions of the above physics properties */ -+ protected float maxSpeedRail; -+ protected float maxSpeedGround; -+ protected float maxSpeedAirLateral; -+ protected float maxSpeedAirVertical; -+ protected double dragAir; ++ private float currentSpeedRail = getMaxCartSpeedOnRail(); ++ protected float maxSpeedAirLateral = defaultMaxSpeedAirLateral; ++ protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; ++ protected double dragAir = defaultDragAir; + public EntityMinecart(World par1World) { super(par1World); -@@ -65,6 +91,18 @@ - this.setSize(0.98F, 0.7F); - this.yOffset = this.height / 2.0F; - this.field_82344_g = par1World != null ? par1World.func_82735_a(this) : null; -+ -+ maxSpeedRail = defaultMaxSpeedRail; -+ maxSpeedGround = defaultMaxSpeedGround; -+ maxSpeedAirLateral = defaultMaxSpeedAirLateral; -+ maxSpeedAirVertical = defaultMaxSpeedAirVertical; -+ dragAir = defaultDragAir; -+ } -+ -+ public EntityMinecart(World world, int type) -+ { -+ this(world); -+ minecartType = type; - } - - /** -@@ -90,6 +128,10 @@ +@@ -99,6 +117,10 @@ */ public AxisAlignedBB getCollisionBox(Entity par1Entity) { @@ -77,7 +43,7 @@ return par1Entity.canBePushed() ? par1Entity.boundingBox : null; } -@@ -98,6 +140,10 @@ +@@ -107,6 +129,10 @@ */ public AxisAlignedBB getBoundingBox() { @@ -88,7 +54,7 @@ return null; } -@@ -106,7 +152,7 @@ +@@ -115,7 +141,7 @@ */ public boolean canBePushed() { @@ -96,296 +62,41 @@ + return canBePushed; } - public EntityMinecart(World par1World, double par2, double par4, double par6, int par8) -@@ -161,48 +207,7 @@ - } + public EntityMinecart(World par1World, double par2, double par4, double par6) +@@ -347,10 +373,13 @@ + double d5 = 0.0078125D; + int l = this.worldObj.getBlockId(j, i, k); - this.setDead(); -- this.dropItemWithOffset(Item.minecartEmpty.itemID, 1, 0.0F); -- -- if (this.minecartType == 1) -- { -- EntityMinecart var3 = this; -- -- for (int var4 = 0; var4 < var3.getSizeInventory(); ++var4) -- { -- ItemStack var5 = var3.getStackInSlot(var4); -- -- if (var5 != null) -- { -- float var6 = this.rand.nextFloat() * 0.8F + 0.1F; -- float var7 = this.rand.nextFloat() * 0.8F + 0.1F; -- float var8 = this.rand.nextFloat() * 0.8F + 0.1F; -- -- while (var5.stackSize > 0) -- { -- int var9 = this.rand.nextInt(21) + 10; -- -- if (var9 > var5.stackSize) -- { -- var9 = var5.stackSize; -- } -- -- var5.stackSize -= var9; -- EntityItem var10 = new EntityItem(this.worldObj, this.posX + (double)var6, this.posY + (double)var7, this.posZ + (double)var8, new ItemStack(var5.itemID, var9, var5.getItemDamage())); -- float var11 = 0.05F; -- var10.motionX = (double)((float)this.rand.nextGaussian() * var11); -- var10.motionY = (double)((float)this.rand.nextGaussian() * var11 + 0.2F); -- var10.motionZ = (double)((float)this.rand.nextGaussian() * var11); -- this.worldObj.spawnEntityInWorld(var10); -- } -- } -- } -- -- this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F); -- } -- else if (this.minecartType == 2) -- { -- this.dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F); -- } -+ dropCartAsItem(); - } +- if (BlockRailBase.isRailBlock(l)) +- { +- int i1 = this.worldObj.getBlockMetadata(j, i, k); +- this.func_94091_a(j, i, k, d4, d5, l, i1); ++ if (canUseRail() && BlockRailBase.isRailBlock(l)) ++ { ++ BlockRailBase rail = (BlockRailBase)Block.blocksList[l]; ++ float railMaxSpeed = rail.getRailMaxSpeed(worldObj, this, j, i, k); ++ double maxSpeed = Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ int i1 = rail.getBasicRailMetadata(worldObj, this, j, i, k); ++ this.func_94091_a(j, i, k, maxSpeed, getSlopeAdjustment(), l, i1); - return true; -@@ -320,7 +325,7 @@ - this.kill(); - } - -- if (this.isMinecartPowered() && this.rand.nextInt(4) == 0) -+ if (this.isMinecartPowered() && this.rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class) - { - this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D); - } -@@ -418,18 +423,18 @@ - double var6 = 0.0078125D; - int var8 = this.worldObj.getBlockId(var45, var2, var47); - -- if (BlockRail.isRailBlock(var8)) -+ if (canUseRail() && BlockRail.isRailBlock(var8)) - { - this.fallDistance = 0.0F; - Vec3 var9 = this.func_70489_a(this.posX, this.posY, this.posZ); -- int var10 = this.worldObj.getBlockMetadata(var45, var2, var47); -+ int var10 = ((BlockRail)Block.blocksList[var8]).getBasicRailMetadata(worldObj, this, var45, var2, var47); - this.posY = (double)var2; - boolean var11 = false; - boolean var12 = false; - - if (var8 == Block.railPowered.blockID) + if (l == Block.field_94337_cv.blockID) { -- var11 = (var10 & 8) != 0; -+ var11 = (worldObj.getBlockMetadata(var45, var2, var47) & 8) != 0; - var12 = !var11; - } - -@@ -443,25 +448,7 @@ - this.posY = (double)(var2 + 1); - } - -- if (var10 == 2) -- { -- this.motionX -= var6; -- } -- -- if (var10 == 3) -- { -- this.motionX += var6; -- } -- -- if (var10 == 4) -- { -- this.motionZ += var6; -- } -- -- if (var10 == 5) -- { -- this.motionZ -= var6; -- } -+ adjustSlopeVelocities(var10); - - int[][] var13 = matrix[var10]; - double var14 = (double)(var13[1][0] - var13[0][0]); -@@ -494,7 +481,7 @@ - } - } - -- if (var12) -+ if (var12 && shouldDoRailFunctions()) - { - var24 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - -@@ -542,36 +529,8 @@ - this.posX = var26 + var14 * var24; - this.posZ = var28 + var16 * var24; - this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); -- var34 = this.motionX; -- var36 = this.motionZ; -- -- if (this.riddenByEntity != null) -- { -- var34 *= 0.75D; -- var36 *= 0.75D; -- } -- -- if (var34 < -var4) -- { -- var34 = -var4; -- } -- -- if (var34 > var4) -- { -- var34 = var4; -- } -- -- if (var36 < -var4) -- { -- var36 = -var4; -- } -- -- if (var36 > var4) -- { -- var36 = var4; -- } -- -- this.moveEntity(var34, 0.0D, var36); -+ -+ moveMinecartOnRail(var45, var2, var47); - - if (var13[0][1] != 0 && MathHelper.floor_double(this.posX) - var45 == var13[0][0] && MathHelper.floor_double(this.posZ) - var47 == var13[0][2]) - { -@@ -582,42 +541,7 @@ - this.setPosition(this.posX, this.posY + (double)var13[1][1], this.posZ); - } - -- if (this.riddenByEntity != null) -- { -- this.motionX *= 0.996999979019165D; -- this.motionY *= 0.0D; -- this.motionZ *= 0.996999979019165D; -- } -- else -- { -- if (this.minecartType == 2) -- { -- double var38 = this.pushX * this.pushX + this.pushZ * this.pushZ; -- -- if (var38 > 1.0E-4D) -- { -- var38 = (double)MathHelper.sqrt_double(var38); -- this.pushX /= var38; -- this.pushZ /= var38; -- double var40 = 0.04D; -- this.motionX *= 0.800000011920929D; -- this.motionY *= 0.0D; -- this.motionZ *= 0.800000011920929D; -- this.motionX += this.pushX * var40; -- this.motionZ += this.pushZ * var40; -- } -- else -- { -- this.motionX *= 0.8999999761581421D; -- this.motionY *= 0.0D; -- this.motionZ *= 0.8999999761581421D; -- } -- } -- -- this.motionX *= 0.9599999785423279D; -- this.motionY *= 0.0D; -- this.motionZ *= 0.9599999785423279D; -- } -+ applyDragAndPushForces(); - - Vec3 var54 = this.func_70489_a(this.posX, this.posY, this.posZ); - -@@ -647,30 +571,14 @@ - - double var41; - -- if (this.minecartType == 2) -- { -- var41 = this.pushX * this.pushX + this.pushZ * this.pushZ; -- -- if (var41 > 1.0E-4D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D) -- { -- var41 = (double)MathHelper.sqrt_double(var41); -- this.pushX /= var41; -- this.pushZ /= var41; -- -- if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D) -- { -- this.pushX = 0.0D; -- this.pushZ = 0.0D; -- } -- else -- { -- this.pushX = this.motionX; -- this.pushZ = this.motionZ; -- } -- } -- } -- -- if (var11) -+ updatePushForces(); -+ -+ if(shouldDoRailFunctions()) -+ { -+ ((BlockRail)Block.blocksList[var8]).onMinecartPass(worldObj, this, var45, var2, var47); -+ } -+ -+ if (var11 && shouldDoRailFunctions()) - { - var41 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - -@@ -706,41 +614,7 @@ +@@ -359,7 +388,7 @@ } else { -- if (this.motionX < -var4) -- { -- this.motionX = -var4; -- } -- -- if (this.motionX > var4) -- { -- this.motionX = var4; -- } -- -- if (this.motionZ < -var4) -- { -- this.motionZ = -var4; -- } -- -- if (this.motionZ > var4) -- { -- this.motionZ = var4; -- } -- -- if (this.onGround) -- { -- this.motionX *= 0.5D; -- this.motionY *= 0.5D; -- this.motionZ *= 0.5D; -- } -- -- this.moveEntity(this.motionX, this.motionY, this.motionZ); -- -- if (!this.onGround) -- { -- this.motionX *= 0.949999988079071D; -- this.motionY *= 0.949999988079071D; -- this.motionZ *= 0.949999988079071D; -- } -+ moveMinecartOffRail(var45, var2, var47); +- this.func_94088_b(d4); ++ this.func_94088_b(onGround ? d4 : getMaxSpeedAirLateral()); } this.doBlockCollisions(); -@@ -767,7 +641,18 @@ +@@ -386,7 +415,18 @@ } this.setRotation(this.rotationYaw, this.rotationPitch); -- List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); +- List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + -+ AxisAlignedBB box = null; ++ AxisAlignedBB box; + if (getCollisionHandler() != null) + { + box = getCollisionHandler().getMinecartCollisionBox(this); @@ -395,105 +106,156 @@ + box = boundingBox.expand(0.2D, 0.0D, 0.2D); + } + -+ List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box); ++ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box); - if (var15 != null && !var15.isEmpty()) + if (list != null && !list.isEmpty()) { -@@ -792,17 +677,8 @@ +@@ -410,6 +450,8 @@ + this.riddenByEntity = null; } - -- if (this.fuel > 0) -- { -- --this.fuel; -- } -- -- if (this.fuel <= 0) -- { -- this.pushX = this.pushZ = 0.0D; -- } -- -- this.setMinecartPowered(this.fuel > 0); -+ updateFuel(); -+ MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, var45, var2, var47)); ++ ++ MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, j, i, k)); } } -@@ -826,12 +702,7 @@ +@@ -435,6 +477,17 @@ + if (this.motionZ > par1) + { + this.motionZ = par1; ++ } ++ ++ double moveY = motionY; ++ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) ++ { ++ moveY = getMaxSpeedAirVertical(); ++ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) ++ { ++ moveY = 0.15f; ++ motionY = moveY; ++ } + } + + if (this.onGround) +@@ -444,13 +497,13 @@ + this.motionZ *= 0.5D; + } + +- this.moveEntity(this.motionX, this.motionY, this.motionZ); ++ this.moveEntity(this.motionX, moveY, this.motionZ); + + if (!this.onGround) + { +- this.motionX *= 0.949999988079071D; +- this.motionY *= 0.949999988079071D; +- this.motionZ *= 0.949999988079071D; ++ this.motionX *= getDragAir(); ++ this.motionY *= getDragAir(); ++ this.motionZ *= getDragAir(); + } + } + +@@ -464,7 +517,7 @@ + + if (par8 == Block.railPowered.blockID) + { +- flag = (par9 & 8) != 0; ++ flag = (worldObj.getBlockMetadata(par1, par2, par3) & 8) != 0; + flag1 = !flag; + } + +@@ -535,7 +588,7 @@ + } + } + +- if (flag1) ++ if (flag1 && shouldDoRailFunctions()) + { + d7 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -583,36 +636,8 @@ + this.posX = d8 + d2 * d7; + this.posZ = d9 + d3 * d7; + this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); +- d12 = this.motionX; +- d13 = this.motionZ; +- +- if (this.riddenByEntity != null) +- { +- d12 *= 0.75D; +- d13 *= 0.75D; +- } +- +- if (d12 < -par4) +- { +- d12 = -par4; +- } +- +- if (d12 > par4) +- { +- d12 = par4; +- } +- +- if (d13 < -par4) +- { +- d13 = -par4; +- } +- +- if (d13 > par4) +- { +- d13 = par4; +- } +- +- this.moveEntity(d12, 0.0D, d13); ++ ++ moveMinecartOnRail(par1, par2, par3, par4); + + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - par1 == aint[0][0] && MathHelper.floor_double(this.posZ) - par3 == aint[0][2]) + { +@@ -650,7 +675,12 @@ + this.motionZ = d6 * (double)(k1 - par3); + } + +- if (flag) ++ if(shouldDoRailFunctions()) ++ { ++ ((BlockRailBase)Block.blocksList[par8]).onMinecartPass(worldObj, this, par1, par2, par3); ++ } ++ ++ if (flag && shouldDoRailFunctions()) + { + double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -721,12 +751,7 @@ } else { -- int var13 = this.worldObj.getBlockMetadata(var9, var10, var11); +- int i1 = this.worldObj.getBlockMetadata(i, j, k); - -- if (((BlockRail)Block.blocksList[var12]).isPowered()) +- if (((BlockRailBase)Block.blocksList[l]).isPowered()) - { -- var13 &= 7; +- i1 &= 7; - } -+ int var13 = ((BlockRail)Block.blocksList[var12]).getBasicRailMetadata(worldObj, this, var9, var10, var11); ++ int i1 = ((BlockRailBase)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); - par3 = (double)var10; + par3 = (double)j; -@@ -877,13 +748,8 @@ +@@ -772,13 +797,8 @@ - if (BlockRail.isRailBlock(var10)) + if (BlockRailBase.isRailBlock(l)) { -- int var11 = this.worldObj.getBlockMetadata(var7, var8, var9); -+ int var11 = ((BlockRail)Block.blocksList[var10]).getBasicRailMetadata(worldObj, this, var7, var8, var9); - par3 = (double)var8; +- int i1 = this.worldObj.getBlockMetadata(i, j, k); ++ int i1 = ((BlockRailBase)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); + par3 = (double)j; - -- if (((BlockRail)Block.blocksList[var10]).isPowered()) +- if (((BlockRailBase)Block.blocksList[l]).isPowered()) - { -- var11 &= 7; +- i1 &= 7; - } - if (var11 >= 2 && var11 <= 5) + if (i1 >= 2 && i1 <= 5) { -@@ -948,13 +814,14 @@ - { - par1NBTTagCompound.setInteger("Type", this.minecartType); - -- if (this.minecartType == 2) -+ if (isPoweredCart()) - { - par1NBTTagCompound.setDouble("PushX", this.pushX); - par1NBTTagCompound.setDouble("PushZ", this.pushZ); -- par1NBTTagCompound.setShort("Fuel", (short)this.fuel); -- } -- else if (this.minecartType == 1) -+ par1NBTTagCompound.setInteger("Fuel", this.fuel); -+ } -+ -+ if (getSizeInventory() > 0) - { - NBTTagList var2 = new NBTTagList(); - -@@ -980,13 +847,21 @@ - { - this.minecartType = par1NBTTagCompound.getInteger("Type"); - -- if (this.minecartType == 2) -+ if (isPoweredCart()) - { - this.pushX = par1NBTTagCompound.getDouble("PushX"); - this.pushZ = par1NBTTagCompound.getDouble("PushZ"); -- this.fuel = par1NBTTagCompound.getShort("Fuel"); -- } -- else if (this.minecartType == 1) -+ try -+ { -+ this.fuel = par1NBTTagCompound.getInteger("Fuel"); -+ } -+ catch (ClassCastException e) -+ { -+ this.fuel = par1NBTTagCompound.getShort("Fuel"); -+ } -+ } -+ -+ if (getSizeInventory() > 0) - { - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); - this.cargoItems = new ItemStack[this.getSizeInventory()]; -@@ -1015,11 +890,17 @@ +@@ -884,11 +904,17 @@ */ public void applyEntityCollision(Entity par1Entity) { @@ -507,189 +269,69 @@ { if (par1Entity != this.riddenByEntity) { -- if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.minecartType == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) +- if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.func_94087_l() == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) + if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) { par1Entity.mountEntity(this); } -@@ -1065,7 +946,7 @@ - double var18 = par1Entity.motionX + this.motionX; - double var20 = par1Entity.motionZ + this.motionZ; +@@ -934,7 +960,7 @@ + double d7 = par1Entity.motionX + this.motionX; + double d8 = par1Entity.motionZ + this.motionZ; -- if (((EntityMinecart)par1Entity).minecartType == 2 && this.minecartType != 2) +- if (((EntityMinecart)par1Entity).func_94087_l() == 2 && this.func_94087_l() != 2) + if (((EntityMinecart)par1Entity).isPoweredCart() && !isPoweredCart()) { this.motionX *= 0.20000000298023224D; this.motionZ *= 0.20000000298023224D; -@@ -1073,7 +954,7 @@ +@@ -942,7 +968,7 @@ par1Entity.motionX *= 0.949999988079071D; par1Entity.motionZ *= 0.949999988079071D; } -- else if (((EntityMinecart)par1Entity).minecartType != 2 && this.minecartType == 2) +- else if (((EntityMinecart)par1Entity).func_94087_l() != 2 && this.func_94087_l() == 2) + else if (!((EntityMinecart)par1Entity).isPoweredCart() && isPoweredCart()) { par1Entity.motionX *= 0.20000000298023224D; par1Entity.motionZ *= 0.20000000298023224D; -@@ -1108,7 +989,7 @@ - */ - public int getSizeInventory() +@@ -1145,4 +1171,211 @@ { -- return 27; -+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0); - } - - /** -@@ -1211,7 +1092,12 @@ - */ - public boolean interact(EntityPlayer par1EntityPlayer) - { -- if (this.minecartType == 0) -+ if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) -+ { -+ return true; -+ } -+ -+ if (canBeRidden()) - { - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) - { -@@ -1223,14 +1109,14 @@ - par1EntityPlayer.mountEntity(this); - } - } -- else if (this.minecartType == 1) -+ else if (getSizeInventory() > 0) - { - if (!this.worldObj.isRemote) - { - par1EntityPlayer.displayGUIChest(this); - } - } -- else if (this.minecartType == 2) -+ else if (this.minecartType == 2 && getClass() == EntityMinecart.class) - { - ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); - -@@ -1366,4 +1252,375 @@ - { - return this.dataWatcher.getWatchableObjectInt(18); + return this.field_94102_c; } + + /** -+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped(). ++ * Moved to allow overrides. ++ * This code handles minecart movement and speed capping when on a rail. + */ -+ public void dropCartAsItem() -+ { -+ for(ItemStack item : getItemsDropped()) ++ public void moveMinecartOnRail(int x, int y, int z, double par4){ ++ double d12 = this.motionX; ++ double d13 = this.motionZ; ++ ++ if (this.riddenByEntity != null) + { -+ entityDropItem(item, 0); ++ d12 *= 0.75D; ++ d13 *= 0.75D; + } -+ } + -+ /** -+ * Override this to define which items your cart drops when broken. -+ * This does not include items contained in the inventory, -+ * that is handled elsewhere. -+ * @return A list of items dropped. -+ */ -+ public List getItemsDropped() -+ { -+ List items = new ArrayList(); -+ items.add(new ItemStack(Item.minecartEmpty)); -+ -+ switch(minecartType) ++ if (d12 < -par4) + { -+ case 1: -+ items.add(new ItemStack(Block.chest)); -+ break; -+ case 2: -+ items.add(new ItemStack(Block.stoneOvenIdle)); -+ break; ++ d12 = -par4; + } -+ return items; -+ } + -+ /** -+ * This function returns an ItemStack that represents this cart. -+ * This should be an ItemStack that can be used by the player to place the cart. -+ * This is the item that was registered with the cart via the registerMinecart function, -+ * but is not necessary the item the cart drops when destroyed. -+ * @return An ItemStack that can be used to place the cart. -+ */ -+ public ItemStack getCartItem() -+ { -+ return MinecartRegistry.getItemForCart(this); -+ } -+ -+ /** -+ * Returns true if this cart is self propelled. -+ * @return True if powered. -+ */ -+ public boolean isPoweredCart() -+ { -+ return minecartType == 2 && getClass() == EntityMinecart.class; -+ } -+ -+ /** -+ * Returns true if this cart is a storage cart -+ * Some carts may have inventories but not be storage carts -+ * and some carts without inventories may be storage carts. -+ * @return True if this cart should be classified as a storage cart. -+ */ -+ public boolean isStorageCart() -+ { -+ return minecartType == 1 && getClass() == EntityMinecart.class; -+ } -+ -+ /** -+ * Returns true if this cart can be ridden by an Entity. -+ * @return True if this cart can be ridden. -+ */ -+ public boolean canBeRidden() -+ { -+ if(minecartType == 0 && getClass() == EntityMinecart.class) ++ if (d12 > par4) + { -+ return true; ++ d12 = par4; + } -+ return false; -+ } + -+ /** -+ * Returns true if this cart can currently use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @return True if the minecart can use rails. -+ */ -+ public boolean canUseRail() -+ { -+ return canUseRail; -+ } ++ if (d13 < -par4) ++ { ++ d13 = -par4; ++ } + -+ /** -+ * Set whether the minecart can use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @param use Whether the minecart can currently use rails. -+ */ -+ public void setCanUseRail(boolean use) -+ { -+ canUseRail = use; -+ } ++ if (d13 > par4) ++ { ++ d13 = par4; ++ } + -+ /** -+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails. -+ * @return True if this cart should call IRail.onMinecartPass(). -+ */ -+ public boolean shouldDoRailFunctions() -+ { -+ return true; -+ } -+ -+ /** -+ * Simply returns the minecartType variable. -+ * @return minecartType -+ */ -+ public int getMinecartType() -+ { -+ return minecartType; ++ this.moveEntity(d12, 0.0D, d13); + } + + /** @@ -713,175 +355,81 @@ + } + + /** -+ * Carts should return their drag factor here -+ * @return The drag rate. ++ * This function returns an ItemStack that represents this cart. ++ * This should be an ItemStack that can be used by the player to place the cart, ++ * but is not necessary the item the cart drops when destroyed. ++ * @return An ItemStack that can be used to place the cart. + */ -+ protected double getDrag() ++ public ItemStack getCartItem() + { -+ return riddenByEntity != null ? defaultDragRidden : defaultDragEmpty; ++ if (this instanceof EntityMinecartChest) ++ { ++ return new ItemStack(Item.minecartCrate); ++ } ++ else if (this instanceof EntityMinecartTNT) ++ { ++ return new ItemStack(Item.field_94582_cb); ++ } ++ else if (this instanceof EntityMinecartFurnace) ++ { ++ return new ItemStack(Item.minecartPowered); ++ } ++ else if (this instanceof EntityMinecartHopper) ++ { ++ return new ItemStack(Item.field_96600_cc); ++ } ++ return new ItemStack(Item.minecartEmpty); + } + + /** -+ * Moved to allow overrides. -+ * This code applies drag and updates push forces. ++ * Returns true if this cart can currently use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @return True if the minecart can use rails. + */ -+ protected void applyDragAndPushForces() ++ public boolean canUseRail() + { -+ if(isPoweredCart()) -+ { -+ double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ); -+ if(d27 > 0.01D) -+ { -+ pushX /= d27; -+ pushZ /= d27; -+ double d29 = 0.04; -+ motionX *= 0.8D; -+ motionY *= 0.0D; -+ motionZ *= 0.8D; -+ motionX += pushX * d29; -+ motionZ += pushZ * d29; -+ } -+ else -+ { -+ motionX *= 0.9D; -+ motionY *= 0.0D; -+ motionZ *= 0.9D; -+ } -+ } -+ motionX *= getDrag(); -+ motionY *= 0.0D; -+ motionZ *= getDrag(); ++ return canUseRail; + } + + /** -+ * Moved to allow overrides. -+ * This code updates push forces. ++ * Set whether the minecart can use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @param use Whether the minecart can currently use rails. + */ -+ protected void updatePushForces() ++ public void setCanUseRail(boolean use) + { -+ if(isPoweredCart()) -+ { -+ double push = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ); -+ if(push > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D) -+ { -+ pushX /= push; -+ pushZ /= push; -+ if(pushX * motionX + pushZ * motionZ < 0.0D) -+ { -+ pushX = 0.0D; -+ pushZ = 0.0D; -+ } -+ else -+ { -+ pushX = motionX; -+ pushZ = motionZ; -+ } -+ } -+ } ++ canUseRail = use; + } + + /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when on a rail. ++ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. ++ * @return True if this cart should call onMinecartPass(). + */ -+ protected void moveMinecartOnRail(int i, int j, int k) ++ public boolean shouldDoRailFunctions() + { -+ int id = worldObj.getBlockId(i, j, k); -+ if (!BlockRail.isRailBlock(id)) -+ { -+ return; -+ } -+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k); -+ -+ double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail()); -+ double mX = motionX; -+ double mZ = motionZ; -+ if(riddenByEntity != null) -+ { -+ mX *= 0.75D; -+ mZ *= 0.75D; -+ } -+ if(mX < -maxSpeed) mX = -maxSpeed; -+ if(mX > maxSpeed) mX = maxSpeed; -+ if(mZ < -maxSpeed) mZ = -maxSpeed; -+ if(mZ > maxSpeed) mZ = maxSpeed; -+ moveEntity(mX, 0.0D, mZ); ++ return true; + } + + /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when not on a rail. ++ * Returns true if this cart is self propelled. ++ * @return True if powered. + */ -+ protected void moveMinecartOffRail(int i, int j, int k) ++ public boolean isPoweredCart() + { -+ double d2 = getMaxSpeedGround(); -+ if(!onGround) -+ { -+ d2 = getMaxSpeedAirLateral(); -+ } -+ if(motionX < -d2) motionX = -d2; -+ if(motionX > d2) motionX = d2; -+ if(motionZ < -d2) motionZ = -d2; -+ if(motionZ > d2) motionZ = d2; -+ double moveY = motionY; -+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) -+ { -+ moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) -+ { -+ moveY = 0.15f; -+ motionY = moveY; -+ } -+ } -+ if(onGround) -+ { -+ motionX *= 0.5D; -+ motionY *= 0.5D; -+ motionZ *= 0.5D; -+ } -+ moveEntity(motionX, moveY, motionZ); -+ if(!onGround) -+ { -+ motionX *= getDragAir(); -+ motionY *= getDragAir(); -+ motionZ *= getDragAir(); -+ } ++ return func_94087_l() == 2; + } + + /** -+ * Moved to allow overrides. -+ * This code applies fuel consumption. ++ * Returns true if this cart can be ridden by an Entity. ++ * @return True if this cart can be ridden. + */ -+ protected void updateFuel() ++ public boolean canBeRidden() + { -+ if (fuel > 0) fuel--; -+ if (fuel <= 0) pushX = pushZ = 0.0D; -+ setMinecartPowered(fuel > 0); -+ } -+ -+ /** -+ * Moved to allow overrides, This code handle slopes affecting velocity. -+ * @param metadata The blocks position metadata -+ */ -+ protected void adjustSlopeVelocities(int metadata) -+ { -+ double acceleration = 0.0078125D; -+ if (metadata == 2) ++ if(this instanceof EntityMinecartEmpty) + { -+ motionX -= acceleration; -+ } -+ else if (metadata == 3) -+ { -+ motionX += acceleration; -+ } -+ else if (metadata == 4) -+ { -+ motionZ += acceleration; -+ } -+ else if (metadata == 5) -+ { -+ motionZ -= acceleration; ++ return true; + } ++ return false; + } + + /** @@ -889,31 +437,36 @@ + */ + + /** -+ * Returns the carts max speed. -+ * Carts going faster than 1.1 cause issues with chunk loading. -+ * Carts cant traverse slopes or corners at greater than 0.5 - 0.6. -+ * This value is compared with the rails max speed to determine -+ * the carts current max speed. A normal rails max speed is 0.4. ++ * Returns the carts max speed when traveling on rails. Carts going faster ++ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or ++ * corners at greater than 0.5 - 0.6. This value is compared with the rails ++ * max speed and the carts current speed cap to determine the carts current ++ * max speed. A normal rail's max speed is 0.4. ++ * + * @return Carts max speed. + */ -+ public float getMaxSpeedRail() ++ public float getMaxCartSpeedOnRail() + { -+ return maxSpeedRail; ++ return 1.2f; + } + -+ public void setMaxSpeedRail(float value) ++ /** ++ * Returns the current speed cap for the cart when traveling on rails. This ++ * functions differs from getMaxCartSpeedOnRail() in that it controls ++ * current movement and cannot be overridden. The value however can never be ++ * higher than getMaxCartSpeedOnRail(). ++ * ++ * @return ++ */ ++ public final float getCurrentCartSpeedCapOnRail() + { -+ maxSpeedRail = value; ++ return currentSpeedRail; + } + -+ public float getMaxSpeedGround() ++ public final void setCurrentCartSpeedCapOnRail(float value) + { -+ return maxSpeedGround; -+ } -+ -+ public void setMaxSpeedGround(float value) -+ { -+ maxSpeedGround = value; ++ value = Math.min(value, getMaxCartSpeedOnRail()); ++ currentSpeedRail = value; + } + + public float getMaxSpeedAirLateral() @@ -944,5 +497,10 @@ + public void setDragAir(double value) + { + dragAir = value; ++ } ++ ++ public double getSlopeAdjustment() ++ { ++ return 0.0078125D; + } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch new file mode 100644 index 000000000..acfbe1171 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java ++++ ../src_work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +@@ -8,6 +8,8 @@ + import net.minecraft.nbt.NBTTagList; + import net.minecraft.util.DamageSource; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; + + public abstract class EntityMinecartContainer extends EntityMinecart implements IInventory + { +@@ -275,6 +277,10 @@ + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { ++ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) ++ { ++ return true; ++ } + if (!this.worldObj.isRemote) + { + par1EntityPlayer.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch new file mode 100644 index 000000000..7944835ed --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java ++++ ../src_work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +@@ -2,6 +2,8 @@ + + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; + + public class EntityMinecartEmpty extends EntityMinecart + { +@@ -20,6 +22,10 @@ + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { ++ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) ++ { ++ return true; ++ } + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) + { + return true; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch new file mode 100644 index 000000000..cd938f3e3 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java ++++ ../src_work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +@@ -8,6 +8,8 @@ + import net.minecraft.util.DamageSource; + import net.minecraft.util.MathHelper; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; + + public class EntityMinecartFurnace extends EntityMinecart + { +@@ -126,6 +128,10 @@ + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { ++ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) ++ { ++ return true; ++ } + ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.itemID == Item.coal.itemID) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch new file mode 100644 index 000000000..f4cb5cdc1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java ++++ ../src_work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +@@ -9,6 +9,8 @@ + import net.minecraft.tileentity.TileEntityHopper; + import net.minecraft.util.DamageSource; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; + + public class EntityMinecartHopper extends EntityMinecartContainer implements Hopper + { +@@ -53,6 +55,10 @@ + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { ++ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) ++ { ++ return true; ++ } + if (!this.worldObj.isRemote) + { + par1EntityPlayer.func_96125_a(this); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index 8adaa9091..cc6af1ed1 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -17,20 +17,20 @@ } } -- if (var2 != null && var2.itemID == Item.shears.itemID && this.getGrowingAge() >= 0) +- if (itemstack != null && itemstack.itemID == Item.shears.itemID && this.getGrowingAge() >= 0) - { - this.setDead(); - this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D); - - if (!this.worldObj.isRemote) - { -- EntityCow var3 = new EntityCow(this.worldObj); -- var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); -- var3.setEntityHealth(this.getHealth()); -- var3.renderYawOffset = this.renderYawOffset; -- this.worldObj.spawnEntityInWorld(var3); +- EntityCow entitycow = new EntityCow(this.worldObj); +- entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); +- entitycow.setEntityHealth(this.getHealth()); +- entitycow.renderYawOffset = this.renderYawOffset; +- this.worldObj.spawnEntityInWorld(entitycow); - -- for (int var4 = 0; var4 < 5; ++var4) +- for (int i = 0; i < 5; ++i) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed))); - } @@ -45,10 +45,10 @@ + return super.interact(par1EntityPlayer); } - /** -@@ -78,4 +58,29 @@ + public EntityMooshroom func_94900_c(EntityAgeable par1EntityAgeable) +@@ -83,4 +63,29 @@ { - return this.spawnBabyAnimal(par1EntityAgeable); + return this.func_94900_c(par1EntityAgeable); } + + @Override diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index cb24facd3..7f264450f 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -3,12 +3,12 @@ @@ -355,8 +355,9 @@ } - int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); + int l = this.worldObj.getBlockId(i, j - 1, k); - -- if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID) -+ Block block = Block.blocksList[var4]; +- if (l == Block.grass.blockID || l == Block.leaves.blockID) ++ Block block = Block.blocksList[l]; + -+ if (var4 == Block.grass.blockID || (block != null && block.isLeaves(worldObj, var1, var2 - 1, var3))) ++ if (l == Block.grass.blockID || (block != null && block.isLeaves(worldObj, i, j - 1, k))) { return true; } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 2db5518b1..ee9c14bd7 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -20,29 +20,29 @@ { private final InventoryCrafting field_90016_e = new InventoryCrafting(new ContainerSheep(this), 2, 1); -@@ -139,28 +143,6 @@ +@@ -159,28 +163,6 @@ */ public boolean interact(EntityPlayer par1EntityPlayer) { -- ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); +- ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - -- if (var2 != null && var2.itemID == Item.shears.itemID && !this.getSheared() && !this.isChild()) +- if (itemstack != null && itemstack.itemID == Item.shears.itemID && !this.getSheared() && !this.isChild()) - { - if (!this.worldObj.isRemote) - { - this.setSheared(true); -- int var3 = 1 + this.rand.nextInt(3); +- int i = 1 + this.rand.nextInt(3); - -- for (int var4 = 0; var4 < var3; ++var4) +- for (int j = 0; j < i; ++j) - { -- EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F); -- var5.motionY += (double)(this.rand.nextFloat() * 0.05F); -- var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); -- var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); +- EntityItem entityitem = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F); +- entityitem.motionY += (double)(this.rand.nextFloat() * 0.05F); +- entityitem.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); +- entityitem.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); - } - } - -- var2.damageItem(1, par1EntityPlayer); +- itemstack.damageItem(1, par1EntityPlayer); - this.playSound("mob.sheep.shear", 1.0F, 1.0F); - } - diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 47ff21b4f..abcb44eb5 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -55,8 +55,21 @@ +@@ -66,8 +66,21 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -22,29 +22,29 @@ /** Inventory of the player */ public InventoryPlayer inventory = new InventoryPlayer(this); private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); -@@ -259,6 +272,7 @@ +@@ -268,6 +281,7 @@ - if (var1 == this.itemInUse) + if (itemstack == this.itemInUse) { + itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount); if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { - this.updateItemUse(var1, 5); -@@ -497,11 +511,11 @@ + this.updateItemUse(itemstack, 5); +@@ -528,11 +542,11 @@ this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - var1, this.posY - var3, this.posZ - var5); + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); - if (this.ridingEntity instanceof EntityPig) + if (this.ridingEntity instanceof EntityLiving && ((EntityLiving)ridingEntity).shouldRiderFaceForward(this)) { - this.rotationPitch = var8; - this.rotationYaw = var7; + this.rotationPitch = f1; + this.rotationYaw = f; - this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; + this.renderYawOffset = ((EntityLiving)this.ridingEntity).renderYawOffset; } } -@@ -630,6 +644,9 @@ +@@ -661,6 +675,9 @@ this.setPosition(this.posX, this.posY, this.posZ); this.motionY = 0.10000000149011612D; @@ -54,7 +54,7 @@ if (this.username.equals("Notch")) { this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); -@@ -638,6 +655,20 @@ +@@ -669,6 +686,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { this.inventory.dropAllItems(); @@ -75,7 +75,7 @@ } if (par1DamageSource != null) -@@ -677,7 +708,20 @@ +@@ -719,7 +750,20 @@ */ public EntityItem dropOneItem(boolean par1) { @@ -97,7 +97,7 @@ } /** -@@ -686,7 +730,7 @@ +@@ -728,7 +772,7 @@ */ public EntityItem dropPlayerItem(ItemStack par1ItemStack) { @@ -106,19 +106,16 @@ } /** -@@ -738,23 +782,39 @@ +@@ -780,15 +824,28 @@ */ public void joinEntityItemWithWorld(EntityItem par1EntityItem) { -- this.worldObj.spawnEntityInWorld(par1EntityItem); + if (captureDrops) + { + capturedDrops.add(par1EntityItem); ++ return; + } -+ else -+ { -+ this.worldObj.spawnEntityInWorld(par1EntityItem); -+ } + this.worldObj.spawnEntityInWorld(par1EntityItem); } /** @@ -127,41 +124,41 @@ + * Deprecated in favor of the more sensitive version + */ + @Deprecated - public float getCurrentPlayerStrVsBlock(Block par1Block) + public float getCurrentPlayerStrVsBlock(Block par1Block, boolean par2) { -- float var2 = this.inventory.getStrVsBlock(par1Block); -+ return getCurrentPlayerStrVsBlock(par1Block, 0); +- float f = this.inventory.getStrVsBlock(par1Block); ++ return getCurrentPlayerStrVsBlock(par1Block, par2, 0); + } + -+ public float getCurrentPlayerStrVsBlock(Block par1Block, int meta) ++ public float getCurrentPlayerStrVsBlock(Block par1Block, boolean par2, int meta) + { + ItemStack stack = inventory.getCurrentItem(); -+ float var2 = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta)); - int var3 = EnchantmentHelper.getEfficiencyModifier(this); - ItemStack var4 = this.inventory.getCurrentItem(); ++ float f = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta)); - if (var3 > 0 && var4 != null) + if (f > 1.0F) { - float var5 = (float)(var3 * var3 + 1); -- -- if (!var4.canHarvestBlock(par1Block) && var2 <= 1.0F) -+ boolean canHarvest = ForgeHooks.canToolHarvestBlock(par1Block, meta, var4); -+ -+ if (!canHarvest && var2 <= 1.0F) +@@ -799,7 +856,9 @@ { - var2 += var5 * 0.08F; - } -@@ -784,7 +844,8 @@ - var2 /= 5.0F; + float f1 = (float)(i * i + 1); + +- if (!itemstack.canHarvestBlock(par1Block) && f <= 1.0F) ++ boolean canHarvest = ForgeHooks.canToolHarvestBlock(par1Block, meta, itemstack); ++ ++ if (!canHarvest && f <= 1.0F) + { + f += f1 * 0.08F; + } +@@ -830,7 +889,8 @@ + f /= 5.0F; } -- return var2; -+ var2 = ForgeEventFactory.getBreakSpeed(this, par1Block, meta, var2); -+ return (var2 < 0 ? 0 : var2); +- return f; ++ f = ForgeEventFactory.getBreakSpeed(this, par1Block, meta, f); ++ return (f < 0 ? 0 : f); } /** -@@ -792,7 +853,7 @@ +@@ -838,7 +898,7 @@ */ public boolean canHarvestBlock(Block par1Block) { @@ -170,18 +167,7 @@ } /** -@@ -831,6 +892,10 @@ - NBTTagList var3 = par1NBTTagCompound.getTagList("EnderItems"); - this.theInventoryEnderChest.loadInventoryFromNBT(var3); - } -+ -+ //Disable vanilla mob armor/item pickup, players can already pickup items -+ //and it causes issues with overwriting items, dropping items, etc.. -+ this.canPickUpLoot = false; - } - - /** -@@ -1079,12 +1144,22 @@ +@@ -1096,12 +1156,22 @@ { if (!this.isEntityInvulnerable()) { @@ -204,8 +190,8 @@ + } par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); this.addExhaustion(par1DamageSource.getHungerDamage()); - this.health -= par2; -@@ -1125,6 +1200,10 @@ + int j = this.getHealth(); +@@ -1144,6 +1214,10 @@ public boolean interactWith(Entity par1Entity) { @@ -216,7 +202,7 @@ if (par1Entity.interact(this)) { return true; -@@ -1168,7 +1247,9 @@ +@@ -1187,7 +1261,9 @@ */ public void destroyCurrentEquippedItem() { @@ -226,7 +212,7 @@ } /** -@@ -1185,6 +1266,15 @@ +@@ -1204,6 +1280,15 @@ */ public void attackTargetEntityWithCurrentItem(Entity par1Entity) { @@ -242,7 +228,7 @@ if (par1Entity.canAttackWithItem()) { if (!par1Entity.func_85031_j(this)) -@@ -1348,6 +1438,12 @@ +@@ -1378,6 +1463,12 @@ */ public EnumStatus sleepInBedAt(int par1, int par2, int par3) { @@ -255,36 +241,36 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1387,6 +1483,11 @@ +@@ -1417,6 +1508,11 @@ { - int var9 = this.worldObj.getBlockMetadata(par1, par2, par3); - int var5 = BlockBed.getDirection(var9); + int l = this.worldObj.getBlockMetadata(par1, par2, par3); + int i1 = BlockBed.getDirection(l); + Block block = Block.blocksList[worldObj.getBlockId(par1, par2, par3)]; + if (block != null) + { -+ var5 = block.getBedDirection(worldObj, par1, par2, par3); ++ i1 = block.getBedDirection(worldObj, par1, par2, par3); + } - float var10 = 0.5F; - float var7 = 0.5F; + float f = 0.5F; + float f1 = 0.5F; -@@ -1457,10 +1558,12 @@ - ChunkCoordinates var4 = this.playerLocation; - ChunkCoordinates var5 = this.playerLocation; +@@ -1487,10 +1583,12 @@ + ChunkCoordinates chunkcoordinates = this.playerLocation; + ChunkCoordinates chunkcoordinates1 = this.playerLocation; -- if (var4 != null && this.worldObj.getBlockId(var4.posX, var4.posY, var4.posZ) == Block.bed.blockID) +- if (chunkcoordinates != null && this.worldObj.getBlockId(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ) == Block.bed.blockID) - { -- BlockBed.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, false); -- var5 = BlockBed.getNearestEmptyChunkCoordinates(this.worldObj, var4.posX, var4.posY, var4.posZ, 0); -+ Block block = (var4 == null ? null : Block.blocksList[worldObj.getBlockId(var4.posX, var4.posY, var4.posZ)]); +- BlockBed.setBedOccupied(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, false); +- chunkcoordinates1 = BlockBed.getNearestEmptyChunkCoordinates(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, 0); ++ Block block = (chunkcoordinates == null ? null : Block.blocksList[worldObj.getBlockId(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ)]); + -+ if (var4 != null && block != null && block.isBed(worldObj, var4.posX, var4.posY, var4.posZ, this)) ++ if (chunkcoordinates != null && block != null && block.isBed(worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this)) + { -+ block.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, this, false); -+ var5 = block.getBedSpawnPosition(worldObj, var4.posX, var4.posY, var4.posZ, this); ++ block.setBedOccupied(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this, false); ++ chunkcoordinates1 = block.getBedSpawnPosition(worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this); - if (var5 == null) + if (chunkcoordinates1 == null) { -@@ -1497,7 +1600,9 @@ +@@ -1527,7 +1625,9 @@ */ private boolean isInBed() { @@ -295,62 +281,58 @@ } /** -@@ -1512,9 +1617,12 @@ - var3.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); - var3.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); +@@ -1542,9 +1642,12 @@ + ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); + ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); - if (par0World.getBlockId(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) == Block.bed.blockID) - { -- ChunkCoordinates var8 = BlockBed.getNearestEmptyChunkCoordinates(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, 0); +- ChunkCoordinates chunkcoordinates1 = BlockBed.getNearestEmptyChunkCoordinates(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, 0); + ChunkCoordinates c = par1ChunkCoordinates; + Block block = Block.blocksList[par0World.getBlockId(c.posX, c.posY, c.posZ)]; + + if (block != null && block.isBed(par0World, c.posX, c.posY, c.posZ, null)) + { -+ ChunkCoordinates var8 = block.getBedSpawnPosition(par0World, c.posX, c.posY, c.posZ, null); - return var8; ++ ChunkCoordinates chunkcoordinates1 = block.getBedSpawnPosition(par0World, c.posX, c.posY, c.posZ, null); + return chunkcoordinates1; } else -@@ -1536,8 +1644,11 @@ +@@ -1566,10 +1669,13 @@ { if (this.playerLocation != null) { -- int var1 = this.worldObj.getBlockMetadata(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ); -- int var2 = BlockBed.getDirection(var1); +- int i = this.worldObj.getBlockMetadata(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ); +- int j = BlockBed.getDirection(i); +- +- switch (j) + int x = playerLocation.posX; + int y = playerLocation.posY; + int z = playerLocation.posZ; + Block block = Block.blocksList[worldObj.getBlockId(x, y, z)]; -+ int var2 = (block == null ? 0 : block.getBedDirection(worldObj, x, y, z)); - - switch (var2) ++ int i = (block == null ? 0 : block.getBedDirection(worldObj, x, y, z)); ++ ++ switch (i) { -@@ -1571,7 +1682,6 @@ - return this.sleeping && this.sleepTimer >= 100; - } - -- @SideOnly(Side.CLIENT) - public int getSleepTimer() - { - return this.sleepTimer; -@@ -1846,7 +1956,7 @@ + case 0: + return 90.0F; +@@ -1876,7 +1982,7 @@ { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { - return par1ItemStack.getItem().getIconFromDamageForRenderPass(par1ItemStack.getItemDamage(), par2); -+ return par1ItemStack.getItem().getIconIndex(par1ItemStack, par2); ++ return par1ItemStack.getItem().getIcon(par1ItemStack, par2); } if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) -@@ -1868,6 +1978,7 @@ - return 101; +@@ -1898,6 +2004,7 @@ + return Item.bow.func_94599_c(0); } } -+ var3 = par1ItemStack.getItem().getIconIndex(par1ItemStack, par2, this, itemInUse, itemInUseCount); ++ icon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount); } - return var3; -@@ -2088,6 +2199,14 @@ + return icon; +@@ -2137,6 +2244,14 @@ } this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest; @@ -365,7 +347,7 @@ } /** -@@ -2159,7 +2278,14 @@ +@@ -2208,7 +2323,14 @@ */ public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { @@ -380,4 +362,4 @@ + } } - public ItemStack[] getLastActiveItems() + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index d97de5425..f607f7d4f 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,17 +1,10 @@ --- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -9,6 +9,7 @@ - import java.util.List; - import net.minecraft.entity.Entity; - import net.minecraft.entity.IMerchant; -+import net.minecraft.entity.item.EntityItem; - import net.minecraft.entity.projectile.EntityArrow; - import net.minecraft.inventory.Container; - import net.minecraft.inventory.ContainerBeacon; -@@ -74,6 +75,11 @@ +@@ -87,6 +87,12 @@ import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; ++import net.minecraft.entity.item.EntityItem; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerDropsEvent; @@ -20,47 +13,47 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { private StringTranslate translator = new StringTranslate("en_US"); -@@ -145,18 +151,10 @@ +@@ -158,18 +164,10 @@ par4ItemInWorldManager.thisPlayerMP = this; this.theItemInWorldManager = par4ItemInWorldManager; this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance(); -- ChunkCoordinates var5 = par2World.getSpawnPoint(); -+ ChunkCoordinates var5 = par2World.provider.getRandomizedSpawnPoint(); - int var6 = var5.posX; - int var7 = var5.posZ; - int var8 = var5.posY; +- ChunkCoordinates chunkcoordinates = par2World.getSpawnPoint(); ++ ChunkCoordinates chunkcoordinates = par2World.provider.getRandomizedSpawnPoint(); + int i = chunkcoordinates.posX; + int j = chunkcoordinates.posZ; + int k = chunkcoordinates.posY; - - if (!par2World.provider.hasNoSky && par2World.getWorldInfo().getGameType() != EnumGameType.ADVENTURE) - { -- int var9 = Math.max(5, par1MinecraftServer.getSpawnProtectionSize() - 6); -- var6 += this.rand.nextInt(var9 * 2) - var9; -- var7 += this.rand.nextInt(var9 * 2) - var9; -- var8 = par2World.getTopSolidOrLiquidBlock(var6, var7); +- int l = Math.max(5, par1MinecraftServer.getSpawnProtectionSize() - 6); +- i += this.rand.nextInt(l * 2) - l; +- j += this.rand.nextInt(l * 2) - l; +- k = par2World.getTopSolidOrLiquidBlock(i, j); - } - this.setLocationAndAngles((double)var6 + 0.5D, (double)var8, (double)var7 + 0.5D, 0.0F, 0.0F); this.mcServer = par1MinecraftServer; -@@ -253,7 +251,10 @@ - if (var9 != null && this.worldObj.blockExists(var9.chunkXPos << 4, 0, var9.chunkZPos << 4)) + this.stepHeight = 0.0F; +@@ -271,7 +269,10 @@ + if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4)) { - var6.add(this.worldObj.getChunkFromChunkCoords(var9.chunkXPos, var9.chunkZPos)); -- var8.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(var9.chunkXPos * 16, 0, var9.chunkZPos * 16, var9.chunkXPos * 16 + 16, 256, var9.chunkZPos * 16 + 16)); + arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos)); +- arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); + //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. + //ToDo: Find a way to efficiently clean abandoned chunks. -+ //var8.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(var9.chunkXPos * 16, 0, var9.chunkZPos * 16, var9.chunkXPos * 16 + 16, 256, var9.chunkZPos * 16 + 16)); -+ var8.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(var9.chunkXPos * 16, 0, var9.chunkZPos * 16, var9.chunkXPos * 16 + 15, 256, var9.chunkZPos * 16 + 15)); ++ //arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); ++ arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); } } -@@ -274,6 +275,7 @@ +@@ -292,6 +293,7 @@ { - Chunk var10 = (Chunk)var11.next(); - this.getServerForPlayer().getEntityTracker().func_85172_a(this, var10); -+ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(var10.getChunkCoordIntPair(), this)); + Chunk chunk = (Chunk)iterator2.next(); + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); ++ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); } } } -@@ -318,11 +320,29 @@ +@@ -359,11 +361,29 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -69,7 +62,7 @@ + return; + } + - this.mcServer.getConfigurationManager().sendChatMsg(par1DamageSource.getDeathMessage(this)); + this.mcServer.getConfigurationManager().sendChatMsg(this.field_94063_bt.func_94546_b()); if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { @@ -88,5 +81,5 @@ + } + } } - } + Collection collection = this.worldObj.func_96441_U().func_96520_a(ScoreObjectiveCriteria.field_96642_c); diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 9f0a109f0..acaddd6d2 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,17 +1,17 @@ --- ../src_base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src_work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -337,6 +337,14 @@ - this.mainInventory[var1].updateAnimation(this.player.worldObj, this.player, var1, this.currentItem == var1); - } - } +@@ -338,6 +338,14 @@ + if (this.mainInventory[i] != null) + { + this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); ++ } ++ } + + for (int i = 0; i < this.armorInventory.length; i++) + { + if (this.armorInventory[i] != null) + { + this.armorInventory[i].getItem().onArmorTickUpdate(this.player.worldObj, this.player, this.armorInventory[i]); -+ } -+ } + } + } } - - /** diff --git a/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch index 40daf8cbd..ea525208f 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch @@ -4,8 +4,8 @@ } else if (par2 != 1 && par2 != 0) { -- if (FurnaceRecipes.smelting().getSmeltingResult(var5.getItem().itemID) != null) -+ if (FurnaceRecipes.smelting().getSmeltingResult(var5) != null) +- if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1.getItem().itemID) != null) ++ if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { - if (!this.mergeItemStack(var5, 0, 1, false)) + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index e3b84d5ce..5371563e7 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -1,25 +1,25 @@ --- ../src_base/minecraft/net/minecraft/inventory/Slot.java +++ ../src_work/minecraft/net/minecraft/inventory/Slot.java -@@ -21,6 +21,12 @@ +@@ -22,6 +22,12 @@ /** display position of the inventory slot on the screen y axis */ public int yDisplayPosition; + + /** Position within background texture file, normally -1 which causes no background to be drawn. */ -+ protected int backgroundIconIndex = -1; ++ protected Icon backgroundIcon = null; + + /** Background texture file assigned to this slot, if any. Vanilla "/gui/items.png" is used if this is null. */ + protected String texture = "/gui/items.png"; public Slot(IInventory par1IInventory, int par2, int par3, int par4) { -@@ -147,6 +153,44 @@ +@@ -148,6 +154,45 @@ */ - public int getBackgroundIconIndex() + public Icon getBackgroundIconIndex() { -- return -1; -+ return backgroundIconIndex; -+ } +- return null; ++ return backgroundIcon; + } + + /** + * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. @@ -32,11 +32,11 @@ + + /** + * Sets which icon index to use as the background image of the slot when it's empty. -+ * @param iconIndex int: The index into the texture file, 0-255, or -1 for no background. ++ * @param icon The icon to use, null for none + */ -+ public void setBackgroundIconIndex(int iconIndex) ++ public void setBackgroundIconIndex(Icon icon) + { -+ backgroundIconIndex = iconIndex; ++ backgroundIcon = icon; + } + + /** @@ -57,5 +57,6 @@ + public int getSlotIndex() + { + return slotIndex; - } ++ } ++ } diff --git a/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch b/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch index 142ab5b8c..31aba7ffb 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/inventory/SlotArmor.java +++ ../src_work/minecraft/net/minecraft/inventory/SlotArmor.java -@@ -40,7 +40,8 @@ +@@ -41,7 +41,8 @@ */ public boolean isItemValid(ItemStack par1ItemStack) { diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index ce1dbd925..188b5cb07 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -13,19 +13,19 @@ { @@ -124,9 +128,15 @@ - if (var4.getItem().hasContainerItem()) + if (itemstack1.getItem().hasContainerItem()) { -- ItemStack var5 = new ItemStack(var4.getItem().getContainerItem()); -+ ItemStack var5 = var4.getItem().getContainerItemStack(var4); -+ -+ if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage()) -+ { -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, var5)); -+ var5 = null; -+ } +- ItemStack itemstack2 = new ItemStack(itemstack1.getItem().getContainerItem()); ++ ItemStack itemstack2 = itemstack1.getItem().getContainerItemStack(itemstack1); -- if (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5)) -+ if (var5 != null && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5))) +- if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) ++ if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) ++ { ++ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); ++ itemstack2 = null; ++ } ++ ++ if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))) { - if (this.craftMatrix.getStackInSlot(var3) == null) + if (this.craftMatrix.getStackInSlot(i) == null) { diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch index 34425d78e..a6d52e28f 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch @@ -3,9 +3,9 @@ @@ -69,7 +69,7 @@ if (!this.thePlayer.worldObj.isRemote) { - int var2 = this.field_75228_b; -- float var3 = FurnaceRecipes.smelting().getExperience(par1ItemStack.itemID); -+ float var3 = FurnaceRecipes.smelting().getExperience(par1ItemStack); - int var4; + int i = this.field_75228_b; +- float f = FurnaceRecipes.smelting().getExperience(par1ItemStack.itemID); ++ float f = FurnaceRecipes.smelting().getExperience(par1ItemStack); + int j; - if (var3 == 0.0F) + if (f == 0.0F) diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 4461f722a..237d95a9b 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/item/Item.java +++ ../src_work/minecraft/net/minecraft/item/Item.java -@@ -13,6 +13,7 @@ +@@ -14,6 +14,7 @@ import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; @@ -8,7 +8,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionHelper; import net.minecraft.stats.StatList; -@@ -21,7 +22,9 @@ +@@ -23,7 +24,9 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.StringTranslate; import net.minecraft.util.Vec3; @@ -18,9 +18,9 @@ public class Item { -@@ -230,18 +233,26 @@ - /** full name of item from language file */ - private String itemName; +@@ -238,13 +241,16 @@ + /** Icon index in the icons table. */ + protected Icon iconIndex; + /** FORGE: To disable repair recipes. */ + protected boolean canRepair = true; @@ -36,52 +36,23 @@ } itemsList[256 + par1] = this; - - GameData.newItemAdded(this); -+ -+ if (!(this instanceof ItemBlock)) -+ { -+ isDefaultTexture = "/gui/items.png".equals(getTextureFile()); -+ } - } - - /** -@@ -561,6 +572,7 @@ - - /** - * Returns a string representing what this item does to a potion. -+ * @Deprecated In favor of ItemStack sensitive version - */ - public String getPotionEffect() - { -@@ -569,6 +581,7 @@ - - /** - * Returns true if this item serves as a potion ingredient (its ingredient information is not null). -+ * @Deprecated In favor of ItemStack sensitive version - */ - public boolean isPotionIngredient() - { -@@ -627,6 +640,10 @@ - float var18 = var15 * var16; - float var20 = var14 * var16; - double var21 = 5.0D; +@@ -636,6 +642,10 @@ + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = 5.0D; + if (par2EntityPlayer instanceof EntityPlayerMP) + { -+ var21 = ((EntityPlayerMP)par2EntityPlayer).theItemInWorldManager.getBlockReachDistance(); ++ d3 = ((EntityPlayerMP)par2EntityPlayer).theItemInWorldManager.getBlockReachDistance(); + } - Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); - return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3); + Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -701,4 +718,362 @@ +@@ -716,4 +726,324 @@ { StatList.initStats(); } + + /* =========================================================== FORGE START ===============================================================*/ -+ public boolean isDefaultTexture = true; -+ private String currentTexture = "/gui/items.png"; -+ + /** + * Called when a player drops the item into the world, + * returning false from this will prevent the item from @@ -195,19 +166,9 @@ + * @param useRemaining The ticks remaining for the active item. + * @return The icon index + */ -+ public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) ++ public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + { -+ /* -+ * Here is an example usage for Vanilla bows. -+ if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex) -+ { -+ int k = usingItem.getMaxItemUseDuration() - useRemaining; -+ if (k >= 18) return 133; -+ if (k > 13) return 117; -+ if (k > 0) return 101; -+ } -+ */ -+ return getIconIndex(stack); ++ return getIcon(stack, renderPass); + } + + /** @@ -224,31 +185,6 @@ + } + + /** -+ * Grabs the current texture file used for this block -+ */ -+ public String getTextureFile() -+ { -+ if (this instanceof ItemBlock) -+ { -+ return Block.blocksList[((ItemBlock)this).getBlockID()].getTextureFile(); -+ } -+ return currentTexture; -+ } -+ -+ /** -+ * Sets the current texture file for this item, used when rendering. -+ * Default is "/gui/items.png" -+ * -+ * @param texture The texture file -+ */ -+ public Item setTextureFile(String texture) -+ { -+ currentTexture = texture; -+ isDefaultTexture = false; -+ return this; -+ } -+ -+ /** + * ItemStack sensitive version of getContainerItem. + * Returns a full ItemStack instance of the result. + * @@ -336,9 +272,9 @@ + * Defers to {@link #getIconFromDamageForRenderPass(int, int)} + * @param stack to render for + * @param pass the multi-render pass -+ * @return the icon index ++ * @return the icon + */ -+ public int getIconIndex(ItemStack stack, int pass) ++ public Icon getIcon(ItemStack stack, int pass) + { + return getIconFromDamageForRenderPass(stack.getItemDamage(), pass); + } diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index 8527c460a..c979b7a88 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,53 +1,45 @@ --- ../src_base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src_work/minecraft/net/minecraft/item/ItemBlock.java -@@ -19,6 +19,7 @@ - super(par1); - this.blockID = par1 + 256; - this.setIconIndex(Block.blocksList[par1 + 256].getBlockTextureFromSide(2)); -+ isDefaultTexture = Block.blocksList[par1 + 256].isDefaultTexture; - } - - /** -@@ -41,7 +42,8 @@ +@@ -60,7 +60,8 @@ { par7 = 1; } -- else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID) -+ else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID -+ && (Block.blocksList[var11] == null || !Block.blocksList[var11].isBlockReplaceable(par3World, par4, par5, par6))) +- else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID) ++ else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID ++ && (Block.blocksList[i1] == null || !Block.blocksList[i1].isBlockReplaceable(par3World, par4, par5, par6))) { if (par7 == 0) { -@@ -92,14 +94,8 @@ - int var13 = this.getMetadata(par1ItemStack.getItemDamage()); - int var14 = Block.blocksList[this.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, var13); +@@ -111,14 +112,8 @@ + int j1 = this.getMetadata(par1ItemStack.getItemDamage()); + int k1 = Block.blocksList[this.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, j1); -- if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, this.blockID, var14)) +- if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, this.blockID, k1, 3)) - { - if (par3World.getBlockId(par4, par5, par6) == this.blockID) - { -- Block.blocksList[this.blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer); -- Block.blocksList[this.blockID].onPostBlockPlaced(par3World, par4, par5, par6, var14); +- Block.blocksList[this.blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); +- Block.blocksList[this.blockID].onPostBlockPlaced(par3World, par4, par5, par6, k1); - } - -+ if (placeBlockAt(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10, var14)) ++ if (placeBlockAt(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10, k1)) + { - par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var12.stepSound.getPlaceSound(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F); + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; } -@@ -125,7 +121,8 @@ +@@ -144,7 +139,8 @@ { par5 = 1; } -- else if (var8 != Block.vine.blockID && var8 != Block.tallGrass.blockID && var8 != Block.deadBush.blockID) -+ else if (var8 != Block.vine.blockID && var8 != Block.tallGrass.blockID && var8 != Block.deadBush.blockID -+ && (Block.blocksList[var8] == null || !Block.blocksList[var8].isBlockReplaceable(par1World, par2, par3, par4))) +- else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID) ++ else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID ++ && (Block.blocksList[i1] == null || !Block.blocksList[i1].isBlockReplaceable(par1World, par2, par3, par4))) { if (par5 == 0) { -@@ -190,4 +187,28 @@ - { - Block.blocksList[this.blockID].getSubBlocks(par1, par2CreativeTabs, par3List); +@@ -227,4 +223,28 @@ + this.field_94588_b = par1IconRegister.func_94245_a(s); + } } + + /** @@ -60,14 +52,14 @@ + */ + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) + { -+ if (!world.setBlockAndMetadataWithNotify(x, y, z, this.blockID, metadata)) ++ if (!world.setBlockAndMetadataWithNotify(x, y, z, this.blockID, metadata, 3)) + { -+ return false; ++ return false; + } + + if (world.getBlockId(x, y, z) == this.blockID) + { -+ Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player); ++ Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player, stack); + Block.blocksList[this.blockID].onPostBlockPlaced(world, x, y, z, metadata); + } + diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index c5be35e7c..ebf7d5bcd 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/item/ItemBow.java +++ ../src_work/minecraft/net/minecraft/item/ItemBow.java -@@ -6,6 +6,10 @@ - import net.minecraft.entity.player.EntityPlayer; +@@ -10,6 +10,10 @@ import net.minecraft.entity.projectile.EntityArrow; + import net.minecraft.util.Icon; import net.minecraft.world.World; + +import net.minecraftforge.common.MinecraftForge; @@ -11,29 +11,29 @@ public class ItemBow extends Item { -@@ -22,11 +26,20 @@ +@@ -30,11 +34,20 @@ */ public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { -+ int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4; ++ int j = this.getMaxItemUseDuration(par1ItemStack) - par4; + -+ ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, var6); ++ ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j); + MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) + { + return; + } -+ var6 = event.charge; ++ j = event.charge; + - boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; + boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; - if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) + if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) { -- int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4; - float var7 = (float)var6 / 20.0F; - var7 = (var7 * var7 + var7 * 2.0F) / 3.0F; +- int j = this.getMaxItemUseDuration(par1ItemStack) - par4; + float f = (float)j / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; -@@ -111,6 +124,13 @@ +@@ -119,6 +132,13 @@ */ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index 195f6f443..785d5cdad 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -15,7 +15,7 @@ } else { -+ FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, par1ItemStack, par2World, var12); ++ FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, par1ItemStack, par2World, movingobjectposition); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return par1ItemStack; @@ -41,6 +41,6 @@ + return par1ItemStack; + } + - if (var12.typeOfHit == EnumMovingObjectType.TILE) + if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) { - int var13 = var12.blockX; + int i = movingobjectposition.blockX; diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index 62cdf1767..4bb41ca95 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -1,9 +1,10 @@ --- ../src_base/minecraft/net/minecraft/item/ItemDye.java +++ ../src_work/minecraft/net/minecraft/item/ItemDye.java -@@ -18,6 +18,11 @@ +@@ -21,6 +21,12 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; ++import net.minecraftforge.common.FakePlayerFactory; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event.Result; @@ -12,44 +13,50 @@ public class ItemDye extends Item { /** List of dye color names */ -@@ -68,6 +73,21 @@ - if (par1ItemStack.getItemDamage() == 15) - { - var11 = par3World.getBlockId(par4, par5, par6); -+ -+ BonemealEvent event = new BonemealEvent(par2EntityPlayer, par3World, var11, par4, par5, par6); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return false; -+ } -+ -+ if (event.getResult() == Result.ALLOW) -+ { -+ if (!par3World.isRemote) -+ { -+ par1ItemStack.stackSize--; -+ } -+ return true; -+ } +@@ -141,7 +147,27 @@ - if (var11 == Block.sapling.blockID) - { -@@ -167,16 +187,9 @@ - par3World.setBlockAndMetadataWithNotify(var13, var14, var15, Block.tallGrass.blockID, 1); + public static boolean func_96604_a(ItemStack par0ItemStack, World par1World, int par2, int par3, int par4) + { ++ return applyBonemeal(par0ItemStack, par1World, par2, par3, par4, FakePlayerFactory.getMinecraft(par1World)); ++ } ++ ++ public static boolean applyBonemeal(ItemStack par0ItemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) ++ { + int l = par1World.getBlockId(par2, par3, par4); ++ ++ BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4); ++ if (MinecraftForge.EVENT_BUS.post(event)) ++ { ++ return false; ++ } ++ ++ if (event.getResult() == Result.ALLOW) ++ { ++ if (!par1World.isRemote) ++ { ++ par0ItemStack.stackSize--; ++ } ++ return true; ++ } + + if (l == Block.sapling.blockID) + { +@@ -244,16 +270,9 @@ + par1World.setBlockAndMetadataWithNotify(j1, k1, l1, Block.tallGrass.blockID, 1, 3); + } + } +- else if (itemRand.nextInt(3) != 0) ++ else + { +- if (Block.plantYellow.canBlockStay(par1World, j1, k1, l1)) +- { +- par1World.func_94575_c(j1, k1, l1, Block.plantYellow.blockID); +- } +- } +- else if (Block.plantRed.canBlockStay(par1World, j1, k1, l1)) +- { +- par1World.func_94575_c(j1, k1, l1, Block.plantRed.blockID); ++ ForgeHooks.plantGrass(par1World, j1, k1, l1); } } -- else if (itemRand.nextInt(3) != 0) -+ else - { -- if (Block.plantYellow.canBlockStay(par3World, var13, var14, var15)) -- { -- par3World.setBlockWithNotify(var13, var14, var15, Block.plantYellow.blockID); -- } -- } -- else if (Block.plantRed.canBlockStay(par3World, var13, var14, var15)) -- { -- par3World.setBlockWithNotify(var13, var14, var15, Block.plantRed.blockID); -+ ForgeHooks.plantGrass(par3World, var13, var14, var15); - } } - } diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index 5b4caa4f7..9be305a65 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -26,6 +26,6 @@ + return true; + } + - int var11 = par3World.getBlockId(par4, par5, par6); - int var12 = par3World.getBlockId(par4, par5 + 1, par6); + int i1 = par3World.getBlockId(par4, par5, par6); + int j1 = par3World.getBlockId(par4, par5 + 1, par6); diff --git a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch index 0c4413ee2..6688f2bf3 100644 --- a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch @@ -34,20 +34,20 @@ if (this.isCreative()) { if (!this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4)) -@@ -154,15 +172,32 @@ +@@ -154,15 +172,33 @@ } else { -- this.theWorld.extinguishFire(this.thisPlayerMP, par1, par2, par3, par4); +- this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4); this.initialDamage = this.curblockDamage; - float var5 = 1.0F; - int var6 = this.theWorld.getBlockId(par1, par2, par3); -- -- if (var6 > 0) + float f = 1.0F; + int i1 = this.theWorld.getBlockId(par1, par2, par3); + +- if (i1 > 0) - { -- Block.blocksList[var6].onBlockClicked(this.theWorld, par1, par2, par3, this.thisPlayerMP); -- var5 = Block.blocksList[var6].getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3); -+ Block block = Block.blocksList[var6]; +- Block.blocksList[i1].onBlockClicked(this.theWorld, par1, par2, par3, this.thisPlayerMP); +- f = Block.blocksList[i1].getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3); ++ Block block = Block.blocksList[i1]; + + if (block != null) + { @@ -60,29 +60,29 @@ + { + thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld)); + } -+ var5 = block.getPlayerRelativeBlockHardness(thisPlayerMP, thisPlayerMP.worldObj, par1, par2, par3); ++ f = block.getPlayerRelativeBlockHardness(thisPlayerMP, thisPlayerMP.worldObj, par1, par2, par3); + } + + if (event.useItem == Event.Result.DENY) + { -+ if (var5 >= 1.0f) ++ if (f >= 1.0f) + { + thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld)); + } + return; } - if (var6 > 0 && var5 >= 1.0F) -@@ -236,7 +271,7 @@ - var4.onBlockHarvested(this.theWorld, par1, par2, par3, var5, this.thisPlayerMP); + if (i1 > 0 && f >= 1.0F) +@@ -236,7 +272,7 @@ + block.onBlockHarvested(this.theWorld, par1, par2, par3, l, this.thisPlayerMP); } -- boolean var6 = this.theWorld.setBlockWithNotify(par1, par2, par3, 0); -+ boolean var6 = (var4 != null && var4.removeBlockByPlayer(theWorld, thisPlayerMP, par1, par2, par3)); +- boolean flag = this.theWorld.func_94571_i(par1, par2, par3); ++ boolean flag = (block != null && block.removeBlockByPlayer(theWorld, thisPlayerMP, par1, par2, par3)); - if (var4 != null && var6) + if (block != null && flag) { -@@ -257,19 +292,30 @@ +@@ -257,19 +293,30 @@ } else { @@ -91,57 +91,57 @@ + { + return false; + } - int var4 = this.theWorld.getBlockId(par1, par2, par3); - int var5 = this.theWorld.getBlockMetadata(par1, par2, par3); - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, par1, par2, par3, var4 + (this.theWorld.getBlockMetadata(par1, par2, par3) << 12)); -- boolean var6 = this.removeBlock(par1, par2, par3); -+ boolean var6 = false; + int l = this.theWorld.getBlockId(par1, par2, par3); + int i1 = this.theWorld.getBlockMetadata(par1, par2, par3); + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, par1, par2, par3, l + (this.theWorld.getBlockMetadata(par1, par2, par3) << 12)); +- boolean flag = this.removeBlock(par1, par2, par3); ++ boolean flag = false; if (this.isCreative()) { -+ var6 = this.removeBlock(par1, par2, par3); ++ flag = this.removeBlock(par1, par2, par3); this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, this.theWorld)); } else { - ItemStack var7 = this.thisPlayerMP.getCurrentEquippedItem(); -- boolean var8 = this.thisPlayerMP.canHarvestBlock(Block.blocksList[var4]); -+ boolean var8 = false; -+ Block block = Block.blocksList[var4]; + ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- boolean flag1 = this.thisPlayerMP.canHarvestBlock(Block.blocksList[l]); ++ boolean flag1 = false; ++ Block block = Block.blocksList[l]; + if (block != null) + { -+ var8 = block.canHarvestBlock(thisPlayerMP, var5); ++ flag1 = block.canHarvestBlock(thisPlayerMP, i1); + } - if (var7 != null) + if (itemstack != null) { -@@ -281,6 +327,7 @@ +@@ -281,6 +328,7 @@ } } -+ var6 = this.removeBlock(par1, par2, par3); - if (var6 && var8) ++ flag = this.removeBlock(par1, par2, par3); + if (flag && flag1) { - Block.blocksList[var4].harvestBlock(this.theWorld, this.thisPlayerMP, par1, par2, par3, var5); -@@ -321,6 +368,7 @@ - if (var6.stackSize == 0) + Block.blocksList[l].harvestBlock(this.theWorld, this.thisPlayerMP, par1, par2, par3, i1); +@@ -321,6 +369,7 @@ + if (itemstack1.stackSize == 0) { par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thisPlayerMP, var6)); ++ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thisPlayerMP, itemstack1)); } if (!par1EntityPlayer.isUsingItem()) -@@ -338,35 +386,56 @@ +@@ -338,35 +387,56 @@ */ public boolean activateBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { -- int var11; +- int i1; - - if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) - { -- var11 = par2World.getBlockId(par4, par5, par6); +- i1 = par2World.getBlockId(par4, par5, par6); - -- if (var11 > 0 && Block.blocksList[var11].onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10)) +- if (i1 > 0 && Block.blocksList[i1].onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10)) - { - return true; - } @@ -157,12 +157,12 @@ } - else if (this.isCreative()) - { -- var11 = par3ItemStack.getItemDamage(); -- int var12 = par3ItemStack.stackSize; -- boolean var13 = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); -- par3ItemStack.setItemDamage(var11); -- par3ItemStack.stackSize = var12; -- return var13; +- i1 = par3ItemStack.getItemDamage(); +- int j1 = par3ItemStack.stackSize; +- boolean flag = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); +- par3ItemStack.setItemDamage(i1); +- par3ItemStack.stackSize = j1; +- return flag; - } - else - { @@ -176,8 +176,8 @@ + return true; + } + -+ int var11 = par2World.getBlockId(par4, par5, par6); -+ Block block = Block.blocksList[var11]; ++ int i1 = par2World.getBlockId(par4, par5, par6); ++ Block block = Block.blocksList[i1]; + boolean result = false; + + if (block != null && (!par1EntityPlayer.isSneaking() || ( par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(par2World, par4, par5, par6)))) @@ -215,7 +215,7 @@ } /** -@@ -376,4 +445,13 @@ +@@ -376,4 +446,13 @@ { this.theWorld = par1WorldServer; } diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch index 7f6b0d3b0..340992551 100644 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMap.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/item/ItemMap.java +++ ../src_work/minecraft/net/minecraft/item/ItemMap.java @@ -98,7 +98,7 @@ - boolean var21 = var19 * var19 + var20 * var20 > (var11 - 2) * (var11 - 2); - int var22 = (var7 / var6 + var13 - var4 / 2) * var6; - int var23 = (var8 / var6 + var18 - var5 / 2) * var6; -- int[] var24 = new int[256]; -+ int[] var24 = new int[Block.blocksList.length]; - Chunk var25 = par1World.getChunkFromBlockCoords(var22, var23); + boolean flag = k2 * k2 + l2 * l2 > (j1 - 2) * (j1 - 2); + int i3 = (j / i + k1 - short1 / 2) * i; + int j3 = (k / i + j2 - short2 / 2) * i; +- int[] aint = new int[256]; ++ int[] aint = new int[Block.blocksList.length]; + Chunk chunk = par1World.getChunkFromBlockCoords(i3, j3); - if (!var25.isEmpty()) + if (!chunk.isEmpty()) @@ -194,7 +194,7 @@ - var31 = 0; - var32 = 0; + j4 = 0; + k4 = 0; -- for (var33 = 0; var33 < 256; ++var33) -+ for (var33 = 0; var33 < Block.blocksList.length; ++var33) +- for (l4 = 0; l4 < 256; ++l4) ++ for (l4 = 0; l4 < Block.blocksList.length; ++l4) { - if (var24[var33] > var31) + if (aint[l4] > j4) { diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index 5f75170a4..bbc03ab34 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -1,10 +1,13 @@ --- ../src_base/minecraft/net/minecraft/item/ItemSeedFood.java +++ ../src_work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -2,8 +2,10 @@ +@@ -1,9 +1,13 @@ + package net.minecraft.item; ++import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; +import net.minecraftforge.common.EnumPlantType; ++import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.IPlantable; -public class ItemSeedFood extends ItemFood @@ -12,7 +15,18 @@ { /** Block ID of the crop this seed food should place. */ private int cropId; -@@ -48,4 +50,22 @@ +@@ -31,8 +35,9 @@ + else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) + { + int i1 = par3World.getBlockId(par4, par5, par6); ++ Block soil = Block.blocksList[i1]; + +- if (i1 == this.soilId && par3World.isAirBlock(par4, par5 + 1, par6)) ++ if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6)) + { + par3World.func_94575_c(par4, par5 + 1, par6, this.cropId); + --par1ItemStack.stackSize; +@@ -48,4 +53,22 @@ return false; } } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch index a8df3c138..45e2d366e 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -20,13 +20,13 @@ @@ -35,8 +40,9 @@ else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) { - int var11 = par3World.getBlockId(par4, par5, par6); -+ Block soil = Block.blocksList[var11]; + int i1 = par3World.getBlockId(par4, par5, par6); ++ Block soil = Block.blocksList[i1]; -- if (var11 == this.soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) +- if (i1 == this.soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) + if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6)) { - par3World.setBlockWithNotify(par4, par5 + 1, par6, this.blockType); + par3World.func_94575_c(par4, par5 + 1, par6, this.blockType); --par1ItemStack.stackSize; @@ -52,4 +58,22 @@ return false; diff --git a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch index 66cb2b648..9f78a316f 100644 --- a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/item/crafting/CraftingManager.java +++ ../src_work/minecraft/net/minecraft/item/crafting/CraftingManager.java -@@ -269,7 +269,7 @@ +@@ -282,7 +282,7 @@ } } -- if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isDamageable()) -+ if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isRepairable()) +- if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable()) ++ if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable()) { - Item var11 = Item.itemsList[var4.itemID]; - int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay(); + Item item = Item.itemsList[itemstack.itemID]; + int k = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index 658446c35..6b74a48f8 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -18,7 +18,7 @@ /** * Used to call methods addSmelting and getSmeltingResult. -@@ -54,7 +58,9 @@ +@@ -56,7 +60,9 @@ /** * Returns the smelting result of an item. @@ -28,7 +28,7 @@ public ItemStack getSmeltingResult(int par1) { return (ItemStack)this.smeltingList.get(Integer.valueOf(par1)); -@@ -65,8 +71,63 @@ +@@ -67,8 +73,63 @@ return this.smeltingList; } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index b608efcce..488cc8fa3 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -4,23 +4,23 @@ { this.field_92102_a = new ItemStack(Item.firework); -+ var15 = new NBTTagCompound(); - if (var6 > 0) ++ nbttagcompound = new NBTTagCompound(); + if (l > 0) { -- var15 = new NBTTagCompound(); - var18 = new NBTTagCompound("Fireworks"); - NBTTagList var25 = new NBTTagList("Explosions"); +- nbttagcompound = new NBTTagCompound(); + nbttagcompound1 = new NBTTagCompound("Fireworks"); + NBTTagList nbttaglist = new NBTTagList("Explosions"); @@ -110,9 +110,9 @@ - var18.setTag("Explosions", var25); - var18.setByte("Flight", (byte)var4); - var15.setTag("Fireworks", var18); -- this.field_92102_a.setTagCompound(var15); + nbttagcompound1.setTag("Explosions", nbttaglist); + nbttagcompound1.setByte("Flight", (byte)j); + nbttagcompound.setTag("Fireworks", nbttagcompound1); +- this.field_92102_a.setTagCompound(nbttagcompound); - } - + } + -+ this.field_92102_a.setTagCompound(var15); ++ this.field_92102_a.setTagCompound(nbttagcompound); return true; } - else if (var4 == 1 && var3 == 0 && var6 == 0 && var5 > 0 && var8 <= 1) + else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index 7657a8633..e8c364ea5 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -7,7 +7,7 @@ - @SideOnly(Side.CLIENT) public static void write(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException { - DataOutputStream var2 = new DataOutputStream(new FileOutputStream(par1File)); + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(par1File)); @@ -155,7 +154,6 @@ } } diff --git a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch index 9a32ced01..50e8fbb83 100644 --- a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/network/NetServerHandler.java +++ ../src_work/minecraft/net/minecraft/network/NetServerHandler.java -@@ -64,6 +64,13 @@ - import net.minecraft.util.MathHelper; +@@ -65,6 +65,13 @@ + import net.minecraft.util.ReportedException; import net.minecraft.world.WorldServer; +import net.minecraftforge.common.MinecraftForge; @@ -13,8 +13,8 @@ + public class NetServerHandler extends NetHandler { - /** The logging system. */ -@@ -235,6 +242,11 @@ + /** The underlying network manager for this server handler. */ +@@ -233,6 +240,11 @@ if (this.playerEntity.ridingEntity != null) { this.playerEntity.ridingEntity.updateRiderPosition(); @@ -26,22 +26,21 @@ } this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); -@@ -307,9 +319,10 @@ - var13 = var5 - this.playerEntity.posX; - double var15 = var7 - this.playerEntity.posY; - double var17 = var9 - this.playerEntity.posZ; -- double var19 = Math.min(Math.abs(var13), Math.abs(this.playerEntity.motionX)); -- double var21 = Math.min(Math.abs(var15), Math.abs(this.playerEntity.motionY)); -- double var23 = Math.min(Math.abs(var17), Math.abs(this.playerEntity.motionZ)); -+ //Change min->max, fixes movement speed check -+ double var19 = Math.max(Math.abs(var13), Math.abs(this.playerEntity.motionX)); -+ double var21 = Math.max(Math.abs(var15), Math.abs(this.playerEntity.motionY)); -+ double var23 = Math.max(Math.abs(var17), Math.abs(this.playerEntity.motionZ)); - double var25 = var19 * var19 + var21 * var21 + var23 * var23; +@@ -305,9 +317,9 @@ + d4 = d1 - this.playerEntity.posX; + double d6 = d2 - this.playerEntity.posY; + double d7 = d3 - this.playerEntity.posZ; +- double d8 = Math.min(Math.abs(d4), Math.abs(this.playerEntity.motionX)); +- double d9 = Math.min(Math.abs(d6), Math.abs(this.playerEntity.motionY)); +- double d10 = Math.min(Math.abs(d7), Math.abs(this.playerEntity.motionZ)); ++ double d8 = Math.max(Math.abs(d4), Math.abs(this.playerEntity.motionX)); ++ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionY)); ++ double d10 = Math.max(Math.abs(d7), Math.abs(this.playerEntity.motionZ)); + double d11 = d8 * d8 + d9 * d9 + d10 * d10; - if (var25 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.username))) -@@ -325,6 +338,11 @@ - if (this.playerEntity.onGround && !par1Packet10Flying.onGround && var15 > 0.0D) + if (d11 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.username))) +@@ -323,6 +335,11 @@ + if (this.playerEntity.onGround && !par1Packet10Flying.onGround && d6 > 0.0D) { this.playerEntity.addExhaustion(0.2F); + } @@ -51,9 +50,9 @@ + return; } - this.playerEntity.moveEntity(var13, var15, var17); -@@ -349,10 +367,15 @@ - logger.warning(this.playerEntity.username + " moved wrongly!"); + this.playerEntity.moveEntity(d4, d6, d7); +@@ -347,10 +364,15 @@ + this.mcServer.func_98033_al().func_98236_b(this.playerEntity.username + " moved wrongly!"); } + if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving @@ -61,24 +60,24 @@ + return; + } + - this.playerEntity.setPositionAndRotation(var5, var7, var9, var11, var12); - boolean var32 = var2.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)var27, (double)var27, (double)var27)).isEmpty(); + this.playerEntity.setPositionAndRotation(d1, d2, d3, f2, f3); + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)f4, (double)f4, (double)f4)).isEmpty(); -- if (var28 && (var31 || !var32) && !this.playerEntity.isPlayerSleeping()) -+ if (var28 && (var31 || !var32) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) +- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) ++ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) { - this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12); + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f2, f3); return; -@@ -360,7 +383,7 @@ +@@ -358,7 +380,7 @@ - AxisAlignedBB var33 = this.playerEntity.boundingBox.copy().expand((double)var27, (double)var27, (double)var27).addCoord(0.0D, -0.55D, 0.0D); + AxisAlignedBB axisalignedbb = this.playerEntity.boundingBox.copy().expand((double)f4, (double)f4, (double)f4).addCoord(0.0D, -0.55D, 0.0D); -- if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !var2.isAABBNonEmpty(var33)) -+ if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !var2.isAABBNonEmpty(var33) && !this.playerEntity.capabilities.allowFlying) +- if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.isAABBNonEmpty(axisalignedbb)) ++ if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.isAABBNonEmpty(axisalignedbb) && !this.playerEntity.capabilities.allowFlying) { - if (var29 >= -0.03125D) + if (d12 >= -0.03125D) { -@@ -379,6 +402,11 @@ +@@ -377,6 +399,11 @@ this.ticksForFloatKick = 0; } @@ -89,67 +88,59 @@ + this.playerEntity.onGround = par1Packet10Flying.onGround; this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - this.playerEntity.updateFlyingState(this.playerEntity.posY - var3, par1Packet10Flying.onGround); -@@ -447,7 +475,10 @@ - double var13 = this.playerEntity.posZ - ((double)var8 + 0.5D); - double var15 = var9 * var9 + var11 * var11 + var13 * var13; + this.playerEntity.updateFlyingState(this.playerEntity.posY - d0, par1Packet10Flying.onGround); +@@ -443,7 +470,10 @@ + double d2 = this.playerEntity.posZ - ((double)k + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; -- if (var15 > 36.0D) +- if (d3 > 36.0D) + double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; + dist *= dist; + -+ if (var15 > dist) ++ if (d3 > dist) { return; } -@@ -471,6 +502,7 @@ - { - if (var18 <= var3 && !var4) - { -+ ForgeEventFactory.onPlayerInteract(playerEntity, Action.LEFT_CLICK_BLOCK, var6, var7, var8, 0); - this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var6, var7, var8, var2)); - } - else -@@ -518,7 +550,11 @@ +@@ -503,7 +533,11 @@ return; } -- this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, var2, var3); +- this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); + PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1); + if (event.useItem != Event.Result.DENY) + { -+ this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, var2, var3); ++ this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); + } } else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) { -@@ -536,7 +572,9 @@ - var13 = var12; - } - -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && (var13 > var9 || var10)) +@@ -512,7 +546,9 @@ + } + else + { +- if (this.hasMoved && this.playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64.0D && !this.mcServer.func_96290_a(worldserver, i, j, k, this.playerEntity)) + double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; + dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < dist && (var13 > var9 || var10)) ++ if (this.hasMoved && this.playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && !this.mcServer.func_96290_a(worldserver, i, j, k, this.playerEntity)) { - this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); + this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } -@@ -703,8 +741,12 @@ - this.sendPacketToPlayer(new Packet3Chat("Cannot send chat message.")); +@@ -691,7 +727,14 @@ return; } -- -- var2 = "<" + this.playerEntity.username + "> " + var2; -+ ServerChatEvent event = new ServerChatEvent(this.playerEntity, var2, "<" + this.playerEntity.username + "> " + var2); + ++ String old = s; + s = "<" + this.playerEntity.func_96090_ax() + "> " + s; ++ ServerChatEvent event = new ServerChatEvent(this.playerEntity, old, s); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return; + } -+ var2 = event.line; - logger.info(var2); - this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(var2, false)); ++ s = event.line; + this.mcServer.func_98033_al().func_98233_a(s); + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(s, false)); } -@@ -835,7 +877,7 @@ +@@ -822,7 +865,7 @@ return; } @@ -158,3 +149,11 @@ } } } +@@ -1220,7 +1263,6 @@ + } + } + } +- + + @Override + diff --git a/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch index 2644fc89e..e8d50c754 100644 --- a/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch +++ b/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch @@ -20,46 +20,46 @@ @@ -59,17 +62,22 @@ this.zCh = par1Chunk.zPosition; this.includeInitialize = par2; - Packet51MapChunkData var4 = getMapChunkData(par1Chunk, par2, par3); -- Deflater var5 = new Deflater(-1); - this.yChMax = var4.chunkHasAddSectionFlag; - this.yChMin = var4.chunkExistFlag; + Packet51MapChunkData packet51mapchunkdata = getMapChunkData(par1Chunk, par2, par3); +- Deflater deflater = new Deflater(-1); + this.yChMax = packet51mapchunkdata.chunkHasAddSectionFlag; + this.yChMin = packet51mapchunkdata.chunkExistFlag; - -+ this.compressedChunkData = var4.compressedData; ++ this.compressedChunkData = packet51mapchunkdata.compressedData; + this.deflateGate = new Semaphore(1); + } + + private void deflate() + { -+ Deflater var5 = new Deflater(-1); ++ Deflater deflater = new Deflater(-1); try { -- this.compressedChunkData = var4.compressedData; -- var5.setInput(var4.compressedData, 0, var4.compressedData.length); -+ var5.setInput(compressedChunkData, 0, compressedChunkData.length); - var5.finish(); -- this.chunkData = new byte[var4.compressedData.length]; -- this.tempLength = var5.deflate(this.chunkData); +- this.compressedChunkData = packet51mapchunkdata.compressedData; +- deflater.setInput(packet51mapchunkdata.compressedData, 0, packet51mapchunkdata.compressedData.length); ++ deflater.setInput(compressedChunkData, 0, compressedChunkData.length); + deflater.finish(); +- this.chunkData = new byte[packet51mapchunkdata.compressedData.length]; +- this.tempLength = deflater.deflate(this.chunkData); + byte[] deflated = new byte[compressedChunkData.length]; -+ this.tempLength = var5.deflate(deflated); ++ this.tempLength = deflater.deflate(deflated); + this.chunkData = deflated; } finally { @@ -97,13 +105,16 @@ par1DataInputStream.readFully(temp, 0, this.tempLength); - int var2 = 0; - int var3; + int i = 0; + int j; + int msb = 0; //BugFix: MC does not read the MSB array from the packet properly, causing issues for servers that use blocks > 256 - for (var3 = 0; var3 < 16; ++var3) + for (j = 0; j < 16; ++j) { - var2 += this.yChMin >> var3 & 1; -+ msb += this.yChMax >> var3 & 1; + i += this.yChMin >> j & 1; ++ msb += this.yChMax >> j & 1; } - var3 = 12288 * var2; -+ var3 += 2048 * msb; + j = 12288 * i; ++ j += 2048 * msb; if (this.includeInitialize) { diff --git a/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch index d1d879562..9a0fcd0dd 100644 --- a/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch +++ b/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch @@ -16,8 +16,8 @@ - if (par4 >= 64) + if (par4 >= ForgeDummyContainer.clumpingThreshold) { -- System.out.println("ChunkTilesUpdatePacket compress " + par4); +- this.field_98193_m.func_98233_a("ChunkTilesUpdatePacket compress " + par4); - - if (field_73449_e.length < var6) + if (field_73449_e.length < l) { - field_73449_e = new byte[var6]; + field_73449_e = new byte[l]; diff --git a/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch index d98b19dda..ab0a2d9b8 100644 --- a/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch +++ b/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch @@ -20,26 +20,26 @@ @@ -44,15 +48,6 @@ { - Chunk var5 = (Chunk)par1List.get(var4); - Packet51MapChunkData var6 = Packet51MapChunk.getMapChunkData(var5, true, 65535); + Chunk chunk = (Chunk)par1List.get(k); + Packet51MapChunkData packet51mapchunkdata = Packet51MapChunk.getMapChunkData(chunk, true, 65535); - -- if (chunkDataNotCompressed.length < var3 + var6.compressedData.length) +- if (chunkDataNotCompressed.length < j + packet51mapchunkdata.compressedData.length) - { -- byte[] var7 = new byte[var3 + var6.compressedData.length]; -- System.arraycopy(chunkDataNotCompressed, 0, var7, 0, chunkDataNotCompressed.length); -- chunkDataNotCompressed = var7; +- byte[] abyte = new byte[j + packet51mapchunkdata.compressedData.length]; +- System.arraycopy(chunkDataNotCompressed, 0, abyte, 0, chunkDataNotCompressed.length); +- chunkDataNotCompressed = abyte; - } - -- System.arraycopy(var6.compressedData, 0, chunkDataNotCompressed, var3, var6.compressedData.length); - var3 += var6.compressedData.length; - this.chunkPostX[var4] = var5.xPosition; - this.chunkPosZ[var4] = var5.zPosition; +- System.arraycopy(packet51mapchunkdata.compressedData, 0, chunkDataNotCompressed, j, packet51mapchunkdata.compressedData.length); + j += packet51mapchunkdata.compressedData.length; + this.chunkPostX[k] = chunk.xPosition; + this.chunkPosZ[k] = chunk.zPosition; @@ -60,15 +55,29 @@ - this.field_73588_b[var4] = var6.chunkHasAddSectionFlag; - this.field_73584_f[var4] = var6.compressedData; + this.field_73588_b[k] = packet51mapchunkdata.chunkHasAddSectionFlag; + this.field_73584_f[k] = packet51mapchunkdata.compressedData; } + deflateGate = new Semaphore(1); -+ maxLen = var3; ++ maxLen = j; + } + + private void deflate() @@ -52,17 +52,17 @@ + offset += field_73584_f[x].length; + } - Deflater var11 = new Deflater(-1); + Deflater deflater = new Deflater(-1); try { -- var11.setInput(chunkDataNotCompressed, 0, var3); -+ var11.setInput(data, 0, maxLen); - var11.finish(); -- this.chunkDataBuffer = new byte[var3]; -- this.dataLength = var11.deflate(this.chunkDataBuffer); +- deflater.setInput(chunkDataNotCompressed, 0, j); ++ deflater.setInput(data, 0, maxLen); + deflater.finish(); +- this.chunkDataBuffer = new byte[j]; +- this.dataLength = deflater.deflate(this.chunkDataBuffer); + byte[] deflated = new byte[maxLen]; -+ this.dataLength = var11.deflate(deflated); ++ this.dataLength = deflater.deflate(deflated); + this.chunkDataBuffer = deflated; } finally diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index 6a771602e..e13b709f1 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,20 +1,22 @@ --- ../src_base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src_work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -1,6 +1,11 @@ +@@ -1,8 +1,13 @@ package net.minecraft.potion; - ++ +import java.util.ArrayList; +import java.util.List; -+ + + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.EntityLiving; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class PotionEffect -@@ -20,6 +25,9 @@ - /** Whether the potion effect came from a beacon */ - private boolean isAmbient; +@@ -24,6 +29,9 @@ + @SideOnly(Side.CLIENT) + private boolean field_100013_f; + /** List of ItemStack that can cure the potion effect **/ + private List curativeItems; @@ -22,7 +24,7 @@ public PotionEffect(int par1, int par2) { this(par1, par2, 0); -@@ -36,6 +44,8 @@ +@@ -40,6 +48,8 @@ this.duration = par2; this.amplifier = par3; this.isAmbient = par4; @@ -31,7 +33,7 @@ } public PotionEffect(PotionEffect par1PotionEffect) -@@ -43,6 +53,7 @@ +@@ -47,6 +57,7 @@ this.potionID = par1PotionEffect.potionID; this.duration = par1PotionEffect.duration; this.amplifier = par1PotionEffect.amplifier; @@ -39,7 +41,7 @@ } /** -@@ -87,6 +98,63 @@ +@@ -91,6 +102,63 @@ public int getAmplifier() { return this.amplifier; diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 2263fcc5b..3facdbead 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -8,7 +8,7 @@ import java.util.Iterator; import java.util.List; import java.util.logging.Level; -@@ -66,6 +67,10 @@ +@@ -56,6 +57,10 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; @@ -18,8 +18,8 @@ + public abstract class MinecraftServer implements ICommandSender, Runnable, IPlayerUsage { - /** The logging system. */ -@@ -146,7 +151,8 @@ + /** Instance of Minecraft Server. */ +@@ -133,7 +138,8 @@ public final long[] tickTimeArray = new long[100]; /** Stats are [dimension][tick%100] system.nanoTime is stored. */ @@ -29,59 +29,59 @@ private KeyPair serverKeyPair; /** Username of the server owner (for integrated servers) */ -@@ -238,8 +244,6 @@ +@@ -209,8 +215,6 @@ { this.convertMapIfNeeded(par1Str); this.setUserMessage("menu.loadingLevel"); - this.worldServers = new WorldServer[3]; - this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); - WorldInfo var9 = var7.loadWorldInfo(); - WorldSettings var8; -@@ -259,46 +263,23 @@ - var8.enableBonusChest(); + ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + WorldSettings worldsettings; +@@ -230,46 +234,23 @@ + worldsettings.enableBonusChest(); } -- for (int var10 = 0; var10 < this.worldServers.length; ++var10) +- for (int j = 0; j < this.worldServers.length; ++j) - { -- byte var11 = 0; +- byte b0 = 0; - -- if (var10 == 1) +- if (j == 1) - { -- var11 = -1; +- b0 = -1; - } - -- if (var10 == 2) +- if (j == 2) - { -- var11 = 1; +- b0 = 1; - } - -- if (var10 == 0) +- if (j == 0) - { - if (this.isDemo()) - { -- this.worldServers[var10] = new DemoWorldServer(this, var7, par2Str, var11, this.theProfiler); +- this.worldServers[j] = new DemoWorldServer(this, isavehandler, par2Str, b0, this.theProfiler, this.func_98033_al()); - } - else - { -- this.worldServers[var10] = new WorldServer(this, var7, par2Str, var11, var8, this.theProfiler); +- this.worldServers[j] = new WorldServer(this, isavehandler, par2Str, b0, worldsettings, this.theProfiler, this.func_98033_al()); - } - } - else - { -- this.worldServers[var10] = new WorldServerMulti(this, var7, par2Str, var11, var8, this.worldServers[0], this.theProfiler); +- this.worldServers[j] = new WorldServerMulti(this, isavehandler, par2Str, b0, worldsettings, this.worldServers[0], this.theProfiler, this.func_98033_al()); - } - -- this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10])); -+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var7, par2Str, 0, theProfiler) : new WorldServer(this, var7, par2Str, 0, var8, theProfiler)); +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); ++ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, func_98033_al()) : new WorldServer(this, isavehandler, par2Str, 0, worldsettings, theProfiler, func_98033_al())); + for (int dim : DimensionManager.getStaticDimensionIDs()) + { -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var7, par2Str, dim, var8, overWorld, theProfiler)); ++ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, worldsettings, overWorld, theProfiler, func_98033_al())); + world.addWorldAccess(new WorldManager(this, world)); if (!this.isSinglePlayer()) { -- this.worldServers[var10].getWorldInfo().setGameType(this.getGameType()); +- this.worldServers[j].getWorldInfo().setGameType(this.getGameType()); + world.getWorldInfo().setGameType(this.getGameType()); } @@ -96,12 +96,12 @@ this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); } -@@ -427,7 +408,14 @@ - for (int var1 = 0; var1 < this.worldServers.length; ++var1) +@@ -398,7 +379,14 @@ + for (int i = 0; i < this.worldServers.length; ++i) { - WorldServer var2 = this.worldServers[var1]; -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(var2)); - var2.flush(); + WorldServer worldserver = this.worldServers[i]; ++ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver)); + worldserver.flush(); + } + + WorldServer[] tmp = worldServers; @@ -111,35 +111,35 @@ } if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning()) -@@ -651,13 +639,15 @@ +@@ -622,13 +610,15 @@ this.theProfiler.startSection("levels"); - int var1; + int i; -- for (var1 = 0; var1 < this.worldServers.length; ++var1) +- for (i = 0; i < this.worldServers.length; ++i) - { + Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0); + for (int x = 0; x < ids.length; x++) + { + int id = ids[x]; - long var2 = System.nanoTime(); + long j = System.nanoTime(); -- if (var1 == 0 || this.getAllowNether()) +- if (i == 0 || this.getAllowNether()) - { -- WorldServer var4 = this.worldServers[var1]; +- WorldServer worldserver = this.worldServers[i]; + if (id == 0 || this.getAllowNether()) + { -+ WorldServer var4 = DimensionManager.getWorld(id); - this.theProfiler.startSection(var4.getWorldInfo().getWorldName()); ++ WorldServer worldserver = DimensionManager.getWorld(id); + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); - var4.getWorldVec3Pool().clear(); -@@ -704,9 +694,11 @@ + worldserver.getWorldVec3Pool().clear(); +@@ -675,9 +665,11 @@ this.theProfiler.endSection(); } -- this.timeOfLastDimensionTick[var1][this.tickCounter % 100] = System.nanoTime() - var2; +- this.timeOfLastDimensionTick[i][this.tickCounter % 100] = System.nanoTime() - j; - } - -+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - var2; ++ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - j; + } + + this.theProfiler.endStartSection("dim_unloading"); @@ -147,7 +147,7 @@ this.theProfiler.endStartSection("connection"); this.getNetworkThread().networkTick(); this.theProfiler.endStartSection("players"); -@@ -760,7 +752,13 @@ +@@ -731,7 +723,13 @@ */ public WorldServer worldServerForDimension(int par1) { @@ -162,20 +162,11 @@ } @SideOnly(Side.SERVER) -@@ -869,7 +867,7 @@ +@@ -1102,6 +1100,7 @@ - public String getServerModName() - { -- return "fml"; -+ return "forge,fml"; - } - - /** -@@ -1131,6 +1129,7 @@ - - if (var2 != null) + if (worldserver != null) { -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(var2)); - var2.flush(); ++ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver)); + worldserver.flush(); } } diff --git a/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch b/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch index 7c977f1ec..8ec5539a9 100644 --- a/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch @@ -14,30 +14,30 @@ private void updateStats() { + this.displayStrings = new String[5 + DimensionManager.getIDs().length]; - long var1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); System.gc(); - this.displayStrings[0] = "Memory use: " + var1 / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; + this.displayStrings[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; @@ -53,15 +56,18 @@ if (this.field_79017_e.worldServers != null) { -- for (int var3 = 0; var3 < this.field_79017_e.worldServers.length; ++var3) -+ int var3 = 0; +- for (int j = 0; j < this.field_79017_e.worldServers.length; ++j) ++ int j = 0; + for (Integer id : DimensionManager.getIDs()) { -- this.displayStrings[5 + var3] = "Lvl " + var3 + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.timeOfLastDimensionTick[var3]) * 1.0E-6D) + " ms"; -+ this.displayStrings[5 + var3] = "Lvl " + id + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms"; +- this.displayStrings[5 + j] = "Lvl " + j + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.timeOfLastDimensionTick[j]) * 1.0E-6D) + " ms"; ++ this.displayStrings[5 + j] = "Lvl " + id + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms"; -- if (this.field_79017_e.worldServers[var3] != null && this.field_79017_e.worldServers[var3].theChunkProviderServer != null) +- if (this.field_79017_e.worldServers[j] != null && this.field_79017_e.worldServers[j].theChunkProviderServer != null) + WorldServer world = DimensionManager.getWorld(id); + if (world != null && world.theChunkProviderServer != null) { -- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + this.field_79017_e.worldServers[var3].theChunkProviderServer.makeString(); -- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", Vec3: " + this.field_79017_e.worldServers[var3].getWorldVec3Pool().func_82590_d() + " / " + this.field_79017_e.worldServers[var3].getWorldVec3Pool().getPoolSize(); -+ this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + world.theChunkProviderServer.makeString(); -+ this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize(); +- this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", " + this.field_79017_e.worldServers[j].theChunkProviderServer.makeString(); +- this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", Vec3: " + this.field_79017_e.worldServers[j].getWorldVec3Pool().func_82590_d() + " / " + this.field_79017_e.worldServers[j].getWorldVec3Pool().getPoolSize(); ++ this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", " + world.theChunkProviderServer.makeString(); ++ this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize(); } -+ var3++; ++ j++; } } diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index ed03c1af3..9db4d93b1 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src_work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -21,6 +21,10 @@ +@@ -23,6 +23,10 @@ import net.minecraft.world.demo.DemoWorldServer; import net.minecraft.world.storage.ISaveHandler; @@ -11,52 +11,53 @@ @SideOnly(Side.CLIENT) public class IntegratedServer extends MinecraftServer { -@@ -60,44 +64,22 @@ +@@ -63,44 +67,23 @@ protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); - this.worldServers = new WorldServer[3]; - this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler var7 = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); + ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); -- for (int var8 = 0; var8 < this.worldServers.length; ++var8) +- for (int j = 0; j < this.worldServers.length; ++j) - { -- byte var9 = 0; +- byte b0 = 0; - -- if (var8 == 1) -+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var7, par2Str, 0, theProfiler) : new WorldServer(this, var7, par2Str, 0, theWorldSettings, theProfiler)); +- if (j == 1) ++ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, func_98033_al()) : new WorldServer(this, isavehandler, par2Str, 0, theWorldSettings, theProfiler, func_98033_al())); + for (int dim : DimensionManager.getStaticDimensionIDs()) + { -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var7, par2Str, dim, theWorldSettings, overWorld, theProfiler)); ++ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, theWorldSettings, overWorld, theProfiler, func_98033_al())); + world.addWorldAccess(new WorldManager(this, world)); ++ + if (!this.isSinglePlayer()) { -- var9 = -1; +- b0 = -1; + world.getWorldInfo().setGameType(this.getGameType()); } -- if (var8 == 2) +- if (j == 2) - { -- var9 = 1; +- b0 = 1; - } - -- if (var8 == 0) +- if (j == 0) - { - if (this.isDemo()) - { -- this.worldServers[var8] = new DemoWorldServer(this, var7, par2Str, var9, this.theProfiler); +- this.worldServers[j] = new DemoWorldServer(this, isavehandler, par2Str, b0, this.theProfiler, this.func_98033_al()); - } - else - { -- this.worldServers[var8] = new WorldServer(this, var7, par2Str, var9, this.theWorldSettings, this.theProfiler); +- this.worldServers[j] = new WorldServer(this, isavehandler, par2Str, b0, this.theWorldSettings, this.theProfiler, this.func_98033_al()); - } - } - else - { -- this.worldServers[var8] = new WorldServerMulti(this, var7, par2Str, var9, this.theWorldSettings, this.worldServers[0], this.theProfiler); +- this.worldServers[j] = new WorldServerMulti(this, isavehandler, par2Str, b0, this.theWorldSettings, this.worldServers[0], this.theProfiler, this.func_98033_al()); - } - -- this.worldServers[var8].addWorldAccess(new WorldManager(this, this.worldServers[var8])); +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); - this.getConfigurationManager().setPlayerManager(this.worldServers); - } - diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch index 0d53d3431..8aeddfc58 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch @@ -1,36 +1,24 @@ --- ../src_base/minecraft/net/minecraft/server/management/PlayerInstance.java +++ ../src_work/minecraft/net/minecraft/server/management/PlayerInstance.java -@@ -1,7 +1,11 @@ +@@ -1,6 +1,7 @@ package net.minecraft.server.management; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -+ -+import com.google.common.collect.ObjectArrays; -+ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.packet.Packet; - import net.minecraft.network.packet.Packet51MapChunk; -@@ -10,9 +14,16 @@ +@@ -9,6 +10,9 @@ + import net.minecraft.network.packet.Packet53BlockChange; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; - +import net.minecraftforge.common.ForgeDummyContainer; -+import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.ChunkWatchEvent; -+ + public class PlayerInstance { -- private final List playersInChunk; -+ public static int clumpingThreshold; -+ -+ public final List playersInChunk; - - /** note: this is final */ - private final ChunkCoordIntPair chunkLocation; -@@ -56,6 +67,8 @@ +@@ -56,6 +60,8 @@ this.playersInChunk.remove(par1EntityPlayerMP); par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); @@ -38,96 +26,55 @@ + if (this.playersInChunk.isEmpty()) { - long var2 = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; -@@ -80,20 +93,21 @@ + long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; +@@ -80,7 +86,7 @@ this.field_73260_f |= 1 << (par2 >> 4); - if (this.numberOfTilesToUpdate < 64) -- { -- short var4 = (short)(par1 << 12 | par3 << 8 | par2); -- -- for (int var5 = 0; var5 < this.numberOfTilesToUpdate; ++var5) -- { -- if (this.locationOfBlockChange[var5] == var4) -- { -- return; -- } -- } -- -- this.locationOfBlockChange[this.numberOfTilesToUpdate++] = var4; -- } -+ short var4 = (short)(par1 << 12 | par3 << 8 | par2); -+ -+ for (int var5 = 0; var5 < this.numberOfTilesToUpdate; ++var5) -+ { -+ if (this.locationOfBlockChange[var5] == var4) -+ { -+ return; -+ } -+ } -+ -+ if (this.numberOfTilesToUpdate == locationOfBlockChange.length) -+ { -+ this.locationOfBlockChange = Arrays.copyOf(this.locationOfBlockChange, locationOfBlockChange.length << 1); -+ } -+ this.locationOfBlockChange[this.numberOfTilesToUpdate++] = var4; - } ++ //if (this.numberOfTilesToUpdate < 64) //Forge; Cache everything, so always run + { + short short1 = (short)(par1 << 12 | par3 << 8 | par2); - public void sendToAllPlayersWatchingChunk(Packet par1Packet) -@@ -133,40 +147,26 @@ +@@ -92,6 +98,10 @@ + } + } + ++ if (numberOfTilesToUpdate == locationOfBlockChange.length) ++ { ++ locationOfBlockChange = Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ } + this.locationOfBlockChange[this.numberOfTilesToUpdate++] = short1; + } + } +@@ -133,12 +143,13 @@ { - int var4; + int l; - if (this.numberOfTilesToUpdate == 64) + if (this.numberOfTilesToUpdate >= ForgeDummyContainer.clumpingThreshold) { - var1 = this.chunkLocation.chunkXPos * 16; - var2 = this.chunkLocation.chunkZPos * 16; + i = this.chunkLocation.chunkXPos * 16; + j = this.chunkLocation.chunkZPos * 16; this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.myManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.field_73260_f)); -- -- for (var3 = 0; var3 < 16; ++var3) -+ } -+ else -+ { -+ this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.myManager))); -+ } -+ -+ for (var1 = 0; var1 < this.numberOfTilesToUpdate; ++var1) -+ { -+ var2 = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[var1] >> 12 & 15); -+ var3 = this.locationOfBlockChange[var1] & 255; -+ var4 = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[var1] >> 8 & 15); -+ -+ if (PlayerManager.getWorldServer(this.myManager).blockHasTileEntity(var2, var3, var4)) + ++ /* Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones + for (k = 0; k < 16; ++k) { -- if ((this.field_73260_f & 1 << var3) != 0) -- { -- var4 = var3 << 4; -- List var5 = PlayerManager.getWorldServer(this.myManager).getAllTileEntityInBox(var1, var4, var2, var1 + 16, var4 + 16, var2 + 16); -- -- for (int var6 = 0; var6 < var5.size(); ++var6) -- { -- this.sendTileToAllPlayersWatchingChunk((TileEntity)var5.get(var6)); -- } -- } -- } -- } -- else -- { -- this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.myManager))); -- -- for (var1 = 0; var1 < this.numberOfTilesToUpdate; ++var1) -- { -- var2 = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[var1] >> 12 & 15); -- var3 = this.locationOfBlockChange[var1] & 255; -- var4 = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[var1] >> 8 & 15); -- -- if (PlayerManager.getWorldServer(this.myManager).blockHasTileEntity(var2, var3, var4)) -- { -- this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.myManager).getBlockTileEntity(var2, var3, var4)); -- } -+ this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.myManager).getBlockTileEntity(var2, var3, var4)); + if ((this.field_73260_f & 1 << k) != 0) +@@ -152,11 +163,14 @@ + } + } } ++ */ } - } + else + { + this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.myManager))); +- ++ } ++ ++ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small + for (i = 0; i < this.numberOfTilesToUpdate; ++i) + { + j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15); diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index b39166afc..b7657c7af 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src_work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -38,10 +38,14 @@ - import net.minecraft.util.ChunkCoordinates; +@@ -47,10 +47,14 @@ + import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.world.EnumGameType; +import net.minecraft.world.Teleporter; @@ -15,7 +15,7 @@ public abstract class ServerConfigurationManager { -@@ -323,6 +327,16 @@ +@@ -386,6 +390,16 @@ */ public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) { @@ -29,47 +29,46 @@ + par2 = world.provider.getRespawnDimension(par1EntityPlayerMP); + } + - par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeAllTrackingPlayers(par1EntityPlayerMP); + par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeEntityFromAllTrackingPlayers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP); -@@ -345,6 +359,7 @@ - EntityPlayerMP var7 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.username, (ItemInWorldManager)var6); - var7.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler; - var7.clonePlayer(par1EntityPlayerMP, par3); -+ var7.dimension = par2; - var7.entityId = par1EntityPlayerMP.entityId; - WorldServer var8 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); - this.func_72381_a(var7, par1EntityPlayerMP, var8); -@@ -388,14 +403,20 @@ +@@ -408,6 +422,7 @@ + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.username, (ItemInWorldManager)object); + entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler; + entityplayermp1.clonePlayer(par1EntityPlayerMP, par3); ++ entityplayermp1.dimension = par2; + entityplayermp1.entityId = par1EntityPlayerMP.entityId; + WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); + this.func_72381_a(entityplayermp1, par1EntityPlayerMP, worldserver); +@@ -452,6 +467,11 @@ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2) { -+ transferPlayerToDimension(par1EntityPlayerMP, par2, mcServer.worldServerForDimension(par2).func_85176_s()); ++ transferPlayerToDimension(par1EntityPlayerMP, par2, mcServer.worldServerForDimension(par2).getDefaultTeleporter()); + } + + public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2, Teleporter teleporter) + { - int var3 = par1EntityPlayerMP.dimension; - WorldServer var4 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); + int j = par1EntityPlayerMP.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); par1EntityPlayerMP.dimension = par2; - WorldServer var5 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); -+ - par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, var5.getWorldInfo().getTerrainType(), var5.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); - var4.removePlayerEntityDangerously(par1EntityPlayerMP); +@@ -459,7 +479,7 @@ + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, worldserver1.getWorldInfo().getTerrainType(), worldserver1.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); + worldserver.removePlayerEntityDangerously(par1EntityPlayerMP); par1EntityPlayerMP.isDead = false; -- this.transferEntityToWorld(par1EntityPlayerMP, var3, var4, var5); -+ this.transferEntityToWorld(par1EntityPlayerMP, var3, var4, var5, teleporter); - this.func_72375_a(par1EntityPlayerMP, var4); +- this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1); ++ this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1, teleporter); + this.func_72375_a(par1EntityPlayerMP, worldserver); par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch); - par1EntityPlayerMP.theItemInWorldManager.setWorld(var5); -@@ -417,38 +438,23 @@ + par1EntityPlayerMP.theItemInWorldManager.setWorld(worldserver1); +@@ -481,38 +501,23 @@ */ public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer) { -- double var5 = par1Entity.posX; -- double var7 = par1Entity.posZ; -- double var9 = 8.0D; -+ transferEntityToWorld(par1Entity, par2, par3WorldServer, par4WorldServer, par4WorldServer.func_85176_s()); +- double d0 = par1Entity.posX; +- double d1 = par1Entity.posZ; +- double d2 = 8.0D; ++ transferEntityToWorld(par1Entity, par2, par3WorldServer, par4WorldServer, par4WorldServer.getDefaultTeleporter()); + } + + public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer, Teleporter teleporter) @@ -77,19 +76,19 @@ + WorldProvider pOld = par3WorldServer.provider; + WorldProvider pNew = par4WorldServer.provider; + double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double var5 = par1Entity.posX * moveFactor; -+ double var7 = par1Entity.posZ * moveFactor; - double var11 = par1Entity.posX; - double var13 = par1Entity.posY; - double var15 = par1Entity.posZ; - float var17 = par1Entity.rotationYaw; ++ double d0 = par1Entity.posX * moveFactor; ++ double d1 = par1Entity.posZ * moveFactor; + double d3 = par1Entity.posX; + double d4 = par1Entity.posY; + double d5 = par1Entity.posZ; + float f = par1Entity.rotationYaw; par3WorldServer.theProfiler.startSection("moving"); - if (par1Entity.dimension == -1) - { -- var5 /= var9; -- var7 /= var9; -- par1Entity.setLocationAndAngles(var5, par1Entity.posY, var7, par1Entity.rotationYaw, par1Entity.rotationPitch); +- d0 /= d2; +- d1 /= d2; +- par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); - - if (par1Entity.isEntityAlive()) - { @@ -98,9 +97,9 @@ - } - else if (par1Entity.dimension == 0) - { -- var5 *= var9; -- var7 *= var9; -- par1Entity.setLocationAndAngles(var5, par1Entity.posY, var7, par1Entity.rotationYaw, par1Entity.rotationPitch); +- d0 *= d2; +- d1 *= d2; +- par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); - - if (par1Entity.isEntityAlive()) - { @@ -110,14 +109,14 @@ - else + if (par1Entity.dimension == 1) { - ChunkCoordinates var18; + ChunkCoordinates chunkcoordinates; -@@ -485,7 +491,7 @@ +@@ -549,7 +554,7 @@ par4WorldServer.spawnEntityInWorld(par1Entity); - par1Entity.setLocationAndAngles(var5, par1Entity.posY, var7, par1Entity.rotationYaw, par1Entity.rotationPitch); + par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); par4WorldServer.updateEntityWithOptionalForce(par1Entity, false); -- par4WorldServer.func_85176_s().placeInPortal(par1Entity, var11, var13, var15, var17); -+ teleporter.placeInPortal(par1Entity, var11, var13, var15, var17); +- par4WorldServer.getDefaultTeleporter().placeInPortal(par1Entity, d3, d4, d5, f); ++ teleporter.placeInPortal(par1Entity, d3, d4, d5, f); } par3WorldServer.theProfiler.endSection(); diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 57861631f..6c2eb1e61 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -4,12 +4,12 @@ */ private static StatBase[] initMinableStats(String par0Str, int par1) { -- StatBase[] var2 = new StatBase[256]; +- StatBase[] astatbase = new StatBase[256]; - -- for (int var3 = 0; var3 < 256; ++var3) -+ StatBase[] var2 = new StatBase[Block.blocksList.length]; +- for (int j = 0; j < 256; ++j) ++ StatBase[] astatbase = new StatBase[Block.blocksList.length]; + -+ for (int var3 = 0; var3 < Block.blocksList.length; ++var3) ++ for (int j = 0; j < Block.blocksList.length; ++j) { - if (Block.blocksList[var3] != null && Block.blocksList[var3].getEnableStats()) + if (Block.blocksList[j] != null && Block.blocksList[j].getEnableStats()) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index e9922fec2..0832b4a84 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,19 +1,20 @@ --- ../src_base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src_work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -11,7 +11,10 @@ - import net.minecraft.block.TileEntityRecordPlayer; +@@ -10,8 +10,11 @@ + import net.minecraft.block.Block; import net.minecraft.crash.CrashReportCategory; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.Packet132TileEntityData; + import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; public class TileEntity -@@ -296,4 +299,93 @@ - addMapping(TileEntityBeacon.class, "Beacon"); - addMapping(TileEntitySkull.class, "Skull"); +@@ -308,4 +311,93 @@ + addMapping(TileEntityHopper.class, "Hopper"); + addMapping(TileEntityComparator.class, "Comparator"); } + + // -- BEGIN FORGE PATCHES -- @@ -88,11 +89,11 @@ + Block type = getBlockType(); + if (type == Block.enchantmentTable) + { -+ bb = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); ++ bb = AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + else if (type == Block.chest) + { -+ bb = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 1, zCoord + 2); ++ bb = AxisAlignedBB.getAABBPool().getAABB(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 2, zCoord + 2); + } + else if (type != null && type != Block.beacon) + { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index b594acb93..994b6f0c3 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,14 +1,14 @@ --- ../src_base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -114,8 +114,9 @@ - for (int var5 = this.zCoord - var1; var5 <= this.zCoord + var1; ++var5) +@@ -120,8 +120,9 @@ + for (int l = this.zCoord - i; l <= this.zCoord + i; ++l) { - int var6 = this.worldObj.getBlockId(var4, var2, var5); + int i1 = this.worldObj.getBlockId(k, j, l); - -- if (var6 != Block.blockEmerald.blockID && var6 != Block.blockGold.blockID && var6 != Block.blockDiamond.blockID && var6 != Block.blockSteel.blockID) -+ Block block = Block.blocksList[var6]; +- if (i1 != Block.blockEmerald.blockID && i1 != Block.blockGold.blockID && i1 != Block.blockDiamond.blockID && i1 != Block.blockSteel.blockID) ++ Block block = Block.blocksList[i1]; + -+ if (block == null || !block.isBeaconBase(worldObj, var4, var2, var5, xCoord, yCoord, zCoord)) ++ if (block == null || !block.isBeaconBase(worldObj, k, j, l, xCoord, yCoord, zCoord)) { - var3 = false; + flag = false; break; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index f6838f834..e6594c9aa 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,58 +1,11 @@ --- ../src_base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -12,7 +12,10 @@ - import net.minecraft.nbt.NBTTagList; - import net.minecraft.potion.PotionHelper; +@@ -177,7 +177,7 @@ --public class TileEntityBrewingStand extends TileEntity implements IInventory -+import net.minecraftforge.common.ISidedInventory; -+import net.minecraftforge.common.ForgeDirection; -+ -+public class TileEntityBrewingStand extends TileEntity implements IInventory, ISidedInventory - { - /** The itemstacks currently placed in the slots of the brewing stand */ - private ItemStack[] brewingItemStacks = new ItemStack[4]; -@@ -94,7 +97,7 @@ - { - ItemStack var1 = this.brewingItemStacks[3]; - -- if (!Item.itemsList[var1.itemID].isPotionIngredient()) -+ if (!Item.itemsList[var1.itemID].isPotionIngredient(var1)) + if (Item.itemsList[itemstack.itemID].hasContainerItem()) { - return false; - } -@@ -166,7 +169,7 @@ - - if (Item.itemsList[var1.itemID].hasContainerItem()) - { -- this.brewingItemStacks[3] = new ItemStack(Item.itemsList[var1.itemID].getContainerItem()); -+ this.brewingItemStacks[3] = Item.itemsList[var1.itemID].getContainerItemStack(brewingItemStacks[3]); +- this.brewingItemStacks[3] = new ItemStack(Item.itemsList[itemstack.itemID].getContainerItem()); ++ this.brewingItemStacks[3] = Item.itemsList[itemstack.itemID].getContainerItemStack(brewingItemStacks[3]); } else { -@@ -185,7 +188,7 @@ - */ - private int getPotionResult(int par1, ItemStack par2ItemStack) - { -- return par2ItemStack == null ? par1 : (Item.itemsList[par2ItemStack.itemID].isPotionIngredient() ? PotionHelper.applyIngredient(par1, Item.itemsList[par2ItemStack.itemID].getPotionEffect()) : par1); -+ return par2ItemStack == null ? par1 : (Item.itemsList[par2ItemStack.itemID].isPotionIngredient(par2ItemStack) ? PotionHelper.applyIngredient(par1, Item.itemsList[par2ItemStack.itemID].getPotionEffect(par2ItemStack)) : par1); - } - - /** -@@ -333,4 +336,16 @@ - - return var1; - } -+ -+ @Override -+ public int getStartInventorySide(ForgeDirection side) -+ { -+ return (side == ForgeDirection.UP ? 3 : 0); -+ } -+ -+ @Override -+ public int getSizeInventorySide(ForgeDirection side) -+ { -+ return (side == ForgeDirection.UP ? 1 : 3); -+ } - } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 95f497b35..ade5f3948 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -2,89 +2,122 @@ +++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.inventory.IInventory; + import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; -@@ -17,7 +18,10 @@ +@@ -16,8 +17,10 @@ + import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; - --public class TileEntityFurnace extends TileEntity implements IInventory +- +-public class TileEntityFurnace extends TileEntity implements ISidedInventory +import net.minecraftforge.common.ForgeDirection; -+import net.minecraftforge.common.ISidedInventory; ++import net.minecraftforge.common.ForgeDummyContainer; + -+public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory ++public class TileEntityFurnace extends TileEntity implements ISidedInventory, net.minecraftforge.common.ISidedInventory { /** * The ItemStacks that hold the items currently being used in the furnace -@@ -247,8 +251,7 @@ +@@ -268,8 +271,7 @@ if (this.furnaceItemStacks[1].stackSize == 0) { -- Item var3 = this.furnaceItemStacks[1].getItem().getContainerItem(); -- this.furnaceItemStacks[1] = var3 != null ? new ItemStack(var3) : null; +- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); +- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; + this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem().getContainerItemStack(furnaceItemStacks[1]); } } } -@@ -294,8 +297,12 @@ +@@ -315,8 +317,12 @@ } else { -- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID); -- return var1 == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(var1) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < var1.getMaxStackSize()))); -+ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); -+ if (var1 == null) return false; +- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID); +- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); ++ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); ++ if (itemstack == null) return false; + if (this.furnaceItemStacks[2] == null) return true; -+ if (!this.furnaceItemStacks[2].isItemEqual(var1)) return false; -+ int result = furnaceItemStacks[2].stackSize + var1.stackSize; -+ return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize()); ++ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; ++ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; ++ return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); } } -@@ -306,15 +313,15 @@ +@@ -327,15 +333,15 @@ { if (this.canSmelt()) { -- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID); -+ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); +- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID); ++ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { - this.furnaceItemStacks[2] = var1.copy(); + this.furnaceItemStacks[2] = itemstack.copy(); } -- else if (this.furnaceItemStacks[2].itemID == var1.itemID) +- else if (this.furnaceItemStacks[2].itemID == itemstack.itemID) - { - ++this.furnaceItemStacks[2].stackSize; -+ else if (this.furnaceItemStacks[2].isItemEqual(var1)) ++ else if (this.furnaceItemStacks[2].isItemEqual(itemstack)) + { -+ furnaceItemStacks[2].stackSize += var1.stackSize; ++ furnaceItemStacks[2].stackSize += itemstack.stackSize; } --this.furnaceItemStacks[0].stackSize; -@@ -341,7 +348,7 @@ - int var1 = par0ItemStack.getItem().itemID; - Item var2 = par0ItemStack.getItem(); +@@ -362,7 +368,7 @@ + int i = par0ItemStack.getItem().itemID; + Item item = par0ItemStack.getItem(); -- if (var1 < 256 && Block.blocksList[var1] != null) -+ if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[var1] != null) +- if (i < 256 && Block.blocksList[i] != null) ++ if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[i] != null) { - Block var3 = Block.blocksList[var1]; + Block block = Block.blocksList[i]; -@@ -387,4 +394,18 @@ - public void openChest() {} - - public void closeChest() {} +@@ -423,4 +429,50 @@ + { + return 1; + } ++ ++ /*********************************************************************************** ++ * This function is here for compatibilities sake, Modders should Check for ++ * Sided before ContainerWorldly, Vanilla Minecraft does not follow the sided standard ++ * that Modding has for a while. ++ * ++ * In vanilla: ++ * ++ * Top: Ores ++ * Sides: Fuel ++ * Bottom: Output ++ * ++ * Standard Modding: ++ * Top: Ores ++ * Sides: Output ++ * Bottom: Fuel ++ * ++ * The Modding one is designed after the GUI, the vanilla one is designed because its ++ * intended use is for the hopper, which logically would take things in from the top. ++ * ++ * This will possibly be removed in future updates, and make vanilla the definitive ++ * standard. ++ */ + + @Override + public int getStartInventorySide(ForgeDirection side) + { -+ if (side == ForgeDirection.DOWN) return 1; -+ if (side == ForgeDirection.UP) return 0; -+ return 2; ++ if (ForgeDummyContainer.legacyFurnaceSides) ++ { ++ if (side == ForgeDirection.DOWN) return 1; ++ if (side == ForgeDirection.UP) return 0; ++ return 2; ++ } ++ else ++ { ++ if (side == ForgeDirection.DOWN) return 2; ++ if (side == ForgeDirection.UP) return 0; ++ return 1; ++ } + } + + @Override diff --git a/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch b/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch index efcc1e59c..cf4942a11 100644 --- a/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch +++ b/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch @@ -10,28 +10,28 @@ import javax.xml.parsers.DocumentBuilderFactory; import net.minecraft.client.Minecraft; @@ -48,7 +50,11 @@ - URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/"); - DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance(); - DocumentBuilder var3 = var2.newDocumentBuilder(); -- Document var4 = var3.parse(var1.openStream()); + URL url = new URL("http://s3.amazonaws.com/MinecraftResources/"); + DocumentBuilderFactory documentbuilderfactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentbuilder = documentbuilderfactory.newDocumentBuilder(); +- Document document = documentbuilder.parse(url.openStream()); + //Add a timeout of 60 seconds to getting the list, MC stalls without sound for some users. -+ URLConnection con = var1.openConnection(); ++ URLConnection con = url.openConnection(); + con.setConnectTimeout(60000); + con.setReadTimeout(60000); -+ Document var4 = var3.parse(con.getInputStream()); - NodeList var5 = var4.getElementsByTagName("Contents"); ++ Document document = documentbuilder.parse(con.getInputStream()); + NodeList nodelist = document.getElementsByTagName("Contents"); - for (int var6 = 0; var6 < 2; ++var6) + for (int i = 0; i < 2; ++i) @@ -168,7 +174,11 @@ private void downloadResource(URL par1URL, File par2File, long par3) throws IOException { - byte[] var5 = new byte[4096]; -- DataInputStream var6 = new DataInputStream(par1URL.openStream()); + byte[] abyte = new byte[4096]; +- DataInputStream datainputstream = new DataInputStream(par1URL.openStream()); + //Add a timeout of 60 seconds to getting the list, MC stalls without sound for some users. + URLConnection con = par1URL.openConnection(); + con.setConnectTimeout(60000); + con.setReadTimeout(60000); -+ DataInputStream var6 = new DataInputStream(con.getInputStream()); - DataOutputStream var7 = new DataOutputStream(new FileOutputStream(par2File)); - boolean var8 = false; ++ DataInputStream datainputstream = new DataInputStream(con.getInputStream()); + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(par2File)); + boolean flag = false; diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index fb28b6763..333e3cc71 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -1,81 +1,69 @@ --- ../src_base/minecraft/net/minecraft/util/WeightedRandomChestContent.java +++ ../src_work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -1,9 +1,14 @@ - package net.minecraft.util; - - import java.util.Random; -+ -+import cpw.mods.fml.common.FMLLog; -+import net.minecraft.inventory.IInventory; +@@ -4,6 +4,9 @@ + import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; - import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.DungeonHooks; ++import cpw.mods.fml.common.FMLLog; public class WeightedRandomChestContent extends WeightedRandomItem { -@@ -35,27 +40,17 @@ - /** - * Generates the Chest contents. - */ -+ @SuppressWarnings("deprecation") - public static void generateChestContents(Random par0Random, WeightedRandomChestContent[] par1ArrayOfWeightedRandomChestContent, TileEntityChest par2TileEntityChest, int par3) - { - for (int var4 = 0; var4 < par3; ++var4) - { - WeightedRandomChestContent var5 = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); -- int var6 = var5.theMinimumChanceToGenerateItem + par0Random.nextInt(var5.theMaximumChanceToGenerateItem - var5.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = var5.generateChestContent(par0Random, par2TileEntityChest); +@@ -42,20 +45,11 @@ + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); + int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + par0Random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -- if (var5.theItemId.getMaxStackSize() >= var6) +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) ++ ItemStack[] stacks = ChestGenHooks.generateStacks(par0Random, weightedrandomchestcontent.theItemId, weightedrandomchestcontent.theMinimumChanceToGenerateItem, weightedrandomchestcontent.theMaximumChanceToGenerateItem); ++ + for (ItemStack item : stacks) { -- ItemStack var7 = var5.theItemId.copy(); -- var7.stackSize = var6; -- par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), var7); +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; +- par2IInventory.setInventorySlotContents(par0Random.nextInt(par2IInventory.getSizeInventory()), itemstack); - } - else - { -- for (int var9 = 0; var9 < var6; ++var9) +- for (int l = 0; l < k; ++l) - { -- ItemStack var8 = var5.theItemId.copy(); -- var8.stackSize = 1; -- par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), var8); +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- par2IInventory.setInventorySlotContents(par0Random.nextInt(par2IInventory.getSizeInventory()), itemstack1); - } -+ par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), item); ++ par2IInventory.setInventorySlotContents(par0Random.nextInt(par2IInventory.getSizeInventory()), item); } } } -@@ -68,22 +63,11 @@ - for (int var4 = 0; var4 < par3; ++var4) +@@ -68,22 +62,11 @@ + for (int j = 0; j < par3; ++j) { - WeightedRandomChestContent var5 = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); -- int var6 = var5.theMinimumChanceToGenerateItem + par0Random.nextInt(var5.theMaximumChanceToGenerateItem - var5.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = var5.generateChestContent(par0Random, par2TileEntityDispenser); + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + par0Random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = ChestGenHooks.generateStacks(par0Random, weightedrandomchestcontent.theItemId, weightedrandomchestcontent.theMinimumChanceToGenerateItem, weightedrandomchestcontent.theMaximumChanceToGenerateItem); -- if (var5.theItemId.getMaxStackSize() >= var6) +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) + for (ItemStack item : stacks) { -- ItemStack var7 = var5.theItemId.copy(); -- var7.stackSize = var6; -- par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), var7); +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; +- par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), itemstack); - } - else - { -- for (int var9 = 0; var9 < var6; ++var9) +- for (int l = 0; l < k; ++l) - { -- ItemStack var8 = var5.theItemId.copy(); -- var8.stackSize = 1; -- par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), var8); +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), itemstack1); - } + par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), item); } } } -@@ -109,4 +93,18 @@ +@@ -109,4 +92,18 @@ - return var2; + return aweightedrandomchestcontent1; } + + // -- Forge hooks diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index 2b7ba413b..b683bb2c4 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -2,13 +2,13 @@ +++ ../src_work/minecraft/net/minecraft/world/ChunkCache.java @@ -99,7 +99,15 @@ { - int var4 = (par1 >> 4) - this.chunkX; - int var5 = (par3 >> 4) - this.chunkZ; -- return this.chunkArray[var4][var5].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); -+ if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) + int l = (par1 >> 4) - this.chunkX; + int i1 = (par3 >> 4) - this.chunkZ; +- return this.chunkArray[l][i1].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); ++ if (l >= 0 && l < this.chunkArray.length && i1 >= 0 && i1 < this.chunkArray[l].length) + { -+ Chunk var6 = this.chunkArray[var4][var5]; -+ return var6 == null ? null : var6.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); ++ Chunk chunk = this.chunkArray[l][i1]; ++ return chunk == null ? null : chunk.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); + } + else + { @@ -17,15 +17,15 @@ } @SideOnly(Side.CLIENT) -@@ -247,7 +255,12 @@ +@@ -150,7 +158,12 @@ { - int var4 = (par1 >> 4) - this.chunkX; - int var5 = (par3 >> 4) - this.chunkZ; -- return this.chunkArray[var4][var5].getBlockMetadata(par1 & 15, par2, par3 & 15); -+ if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) + int l = (par1 >> 4) - this.chunkX; + int i1 = (par3 >> 4) - this.chunkZ; +- return this.chunkArray[l][i1].getBlockMetadata(par1 & 15, par2, par3 & 15); ++ if (l >= 0 && l < this.chunkArray.length && i1 >= 0 && i1 < this.chunkArray[l].length) + { -+ Chunk var6 = this.chunkArray[var4][var5]; -+ return var6 == null ? 0 : var6.getBlockMetadata(par1 & 15, par2, par3 & 15); ++ Chunk chunk = this.chunkArray[l][i1]; ++ return chunk == null ? 0 : chunk.getBlockMetadata(par1 & 15, par2, par3 & 15); + } + return 0; } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index f7dc037b0..8c4cd178b 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/world/Explosion.java +++ ../src_work/minecraft/net/minecraft/world/Explosion.java -@@ -90,7 +90,7 @@ - if (var25 > 0) +@@ -92,7 +92,7 @@ + if (k1 > 0) { - Block var26 = Block.blocksList[var25]; -- float var27 = this.exploder != null ? this.exploder.func_82146_a(this, var26, var22, var23, var24) : var26.getExplosionResistance(this.exploder); -+ float var27 = this.exploder != null ? this.exploder.func_82146_a(this, var26, var22, var23, var24) : var26.getExplosionResistance(this.exploder, worldObj, var22, var23, var24, explosionX, explosionY, explosionZ); - var14 -= (var27 + 0.3F) * var21; + Block block = Block.blocksList[k1]; +- float f3 = this.exploder != null ? this.exploder.func_82146_a(this, this.worldObj, l, i1, j1, block) : block.getExplosionResistance(this.exploder); ++ float f3 = this.exploder != null ? this.exploder.func_82146_a(this, this.worldObj, l, i1, j1, block) : block.getExplosionResistance(this.exploder, worldObj, l, i1, j1, explosionX, explosionY, explosionZ); + f1 -= (f3 + 0.3F) * f2; } diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index d731aa820..fb4624bc3 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -8,49 +8,48 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -@@ -19,6 +21,11 @@ +@@ -19,6 +21,10 @@ import net.minecraft.world.biome.SpawnListEntry; import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event.Result; +import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.entity.living.LivingSpecialSpawnEvent; + public final class SpawnerAnimals { /** The 17x17 area around the player where mobs can spawn */ -@@ -93,6 +100,9 @@ - if ((!var35.getPeacefulCreature() || par2) && (var35.getPeacefulCreature() || par1) && (!var35.getAnimal() || par3) && par0WorldServer.countEntities(var35.getCreatureClass()) <= var35.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256) +@@ -93,6 +99,9 @@ + if ((!enumcreaturetype.getPeacefulCreature() || par2) && (enumcreaturetype.getPeacefulCreature() || par1) && (!enumcreaturetype.getAnimal() || par3) && par0WorldServer.countEntities(enumcreaturetype.getCreatureClass()) <= enumcreaturetype.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256) { - Iterator var37 = eligibleChunksForSpawning.keySet().iterator(); + Iterator iterator = eligibleChunksForSpawning.keySet().iterator(); + ArrayList tmp = new ArrayList(eligibleChunksForSpawning.keySet()); + Collections.shuffle(tmp); -+ var37 = tmp.iterator(); ++ iterator = tmp.iterator(); label110: - while (var37.hasNext()) -@@ -169,7 +179,8 @@ + while (iterator.hasNext()) +@@ -169,7 +178,8 @@ - var39.setLocationAndAngles((double)var24, (double)var25, (double)var26, par0WorldServer.rand.nextFloat() * 360.0F, 0.0F); + entityliving.setLocationAndAngles((double)f, (double)f1, (double)f2, par0WorldServer.rand.nextFloat() * 360.0F, 0.0F); -- if (var39.getCanSpawnHere()) -+ Result canSpawn = ForgeEventFactory.canEntitySpawn(var39, par0WorldServer, var24, var25, var26); -+ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && var39.getCanSpawnHere())) +- if (entityliving.getCanSpawnHere()) ++ Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, par0WorldServer, f, f1, f2); ++ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && entityliving.getCanSpawnHere())) { - ++var16; - par0WorldServer.spawnEntityInWorld(var39); -@@ -221,7 +232,8 @@ + ++j2; + par0WorldServer.spawnEntityInWorld(entityliving); +@@ -221,7 +231,8 @@ else { - int var5 = par1World.getBlockId(par2, par3 - 1, par4); -- return var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); -+ boolean spawnBlock = (Block.blocksList[var5] != null && Block.blocksList[var5].canCreatureSpawn(par0EnumCreatureType, par1World, par2, par3 - 1, par4)); -+ return spawnBlock && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); + int l = par1World.getBlockId(par2, par3 - 1, par4); +- return l != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); ++ boolean spawnBlock = (Block.blocksList[l] != null && Block.blocksList[l].canCreatureSpawn(par0EnumCreatureType, par1World, par2, par3 - 1, par4)); ++ return spawnBlock && l != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); } } -@@ -230,6 +242,11 @@ +@@ -230,6 +241,11 @@ */ private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4) { diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 0df056356..9ec54faf6 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/world/World.java +++ ../src_work/minecraft/net/minecraft/world/World.java -@@ -44,8 +44,30 @@ +@@ -51,8 +51,30 @@ import net.minecraft.world.storage.MapStorage; import net.minecraft.world.storage.WorldInfo; @@ -31,33 +31,34 @@ /** * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately */ -@@ -162,6 +184,11 @@ - * Gets the biome for a given set of x/z coordinates +@@ -163,6 +185,11 @@ */ public BiomeGenBase getBiomeGenForCoords(int par1, int par2) -+ { + { + return provider.getBiomeGenForCoords(par1, par2); + } + + public BiomeGenBase getBiomeGenForCoordsBody(int par1, int par2) - { ++ { if (this.blockExists(par1, 0, par2)) { -@@ -192,7 +219,13 @@ + Chunk chunk = this.getChunkFromBlockCoords(par1, par2); +@@ -191,8 +218,14 @@ this.theProfiler = par5Profiler; this.worldInfo = new WorldInfo(par4WorldSettings, par2Str); this.provider = par3WorldProvider; - this.mapStorage = new MapStorage(par1ISaveHandler); + perWorldStorage = new MapStorage((ISaveHandler)null); + this.field_98181_L = par6ILogAgent; + } + + // Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes + @SideOnly(Side.CLIENT) + protected void finishSetup() + { - VillageCollection var6 = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); + VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); - if (var6 == null) + if (villagecollection == null) @@ -206,7 +239,7 @@ this.villageCollectionObj.func_82566_a(this); } @@ -67,20 +68,20 @@ this.chunkProvider = this.createChunkProvider(); this.calculateInitialSkylight(); this.calculateInitialWeather(); -@@ -220,7 +253,7 @@ +@@ -219,7 +252,7 @@ this.isRemote = false; this.saveHandler = par1ISaveHandler; this.theProfiler = par5Profiler; - this.mapStorage = new MapStorage(par1ISaveHandler); + this.mapStorage = getMapStorage(par1ISaveHandler); + this.field_98181_L = par6ILogAgent; this.worldInfo = par1ISaveHandler.loadWorldInfo(); - if (par4WorldProvider != null) @@ -273,12 +306,20 @@ this.worldInfo.setServerInitialized(true); } -- VillageCollection var6 = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); + if (this instanceof WorldServer) + { + this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, par1ISaveHandler)); @@ -89,9 +90,9 @@ + { + this.perWorldStorage = new MapStorage((ISaveHandler)null); + } -+ VillageCollection var6 = (VillageCollection)perWorldStorage.loadData(VillageCollection.class, "villages"); ++ VillageCollection villagecollection = (VillageCollection)perWorldStorage.loadData(VillageCollection.class, "villages"); - if (var6 == null) + if (villagecollection == null) { this.villageCollectionObj = new VillageCollection(this); - this.mapStorage.setData("villages", this.villageCollectionObj); @@ -119,7 +120,7 @@ } /** -@@ -376,7 +430,8 @@ +@@ -371,7 +425,8 @@ */ public boolean isAirBlock(int par1, int par2, int par3) { @@ -129,17 +130,17 @@ } /** -@@ -385,7 +440,8 @@ +@@ -380,7 +435,8 @@ public boolean blockHasTileEntity(int par1, int par2, int par3) { - int var4 = this.getBlockId(par1, par2, par3); -- return Block.blocksList[var4] != null && Block.blocksList[var4].hasTileEntity(); + int l = this.getBlockId(par1, par2, par3); +- return Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(); + int meta = this.getBlockMetadata(par1, par2, par3); -+ return Block.blocksList[var4] != null && Block.blocksList[var4].hasTileEntity(meta); ++ return Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta); } /** -@@ -1130,7 +1186,7 @@ +@@ -1132,7 +1188,7 @@ */ public boolean isDaytime() { @@ -148,16 +149,16 @@ } /** -@@ -1162,7 +1218,7 @@ - int var12 = this.getBlockMetadata(var8, var9, var10); - Block var13 = Block.blocksList[var11]; +@@ -1164,7 +1220,7 @@ + int l1 = this.getBlockMetadata(l, i1, j1); + Block block = Block.blocksList[k1]; -- if ((!par4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) && var11 > 0 && var13.canCollideCheck(var12, par3)) -+ if (var13 != null && (!par4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) && var11 > 0 && var13.canCollideCheck(var12, par3)) +- if ((!par4 || block == null || block.getCollisionBoundingBoxFromPool(this, l, i1, j1) != null) && k1 > 0 && block.canCollideCheck(l1, par3)) ++ if (block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(this, l, i1, j1) != null) && k1 > 0 && block.canCollideCheck(l1, par3)) { - MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, par1Vec3, par2Vec3); + MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, l, i1, j1, par1Vec3, par2Vec3); -@@ -1362,6 +1418,12 @@ +@@ -1364,6 +1420,12 @@ */ public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4) { @@ -169,8 +170,8 @@ + par2Str = event.name; if (par1Entity != null && par2Str != null) { - for (int var5 = 0; var5 < this.worldAccesses.size(); ++var5) -@@ -1376,6 +1438,12 @@ + for (int i = 0; i < this.worldAccesses.size(); ++i) +@@ -1378,6 +1440,12 @@ */ public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, float par3, float par4) { @@ -182,20 +183,20 @@ + par2Str = event.name; if (par1EntityPlayer != null && par2Str != null) { - for (int var5 = 0; var5 < this.worldAccesses.size(); ++var5) -@@ -1462,6 +1530,11 @@ - EntityPlayer var5 = (EntityPlayer)par1Entity; - this.playerEntities.add(var5); + for (int i = 0; i < this.worldAccesses.size(); ++i) +@@ -1464,6 +1532,11 @@ + EntityPlayer entityplayer = (EntityPlayer)par1Entity; + this.playerEntities.add(entityplayer); this.updateAllPlayersSleepingFlag(); + } + -+ if (!var4 && MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this))) ++ if (!flag && MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this))) + { + return false; } - this.getChunkFromChunkCoords(var2, var3).addEntity(par1Entity); -@@ -1708,6 +1781,12 @@ + this.getChunkFromChunkCoords(i, j).addEntity(par1Entity); +@@ -1710,6 +1783,12 @@ * Calculates the color for the skybox */ public Vec3 getSkyColor(Entity par1Entity, float par2) @@ -206,11 +207,11 @@ + @SideOnly(Side.CLIENT) + public Vec3 getSkyColorBody(Entity par1Entity, float par2) { - float var3 = this.getCelestialAngle(par2); - float var4 = MathHelper.cos(var3 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1803,6 +1882,12 @@ + float f1 = this.getCelestialAngle(par2); + float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; +@@ -1802,6 +1881,12 @@ @SideOnly(Side.CLIENT) - public Vec3 drawClouds(float par1) + public Vec3 getCloudColour(float par1) { + return provider.drawClouds(par1); + } @@ -218,19 +219,19 @@ + @SideOnly(Side.CLIENT) + public Vec3 drawCloudsBody(float par1) + { - float var2 = this.getCelestialAngle(par1); - float var3 = MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + float f1 = this.getCelestialAngle(par1); + float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1881,7 +1966,7 @@ +@@ -1880,7 +1965,7 @@ { - int var5 = var3.getBlockID(par1, var4, par2); + int l = chunk.getBlockID(par1, k, par2); -- if (var5 != 0 && Block.blocksList[var5].blockMaterial.blocksMovement() && Block.blocksList[var5].blockMaterial != Material.leaves) -+ if (var5 != 0 && Block.blocksList[var5].blockMaterial.blocksMovement() && Block.blocksList[var5].blockMaterial != Material.leaves && !Block.blocksList[var5].isBlockFoliage(this, par1, var4, par2)) +- if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement() && Block.blocksList[l].blockMaterial != Material.leaves) ++ if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement() && Block.blocksList[l].blockMaterial != Material.leaves && !Block.blocksList[l].isBlockFoliage(this, par1, k, par2)) { - return var4 + 1; + return k + 1; } -@@ -1896,6 +1981,12 @@ +@@ -1895,6 +1980,12 @@ * How bright are stars in the sky */ public float getStarBrightness(float par1) @@ -241,37 +242,37 @@ + @SideOnly(Side.CLIENT) + public float getStarBrightnessBody(float par1) { - float var2 = this.getCelestialAngle(par1); - float var3 = 1.0F - (MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); -@@ -2040,16 +2131,8 @@ + float f1 = this.getCelestialAngle(par1); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); +@@ -2030,16 +2121,8 @@ - if (var2.isDead) + if (entity.isDead) { -- var3 = var2.chunkCoordX; -- var13 = var2.chunkCoordZ; +- j = entity.chunkCoordX; +- k = entity.chunkCoordZ; - -- if (var2.addedToChunk && this.chunkExists(var3, var13)) +- if (entity.addedToChunk && this.chunkExists(j, k)) - { -- this.getChunkFromChunkCoords(var3, var13).removeEntity(var2); +- this.getChunkFromChunkCoords(j, k).removeEntity(entity); - } - -- this.loadedEntityList.remove(var1--); -- this.releaseEntitySkin(var2); +- this.loadedEntityList.remove(i--); +- this.releaseEntitySkin(entity); + // If it's dead, move it to the unloaded list for removal on the next tick -+ unloadedEntityList.add(var2); ++ unloadedEntityList.add(entity); } this.theProfiler.endSection(); -@@ -2097,7 +2180,7 @@ +@@ -2078,7 +2161,7 @@ - if (var11 != null) + if (chunk != null) { -- var11.removeChunkBlockTileEntity(var9.xCoord & 15, var9.yCoord, var9.zCoord & 15); -+ var11.cleanChunkBlockTileEntity(var9.xCoord & 15, var9.yCoord, var9.zCoord & 15); +- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 15, tileentity.yCoord, tileentity.zCoord & 15); ++ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 15, tileentity.yCoord, tileentity.zCoord & 15); } } } -@@ -2106,6 +2189,10 @@ +@@ -2087,6 +2170,10 @@ if (!this.entityRemoval.isEmpty()) { @@ -282,30 +283,30 @@ this.loadedTileEntityList.removeAll(this.entityRemoval); this.entityRemoval.clear(); } -@@ -2126,18 +2213,18 @@ +@@ -2107,18 +2194,18 @@ { - this.loadedTileEntityList.add(var12); + this.loadedTileEntityList.add(tileentity1); } - + } + else + { - if (this.chunkExists(var12.xCoord >> 4, var12.zCoord >> 4)) + if (this.chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) { - Chunk var15 = this.getChunkFromChunkCoords(var12.xCoord >> 4, var12.zCoord >> 4); + Chunk chunk1 = this.getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); - if (var15 != null) + if (chunk1 != null) { -- var15.setChunkBlockTileEntity(var12.xCoord & 15, var12.yCoord, var12.zCoord & 15, var12); -+ var15.cleanChunkBlockTileEntity(var12.xCoord & 15, var12.yCoord, var12.zCoord & 15); +- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 15, tileentity1.yCoord, tileentity1.zCoord & 15, tileentity1); ++ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 15, tileentity1.yCoord, tileentity1.zCoord & 15); } } - -- this.markBlockForUpdate(var12.xCoord, var12.yCoord, var12.zCoord); +- this.markBlockForUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); } } -@@ -2150,13 +2237,13 @@ +@@ -2131,13 +2218,13 @@ public void addTileEntity(Collection par1Collection) { @@ -326,17 +327,17 @@ } } -@@ -2176,9 +2263,17 @@ +@@ -2157,9 +2244,17 @@ { - int var3 = MathHelper.floor_double(par1Entity.posX); - int var4 = MathHelper.floor_double(par1Entity.posZ); -- byte var5 = 32; + int i = MathHelper.floor_double(par1Entity.posX); + int j = MathHelper.floor_double(par1Entity.posZ); +- byte b0 = 32; - -- if (!par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5)) +- if (!par2 || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0)) + -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(var3 >> 4, var4 >> 4)); -+ byte var5 = isForced ? (byte)0 : 32; -+ boolean canUpdate = !par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5); ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); ++ byte b0 = isForced ? (byte)0 : 32; ++ boolean canUpdate = !par2 || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0); + if (!canUpdate) + { + EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(par1Entity); @@ -347,14 +348,14 @@ { par1Entity.lastTickPosX = par1Entity.posX; par1Entity.lastTickPosY = par1Entity.posY; -@@ -2411,6 +2506,14 @@ +@@ -2392,6 +2487,14 @@ { return true; } + else + { -+ Block block = Block.blocksList[var11]; -+ if (block != null && block.isBlockBurning(this, var8, var9, var10)) ++ Block block = Block.blocksList[j2]; ++ if (block != null && block.isBlockBurning(this, k1, l1, i2)) + { + return true; + } @@ -362,7 +363,7 @@ } } } -@@ -2716,25 +2819,21 @@ +@@ -2714,38 +2817,38 @@ */ public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) { @@ -373,18 +374,8 @@ - par4TileEntity.xCoord = par1; - par4TileEntity.yCoord = par2; - par4TileEntity.zCoord = par3; -- this.addedTileEntityList.add(par4TileEntity); -- } -- else -- { -- this.loadedTileEntityList.add(par4TileEntity); -- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); +- Iterator iterator = this.addedTileEntityList.iterator(); - -- if (var5 != null) -- { -- var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); -- } -- } + if (par4TileEntity == null || par4TileEntity.isInvalid()) + { + return; @@ -392,41 +383,69 @@ + + if (par4TileEntity.canUpdate()) + { -+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; -+ dest.add(par4TileEntity); ++ if (scanningTileEntities) ++ { ++ Iterator iterator = addedTileEntityList.iterator(); + while (iterator.hasNext()) + { + TileEntity tileentity1 = (TileEntity)iterator.next(); +- ++ + if (tileentity1.xCoord == par1 && tileentity1.yCoord == par2 && tileentity1.zCoord == par3) + { + tileentity1.invalidate(); + iterator.remove(); + } + } +- +- this.addedTileEntityList.add(par4TileEntity); ++ addedTileEntityList.add(par4TileEntity); + } + else + { +- this.loadedTileEntityList.add(par4TileEntity); +- Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); +- +- if (chunk != null) +- { +- chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); +- } +- } ++ loadedTileEntityList.add(par4TileEntity); ++ } + } + -+ Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4); ++ Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + if (chunk != null) + { + chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); } } -@@ -2743,27 +2842,10 @@ +@@ -2754,27 +2857,10 @@ */ public void removeBlockTileEntity(int par1, int par2, int par3) { -- TileEntity var4 = this.getBlockTileEntity(par1, par2, par3); +- TileEntity tileentity = this.getBlockTileEntity(par1, par2, par3); - -- if (var4 != null && this.scanningTileEntities) +- if (tileentity != null && this.scanningTileEntities) - { -- var4.invalidate(); -- this.addedTileEntityList.remove(var4); +- tileentity.invalidate(); +- this.addedTileEntityList.remove(tileentity); - } - else - { -- if (var4 != null) +- if (tileentity != null) - { -- this.addedTileEntityList.remove(var4); -- this.loadedTileEntityList.remove(var4); +- this.addedTileEntityList.remove(tileentity); +- this.loadedTileEntityList.remove(tileentity); - } - -- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); +- Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); - -- if (var5 != null) +- if (chunk != null) - { -- var5.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); +- chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); - } + Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + if (chunk != null) @@ -435,7 +454,7 @@ } } -@@ -2789,7 +2871,8 @@ +@@ -2800,7 +2886,8 @@ */ public boolean isBlockNormalCube(int par1, int par2, int par3) { @@ -445,26 +464,26 @@ } public boolean func_85174_u(int par1, int par2, int par3) -@@ -2812,8 +2895,7 @@ +@@ -2823,8 +2910,7 @@ */ public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) { -- Block var4 = Block.blocksList[this.getBlockId(par1, par2, par3)]; -- return var4 == null ? false : (var4.blockMaterial.isOpaque() && var4.renderAsNormalBlock() ? true : (var4 instanceof BlockStairs ? (this.getBlockMetadata(par1, par2, par3) & 4) == 4 : (var4 instanceof BlockHalfSlab ? (this.getBlockMetadata(par1, par2, par3) & 8) == 8 : false))); +- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; +- return block == null ? false : (block.blockMaterial.isOpaque() && block.renderAsNormalBlock() ? true : (block instanceof BlockStairs ? (this.getBlockMetadata(par1, par2, par3) & 4) == 4 : (block instanceof BlockHalfSlab ? (this.getBlockMetadata(par1, par2, par3) & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (this.getBlockMetadata(par1, par2, par3) & 7) == 7 : false))))); + return isBlockSolidOnSide(par1, par2, par3, ForgeDirection.UP); } /** -@@ -2829,7 +2911,7 @@ - if (var5 != null && !var5.isEmpty()) +@@ -2840,7 +2926,7 @@ + if (chunk != null && !chunk.isEmpty()) { - Block var6 = Block.blocksList[this.getBlockId(par1, par2, par3)]; -- return var6 == null ? false : var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock(); -+ return var6 == null ? false : isBlockNormalCube(par1, par2, par3); + Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; +- return block == null ? false : block.blockMaterial.isOpaque() && block.renderAsNormalBlock(); ++ return block == null ? false : isBlockNormalCube(par1, par2, par3); } else { -@@ -2860,8 +2942,7 @@ +@@ -2871,8 +2957,7 @@ */ public void setAllowedSpawnTypes(boolean par1, boolean par2) { @@ -474,7 +493,7 @@ } /** -@@ -2877,6 +2958,11 @@ +@@ -2888,6 +2973,11 @@ */ private void calculateInitialWeather() { @@ -486,7 +505,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2892,6 +2978,11 @@ +@@ -2903,6 +2993,11 @@ * Updates all weather states. */ protected void updateWeather() @@ -498,7 +517,7 @@ { if (!this.provider.hasNoSky) { -@@ -2989,12 +3080,14 @@ +@@ -3000,12 +3095,14 @@ public void toggleRain() { @@ -512,9 +531,9 @@ + this.activeChunkSet.addAll(getPersistentChunks().keySet()); + this.theProfiler.startSection("buildList"); - int var1; - EntityPlayer var2; -@@ -3101,6 +3194,11 @@ + int i; + EntityPlayer entityplayer; +@@ -3112,6 +3209,11 @@ */ public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4) { @@ -523,88 +542,89 @@ + + public boolean canBlockFreezeBody(int par1, int par2, int par3, boolean par4) + { - BiomeGenBase var5 = this.getBiomeGenForCoords(par1, par3); - float var6 = var5.getFloatTemperature(); + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); + float f = biomegenbase.getFloatTemperature(); -@@ -3158,6 +3256,11 @@ - * Tests whether or not snow can be placed at a given location +@@ -3170,6 +3272,11 @@ */ public boolean canSnowAt(int par1, int par2, int par3) -+ { + { + return provider.canSnowAt(par1, par2, par3); + } + + public boolean canSnowAtBody(int par1, int par2, int par3) - { - BiomeGenBase var4 = this.getBiomeGenForCoords(par1, par3); - float var5 = var4.getFloatTemperature(); -@@ -3251,7 +3354,7 @@ ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); + float f = biomegenbase.getFloatTemperature(); - private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6) - { -- int var7 = Block.lightValue[par5]; -+ int var7 = (par5 == 0 || Block.blocksList[par5] == null ? 0 : Block.blocksList[par5].getLightValue(this, par2, par3, par4)); - int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6; - int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6; - int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6; -@@ -3386,7 +3489,7 @@ - int var21 = var24 + (var18 / 2 + 1) % 3 / 2 * var19; - int var22 = var12 + (var18 / 2 + 2) % 3 / 2 * var19; - var14 = this.getSavedLightValue(par1EnumSkyBlock, var20, var21, var22); -- int var23 = Block.lightOpacity[this.getBlockId(var20, var21, var22)]; -+ int var23 = this.getBlockLightOpacity(var20, var21, var22); - - if (var23 == 0) - { -@@ -3417,7 +3520,7 @@ - var12 = (var9 >> 12 & 63) - 32 + par4; - var13 = this.getSavedLightValue(par1EnumSkyBlock, var10, var24, var12); - var14 = this.getBlockId(var10, var24, var12); -- var15 = Block.lightOpacity[var14]; -+ var15 = this.getBlockLightOpacity(var10, var24, var12); - - if (var15 == 0) - { -@@ -3519,10 +3622,10 @@ - public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB) - { - this.entitiesWithinAABBExcludingEntity.clear(); -- int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D); -- int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D); -- int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D); -- int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D); -+ int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - - for (int var7 = var3; var7 <= var4; ++var7) +@@ -3213,10 +3320,12 @@ + else { -@@ -3548,10 +3651,10 @@ + int l = this.getBlockId(par1, par2, par3); +- int i1 = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : Block.lightValue[l]; +- int j1 = Block.lightOpacity[l]; +- +- if (j1 >= 15 && Block.lightValue[l] > 0) ++ Block block = Block.blocksList[l]; ++ int blockLight = (block == null ? 0 : block.getLightValue(this, par1, par2, par3)); ++ int i1 = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : blockLight; ++ int j1 = (block == null ? 0 : block.getLightOpacity(this, par1, par2, par3)); ++ ++ if (j1 >= 15 && blockLight > 0) + { + j1 = 1; + } +@@ -3312,7 +3421,9 @@ + int j4 = i2 + Facing.offsetsXForSide[i4]; + int k4 = j2 + Facing.offsetsYForSide[i4]; + int l4 = k2 + Facing.offsetsZForSide[i4]; +- int i5 = Math.max(1, Block.lightOpacity[this.getBlockId(j4, k4, l4)]); ++ Block block = Block.blocksList[getBlockId(j4, k4, l4)]; ++ int blockOpacity = (block == null ? 0 : block.getLightOpacity(this, j4, k4, l4)); ++ int i5 = Math.max(1, blockOpacity); + i3 = this.getSavedLightValue(par1EnumSkyBlock, j4, k4, l4); + + if (i3 == l2 - i5 && i1 < this.lightUpdateBlockList.length) +@@ -3415,10 +3526,10 @@ + public List func_94576_a(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) + { + ArrayList arraylist = new ArrayList(); +- int i = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + + for (int i1 = i; i1 <= j; ++i1) + { +@@ -3444,10 +3555,10 @@ public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { -- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D); -- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D); -- int var6 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D); -- int var7 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D); -+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int var7 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - ArrayList var8 = new ArrayList(); +- int i = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + ArrayList arraylist = new ArrayList(); - for (int var9 = var4; var9 <= var5; ++var9) -@@ -3644,11 +3747,14 @@ + for (int i1 = i; i1 <= j; ++i1) +@@ -3540,11 +3651,14 @@ */ public void addLoadedEntities(List par1List) { - this.loadedEntityList.addAll(par1List); - - for (int var2 = 0; var2 < par1List.size(); ++var2) + for (int i = 0; i < par1List.size(); ++i) { -- this.obtainEntitySkin((Entity)par1List.get(var2)); -+ Entity entity = (Entity)par1List.get(var2); +- this.obtainEntitySkin((Entity)par1List.get(i)); ++ Entity entity = (Entity)par1List.get(i); + if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this))) + { + loadedEntityList.add(entity); @@ -613,19 +633,19 @@ } } -@@ -3682,6 +3788,11 @@ +@@ -3578,6 +3692,11 @@ else { - if (var9 != null && (var9 == Block.waterMoving || var9 == Block.waterStill || var9 == Block.lavaMoving || var9 == Block.lavaStill || var9 == Block.fire || var9.blockMaterial.isReplaceable())) + if (block != null && (block == Block.waterMoving || block == Block.waterStill || block == Block.lavaMoving || block == Block.lavaStill || block == Block.fire || block.blockMaterial.isReplaceable())) + { -+ var9 = null; ++ block = null; + } + -+ if (var9 != null && var9.isBlockReplaceable(this, par2, par3, par4)) ++ if (block != null && block.isBlockReplaceable(this, par2, par3, par4)) { - var9 = null; + block = null; } -@@ -3899,7 +4010,7 @@ +@@ -3866,7 +3985,7 @@ */ public long getSeed() { @@ -634,7 +654,7 @@ } public long getTotalWorldTime() -@@ -3909,7 +4020,7 @@ +@@ -3876,7 +3995,7 @@ public long getWorldTime() { @@ -643,7 +663,7 @@ } /** -@@ -3917,7 +4028,7 @@ +@@ -3884,7 +4003,7 @@ */ public void setWorldTime(long par1) { @@ -652,7 +672,7 @@ } /** -@@ -3925,13 +4036,13 @@ +@@ -3892,13 +4011,13 @@ */ public ChunkCoordinates getSpawnPoint() { @@ -668,7 +688,7 @@ } @SideOnly(Side.CLIENT) -@@ -3955,7 +4066,10 @@ +@@ -3922,7 +4041,10 @@ if (!this.loadedEntityList.contains(par1Entity)) { @@ -680,7 +700,7 @@ } } -@@ -3963,6 +4077,11 @@ +@@ -3930,6 +4052,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -692,17 +712,17 @@ { return true; } -@@ -4083,8 +4202,7 @@ +@@ -4050,8 +4177,7 @@ */ public boolean isBlockHighHumidity(int par1, int par2, int par3) { -- BiomeGenBase var4 = this.getBiomeGenForCoords(par1, par3); -- return var4.isHighHumidity(); +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); +- return biomegenbase.isHighHumidity(); + return provider.isBlockHighHumidity(par1, par2, par3); } /** -@@ -4159,7 +4277,7 @@ +@@ -4126,7 +4252,7 @@ */ public int getHeight() { @@ -711,7 +731,7 @@ } /** -@@ -4167,7 +4285,7 @@ +@@ -4134,7 +4260,7 @@ */ public int getActualHeight() { @@ -720,7 +740,7 @@ } public IUpdatePlayerListBox func_82735_a(EntityMinecart par1EntityMinecart) -@@ -4210,7 +4328,7 @@ +@@ -4177,7 +4303,7 @@ */ public double getHorizon() { @@ -729,10 +749,10 @@ } /** -@@ -4271,4 +4389,75 @@ - - @SideOnly(Side.CLIENT) - public void func_92088_a(double par1, double par3, double par5, double par7, double par9, double par11, NBTTagCompound par13NBTTagCompound) {} +@@ -4280,4 +4406,98 @@ + { + return this.field_98181_L; + } + + /** + * Adds a single TileEntity to the world. @@ -780,8 +800,8 @@ + return _default; + } + -+ Chunk var5 = this.chunkProvider.provideChunk(x >> 4, z >> 4); -+ if (var5 == null || var5.isEmpty()) ++ Chunk chunk = this.chunkProvider.provideChunk(x >> 4, z >> 4); ++ if (chunk == null || chunk.isEmpty()) + { + return _default; + } @@ -803,5 +823,28 @@ + public ImmutableSetMultimap getPersistentChunks() + { + return ForgeChunkManager.getPersistentChunksFor(this); ++ } ++ ++ /** ++ * Readded as it was removed, very useful helper function ++ * ++ * @param x X position ++ * @param y Y Position ++ * @param z Z Position ++ * @return The blocks light opacity ++ */ ++ public int getBlockLightOpacity(int x, int y, int z) ++ { ++ if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) ++ { ++ return 0; ++ } ++ ++ if (y < 0 || y >= 256) ++ { ++ return 0; ++ } ++ ++ return getChunkFromChunkCoords(x >> 4, z >> 4).getBlockLightOpacity(x & 15, y, z & 15); + } } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 5c2eafad4..3131361df 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -24,7 +24,7 @@ public abstract class WorldProvider { -@@ -198,7 +205,7 @@ +@@ -197,7 +204,7 @@ public static WorldProvider getProviderForDimension(int par0) { @@ -33,7 +33,7 @@ } @SideOnly(Side.CLIENT) -@@ -267,4 +274,277 @@ +@@ -266,4 +273,277 @@ * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". */ public abstract String getDimensionName(); @@ -140,7 +140,7 @@ + + public ChunkCoordinates getRandomizedSpawnPoint() + { -+ ChunkCoordinates var5 = new ChunkCoordinates(this.worldObj.getSpawnPoint()); ++ ChunkCoordinates chunkcoordinates = new ChunkCoordinates(this.worldObj.getSpawnPoint()); + + boolean isAdventure = worldObj.getWorldInfo().getGameType() == EnumGameType.ADVENTURE; + int spawnFuzz = terrainType.getSpawnFuzz(); @@ -148,12 +148,12 @@ + + if (!hasNoSky && !isAdventure) + { -+ var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; -+ var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; -+ var5.posY = this.worldObj.getTopSolidOrLiquidBlock(var5.posX, var5.posZ); ++ chunkcoordinates.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; ++ chunkcoordinates.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf; ++ chunkcoordinates.posY = this.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ); + } + -+ return var5; ++ return chunkcoordinates; + } + + /** diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 1272e9a66..04df23f9e 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; -@@ -45,11 +47,18 @@ +@@ -47,11 +49,19 @@ import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; @@ -24,11 +24,12 @@ +import static net.minecraftforge.common.ChestGenHooks.*; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.world.WorldEvent; public class WorldServer extends World { -@@ -85,6 +94,10 @@ +@@ -88,6 +98,10 @@ /** An IntHashMap of entity IDs (integers) to their Entity objects. */ private IntHashMap entityIdMap; @@ -36,18 +37,18 @@ + protected Set doneChunks = new HashSet(); + public List customTeleporters = new ArrayList(); + - public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, Profiler par6Profiler) + public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, Profiler par6Profiler, ILogAgent par7ILogAgent) { - super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4), par6Profiler); -@@ -108,6 +121,7 @@ - } + super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4), par6Profiler, par7ILogAgent); +@@ -122,6 +136,7 @@ - this.field_85177_Q = new Teleporter(this); + scoreboardsavedata.func_96499_a(this.field_96442_D); + ((ServerScoreboard)this.field_96442_D).func_96547_a(scoreboardsavedata); + DimensionManager.setWorld(par4, this); } /** -@@ -171,6 +185,10 @@ +@@ -184,6 +199,10 @@ this.villageSiegeObj.tick(); this.theProfiler.endStartSection("portalForcer"); this.field_85177_Q.func_85189_a(this.getTotalWorldTime()); @@ -58,7 +59,15 @@ this.theProfiler.endSection(); this.sendAndApplyBlockEvents(); } -@@ -224,10 +242,7 @@ +@@ -194,6 +213,7 @@ + public SpawnListEntry spawnRandomCreature(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + List list = this.getChunkProvider().getPossibleCreatures(par1EnumCreatureType, par2, par3, par4); ++ list = ForgeEventFactory.getPotentialSpawns(this, par1EnumCreatureType, par2, par3, par4, list); + return list != null && !list.isEmpty() ? (SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + +@@ -237,10 +257,7 @@ private void resetRainAndThunder() { @@ -70,10 +79,10 @@ } public boolean areAllPlayersAsleep() -@@ -298,6 +313,14 @@ - int var1 = 0; - int var2 = 0; - Iterator var3 = this.activeChunkSet.iterator(); +@@ -311,6 +328,14 @@ + int i = 0; + int j = 0; + Iterator iterator = this.activeChunkSet.iterator(); + + doneChunks.retainAll(activeChunkSet); + if (doneChunks.size() == activeChunkSet.size()) @@ -83,49 +92,49 @@ + + final long startTime = System.nanoTime(); - while (var3.hasNext()) + while (iterator.hasNext()) { -@@ -308,14 +331,18 @@ - Chunk var7 = this.getChunkFromChunkCoords(var4.chunkXPos, var4.chunkZPos); - this.moodSoundAndLightCheck(var5, var6, var7); +@@ -321,14 +346,18 @@ + Chunk chunk = this.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos); + this.moodSoundAndLightCheck(k, l, chunk); this.theProfiler.endStartSection("tickChunk"); -- var7.updateSkylight(); +- chunk.updateSkylight(); + //Limits and evenly distributes the lighting update time -+ if (System.nanoTime() - startTime <= 4000000 && doneChunks.add(var4)) ++ if (System.nanoTime() - startTime <= 4000000 && doneChunks.add(chunkcoordintpair)) + { -+ var7.updateSkylight(); ++ chunk.updateSkylight(); + } this.theProfiler.endStartSection("thunder"); - int var8; - int var9; - int var10; - int var11; + int i1; + int j1; + int k1; + int l1; - if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) -+ if (provider.canDoLightning(var7) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) ++ if (provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) { this.updateLCG = this.updateLCG * 3 + 1013904223; - var8 = this.updateLCG >> 2; -@@ -332,7 +359,7 @@ + i1 = this.updateLCG >> 2; +@@ -345,7 +374,7 @@ this.theProfiler.endStartSection("iceandsnow"); - int var13; + int i2; - if (this.rand.nextInt(16) == 0) -+ if (provider.canDoRainSnowIce(var7) && this.rand.nextInt(16) == 0) ++ if (provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) { this.updateLCG = this.updateLCG * 3 + 1013904223; - var8 = this.updateLCG >> 2; -@@ -411,7 +438,8 @@ + i1 = this.updateLCG >> 2; +@@ -430,6 +459,9 @@ public void func_82740_a(int par1, int par2, int par3, int par4, int par5, int par6) { - NextTickListEntry var7 = new NextTickListEntry(par1, par2, par3, par4); -- byte var8 = 8; -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(var7.xCoord >> 4, var7.zCoord >> 4)); -+ byte var8 = isForced ? (byte)0 : 8; + NextTickListEntry nextticklistentry = new NextTickListEntry(par1, par2, par3, par4); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + byte b0 = 0; if (this.scheduledUpdatesAreImmediate && par4 > 0) - { -@@ -473,7 +501,7 @@ +@@ -493,7 +525,7 @@ */ public void updateEntities() { @@ -134,27 +143,27 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -525,7 +553,8 @@ +@@ -559,6 +591,9 @@ + { + nextticklistentry = (NextTickListEntry)iterator.next(); + iterator.remove(); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + byte b0 = 0; - this.pendingTickListEntries.remove(var4); - this.field_73064_N.remove(var4); -- byte var5 = 8; -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(var4.xCoord >> 4, var4.zCoord >> 4)); -+ byte var5 = isForced ? (byte)0 : 8; - - if (this.checkChunksExist(var4.xCoord - var5, var4.yCoord - var5, var4.zCoord - var5, var4.xCoord + var5, var4.yCoord + var5, var4.zCoord + var5)) - { -@@ -644,16 +673,28 @@ + if (this.checkChunksExist(nextticklistentry.xCoord - b0, nextticklistentry.yCoord - b0, nextticklistentry.zCoord - b0, nextticklistentry.xCoord + b0, nextticklistentry.yCoord + b0, nextticklistentry.zCoord + b0)) +@@ -702,16 +737,28 @@ { - ArrayList var7 = new ArrayList(); + ArrayList arraylist = new ArrayList(); -- for (int var8 = 0; var8 < this.loadedTileEntityList.size(); ++var8) +- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) - { -- TileEntity var9 = (TileEntity)this.loadedTileEntityList.get(var8); +- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); - -- if (var9.xCoord >= par1 && var9.yCoord >= par2 && var9.zCoord >= par3 && var9.xCoord < par4 && var9.yCoord < par5 && var9.zCoord < par6) +- if (tileentity.xCoord >= par1 && tileentity.yCoord >= par2 && tileentity.zCoord >= par3 && tileentity.xCoord < par4 && tileentity.yCoord < par5 && tileentity.zCoord < par6) - { -- var7.add(var9); +- arraylist.add(tileentity); - } - } - @@ -173,17 +182,17 @@ + if (entity.xCoord >= par1 && entity.yCoord >= par2 && entity.zCoord >= par3 && + entity.xCoord <= par4 && entity.yCoord <= par5 && entity.zCoord <= par6) + { -+ var7.add(entity); ++ arraylist.add(entity); + } + } + } + } + } + } - return var7; + return arraylist; } -@@ -661,6 +702,11 @@ +@@ -719,6 +766,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -193,27 +202,18 @@ + + public boolean canMineBlockBody(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) { - int var5 = MathHelper.abs_int(par2 - this.worldInfo.getSpawnX()); - int var6 = MathHelper.abs_int(par4 - this.worldInfo.getSpawnZ()); -@@ -670,7 +716,7 @@ - var6 = var5; - } - -- return var6 > 16 || this.mcServer.getConfigurationManager().areCommandsAllowed(par1EntityPlayer.username) || this.mcServer.isSinglePlayer(); -+ return var6 > mcServer.getSpawnProtectionSize() || this.mcServer.getConfigurationManager().areCommandsAllowed(par1EntityPlayer.username) || this.mcServer.isSinglePlayer(); + return !this.mcServer.func_96290_a(this, par2, par3, par4, par1EntityPlayer); } - - protected void initialize(WorldSettings par1WorldSettings) -@@ -753,7 +799,7 @@ +@@ -803,7 +855,7 @@ */ protected void createBonusChest() { -- WorldGeneratorBonusChest var1 = new WorldGeneratorBonusChest(bonusChestContent, 10); -+ WorldGeneratorBonusChest var1 = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand)); +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand)); - for (int var2 = 0; var2 < 10; ++var2) + for (int i = 0; i < 10; ++i) { -@@ -796,6 +842,7 @@ +@@ -846,6 +898,7 @@ } this.chunkProvider.saveChunks(par1, par2IProgressUpdate); @@ -221,15 +221,15 @@ } } -@@ -807,6 +854,7 @@ +@@ -857,6 +910,7 @@ this.checkSessionLock(); - this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getTagsFromLastWrite()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); this.mapStorage.saveAllData(); + this.perWorldStorage.saveAllData(); } /** -@@ -1029,4 +1077,9 @@ +@@ -1070,4 +1124,9 @@ { return this.field_85177_Q; } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index befd02c9e..8040a7734 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -10,7 +10,7 @@ import net.minecraft.world.*; import net.minecraft.world.gen.*; import net.minecraft.world.biome.*; -@@ -224,4 +227,36 @@ +@@ -224,4 +227,37 @@ * Called when 'Create New World' button is pressed before starting game */ public void onGUICreateWorldPress() { } @@ -31,10 +31,11 @@ + * @param guiCreateWorld the createworld GUI + */ + @SideOnly(Side.CLIENT) -+ public void onCustomizeButton(Minecraft instance, GuiCreateWorld guiCreateWorld) { ++ public void onCustomizeButton(Minecraft instance, GuiCreateWorld guiCreateWorld) ++ { + if (this == FLAT) + { -+ instance.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_82290_a)); ++ instance.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.generatorOptionsToUse)); + } + } + diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index c8ea52f19..9a3e8e58b 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -20,101 +20,101 @@ + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); + + this.generateOres(); - int var1; - int var2; - int var3; + int i; + int j; + int k; -- for (var1 = 0; var1 < this.sandPerChunk2; ++var1) +- for (i = 0; i < this.sandPerChunk2; ++i) + boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND); -+ for (var1 = 0; doGen && var1 < this.sandPerChunk2; ++var1) ++ for (i = 0; doGen && i < this.sandPerChunk2; ++i) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); } -- for (var1 = 0; var1 < this.clayPerChunk; ++var1) +- for (i = 0; i < this.clayPerChunk; ++i) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CLAY); -+ for (var1 = 0; doGen && var1 < this.clayPerChunk; ++var1) ++ for (i = 0; doGen && i < this.clayPerChunk; ++i) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.clayGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.clayGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); } -- for (var1 = 0; var1 < this.sandPerChunk; ++var1) +- for (i = 0; i < this.sandPerChunk; ++i) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND_PASS2); -+ for (var1 = 0; doGen && var1 < this.sandPerChunk; ++var1) ++ for (i = 0; doGen && i < this.sandPerChunk; ++i) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; @@ -241,7 +251,8 @@ - int var4; + int l; -- for (var2 = 0; var2 < var1; ++var2) +- for (j = 0; j < i; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, TREE); -+ for (var2 = 0; doGen && var2 < var1; ++var2) ++ for (j = 0; doGen && j < i; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; @@ -250,7 +261,8 @@ - var5.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); + worldgenerator.generate(this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l); } -- for (var2 = 0; var2 < this.bigMushroomsPerChunk; ++var2) +- for (j = 0; j < this.bigMushroomsPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, BIG_SHROOM); -+ for (var2 = 0; doGen && var2 < this.bigMushroomsPerChunk; ++var2) ++ for (j = 0; doGen && j < this.bigMushroomsPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; @@ -259,7 +271,8 @@ - int var7; + int i1; -- for (var2 = 0; var2 < this.flowersPerChunk; ++var2) +- for (j = 0; j < this.flowersPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, FLOWERS); -+ for (var2 = 0; doGen && var2 < this.flowersPerChunk; ++var2) ++ for (j = 0; doGen && j < this.flowersPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(128); @@ -275,7 +288,8 @@ } } -- for (var2 = 0; var2 < this.grassPerChunk; ++var2) +- for (j = 0; j < this.grassPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, GRASS); -+ for (var2 = 0; doGen && var2 < this.grassPerChunk; ++var2) ++ for (j = 0; doGen && j < this.grassPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(128); @@ -284,7 +298,8 @@ - var6.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + worldgenerator1.generate(this.currentWorld, this.randomGenerator, k, l, i1); } -- for (var2 = 0; var2 < this.deadBushPerChunk; ++var2) +- for (j = 0; j < this.deadBushPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, DEAD_BUSH); -+ for (var2 = 0; doGen && var2 < this.deadBushPerChunk; ++var2) ++ for (j = 0; doGen && j < this.deadBushPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(128); @@ -292,7 +307,8 @@ - (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, k, l, i1); } -- for (var2 = 0; var2 < this.waterlilyPerChunk; ++var2) +- for (j = 0; j < this.waterlilyPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LILYPAD); -+ for (var2 = 0; doGen && var2 < this.waterlilyPerChunk; ++var2) ++ for (j = 0; doGen && j < this.waterlilyPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; @@ -305,7 +321,8 @@ - this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); + this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } -- for (var2 = 0; var2 < this.mushroomsPerChunk; ++var2) +- for (j = 0; j < this.mushroomsPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SHROOM); -+ for (var2 = 0; doGen && var2 < this.mushroomsPerChunk; ++var2) ++ for (j = 0; doGen && j < this.mushroomsPerChunk; ++j) { if (this.randomGenerator.nextInt(4) == 0) { @@ -125,68 +125,68 @@ - if (this.randomGenerator.nextInt(4) == 0) + if (doGen && this.randomGenerator.nextInt(4) == 0) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(128); @@ -332,7 +349,7 @@ - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, k, l); } - if (this.randomGenerator.nextInt(8) == 0) + if (doGen && this.randomGenerator.nextInt(8) == 0) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(128); @@ -340,7 +357,8 @@ - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, k, l); } -- for (var2 = 0; var2 < this.reedsPerChunk; ++var2) +- for (j = 0; j < this.reedsPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, REED); -+ for (var2 = 0; doGen && var2 < this.reedsPerChunk; ++var2) ++ for (j = 0; doGen && j < this.reedsPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; @@ -348,7 +366,7 @@ - this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } -- for (var2 = 0; var2 < 10; ++var2) -+ for (var2 = 0; doGen && var2 < 10; ++var2) +- for (j = 0; j < 10; ++j) ++ for (j = 0; doGen && j < 10; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(128); @@ -356,7 +374,8 @@ - this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, l, i1); } - if (this.randomGenerator.nextInt(32) == 0) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, PUMPKIN); + if (doGen && this.randomGenerator.nextInt(32) == 0) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(128); @@ -364,7 +383,8 @@ - (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, var2, var3, var4); + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, k, l); } -- for (var2 = 0; var2 < this.cactiPerChunk; ++var2) +- for (j = 0; j < this.cactiPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CACTUS); -+ for (var2 = 0; doGen && var2 < this.cactiPerChunk; ++var2) ++ for (j = 0; doGen && j < this.cactiPerChunk; ++j) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(128); @@ -372,7 +392,8 @@ - this.cactusGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, l, i1); } - if (this.generateLakes) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LAKE); + if (doGen && this.generateLakes) { - for (var2 = 0; var2 < 50; ++var2) + for (j = 0; j < 50; ++j) { @@ -390,6 +411,8 @@ - (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, k, l, i1); } } + diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index c6dd1236b..bfb364158 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -23,19 +23,19 @@ /** @@ -372,7 +375,7 @@ { - double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); - double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerGrass.getGrassColor(var1, var3); -+ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(var1, var3)); + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerGrass.getGrassColor(d0, d1); ++ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); } @SideOnly(Side.CLIENT) @@ -384,6 +387,38 @@ { - double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); - double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerFoliage.getFoliageColor(var1, var3); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(var1, var3)); + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerFoliage.getFoliageColor(d0, d1); ++ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); + } + + public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch index e4025b186..27d2b1ee4 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -39,10 +39,10 @@ public WorldChunkManager(long par1, WorldType par3WorldType) { this(); - GenLayer[] var4 = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType); -+ var4 = getModdedBiomeGenerators(par3WorldType, par1, var4); - this.genBiomes = var4[0]; - this.biomeIndexLayer = var4[1]; + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType); ++ agenlayer = getModdedBiomeGenerators(par3WorldType, par1, agenlayer); + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; } @@ -264,4 +265,11 @@ { diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index de0af20b6..5903c5cb2 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -11,18 +11,18 @@ public class Chunk { /** -@@ -139,7 +143,9 @@ +@@ -144,7 +148,9 @@ { - for (int var8 = 0; var8 < var5; ++var8) + for (int j1 = 0; j1 < k; ++j1) { -- byte var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8]; +- byte b0 = par2ArrayOfByte[l << 11 | i1 << 7 | j1]; + /* FORGE: The following change, a cast from unsigned byte to int, + * fixes a vanilla bug when generating new chunks that contain a block ID > 127 */ -+ int var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8] & 0xFF; ++ int b0 = par2ArrayOfByte[l << 11 | i1 << 7 | j1] & 0xFF; - if (var9 != 0) + if (b0 != 0) { -@@ -158,6 +164,90 @@ +@@ -163,6 +169,90 @@ } /** @@ -38,13 +38,13 @@ + public Chunk(World world, byte[] ids, byte[] metadata, int chunkX, int chunkZ) + { + this(world, chunkX, chunkZ); -+ int var5 = ids.length / 256; ++ int k = ids.length / 256; + + for (int x = 0; x < 16; ++x) + { + for (int z = 0; z < 16; ++z) + { -+ for (int y = 0; y < var5; ++y) ++ for (int y = 0; y < k; ++y) + { + int idx = x << 11 | z << 7 | y; + int id = ids[idx] & 0xFF; @@ -52,15 +52,15 @@ + + if (id != 0) + { -+ int var10 = y >> 4; ++ int l = y >> 4; + -+ if (this.storageArrays[var10] == null) ++ if (this.storageArrays[l] == null) + { -+ this.storageArrays[var10] = new ExtendedBlockStorage(var10 << 4, !world.provider.hasNoSky); ++ this.storageArrays[l] = new ExtendedBlockStorage(l << 4, !world.provider.hasNoSky); + } + -+ this.storageArrays[var10].setExtBlockID(x, y & 15, z, id); -+ this.storageArrays[var10].setExtBlockMetadata(x, y & 15, z, meta); ++ this.storageArrays[l].setExtBlockID(x, y & 15, z, id); ++ this.storageArrays[l].setExtBlockMetadata(x, y & 15, z, meta); + } + } + } @@ -113,16 +113,16 @@ * Checks whether the chunk is at the X/Z location specified */ public boolean isAtLocation(int par1, int par2) -@@ -221,7 +311,7 @@ +@@ -226,7 +316,7 @@ { - int var5 = this.getBlockID(var2, var4 - 1, var3); + int i1 = this.getBlockID(j, l - 1, k); -- if (Block.lightOpacity[var5] == 0) -+ if (getBlockLightOpacity(var2, var4 - 1, var3) == 0) +- if (Block.lightOpacity[i1] == 0) ++ if (getBlockLightOpacity(j, l - 1, k) == 0) { - --var4; + --l; continue; -@@ -527,7 +617,10 @@ +@@ -532,7 +622,10 @@ public int getBlockLightOpacity(int par1, int par2, int par3) { @@ -134,7 +134,7 @@ } /** -@@ -535,7 +628,7 @@ +@@ -540,7 +633,7 @@ */ public int getBlockID(int par1, int par2, int par3) { @@ -143,7 +143,7 @@ { return 0; } -@@ -551,7 +644,7 @@ +@@ -556,7 +649,7 @@ */ public int getBlockMetadata(int par1, int par2, int par3) { @@ -152,7 +152,7 @@ { return 0; } -@@ -592,6 +685,11 @@ +@@ -589,6 +682,11 @@ } else { @@ -161,96 +161,96 @@ + return false; + } + - ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4]; - boolean var11 = false; + ExtendedBlockStorage extendedblockstorage = this.storageArrays[par2 >> 4]; + boolean flag = false; -@@ -622,9 +720,13 @@ +@@ -619,9 +717,13 @@ { - Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9); + Block.blocksList[l1].breakBlock(this.worldObj, j2, par2, k2, l1, i2); } -- else if (Block.blocksList[var8] instanceof BlockContainer && var8 != par4) +- else if (Block.blocksList[l1] instanceof ITileEntityProvider && l1 != par4) - { -- this.worldObj.removeBlockTileEntity(var12, par2, var13); -+ else if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(var9)) +- this.worldObj.removeBlockTileEntity(j2, par2, k2); ++ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(i2)) + { -+ TileEntity te = worldObj.getBlockTileEntity(var12, par2, var13); -+ if (te != null && te.shouldRefresh(var8, par4, var9, par5, worldObj, var12, par2, var13)) ++ TileEntity te = worldObj.getBlockTileEntity(j2, par2, k2); ++ if (te != null && te.shouldRefresh(l1, par4, i2, par5, worldObj, j2, par2, k2)) + { -+ this.worldObj.removeBlockTileEntity(var12, par2, var13); ++ this.worldObj.removeBlockTileEntity(j2, par2, k2); + } } } -@@ -642,7 +744,7 @@ +@@ -639,7 +741,7 @@ } else { - if (Block.lightOpacity[par4 & 4095] > 0) + if (getBlockLightOpacity(par1, par2, par3) > 0) { - if (par2 >= var7) + if (par2 >= k1) { -@@ -666,29 +768,21 @@ - Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13); +@@ -663,29 +765,21 @@ + Block.blocksList[par4].onBlockAdded(this.worldObj, j2, par2, k2); } -- if (Block.blocksList[par4] instanceof BlockContainer) +- if (Block.blocksList[par4] instanceof ITileEntityProvider) + if (Block.blocksList[par4] != null && Block.blocksList[par4].hasTileEntity(par5)) { - var14 = this.getChunkBlockTileEntity(par1, par2, par3); + tileentity = this.getChunkBlockTileEntity(par1, par2, par3); - if (var14 == null) + if (tileentity == null) { -- var14 = ((BlockContainer)Block.blocksList[par4]).createNewTileEntity(this.worldObj); -+ var14 = Block.blocksList[par4].createTileEntity(this.worldObj, par5); - this.worldObj.setBlockTileEntity(var12, par2, var13, var14); +- tileentity = ((ITileEntityProvider)Block.blocksList[par4]).createNewTileEntity(this.worldObj); ++ tileentity = Block.blocksList[par4].createTileEntity(this.worldObj, par5); + this.worldObj.setBlockTileEntity(j2, par2, k2, tileentity); } - if (var14 != null) + if (tileentity != null) { - var14.updateContainingBlockInfo(); -+ var14.blockMetadata = par5; + tileentity.updateContainingBlockInfo(); ++ tileentity.blockMetadata = par5; } - } - } -- else if (var8 > 0 && Block.blocksList[var8] instanceof BlockContainer) +- else if (l1 > 0 && Block.blocksList[l1] instanceof ITileEntityProvider) - { -- var14 = this.getChunkBlockTileEntity(par1, par2, par3); +- tileentity = this.getChunkBlockTileEntity(par1, par2, par3); - -- if (var14 != null) +- if (tileentity != null) - { -- var14.updateContainingBlockInfo(); +- tileentity.updateContainingBlockInfo(); } } -@@ -703,7 +797,7 @@ +@@ -700,7 +794,7 @@ */ public boolean setBlockMetadata(int par1, int par2, int par3, int par4) { -- ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4]; -+ ExtendedBlockStorage var5 = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]); +- ExtendedBlockStorage extendedblockstorage = this.storageArrays[par2 >> 4]; ++ ExtendedBlockStorage extendedblockstorage = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]); - if (var5 == null) + if (extendedblockstorage == null) { -@@ -723,7 +817,7 @@ - var5.setExtBlockMetadata(par1, par2 & 15, par3, par4); - int var7 = var5.getExtBlockID(par1, par2 & 15, par3); +@@ -720,7 +814,7 @@ + extendedblockstorage.setExtBlockMetadata(par1, par2 & 15, par3, par4); + int j1 = extendedblockstorage.getExtBlockID(par1, par2 & 15, par3); -- if (var7 > 0 && Block.blocksList[var7] instanceof BlockContainer) -+ if (var7 > 0 && Block.blocksList[var7] != null && Block.blocksList[var7].hasTileEntity(par4)) +- if (j1 > 0 && Block.blocksList[j1] instanceof ITileEntityProvider) ++ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(par4)) { - TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3); + TileEntity tileentity = this.getChunkBlockTileEntity(par1, par2, par3); -@@ -744,7 +838,7 @@ +@@ -741,7 +835,7 @@ */ public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) { -- ExtendedBlockStorage var5 = this.storageArrays[par3 >> 4]; -+ ExtendedBlockStorage var5 = (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0 ? null : storageArrays[par3 >> 4]); - return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? (this.worldObj.provider.hasNoSky ? 0 : var5.getExtSkylightValue(par2, par3 & 15, par4)) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue)); +- ExtendedBlockStorage extendedblockstorage = this.storageArrays[par3 >> 4]; ++ ExtendedBlockStorage extendedblockstorage = (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0 ? null : storageArrays[par3 >> 4]); + return extendedblockstorage == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? (this.worldObj.provider.hasNoSky ? 0 : extendedblockstorage.getExtSkylightValue(par2, par3 & 15, par4)) : (par1EnumSkyBlock == EnumSkyBlock.Block ? extendedblockstorage.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue)); } -@@ -754,6 +848,11 @@ +@@ -751,6 +845,11 @@ */ public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) { @@ -259,73 +259,73 @@ + return; + } + - ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4]; + ExtendedBlockStorage extendedblockstorage = this.storageArrays[par3 >> 4]; - if (var6 == null) -@@ -782,7 +881,7 @@ + if (extendedblockstorage == null) +@@ -779,7 +878,7 @@ */ public int getBlockLightValue(int par1, int par2, int par3, int par4) { -- ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4]; -+ ExtendedBlockStorage var5 = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]); +- ExtendedBlockStorage extendedblockstorage = this.storageArrays[par2 >> 4]; ++ ExtendedBlockStorage extendedblockstorage = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]); - if (var5 == null) + if (extendedblockstorage == null) { -@@ -835,7 +934,7 @@ +@@ -832,7 +931,7 @@ { - var4 = this.entityLists.length - 1; + k = this.entityLists.length - 1; } - + MinecraftForge.EVENT_BUS.post(new EntityEvent.EnteringChunk(par1Entity, this.xPosition, this.zPosition, par1Entity.chunkCoordX, par1Entity.chunkCoordZ)); par1Entity.addedToChunk = true; par1Entity.chunkCoordX = this.xPosition; - par1Entity.chunkCoordY = var4; -@@ -885,33 +984,33 @@ - ChunkPosition var4 = new ChunkPosition(par1, par2, par3); - TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + par1Entity.chunkCoordY = k; +@@ -882,33 +981,32 @@ + ChunkPosition chunkposition = new ChunkPosition(par1, par2, par3); + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition); -+ if (var5 != null && var5.isInvalid()) ++ if (tileentity != null && tileentity.isInvalid()) + { -+ chunkTileEntityMap.remove(var4); -+ var5 = null; ++ chunkTileEntityMap.remove(chunkposition); ++ tileentity = null; + } + - if (var5 == null) + if (tileentity == null) { - int var6 = this.getBlockID(par1, par2, par3); - -- if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity()) + int l = this.getBlockID(par1, par2, par3); +- +- if (l <= 0 || !Block.blocksList[l].hasTileEntity()) + int meta = this.getBlockMetadata(par1, par2, par3); + -+ if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity(meta)) ++ if (l <= 0 || !Block.blocksList[l].hasTileEntity(meta)) { return null; } - if (var5 == null) + if (tileentity == null) { -- var5 = ((BlockContainer)Block.blocksList[var6]).createNewTileEntity(this.worldObj); -+ var5 = Block.blocksList[var6].createTileEntity(this.worldObj, meta); - this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5); +- tileentity = ((ITileEntityProvider)Block.blocksList[l]).createNewTileEntity(this.worldObj); ++ tileentity = Block.blocksList[l].createTileEntity(this.worldObj, meta); + this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, tileentity); } - var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition); } -- if (var5 != null && var5.isInvalid()) +- if (tileentity != null && tileentity.isInvalid()) - { -- this.chunkTileEntityMap.remove(var4); +- this.chunkTileEntityMap.remove(chunkposition); - return null; - } - else - { -- return var5; +- return tileentity; - } -+ return var5; ++ return tileentity; } /** -@@ -926,7 +1025,7 @@ +@@ -923,7 +1021,7 @@ if (this.isChunkLoaded) { @@ -334,79 +334,55 @@ } } -@@ -941,8 +1040,14 @@ +@@ -938,7 +1036,8 @@ par4TileEntity.yCoord = par2; par4TileEntity.zCoord = this.zPosition * 16 + par3; -- if (this.getBlockID(par1, par2, par3) != 0 && Block.blocksList[this.getBlockID(par1, par2, par3)] instanceof BlockContainer) -- { +- if (this.getBlockID(par1, par2, par3) != 0 && Block.blocksList[this.getBlockID(par1, par2, par3)] instanceof ITileEntityProvider) + Block block = Block.blocksList[getBlockID(par1, par2, par3)]; + if (block != null && block.hasTileEntity(getBlockMetadata(par1, par2, par3))) -+ { -+ TileEntity old = (TileEntity)chunkTileEntityMap.get(var5); -+ if (old != null) -+ { -+ old.invalidate(); -+ } - par4TileEntity.validate(); - this.chunkTileEntityMap.put(var5, par4TileEntity); - } -@@ -978,6 +1083,7 @@ { - this.worldObj.addLoadedEntities(this.entityLists[var1]); + if (this.chunkTileEntityMap.containsKey(chunkposition)) + { +@@ -980,6 +1079,7 @@ + { + this.worldObj.addLoadedEntities(this.entityLists[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); } /** -@@ -998,6 +1104,7 @@ +@@ -1000,6 +1100,7 @@ { - this.worldObj.unloadEntities(this.entityLists[var3]); + this.worldObj.unloadEntities(this.entityLists[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); } /** -@@ -1014,17 +1121,25 @@ +@@ -1016,8 +1117,8 @@ */ - public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List) + public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) { -- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); -- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); -+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); +- int i = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - if (var4 < 0) + if (i < 0) { - var4 = 0; - } -+ else if (var4 >= this.entityLists.length) //BugFix: Collision above the world -+ { -+ var4 = this.entityLists.length - 1; -+ } - - if (var5 >= this.entityLists.length) - { - var5 = this.entityLists.length - 1; -+ } -+ else if (var5 < 0) //BugFix: Collision below the world -+ { -+ var5 = 0; - } - - for (int var6 = var4; var6 <= var5; ++var6) -@@ -1062,8 +1177,8 @@ +@@ -1066,8 +1167,8 @@ */ public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) { -- int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); -- int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); -+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); +- int i = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - if (var5 < 0) + if (i < 0) { -@@ -1246,6 +1361,15 @@ +@@ -1250,6 +1351,15 @@ */ public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) { @@ -419,24 +395,22 @@ + tileEntity.getBlockType(); + } + - int var5 = 0; - boolean var6 = !this.worldObj.provider.hasNoSky; - int var7; -@@ -1346,12 +1470,26 @@ + int k = 0; + boolean flag1 = !this.worldObj.provider.hasNoSky; + int l; +@@ -1350,12 +1460,26 @@ } this.generateHeightMap(); -- Iterator var10 = this.chunkTileEntityMap.values().iterator(); +- Iterator iterator = this.chunkTileEntityMap.values().iterator(); - -- while (var10.hasNext()) -- { -- TileEntity var11 = (TileEntity)var10.next(); -- var11.updateContainingBlockInfo(); + + List invalidList = new ArrayList(); + iterator = chunkTileEntityMap.values().iterator(); -+ while (iterator.hasNext()) -+ { + while (iterator.hasNext()) + { +- TileEntity tileentity = (TileEntity)iterator.next(); +- tileentity.updateContainingBlockInfo(); + TileEntity tileEntity = (TileEntity)iterator.next(); + int x = tileEntity.xCoord & 15; + int y = tileEntity.yCoord; @@ -455,7 +429,7 @@ } } -@@ -1460,4 +1598,18 @@ +@@ -1464,4 +1588,18 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index 0f8d40ec5..e401e5b00 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -10,18 +10,18 @@ public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO { @@ -108,6 +110,7 @@ - var5 = this.readChunkFromNBT(par1World, par4NBTTagCompound.getCompoundTag("Level")); + chunk = this.readChunkFromNBT(par1World, par4NBTTagCompound.getCompoundTag("Level")); } -+ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(var5, par4NBTTagCompound)); - return var5; ++ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, par4NBTTagCompound)); + return chunk; } } @@ -123,6 +126,7 @@ - var3.setTag("Level", var4); - this.writeChunkToNBT(par2Chunk, par1World, var4); - this.func_75824_a(par2Chunk.getChunkCoordIntPair(), var3); -+ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(par2Chunk, var3)); + nbttagcompound.setTag("Level", nbttagcompound1); + this.writeChunkToNBT(par2Chunk, par1World, nbttagcompound1); + this.func_75824_a(par2Chunk.getChunkCoordIntPair(), nbttagcompound); ++ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(par2Chunk, nbttagcompound)); } - catch (Exception var5) + catch (Exception exception) { diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch index 5129d51d3..27f2b335e 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +++ ../src_work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java @@ -24,15 +24,9 @@ - File var2 = this.getSaveDirectory(); - File var3; + File file1 = this.getSaveDirectory(); + File file2; - if (par1WorldProvider instanceof WorldProviderHell) + if (par1WorldProvider.getSaveFolder() != null) { -- var3 = new File(var2, "DIM-1"); -- var3.mkdirs(); -- return new AnvilChunkLoader(var3); +- file2 = new File(file1, "DIM-1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); - } - else if (par1WorldProvider instanceof WorldProviderEnd) - { -- var3 = new File(var2, "DIM1"); -+ var3 = new File(var2, par1WorldProvider.getSaveFolder()); - var3.mkdirs(); - return new AnvilChunkLoader(var3); +- file2 = new File(file1, "DIM1"); ++ file2 = new File(file1, par1WorldProvider.getSaveFolder()); + file2.mkdirs(); + return new AnvilChunkLoader(file2); } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 98d911240..16ce34c38 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -36,9 +36,9 @@ + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + - for (int var5 = 0; var5 < 16; ++var5) + for (int k = 0; k < 16; ++k) { - for (int var6 = 0; var6 < 16; ++var6) + for (int l = 0; l < 16; ++l) @@ -201,6 +217,10 @@ */ private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) @@ -57,10 +57,10 @@ + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false)); + - int var4 = par2 * 16; - int var5 = par3 * 16; - BiomeGenBase var6 = this.endWorld.getBiomeGenForCoords(var4 + 16, var5 + 16); - var6.decorate(this.endWorld, this.endWorld.rand, var4, var5); + int k = par2 * 16; + int l = par3 * 16; + BiomeGenBase biomegenbase = this.endWorld.getBiomeGenForCoords(k + 16, l + 16); + biomegenbase.decorate(this.endWorld, this.endWorld.rand, k, l); + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false)); + diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch index ae851325b..9cf69ffd4 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -54,9 +54,9 @@ + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + - byte var5 = 63; - double var6 = 0.03125D; - this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D); + byte b0 = 63; + double d0 = 0.03125D; + this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); @@ -324,6 +353,10 @@ */ private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) @@ -69,60 +69,60 @@ { par1ArrayOfDouble = new double[par5 * par6 * par7]; @@ -492,6 +525,8 @@ - this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed()); - boolean var11 = false; + this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed()); + boolean flag = false; -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, var11)); ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); @@ -504,7 +539,8 @@ - int var13; - int var14; + int l1; + int i2; -- if (!var11 && this.rand.nextInt(4) == 0) -+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, LAKE) && -+ !var11 && this.rand.nextInt(4) == 0) +- if (!flag && this.rand.nextInt(4) == 0) ++ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE) && ++ !flag && this.rand.nextInt(4) == 0) { - var12 = var4 + this.rand.nextInt(16) + 8; - var13 = this.rand.nextInt(128); + k1 = k + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(128); @@ -512,7 +548,8 @@ - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14); + (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2); } -- if (!var11 && this.rand.nextInt(8) == 0) -+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, LAVA) && -+ !var11 && this.rand.nextInt(8) == 0) +- if (!flag && this.rand.nextInt(8) == 0) ++ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && ++ !flag && this.rand.nextInt(8) == 0) { - var12 = var4 + this.rand.nextInt(16) + 8; - var13 = this.rand.nextInt(this.rand.nextInt(120) + 8); + k1 = k + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(this.rand.nextInt(120) + 8); @@ -524,7 +561,8 @@ } } -- for (var12 = 0; var12 < 8; ++var12) -+ boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, DUNGEON); -+ for (var12 = 0; doGen && var12 < 8; ++var12) +- for (k1 = 0; k1 < 8; ++k1) ++ boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON); ++ for (k1 = 0; doGen && k1 < 8; ++k1) { - var13 = var4 + this.rand.nextInt(16) + 8; - var14 = this.rand.nextInt(128); + l1 = k + this.rand.nextInt(16) + 8; + i2 = this.rand.nextInt(128); @@ -541,7 +579,8 @@ - var4 += 8; - var5 += 8; + k += 8; + l += 8; -- for (var12 = 0; var12 < 16; ++var12) -+ doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, ICE); -+ for (var12 = 0; doGen && var12 < 16; ++var12) +- for (k1 = 0; k1 < 16; ++k1) ++ doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE); ++ for (k1 = 0; doGen && k1 < 16; ++k1) { - for (var13 = 0; var13 < 16; ++var13) + for (l1 = 0; l1 < 16; ++l1) { @@ -558,6 +597,8 @@ } } } + -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, var11)); ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); BlockSand.fallInstantly = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch index ee60d7d13..26d1f0ddf 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +++ ../src_work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -18,6 +18,13 @@ - import net.minecraft.world.gen.feature.WorldGenHellLava; +@@ -19,6 +19,13 @@ + import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.structure.MapGenNetherBridge; +import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; @@ -14,7 +14,7 @@ public class ChunkProviderHell implements IChunkProvider { private Random hellRNG; -@@ -58,6 +65,11 @@ +@@ -59,6 +66,11 @@ double[] noiseData3; double[] noiseData4; double[] noiseData5; @@ -26,7 +26,7 @@ public ChunkProviderHell(World par1World, long par2) { -@@ -70,6 +82,16 @@ +@@ -71,6 +83,16 @@ this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); @@ -43,7 +43,7 @@ } /** -@@ -154,6 +176,10 @@ +@@ -155,6 +177,10 @@ */ public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte) { @@ -51,10 +51,10 @@ + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + - byte var4 = 64; - double var5 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var5, var5, 1.0D); -@@ -289,6 +315,9 @@ + byte b0 = 64; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -290,6 +316,9 @@ */ private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { @@ -64,81 +64,81 @@ if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; -@@ -441,6 +470,9 @@ +@@ -442,6 +471,9 @@ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockSand.fallInstantly = true; + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); + - int var4 = par2 * 16; - int var5 = par3 * 16; + int k = par2 * 16; + int l = par3 * 16; this.genNetherBridge.generateStructuresInChunk(this.worldObj, this.hellRNG, par2, par3); -@@ -449,7 +481,8 @@ - int var8; - int var9; +@@ -450,7 +482,8 @@ + int k1; + int l1; -- for (var6 = 0; var6 < 8; ++var6) +- for (i1 = 0; i1 < 8; ++i1) + boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, NETHER_LAVA); -+ for (var6 = 0; doGen && var6 < 8; ++var6) ++ for (i1 = 0; doGen && i1 < 8; ++i1) { - var7 = var4 + this.hellRNG.nextInt(16) + 8; - var8 = this.hellRNG.nextInt(120) + 4; -@@ -460,7 +493,8 @@ - var6 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; - int var10; + j1 = k + this.hellRNG.nextInt(16) + 8; + k1 = this.hellRNG.nextInt(120) + 4; +@@ -461,7 +494,8 @@ + i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; + int i2; -- for (var7 = 0; var7 < var6; ++var7) +- for (j1 = 0; j1 < i1; ++j1) + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, FIRE); -+ for (var7 = 0; doGen && var7 < var6; ++var7) ++ for (j1 = 0; doGen && j1 < i1; ++j1) { - var8 = var4 + this.hellRNG.nextInt(16) + 8; - var9 = this.hellRNG.nextInt(120) + 4; -@@ -470,7 +504,8 @@ + k1 = k + this.hellRNG.nextInt(16) + 8; + l1 = this.hellRNG.nextInt(120) + 4; +@@ -471,7 +505,8 @@ - var6 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); + i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); -- for (var7 = 0; var7 < var6; ++var7) +- for (j1 = 0; j1 < i1; ++j1) + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, GLOWSTONE); -+ for (var7 = 0; doGen && var7 < var6; ++var7) ++ for (j1 = 0; doGen && j1 < i1; ++j1) { - var8 = var4 + this.hellRNG.nextInt(16) + 8; - var9 = this.hellRNG.nextInt(120) + 4; -@@ -478,7 +513,7 @@ - (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + k1 = k + this.hellRNG.nextInt(16) + 8; + l1 = this.hellRNG.nextInt(120) + 4; +@@ -479,7 +514,7 @@ + (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, k1, l1, i2); } -- for (var7 = 0; var7 < 10; ++var7) -+ for (var7 = 0; doGen && var7 < 10; ++var7) +- for (j1 = 0; j1 < 10; ++j1) ++ for (j1 = 0; doGen && j1 < 10; ++j1) { - var8 = var4 + this.hellRNG.nextInt(16) + 8; - var9 = this.hellRNG.nextInt(128); -@@ -486,7 +521,10 @@ - (new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + k1 = k + this.hellRNG.nextInt(16) + 8; + l1 = this.hellRNG.nextInt(128); +@@ -487,7 +522,10 @@ + (new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, k1, l1, i2); } - if (this.hellRNG.nextInt(1) == 0) -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, hellRNG, var4, var5)); ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, hellRNG, k, l)); + -+ doGen = TerrainGen.decorate(worldObj, hellRNG, var4, var5, SHROOM); ++ doGen = TerrainGen.decorate(worldObj, hellRNG, k, l, SHROOM); + if (doGen && this.hellRNG.nextInt(1) == 0) { - var7 = var4 + this.hellRNG.nextInt(16) + 8; - var8 = this.hellRNG.nextInt(128); -@@ -494,7 +532,7 @@ - (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + j1 = k + this.hellRNG.nextInt(16) + 8; + k1 = this.hellRNG.nextInt(128); +@@ -495,7 +533,7 @@ + (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.hellRNG, j1, k1, l1); } - if (this.hellRNG.nextInt(1) == 0) + if (doGen && this.hellRNG.nextInt(1) == 0) { - var7 = var4 + this.hellRNG.nextInt(16) + 8; - var8 = this.hellRNG.nextInt(128); -@@ -502,6 +540,9 @@ - (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + j1 = k + this.hellRNG.nextInt(16) + 8; + k1 = this.hellRNG.nextInt(128); +@@ -522,6 +560,9 @@ + (new WorldGenHellLava(Block.lavaMoving.blockID, true)).generate(this.worldObj, this.hellRNG, l1, i2, j2); } -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, hellRNG, var4, var5)); ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, hellRNG, k, l)); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); + BlockSand.fallInstantly = false; diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index ec8df73f9..fbfb81717 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -17,22 +17,22 @@ - if (this.worldObj.provider.canRespawnHere()) + if (this.worldObj.provider.canRespawnHere() && DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)) { - ChunkCoordinates var3 = this.worldObj.getSpawnPoint(); - int var4 = par1 * 16 + 8 - var3.posX; + ChunkCoordinates chunkcoordinates = this.worldObj.getSpawnPoint(); + int k = par1 * 16 + 8 - chunkcoordinates.posX; @@ -109,7 +112,11 @@ - if (var5 == null) + if (chunk == null) { -- var5 = this.safeLoadChunk(par1, par2); -+ var5 = ForgeChunkManager.fetchDormantChunk(var3, this.worldObj); -+ if (var5 == null) +- chunk = this.safeLoadChunk(par1, par2); ++ chunk = ForgeChunkManager.fetchDormantChunk(k, this.worldObj); ++ if (chunk == null) + { -+ var5 = this.safeLoadChunk(par1, par2); ++ chunk = this.safeLoadChunk(par1, par2); + } - if (var5 == null) + if (chunk == null) { -@@ -306,6 +313,11 @@ +@@ -305,6 +312,11 @@ { if (!this.worldObj.canNotSave) { @@ -41,17 +41,17 @@ + this.chunksToUnload.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); + } + - for (int var1 = 0; var1 < 100; ++var1) + for (int i = 0; i < 100; ++i) { if (!this.chunksToUnload.isEmpty()) -@@ -318,6 +330,11 @@ - this.chunksToUnload.remove(var2); - this.loadedChunkHashMap.remove(var2.longValue()); - this.loadedChunks.remove(var3); -+ ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(var3.xPosition, var3.zPosition), var3); +@@ -317,6 +329,11 @@ + this.chunksToUnload.remove(olong); + this.loadedChunkHashMap.remove(olong.longValue()); + this.loadedChunks.remove(chunk); ++ ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); + if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)) { + DimensionManager.unloadWorld(this.worldObj.provider.dimensionId); -+ return currentChunkProvider.unload100OldestChunks(); ++ return currentChunkProvider.unloadQueuedChunks(); + } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index 6b470cb70..250db9d74 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -2,34 +2,34 @@ +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java @@ -56,7 +56,9 @@ { - var13 = par1World.getBlockId(var11, var9, var12); + i2 = par1World.getBlockId(k1, j1, l1); -- if (var13 != 0 && var13 != Block.leaves.blockID) -+ Block block = Block.blocksList[var13]; +- if (i2 != 0 && i2 != Block.leaves.blockID) ++ Block block = Block.blocksList[i2]; + -+ if (var13 != 0 && block != null && !block.isLeaves(par1World, var11, var9, var12)) ++ if (i2 != 0 && block != null && !block.isLeaves(par1World, k1, j1, l1)) { - var8 = false; + flag = false; } @@ -183,7 +185,9 @@ - var15 = 0; + l2 = 0; } -- if ((var15 != 0 || par4 >= par4 + var7 - 1) && !Block.opaqueCubeLookup[par1World.getBlockId(var13, var11, var14)]) -+ Block block = Block.blocksList[par1World.getBlockId(var13, var11, var14)]; +- if ((l2 != 0 || par4 >= par4 + i1 - 1) && !Block.opaqueCubeLookup[par1World.getBlockId(i2, k1, k2)]) ++ Block block = Block.blocksList[par1World.getBlockId(i2, k1, k2)]; + -+ if ((var15 != 0 || par4 >= par4 + var7 - 1) && (block == null || block.canBeReplacedByLeaves(par1World, var13, var11, var14))) ++ if ((l2 != 0 || par4 >= par4 + i1 - 1) && (block == null || block.canBeReplacedByLeaves(par1World, i2, k1, k2))) { - this.setBlockAndMetadata(par1World, var13, var11, var14, Block.mushroomCapBrown.blockID + var6, var15); + this.setBlockAndMetadata(par1World, i2, k1, k2, Block.mushroomCapBrown.blockID + l, l2); } @@ -195,7 +199,9 @@ { - var12 = par1World.getBlockId(par3, par4 + var11, par5); + l1 = par1World.getBlockId(par3, par4 + k1, par5); -- if (!Block.opaqueCubeLookup[var12]) -+ Block block = Block.blocksList[var12]; +- if (!Block.opaqueCubeLookup[l1]) ++ Block block = Block.blocksList[l1]; + -+ if (block == null || block.canBeReplacedByLeaves(par1World, par3, par4 + var11, par5)) ++ if (block == null || block.canBeReplacedByLeaves(par1World, par3, par4 + k1, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + var11, par5, Block.mushroomCapBrown.blockID + var6, 10); + this.setBlockAndMetadata(par1World, par3, par4 + k1, par5, Block.mushroomCapBrown.blockID + l, 10); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 5380f0c00..dd6518e72 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -14,11 +14,11 @@ public class WorldGenBigTree extends WorldGenerator { @@ -442,7 +445,9 @@ - int[] var2 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; - int var3 = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); + int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; + int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); -- if (var3 != 2 && var3 != 3) -+ Block soil = Block.blocksList[var3]; +- if (i != 2 && i != 3) ++ Block soil = Block.blocksList[i]; + boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling)); + if (!isValidSoil) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch index f4eedf232..592f11deb 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -2,9 +2,9 @@ +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java @@ -18,10 +18,16 @@ { - int var11; + int l; -- for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) +- for (boolean flag = false; ((l = par1World.getBlockId(par3, par4, par5)) == 0 || l == Block.leaves.blockID) && par4 > 0; --par4) + Block block = null; + do { @@ -18,5 +18,5 @@ + par4--; + } while (par4 > 0); - for (int var7 = 0; var7 < 4; ++var7) + for (int i1 = 0; i1 < 4; ++i1) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index 933f45575..91161f8d9 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -16,19 +16,19 @@ { @@ -124,15 +130,8 @@ - if (var16 != null) + if (tileentitychest != null) { -- for (int var17 = 0; var17 < 8; ++var17) +- for (int l2 = 0; l2 < 8; ++l2) - { -- ItemStack var18 = this.pickCheckLootItem(par2Random); +- ItemStack itemstack = this.pickCheckLootItem(par2Random); - -- if (var18 != null) +- if (itemstack != null) - { -- var16.setInventorySlotContents(par2Random.nextInt(var16.getSizeInventory()), var18); +- tileentitychest.setInventorySlotContents(par2Random.nextInt(tileentitychest.getSizeInventory()), itemstack); - } - } + ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); -+ WeightedRandomChestContent.generateChestContents(par2Random, info.getItems(par2Random), var16, info.getCount(par2Random)); ++ WeightedRandomChestContent.generateChestContents(par2Random, info.getItems(par2Random), tileentitychest, info.getCount(par2Random)); } break label210; @@ -36,8 +36,8 @@ */ private ItemStack pickCheckLootItem(Random par1Random) { -- int var2 = par1Random.nextInt(12); -- return var2 == 0 ? new ItemStack(Item.saddle) : (var2 == 1 ? new ItemStack(Item.ingotIron, par1Random.nextInt(4) + 1) : (var2 == 2 ? new ItemStack(Item.bread) : (var2 == 3 ? new ItemStack(Item.wheat, par1Random.nextInt(4) + 1) : (var2 == 4 ? new ItemStack(Item.gunpowder, par1Random.nextInt(4) + 1) : (var2 == 5 ? new ItemStack(Item.silk, par1Random.nextInt(4) + 1) : (var2 == 6 ? new ItemStack(Item.bucketEmpty) : (var2 == 7 && par1Random.nextInt(100) == 0 ? new ItemStack(Item.appleGold) : (var2 == 8 && par1Random.nextInt(2) == 0 ? new ItemStack(Item.redstone, par1Random.nextInt(4) + 1) : (var2 == 9 && par1Random.nextInt(10) == 0 ? new ItemStack(Item.itemsList[Item.record13.itemID + par1Random.nextInt(2)]) : (var2 == 10 ? new ItemStack(Item.dyePowder, 1, 3) : (var2 == 11 ? Item.enchantedBook.func_92109_a(par1Random) : null))))))))))); +- int i = par1Random.nextInt(12); +- return i == 0 ? new ItemStack(Item.saddle) : (i == 1 ? new ItemStack(Item.ingotIron, par1Random.nextInt(4) + 1) : (i == 2 ? new ItemStack(Item.bread) : (i == 3 ? new ItemStack(Item.wheat, par1Random.nextInt(4) + 1) : (i == 4 ? new ItemStack(Item.gunpowder, par1Random.nextInt(4) + 1) : (i == 5 ? new ItemStack(Item.silk, par1Random.nextInt(4) + 1) : (i == 6 ? new ItemStack(Item.bucketEmpty) : (i == 7 && par1Random.nextInt(100) == 0 ? new ItemStack(Item.appleGold) : (i == 8 && par1Random.nextInt(2) == 0 ? new ItemStack(Item.redstone, par1Random.nextInt(4) + 1) : (i == 9 && par1Random.nextInt(10) == 0 ? new ItemStack(Item.itemsList[Item.record13.itemID + par1Random.nextInt(2)]) : (i == 10 ? new ItemStack(Item.dyePowder, 1, 3) : (i == 11 ? Item.enchantedBook.func_92109_a(par1Random) : null))))))))))); + return ChestGenHooks.getOneItem(ChestGenHooks.DUNGEON_CHEST, par1Random); } @@ -46,8 +46,8 @@ */ private String pickMobSpawner(Random par1Random) { -- int var2 = par1Random.nextInt(4); -- return var2 == 0 ? "Skeleton" : (var2 == 1 ? "Zombie" : (var2 == 2 ? "Zombie" : (var2 == 3 ? "Spider" : ""))); +- int i = par1Random.nextInt(4); +- return i == 0 ? "Skeleton" : (i == 1 ? "Zombie" : (i == 2 ? "Zombie" : (i == 3 ? "Spider" : ""))); + return DungeonHooks.getRandomDungeonMob(par1Random); } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch index 89def515e..0e51b276d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -1,10 +1,8 @@ --- ../src_base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -1,8 +1,11 @@ - package net.minecraft.world.gen.feature; +@@ -2,7 +2,9 @@ import java.util.Random; -+ import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; import net.minecraft.world.World; @@ -12,52 +10,51 @@ public class WorldGenForest extends WorldGenerator { -@@ -45,7 +48,9 @@ +@@ -45,7 +47,9 @@ { - var12 = par1World.getBlockId(var10, var8, var11); + l1 = par1World.getBlockId(j1, i1, k1); -- if (var12 != 0 && var12 != Block.leaves.blockID) -+ Block block = Block.blocksList[var12]; +- if (l1 != 0 && l1 != Block.leaves.blockID) ++ Block block = Block.blocksList[l1]; + -+ if (var12 != 0 && (block != null && !block.isLeaves(par1World, var10, var8, var11))) ++ if (l1 != 0 && (block != null && !block.isLeaves(par1World, j1, i1, k1))) { - var7 = false; + flag = false; } -@@ -65,10 +70,12 @@ +@@ -65,10 +69,12 @@ else { - var8 = par1World.getBlockId(par3, par4 - 1, par5); -+ Block soil = Block.blocksList[var8]; + i1 = par1World.getBlockId(par3, par4 - 1, par5); ++ Block soil = Block.blocksList[i1]; + boolean isValidSoil = soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling); -- if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 256 - var6 - 1) -+ if (isValidSoil && par4 < 256 - var6 - 1) +- if ((i1 == Block.grass.blockID || i1 == Block.dirt.blockID) && par4 < 256 - l - 1) ++ if (isValidSoil && par4 < 256 - l - 1) { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); + soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); - int var16; + int i2; - for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) -@@ -84,7 +91,10 @@ - { - int var15 = var14 - par5; - -- if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)]) -+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var14)]; -+ -+ if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var12, var16, var14))) + for (i2 = par4 - 3 + l; i2 <= par4 + l; ++i2) +@@ -87,8 +93,9 @@ + if (Math.abs(j2) != k1 || Math.abs(l2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) { - this.setBlockAndMetadata(par1World, var12, var16, var14, Block.leaves.blockID, 2); - } -@@ -96,7 +106,9 @@ - { - var10 = par1World.getBlockId(par3, par4 + var16, par5); + int i3 = par1World.getBlockId(l1, i2, k2); ++ Block block = Block.blocksList[i3]; -- if (var10 == 0 || var10 == Block.leaves.blockID) -+ Block block = Block.blocksList[var10]; +- if (i3 == 0 || i3 == Block.leaves.blockID) ++ if (block == null || block.canBeReplacedByLeaves(par1World, l1, i2, k2)) + { + this.setBlockAndMetadata(par1World, l1, i2, k2, Block.leaves.blockID, 2); + } +@@ -101,7 +108,9 @@ + { + j1 = par1World.getBlockId(par3, par4 + i2, par5); + +- if (j1 == 0 || j1 == Block.leaves.blockID) ++ Block block = Block.blocksList[j1]; + -+ if (var10 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5)) ++ if (j1 == 0 || block == null || block.isLeaves(par1World, par3, par4 + i2, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 2); + this.setBlockAndMetadata(par1World, par3, par4 + i2, par5, Block.wood.blockID, 2); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 5d46fa309..381ca7541 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -11,100 +11,95 @@ public class WorldGenHugeTrees extends WorldGenerator { -@@ -57,8 +59,13 @@ - if (var8 >= 0 && var8 < 256) +@@ -58,7 +60,12 @@ { - var12 = par1World.getBlockId(var10, var8, var11); -- -- if (var12 != 0 && var12 != Block.leaves.blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != Block.wood.blockID && var12 != Block.sapling.blockID) -+ Block block = Block.blocksList[var12]; -+ -+ if (block != null && -+ !block.isLeaves(par1World, var10, var8, var11) && -+ !block.canSustainPlant(par1World, var10, var8, var11, ForgeDirection.UP, (BlockSapling)Block.sapling) && -+ !block.isWood(par1World, var10, var8, var11) && -+ var12 != Block.sapling.blockID) + l1 = par1World.getBlockId(j1, i1, k1); + +- if (l1 != 0 && l1 != Block.leaves.blockID && l1 != Block.grass.blockID && l1 != Block.dirt.blockID && l1 != Block.wood.blockID && l1 != Block.sapling.blockID) ++ if (l1 != 0 && ++ (Block.blocksList[l1] != null && !Block.blocksList[l1].isLeaves(par1World, j1, i1, k1)) && ++ l1 != Block.grass.blockID && ++ l1 != Block.dirt.blockID && ++ (Block.blocksList[l1] != null && !Block.blocksList[l1].isWood(par1World, j1, i1, k1)) && ++ l1 != Block.sapling.blockID) { - var7 = false; + flag = false; } -@@ -78,13 +85,15 @@ - else +@@ -79,12 +86,15 @@ { - var8 = par1World.getBlockId(par3, par4 - 1, par5); -- -- if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 256 - var6 - 1) + i1 = par1World.getBlockId(par3, par4 - 1, par5); + +- if ((i1 == Block.grass.blockID || i1 == Block.dirt.blockID) && par4 < 256 - l - 1) - { -- par1World.setBlock(par3, par4 - 1, par5, Block.dirt.blockID); -- par1World.setBlock(par3 + 1, par4 - 1, par5, Block.dirt.blockID); -- par1World.setBlock(par3, par4 - 1, par5 + 1, Block.dirt.blockID); -- par1World.setBlock(par3 + 1, par4 - 1, par5 + 1, Block.dirt.blockID); -+ Block soil = Block.blocksList[var8]; +- par1World.setBlockAndMetadataWithNotify(par3, par4 - 1, par5, Block.dirt.blockID, 0, 2); +- par1World.setBlockAndMetadataWithNotify(par3 + 1, par4 - 1, par5, Block.dirt.blockID, 0, 2); +- par1World.setBlockAndMetadataWithNotify(par3, par4 - 1, par5 + 1, Block.dirt.blockID, 0, 2); +- par1World.setBlockAndMetadataWithNotify(par3 + 1, par4 - 1, par5 + 1, Block.dirt.blockID, 0, 2); ++ Block soil = Block.blocksList[i1]; + boolean isValidSoil = soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling); + -+ if (isValidSoil && par4 < 256 - var6 - 1) ++ if (isValidSoil && par4 < 256 - l - 1) + { + onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); + onPlantGrow(par1World, par3 + 1, par4 - 1, par5, par3, par4, par5); + onPlantGrow(par1World, par3, par4 - 1, par5 + 1, par3, par4, par5); + onPlantGrow(par1World, par3 + 1, par4 - 1, par5 + 1, par3, par4, par5); - this.growLeaves(par1World, par3, par5, par4 + var6, 2, par2Random); + this.growLeaves(par1World, par3, par5, par4 + l, 2, par2Random); - for (int var14 = par4 + var6 - 2 - par2Random.nextInt(4); var14 > par4 + var6 / 2; var14 -= 2 + par2Random.nextInt(4)) -@@ -106,7 +115,7 @@ + for (int i2 = par4 + l - 2 - par2Random.nextInt(4); i2 > par4 + l / 2; i2 -= 2 + par2Random.nextInt(4)) +@@ -106,7 +116,7 @@ { - var11 = par1World.getBlockId(par3, par4 + var10, par5); + k1 = par1World.getBlockId(par3, par4 + j1, par5); -- if (var11 == 0 || var11 == Block.leaves.blockID) -+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3, par4 + var10, par5)) +- if (k1 == 0 || k1 == Block.leaves.blockID) ++ if (k1 == 0 || Block.blocksList[k1] == null || Block.blocksList[k1].isLeaves(par1World, par3, par4 + j1, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + var10, par5, Block.wood.blockID, this.woodMetadata); + this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.woodMetadata); -@@ -128,7 +137,7 @@ +@@ -128,7 +138,7 @@ { - var11 = par1World.getBlockId(par3 + 1, par4 + var10, par5); + k1 = par1World.getBlockId(par3 + 1, par4 + j1, par5); -- if (var11 == 0 || var11 == Block.leaves.blockID) -+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3 + 1, par4 + var10, par5)) +- if (k1 == 0 || k1 == Block.leaves.blockID) ++ if (k1 == 0 || Block.blocksList[k1] == null || Block.blocksList[k1].isLeaves(par1World, par3 + 1, par4 + j1, par5)) { - this.setBlockAndMetadata(par1World, par3 + 1, par4 + var10, par5, Block.wood.blockID, this.woodMetadata); + this.setBlockAndMetadata(par1World, par3 + 1, par4 + j1, par5, Block.wood.blockID, this.woodMetadata); -@@ -148,7 +157,7 @@ +@@ -148,7 +158,7 @@ - var11 = par1World.getBlockId(par3 + 1, par4 + var10, par5 + 1); + k1 = par1World.getBlockId(par3 + 1, par4 + j1, par5 + 1); -- if (var11 == 0 || var11 == Block.leaves.blockID) -+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3 + 1, par4 + var10, par5 + 1)) +- if (k1 == 0 || k1 == Block.leaves.blockID) ++ if (k1 == 0 || Block.blocksList[k1] == null || Block.blocksList[k1].isLeaves(par1World, par3 + 1, par4 + j1, par5 + 1)) { - this.setBlockAndMetadata(par1World, par3 + 1, par4 + var10, par5 + 1, Block.wood.blockID, this.woodMetadata); + this.setBlockAndMetadata(par1World, par3 + 1, par4 + j1, par5 + 1, Block.wood.blockID, this.woodMetadata); -@@ -168,7 +177,7 @@ +@@ -168,7 +178,7 @@ - var11 = par1World.getBlockId(par3, par4 + var10, par5 + 1); + k1 = par1World.getBlockId(par3, par4 + j1, par5 + 1); -- if (var11 == 0 || var11 == Block.leaves.blockID) -+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3, par4 + var10, par5 + 1)) +- if (k1 == 0 || k1 == Block.leaves.blockID) ++ if (k1 == 0 || Block.blocksList[k1] == null || Block.blocksList[k1].isLeaves(par1World, par3, par4 + j1, par5 + 1)) { - this.setBlockAndMetadata(par1World, par3, par4 + var10, par5 + 1, Block.wood.blockID, this.woodMetadata); + this.setBlockAndMetadata(par1World, par3, par4 + j1, par5 + 1, Block.wood.blockID, this.woodMetadata); -@@ -219,7 +228,12 @@ - { - int var14 = var13 - par3; - -- if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) && (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) && (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)]) -+ Block block = Block.blocksList[par1World.getBlockId(var11, var8, var13)]; +@@ -222,8 +232,9 @@ + if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (par6Random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1))) + { + int l2 = par1World.getBlockId(l1, i1, j2); +- +- if (l2 == 0 || l2 == Block.leaves.blockID) ++ Block block = Block.blocksList[l2]; + -+ if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) && -+ (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) && -+ (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var11, var8, var13))) - { - this.setBlockAndMetadata(par1World, var11, var8, var13, Block.leaves.blockID, this.leavesMetadata); - } -@@ -227,4 +241,13 @@ ++ if (block == null || block.canBeReplacedByLeaves(par1World, l1, i1, j2)) + { + this.setBlockAndMetadata(par1World, l1, i1, j2, Block.leaves.blockID, this.leavesMetadata); + } +@@ -232,4 +243,13 @@ } } } -+ ++ + private void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) + { + Block block = Block.blocksList[world.getBlockId(x, y, z)]; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index 5ce27701f..494f8a2c4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -8,29 +8,29 @@ /** The number of blocks to generate. */ private int numberOfBlocks; -@@ -17,6 +18,12 @@ - { +@@ -24,6 +25,12 @@ this.minableBlockId = par1; this.numberOfBlocks = par2; + this.field_94523_c = par3; + } + -+ public WorldGenMinable(int id, int meta, int number) ++ public WorldGenMinable(int id, int meta, int number, int target) + { -+ this(id, number); ++ this(id, number, target); + minableBlockMeta = meta; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) -@@ -60,9 +67,10 @@ +@@ -67,9 +74,10 @@ { - double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D); + double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); -- if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == Block.stone.blockID) -+ Block block = Block.blocksList[par1World.getBlockId(var38, var41, var44)]; -+ if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, var38, var41, var44))) +- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(k2, l2, i3) == this.field_94523_c) ++ Block block = Block.blocksList[par1World.getBlockId(k2, l2, i3)]; ++ if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, k2, l2, i3, field_94523_c))) { -- par1World.setBlock(var38, var41, var44, this.minableBlockId); -+ par1World.setBlockAndMetadata(var38, var41, var44, this.minableBlockId, minableBlockMeta); +- par1World.setBlockAndMetadataWithNotify(k2, l2, i3, this.minableBlockId, 0, 2); ++ par1World.setBlockAndMetadataWithNotify(k2, l2, i3, this.minableBlockId, minableBlockMeta, 2); } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index 5135eaa5b..0bdae139e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -2,9 +2,9 @@ +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java @@ -19,10 +19,16 @@ { - int var15; + int l; -- for (boolean var6 = false; ((var15 = par1World.getBlockId(par3, par4, par5)) == 0 || var15 == Block.leaves.blockID) && par4 > 0; --par4) +- for (boolean flag = false; ((l = par1World.getBlockId(par3, par4, par5)) == 0 || l == Block.leaves.blockID) && par4 > 0; --par4) + Block block = null; + do { @@ -18,17 +18,17 @@ + par4--; + } while (par4 > 0); - int var7 = par1World.getBlockId(par3, par4, par5); + int i1 = par1World.getBlockId(par3, par4, par5); @@ -44,7 +50,10 @@ { - int var14 = var13 - par5; + int l2 = k2 - par5; -- if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)]) -+ block = Block.blocksList[par1World.getBlockId(var11, var8, var13)]; +- if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || par2Random.nextInt(2) != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(i2, j1, k2)]) ++ block = Block.blocksList[par1World.getBlockId(i2, j1, k2)]; + -+ if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var11, var8, var13))) ++ if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || par2Random.nextInt(2) != 0) && ++ (block == null || block.canBeReplacedByLeaves(par1World, i2, j1, k2))) { - this.setBlockAndMetadata(par1World, var11, var8, var13, Block.leaves.blockID, this.field_76527_a); + this.setBlockAndMetadata(par1World, i2, j1, k2, Block.leaves.blockID, this.field_76527_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 3143a20c7..584a3fa73 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -2,43 +2,43 @@ +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java @@ -47,7 +47,7 @@ { - var12 = par1World.getBlockId(var10, var8, var11); + l1 = par1World.getBlockId(j1, i1, k1); -- if (var12 != 0 && var12 != Block.leaves.blockID) -+ if (var12 != 0 && (Block.blocksList[var12] != null && !Block.blocksList[var12].isLeaves(par1World, var10, var8, var11))) +- if (l1 != 0 && l1 != Block.leaves.blockID) ++ if (l1 != 0 && (Block.blocksList[l1] != null && !Block.blocksList[l1].isLeaves(par1World, j1, i1, k1))) { - if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID) + if (l1 != Block.waterStill.blockID && l1 != Block.waterMoving.blockID) { @@ -94,7 +94,10 @@ { - int var15 = var14 - par5; + int l2 = k2 - par5; -- if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)]) -+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var14)]; +- if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(l1, j2, k2)]) ++ Block block = Block.blocksList[par1World.getBlockId(l1, j2, k2)]; + -+ if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var12, var16, var14))) ++ if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) && ++ (block == null || block.canBeReplacedByLeaves(par1World, l1, j2, k2))) { - this.setBlock(par1World, var12, var16, var14, Block.leaves.blockID); + this.setBlock(par1World, l1, j2, k2, Block.leaves.blockID); } @@ -106,7 +109,9 @@ { - var10 = par1World.getBlockId(par3, par4 + var16, par5); + j1 = par1World.getBlockId(par3, par4 + j2, par5); -- if (var10 == 0 || var10 == Block.leaves.blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID) -+ Block block = Block.blocksList[var10]; +- if (j1 == 0 || j1 == Block.leaves.blockID || j1 == Block.waterMoving.blockID || j1 == Block.waterStill.blockID) ++ Block block = Block.blocksList[j1]; + -+ if (var10 == 0 || (block != null && block.isLeaves(par1World, par3, par4 + var16, par5)) || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID) ++ if (j1 == 0 || (block != null && block.isLeaves(par1World, par3, par4 + j2, par5)) || j1 == Block.waterMoving.blockID || j1 == Block.waterStill.blockID) { - this.setBlock(par1World, par3, par4 + var16, par5, Block.wood.blockID); + this.setBlock(par1World, par3, par4 + j2, par5, Block.wood.blockID); } @@ -121,7 +126,8 @@ { - for (var13 = par5 - var11; var13 <= par5 + var11; ++var13) + for (i2 = par5 - k1; i2 <= par5 + k1; ++i2) { -- if (par1World.getBlockId(var12, var16, var13) == Block.leaves.blockID) -+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var13)]; -+ if (block != null && block.isLeaves(par1World, var12, var16, var13)) +- if (par1World.getBlockId(l1, j2, i2) == Block.leaves.blockID) ++ Block block = Block.blocksList[par1World.getBlockId(l1, j2, i2)]; ++ if (block != null && block.isLeaves(par1World, l1, j2, i2)) { - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0) + if (par2Random.nextInt(4) == 0 && par1World.getBlockId(l1 - 1, j2, i2) == 0) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index c928aa0a2..bb5ebf71e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -2,35 +2,35 @@ +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java @@ -43,7 +43,9 @@ { - var15 = par1World.getBlockId(var13, var11, var14); + k2 = par1World.getBlockId(i2, l1, j2); -- if (var15 != 0 && var15 != Block.leaves.blockID) -+ Block block = Block.blocksList[var15]; +- if (k2 != 0 && k2 != Block.leaves.blockID) ++ Block block = Block.blocksList[k2]; + -+ if (var15 != 0 && (block == null || !block.isLeaves(par1World, var13, var11, var14))) ++ if (k2 != 0 && (block == null || !block.isLeaves(par1World, i2, l1, j2))) { - var10 = false; + flag = false; } @@ -79,7 +81,10 @@ { - int var17 = var16 - par5; + int j3 = i3 - par5; -- if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var14, var13, var16)]) -+ Block block = Block.blocksList[par1World.getBlockId(var14, var13, var16)]; +- if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(j2, i2, i3)]) ++ Block block = Block.blocksList[par1World.getBlockId(j2, i2, i3)]; + -+ if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var14, var13, var16))) ++ if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && ++ (block == null || block.canBeReplacedByLeaves(par1World, j2, i2, i3))) { - this.setBlockAndMetadata(par1World, var14, var13, var16, Block.leaves.blockID, 1); + this.setBlockAndMetadata(par1World, j2, i2, i3, Block.leaves.blockID, 1); } @@ -100,7 +105,9 @@ { - var14 = par1World.getBlockId(par3, par4 + var13, par5); + j2 = par1World.getBlockId(par3, par4 + i2, par5); -- if (var14 == 0 || var14 == Block.leaves.blockID) -+ Block block = Block.blocksList[var14]; +- if (j2 == 0 || j2 == Block.leaves.blockID) ++ Block block = Block.blocksList[j2]; + -+ if (var14 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var13, par5)) ++ if (j2 == 0 || block == null || block.isLeaves(par1World, par3, par4 + i2, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + var13, par5, Block.wood.blockID, 1); + this.setBlockAndMetadata(par1World, par3, par4 + i2, par5, Block.wood.blockID, 1); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index 259739c8f..bc5800d54 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -12,50 +12,50 @@ { @@ -47,7 +49,9 @@ { - var15 = par1World.getBlockId(var13, var11, var14); + j2 = par1World.getBlockId(i2, l1, l2); -- if (var15 != 0 && var15 != Block.leaves.blockID) -+ Block block = Block.blocksList[var15]; +- if (j2 != 0 && j2 != Block.leaves.blockID) ++ Block block = Block.blocksList[j2]; + -+ if (var15 != 0 && block != null && !block.isLeaves(par1World, var13, var11, var14)) ++ if (j2 != 0 && block != null && !block.isLeaves(par1World, i2, l1, l2)) { - var10 = false; + flag = false; } @@ -67,10 +71,12 @@ else { - var11 = par1World.getBlockId(par3, par4 - 1, par5); -+ Block soil = Block.blocksList[var11]; + l1 = par1World.getBlockId(par3, par4 - 1, par5); ++ Block soil = Block.blocksList[l1]; + boolean isValidSoil = soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling); -- if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID) && par4 < 256 - var6 - 1) -+ if (isValidSoil && par4 < 256 - var6 - 1) +- if ((l1 == Block.grass.blockID || l1 == Block.dirt.blockID) && par4 < 256 - l - 1) ++ if (isValidSoil && par4 < 256 - l - 1) { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); + soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); - var21 = par2Random.nextInt(2); - var13 = 1; - byte var22 = 0; + k2 = par2Random.nextInt(2); + i2 = 1; + byte b0 = 0; @@ -89,7 +95,10 @@ { - int var20 = var19 - par5; + int i4 = l3 - par5; -- if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)]) -+ Block block = Block.blocksList[par1World.getBlockId(var17, var16, var19)]; +- if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(i3, j3, l3)]) ++ Block block = Block.blocksList[par1World.getBlockId(i3, j3, l3)]; + -+ if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var17, var16, var19))) ++ if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && ++ (block == null || block.canBeReplacedByLeaves(par1World, i3, j3, l3))) { - this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 1); + this.setBlockAndMetadata(par1World, i3, j3, l3, Block.leaves.blockID, 1); } @@ -119,7 +128,9 @@ { - var17 = par1World.getBlockId(par3, par4 + var16, par5); + i3 = par1World.getBlockId(par3, par4 + j3, par5); -- if (var17 == 0 || var17 == Block.leaves.blockID) -+ Block block = Block.blocksList[var17]; +- if (i3 == 0 || i3 == Block.leaves.blockID) ++ Block block = Block.blocksList[i3]; + -+ if (var17 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5)) ++ if (i3 == 0 || block == null || block.isLeaves(par1World, par3, par4 + j3, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 1); + this.setBlockAndMetadata(par1World, par3, par4 + j3, par5, Block.wood.blockID, 1); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch index f25bd80ef..8e4ac0bea 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -2,9 +2,9 @@ +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java @@ -20,10 +20,16 @@ { - int var11; + int l; -- for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) +- for (boolean flag = false; ((l = par1World.getBlockId(par3, par4, par5)) == 0 || l == Block.leaves.blockID) && par4 > 0; --par4) + Block block = null; + do { @@ -18,5 +18,5 @@ + par4--; + } while (par4 > 0); - for (int var7 = 0; var7 < 128; ++var7) + for (int i1 = 0; i1 < 128; ++i1) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index aa661276d..24939b8d2 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -11,67 +11,68 @@ public class WorldGenTrees extends WorldGenerator { -@@ -67,7 +69,12 @@ +@@ -67,7 +69,13 @@ { - var12 = par1World.getBlockId(var10, var8, var11); + k1 = par1World.getBlockId(l1, i1, j1); -- if (var12 != 0 && var12 != Block.leaves.blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != Block.wood.blockID) -+ Block block = Block.blocksList[var12]; +- if (k1 != 0 && k1 != Block.leaves.blockID && k1 != Block.grass.blockID && k1 != Block.dirt.blockID && k1 != Block.wood.blockID) ++ Block block = Block.blocksList[k1]; + -+ if (block != null && -+ !block.isLeaves(par1World, var10, var8, var11) && -+ !block.canSustainPlant(par1World, var10, var8, var11, ForgeDirection.UP, (BlockSapling)Block.sapling) && -+ !block.isWood(par1World, var10, var8, var11)) ++ if (k1 != 0 && ++ !block.isLeaves(par1World, l1, i1, j1) && ++ k1 != Block.grass.blockID && ++ k1 != Block.dirt.blockID && ++ !block.isWood(par1World, l1, i1, j1)) { - var7 = false; + flag = false; } -@@ -87,10 +94,12 @@ +@@ -87,10 +95,12 @@ else { - var8 = par1World.getBlockId(par3, par4 - 1, par5); + i1 = par1World.getBlockId(par3, par4 - 1, par5); - -- if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 256 - var6 - 1) +- if ((i1 == Block.grass.blockID || i1 == Block.dirt.blockID) && par4 < 256 - l - 1) - { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); -+ Block soil = Block.blocksList[var8]; ++ Block soil = Block.blocksList[i1]; + boolean isSoil = (soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling)); + -+ if (isSoil && par4 < 256 - var6 - 1) ++ if (isSoil && par4 < 256 - l - 1) + { + soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); - var9 = 3; - byte var18 = 0; - int var13; -@@ -110,7 +119,10 @@ - { - int var17 = var16 - par5; - -- if ((Math.abs(var15) != var13 || Math.abs(var17) != var13 || par2Random.nextInt(2) != 0 && var12 != 0) && par1World.isAirBlock(var14, var11, var16)) -+ Block block = Block.blocksList[par1World.getBlockId(var14, var11, var16)]; -+ -+ if ((Math.abs(var15) != var13 || Math.abs(var17) != var13 || par2Random.nextInt(2) != 0 && var12 != 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, var14, var11, var16))) + b0 = 3; + byte b1 = 0; + int i2; +@@ -113,8 +123,9 @@ + if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || par2Random.nextInt(2) != 0 && k1 != 0) { - this.setBlockAndMetadata(par1World, var14, var11, var16, Block.leaves.blockID, this.metaLeaves); - } -@@ -122,7 +134,9 @@ - { - var12 = par1World.getBlockId(par3, par4 + var11, par5); - -- if (var12 == 0 || var12 == Block.leaves.blockID) -+ Block block = Block.blocksList[var12]; + int j3 = par1World.getBlockId(j2, j1, l2); +- +- if (j3 == 0 || j3 == Block.leaves.blockID) ++ Block block = Block.blocksList[j3]; + -+ if (var12 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var11, par5)) - { - this.setBlockAndMetadata(par1World, par3, par4 + var11, par5, Block.wood.blockID, this.metaWood); - -@@ -162,7 +176,8 @@ - { - for (var15 = par5 - var13; var15 <= par5 + var13; ++var15) - { -- if (par1World.getBlockId(var14, var11, var15) == Block.leaves.blockID) -+ Block block = Block.blocksList[par1World.getBlockId(var14, var11, var15)]; -+ if (block != null && block.isLeaves(par1World, var14, var11, var15)) ++ if (block == null || block.canBeReplacedByLeaves(par1World, j2, j1, l2)) { - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14 - 1, var11, var15) == 0) + this.setBlockAndMetadata(par1World, j2, j1, l2, Block.leaves.blockID, this.metaLeaves); + } +@@ -127,7 +138,9 @@ + { + k1 = par1World.getBlockId(par3, par4 + j1, par5); + +- if (k1 == 0 || k1 == Block.leaves.blockID) ++ Block block = Block.blocksList[k1]; ++ ++ if (k1 == 0 || block == null || block.isLeaves(par1World, par3, par4 + j1, par5)) + { + this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.metaWood); + +@@ -167,7 +180,8 @@ + { + for (k2 = par5 - i2; k2 <= par5 + i2; ++k2) + { +- if (par1World.getBlockId(j2, j1, k2) == Block.leaves.blockID) ++ Block block = Block.blocksList[par1World.getBlockId(j2, j1, k2)]; ++ if (block != null && block.isLeaves(par1World, j2, j1, k2)) + { + if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0) { diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 4c988b678..f2ba63132 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -12,16 +12,16 @@ { @@ -42,6 +45,7 @@ { - var4 = 6; + b0 = 6; } -+ var4 = getModdedBiomeSize(par2WorldType, var4); ++ b0 = getModdedBiomeSize(par2WorldType, b0); - GenLayer var5 = GenLayerZoom.func_75915_a(1000L, var16, 0); - GenLayerRiverInit var13 = new GenLayerRiverInit(100L, var5); + GenLayer genlayer = GenLayerZoom.func_75915_a(1000L, genlayeraddmushroomisland, 0); + GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer); @@ -151,4 +155,11 @@ * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ - public abstract int[] getInts(int var1, int var2, int var3, int var4); + public abstract int[] getInts(int i, int j, int k, int l); + + public static byte getModdedBiomeSize(WorldType worldType, byte original) + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch index b91101d60..cfc71ccf0 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java +++ ../src_work/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java -@@ -7,6 +7,9 @@ +@@ -8,6 +8,9 @@ import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; @@ -10,22 +10,22 @@ public class ComponentMineshaftCorridor extends StructureComponent { -@@ -236,14 +239,16 @@ - this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var10 - 1, Block.torchWood.blockID, 0); - this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var10 + 1, Block.torchWood.blockID, 0); +@@ -260,14 +263,16 @@ + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Block.torchWood.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Block.torchWood.blockID, 0); + ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); + if (par2Random.nextInt(100) == 0) { -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, var10 - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, var10 - 1, info.getItems(par2Random), info.getCount(par2Random)); +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, info.getItems(par2Random), info.getCount(par2Random)); } if (par2Random.nextInt(100) == 0) { -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, var10 + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, var10 + 1, info.getItems(par2Random), info.getCount(par2Random)); +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, info.getItems(par2Random), info.getCount(par2Random)); } if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch index 05a169bf9..109190ee7 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch @@ -15,14 +15,14 @@ this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 10, -11, 13, par3StructureBoundingBox); + ChestGenHooks info = ChestGenHooks.getInfo(PYRAMID_DESERT_CHEST); - for (var10 = 0; var10 < 4; ++var10) + for (i1 = 0; i1 < 4; ++i1) { - if (!this.field_74940_h[var10]) + if (!this.field_74940_h[i1]) { - int var11 = Direction.offsetX[var10] * 2; - int var12 = Direction.offsetZ[var10] * 2; -- this.field_74940_h[var10] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + var11, -11, 10 + var12, WeightedRandomChestContent.func_92080_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); -+ this.field_74940_h[var10] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + var11, -11, 10 + var12, info.getItems(par2Random), info.getCount(par2Random)); + int j1 = Direction.offsetX[i1] * 2; + int k1 = Direction.offsetZ[i1] * 2; +- this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, WeightedRandomChestContent.func_92080_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); ++ this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, info.getItems(par2Random), info.getCount(par2Random)); } } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch index f2c68343e..b028e40fb 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch @@ -11,7 +11,7 @@ public class ComponentStrongholdChestCorridor extends ComponentStronghold { @@ -72,7 +75,7 @@ - if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + if (par3StructureBoundingBox.isVecInside(j, i, k)) { this.hasMadeChest = true; - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, WeightedRandomChestContent.func_92080_a(strongholdChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(2)); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch index 961138671..1e2705608 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch @@ -11,7 +11,7 @@ public class ComponentStrongholdLibrary extends ComponentStronghold { @@ -145,12 +148,14 @@ - this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8, 8, var9 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, b1, 8, b2 + 1, par3StructureBoundingBox); } - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch index dba49424e..2accf88aa 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch @@ -11,7 +11,7 @@ public class ComponentVillageHouse2 extends ComponentVillage { @@ -92,7 +95,7 @@ - if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + if (par3StructureBoundingBox.isVecInside(j, i, k)) { this.hasMadeChest = true; - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 5, 1, 5, villageBlacksmithChestContents, 3 + par2Random.nextInt(6)); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch index 58887589f..22c51f7aa 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch @@ -10,9 +10,9 @@ public final int terrainType; @@ -32,6 +33,7 @@ this.terrainType = par7; - BiomeGenBase var8 = par1WorldChunkManager.getBiomeGenAt(par4, par5); - this.inDesert = var8 == BiomeGenBase.desert || var8 == BiomeGenBase.desertHills; -+ this.biome = var8; + BiomeGenBase biomegenbase = par1WorldChunkManager.getBiomeGenAt(par4, par5); + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; ++ this.biome = biomegenbase; this.startPiece = this; } diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index dfb195e8a..2aa401fdd 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -2,10 +2,10 @@ +++ ../src_work/minecraft/net/minecraft/world/storage/MapData.java @@ -173,7 +173,7 @@ par8 += par8 < 0.0D ? -8.0D : 8.0D; - var15 = (byte)((int)(par8 * 16.0D / 360.0D)); + b3 = (byte)((int)(par8 * 16.0D / 360.0D)); - if (this.dimension < 0) + if (par2World.provider.shouldMapSpin(par3Str, par4, par6, par8)) { - int var17 = (int)(par2World.getWorldInfo().getWorldTime() / 10L); - var15 = (byte)(var17 * var17 * 34187121 + var17 * 121 >> 15 & 15); + int k = (int)(par2World.getWorldInfo().getWorldTime() / 10L); + b3 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/release.bat b/release.bat deleted file mode 100644 index 04eec1cd2..000000000 --- a/release.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -fml\python\python_fml release.py %* \ No newline at end of file diff --git a/release.py b/release.py index 95060406c..8a047b92b 100644 --- a/release.py +++ b/release.py @@ -34,39 +34,56 @@ def main(): mcp_dir = os.path.join(forge_dir, 'mcp') if not options.mcp_dir is None: mcp_dir = os.path.abspath(options.mcp_dir) - elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): - mcp_dir = os.path.abspath('..') ret = 0 fml_dir = os.path.join(forge_dir, 'fml') - build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num) + ret = build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num) if ret != 0: sys.exit(ret) + + temp_dir = os.path.join(forge_dir, 'temp') + src_dir = os.path.join(mcp_dir, 'src') + reobf_dir = os.path.join(mcp_dir, 'reobf') + client_dir = os.path.join(reobf_dir, 'minecraft') + fml_dir = os.path.join(temp_dir, 'fml') print '=================================== Release Start =================================' + + fml = glob.glob(os.path.join(forge_dir, 'fml', 'target', 'fml-src-*.%d-*.zip' % build_num)) + if not len(fml) == 1: + if len(fml) == 0: + print 'Missing FML source zip, should be named fml-src-*.zip inside ./fml/target/ created when running setup' + else: + print 'To many FML source zips found, we should only have one. Check the Forge Git for the latest FML version supported' + sys.exit(1) + + if os.path.isdir(fml_dir): + shutil.rmtree(fml_dir) + + print 'Extracting: %s' % os.path.basename(fml[0]) + zf = zipfile.ZipFile(fml[0]) + zf.extractall(temp_dir) + zf.close() + error_level = 0 try: sys.path.append(mcp_dir) from runtime.reobfuscate import reobfuscate os.chdir(mcp_dir) reset_logger() - reobfuscate(None, False, True, True, True, False) + reobfuscate(None, False, True, True, True, False, False) reset_logger() os.chdir(forge_dir) except SystemExit, e: print 'Reobfusicate Exception: %d ' % e.code error_level = e.code - src_dir = os.path.join(mcp_dir, 'src') - reobf_dir = os.path.join(mcp_dir, 'reobf') - client_dir = os.path.join(reobf_dir, 'minecraft') - - extract_fml_obfed(mcp_dir, reobf_dir, client_dir) + extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir) extract_paulscode(mcp_dir, client_dir) version = load_version(build_num) version_forge = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build']) - version_mc = load_mc_version(forge_dir) + version_mc = load_mc_version(fml_dir) branch = get_branch_name() version_str = '%s-%s' % (version_mc, version_forge) @@ -103,33 +120,35 @@ def main(): zip_add('client/forge_logo.png') zip_add('install/MinecraftForge-Credits.txt') zip_add('install/MinecraftForge-License.txt') - zip_add('fml/CREDITS-fml.txt') - zip_add('fml/LICENSE-fml.txt') - zip_add('fml/README-fml.txt') - zip_add('fml/common/fml_at.cfg') - zip_add('fml/common/fml_marker.cfg') - zip_add('fml/common/fmlversion.properties') - zip_add('fml/common/mcpmod.info') - zip_add('fml/client/mcp.png') zip_add('install/Paulscode IBXM Library License.txt') zip_add('install/Paulscode SoundSystem CodecIBXM License.txt') zip_add('common/forge_at.cfg') zip_add(version_file) if not options.skip_changelog: zip_add(changelog_file, 'MinecraftForge-Changelog.txt') - zip_end() - zips = glob.glob('fml/mcp*.zip') - for i in zips: - print 'Removing MCP Zip: %s' % os.path.basename(i) - os.remove(i) + #Add dependancy and licenses from FML + FML_FILES = [ + 'CREDITS-fml.txt', + 'LICENSE-fml.txt', + 'README-fml.txt', + 'common/fml_at.cfg', + 'common/fml_marker.cfg', + 'common/fmlversion.properties', + 'common/mcpmod.info', + 'client/mcp.png' + ] + for file in FML_FILES: + zip_add(os.path.join(fml_dir, file)) + + zip_end() inject_version(os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num) zip_start('minecraftforge-src-%s.zip' % version_str, 'forge') zip_add('client', 'client') zip_add('common', 'common') zip_add('patches', 'patches') - zip_add('fml', 'fml') + zip_add(fml_dir, 'fml') zip_add('install', '') zip_add('forge.py') zip_add(version_file) @@ -140,6 +159,7 @@ def main(): if os.path.exists(version_file): os.remove(version_file) + shutil.rmtree(temp_dir) print '=================================== Release Finished %d =================================' % error_level sys.exit(error_level) @@ -156,7 +176,7 @@ def zip_add(file, key=None): zip_folder(file, key, zip) else: if os.path.isfile(file): - print key + print ' ' + key zip.write(file, key) def zip_start(name, base=None): @@ -175,8 +195,8 @@ def zip_end(): zip_name = None zip_base = None -def load_mc_version(forge_dir): - props = os.path.join(forge_dir, 'fml', 'common', 'fmlversion.properties') +def load_mc_version(fml_dir): + props = os.path.join(fml_dir, 'common', 'fmlversion.properties') if not os.path.isfile(props): print 'Could not load fmlversion.properties, build failed' @@ -191,8 +211,8 @@ def load_mc_version(forge_dir): print 'Could not load fmlversion.properties, build failed' sys.exit(1) -def extract_fml_obfed(mcp_dir, reobf_dir, client_dir): - fml_file = os.path.join(forge_dir, 'fml', 'difflist.txt') +def extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir): + fml_file = os.path.join(fml_dir, 'difflist.txt') if not os.path.isfile(fml_file): print 'Could not find Forge ModLoader\'s DiffList, looking for it at: %s' % fml_file sys.exit(1) diff --git a/setup.bat b/setup.bat deleted file mode 100644 index 137df8a20..000000000 --- a/setup.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -@SET PATH=%PATH%;.\GnuWin32\ - -if exist "fml" rmdir /S /Q fml - -for %%f in (fml-*.zip) do ( - if exist "fml" ( - echo Multiple FML zips detected, aborting: %%~nf - exit /b 1 - ) - echo Extracting %%~nf - unzip -q %%~nf.zip -) - -if not exist "fml" ( - echo Could not find a valid FML FML jar, aborting - exit /b 1 -) - -fml\python\python_fml setup.py --no-extract %* \ No newline at end of file diff --git a/setup.py b/setup.py index 9f275a431..ce634d017 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import os, os.path, sys, zipfile -import shutil, glob, fnmatch +import shutil, glob, fnmatch, subprocess +from pprint import pformat from optparse import OptionParser forge_dir = os.path.dirname(os.path.abspath(__file__)) @@ -11,20 +12,25 @@ def main(): parser = OptionParser() parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None) - parser.add_option('-n', '--no-extract', action='store_true', dest='no_extract', help='Do not attempt to extract FML zip files', default=False) + parser.add_option('-b', '--build', action='store', dest='build', help='Build number', default=None) options, _ = parser.parse_args() + build_num = 0 + if not options.build is None: + try: + build_num = int(options.build) + except: + pass + fml_dir = os.path.join(forge_dir, 'fml') mcp_dir = os.path.join(forge_dir, 'mcp') if not options.mcp_dir is None: mcp_dir = os.path.abspath(options.mcp_dir) - elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): - mcp_dir = os.path.abspath('..') src_dir = os.path.join(mcp_dir, 'src') - setup_fml(mcp_dir, fml_dir, options.no_extract) + setup_fml(mcp_dir, fml_dir, build_num) base_dir = os.path.join(mcp_dir, 'src_base') work_dir = os.path.join(mcp_dir, 'src_work') @@ -39,35 +45,59 @@ def main(): shutil.copytree(src_dir, work_dir) print 'Applying forge patches' - apply_forge_patches(os.path.join(forge_dir, 'fml'), mcp_dir, forge_dir, work_dir, False) + apply_forge_patches(fml_dir, mcp_dir, forge_dir, work_dir, False) setup_eclipse(forge_dir) print '=================================== Setup Finished =================================' -def setup_fml(mcp_dir, fml_dir, dont_extract=False): +def setup_fml(mcp_dir, fml_dir, build_num=0): print 'Setting up Forge ModLoader' - if not dont_extract: - fml = glob.glob(os.path.join(forge_dir, 'fml-src-*.zip')) - if not len(fml) == 1: - if len(fml) == 0: - print 'Missing FML source zip, should be named fml-src-*.zip inside your forge folder, obtain it from the repo' - else: - print 'To many FML source zips found, we should only have one. Check the Forge Git for the latest FML version supported' - sys.exit(1) - - if os.path.isdir(fml_dir): - shutil.rmtree(fml_dir) - - print 'Extracting: %s' % os.path.basename(fml[0]) - - zf = zipfile.ZipFile(fml[0]) - zf.extractall(forge_dir) - zf.close() + os.environ['WORKSPACE'] = os.path.join(mcp_dir, '..') + os.environ['BUILD_NUMBER'] = str(build_num) + + BUILD = ['ant', 'jenkinsbuild'] + if sys.platform.startswith('win'): + BUILD = ['cmd', '/C'] + BUILD + + if not run_command(BUILD, cwd=fml_dir): + print('Could not setup FML') + sys.exit(1) sys.path.append(fml_dir) - from install import fml_main - fml_main(fml_dir, mcp_dir, True) + sys.path.append(os.path.join(fml_dir, 'install')) + from fml import finish_setup_fml + finish_setup_fml(fml_dir, mcp_dir) + + print('Copy resources:') + copy_files(os.path.join(fml_dir, 'client'), os.path.join(mcp_dir, 'src', 'minecraft')) + copy_files(os.path.join(fml_dir, 'common'), os.path.join(mcp_dir, 'src', 'minecraft')) + + name = 'fmlversion.properties' + print(' ' + name) + shutil.copy(os.path.join(fml_dir, name), os.path.join(mcp_dir, 'src', 'minecraft', name)) + +def copy_files(src_dir, dest_dir): + for file in glob.glob(os.path.join(src_dir, '*')): + if not os.path.isfile(file) or file.lower().endswith('.java'): + continue + print(' ' + file) + shutil.copy(file, os.path.join(dest_dir, os.path.basename(file))) + +def run_command(command, cwd='.', verbose=True): + print('Running command: ') + print(pformat(command)) + + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, cwd=cwd) + while process.poll() is None: + line = process.stdout.readline() + if line: + line = line.rstrip() + print(line) + if process.returncode: + self.logger.error("failed: %d", process.returncode) + return False + return True def setup_eclipse(forge_dir): eclipse_dir = os.path.join(forge_dir, 'eclipse') @@ -80,4 +110,4 @@ def setup_eclipse(forge_dir): zf.close() if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/setup.sh b/setup.sh deleted file mode 100644 index 8c02e4c2f..000000000 --- a/setup.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -python setup.py "$@" \ No newline at end of file diff --git a/submodule_changlog.py b/submodule_changlog.py new file mode 100644 index 000000000..411c864db --- /dev/null +++ b/submodule_changlog.py @@ -0,0 +1,46 @@ +import subprocess, sys, os +from pprint import pformat +from optparse import OptionParser + +def run_command(command, cwd='.'): + #print('Running command: ') + process = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, cwd=cwd) + out, err = process.communicate() + out = out.strip('\n') + #print(pformat(out.split('\n'))) + if process.returncode: + print('failed: %d' % process.returncode) + return None + return out.split('\n') + +def main(options, args): + output = run_command(['git', 'diff', '--no-color', '--', 'fml']) + if output is None: + print('Failed to grab submodule commits') + sys.exit(1) + + start = None + end = None + for line in output: + if not 'Subproject commit' in line: + continue + if line[0:18] == '-Subproject commit': + start = line[19:] + elif line[0:18] == '+Subproject commit': + end = line[19:] + + if start == None or end == None: + print('Could not extract start and end range') + sys.exit(1) + + output = run_command(['git', 'log', '--reverse', '--pretty=oneline', '%s...%s' % (start, end)], './fml') + print('Updated FML:') + for line in output: + print('MinecraftForge/FML@%s' % line) + + +if __name__ == '__main__': + parser = OptionParser() + options, args = parser.parse_args() + + main(options, args) \ No newline at end of file diff --git a/update_patches.bat b/update_patches.bat deleted file mode 100644 index c3a4e9690..000000000 --- a/update_patches.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -fml\python\python_fml update_patches.py %* \ No newline at end of file