diff --git a/fml/client/cpw/mods/fml/client/BlockRenderInfo.java b/fml/client/cpw/mods/fml/client/BlockRenderInfo.java index 9aca94020..5fcbedfe3 100644 --- a/fml/client/cpw/mods/fml/client/BlockRenderInfo.java +++ b/fml/client/cpw/mods/fml/client/BlockRenderInfo.java @@ -14,36 +14,67 @@ package cpw.mods.fml.client; -import cpw.mods.fml.common.IBlockRenderInfo; +import net.minecraft.src.BaseMod; +import net.minecraft.src.Block; +import net.minecraft.src.IBlockAccess; +import net.minecraft.src.RenderBlocks; +import cpw.mods.fml.common.ModContainer; +import cpw.mods.fml.common.modloader.ModLoaderModContainer; /** * @author cpw * */ -public class BlockRenderInfo implements IBlockRenderInfo +public class BlockRenderInfo { private int renderId; - private boolean forInventory; + private boolean render3dInInventory; + private ModContainer modContainer; /** + * @param modContainer * */ - public BlockRenderInfo(int renderId, boolean forInventory) + public BlockRenderInfo(int renderId, boolean render3dInInventory, ModContainer modContainer) { this.renderId=renderId; - this.forInventory=forInventory; + this.render3dInInventory=render3dInInventory; + this.modContainer=modContainer; } - @Override public int getRenderId() { return renderId; } - @Override - public boolean getInventoryRendering() + public boolean shouldRender3DInInventory() { - return forInventory; + return render3dInInventory; + } + + /** + * @param world + * @param x + * @param y + * @param z + * @param block + * @param modelId + * @param renderer + */ + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) + { + return ((BaseMod)modContainer.getMod()).renderWorldBlock(renderer, world, x, y, z, block, modelId); + } + + /** + * @param block + * @param metadata + * @param modelID + * @param renderer + */ + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) + { + ((BaseMod)modContainer.getMod()).renderInvBlock(renderer, block, metadata, modelID); } } diff --git a/fml/client/cpw/mods/fml/client/FMLClientHandler.java b/fml/client/cpw/mods/fml/client/FMLClientHandler.java index 95b830afd..58b8f3a80 100644 --- a/fml/client/cpw/mods/fml/client/FMLClientHandler.java +++ b/fml/client/cpw/mods/fml/client/FMLClientHandler.java @@ -100,7 +100,7 @@ public class FMLClientHandler implements IFMLSidedHandler // Cached lookups private static HashMap> overrideInfo = new HashMap>(); - private static HashMap blockModelIds = new HashMap(); + private static HashMap blockModelIds = new HashMap(); private static HashMap keyBindings = new HashMap(); /** @@ -562,8 +562,8 @@ public class FMLClientHandler implements IFMLSidedHandler { ModLoaderModContainer mlmc=ModLoaderHelper.registerRenderHelper(mod); int renderId=nextRenderId++; - mlmc.addRenderHandler(new BlockRenderInfo(renderId, inventoryRenderer)); - blockModelIds.put(renderId, mlmc); + BlockRenderInfo bri=new BlockRenderInfo(renderId, inventoryRenderer, mlmc); + blockModelIds.put(renderId, bri); return renderId; } @@ -615,18 +615,16 @@ public class FMLClientHandler implements IFMLSidedHandler * @param y * @param z * @param block - * @param modelID + * @param modelId * @return */ - public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID) + public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId) { - ModContainer mod = blockModelIds.get(modelID); - if (mod == null) - { + if (!blockModelIds.containsKey(modelId)) { return false; } - mod.renderWorldBlock(world, x, y, z, block, modelID, renderer); - return ((BaseMod)mod.getMod()).renderWorldBlock(renderer, world, x, y, z, block, modelID); + BlockRenderInfo bri = blockModelIds.get(modelId); + return bri.renderWorldBlock(world, x, y, z, block, modelId, renderer); } /** @@ -637,11 +635,11 @@ public class FMLClientHandler implements IFMLSidedHandler */ public void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID) { - ModContainer mod = blockModelIds.get(modelID); - if (mod != null) - { - mod.renderInventoryBlock(block, metadata, modelID, renderer); + if (!blockModelIds.containsKey(modelID)) { + return; } + BlockRenderInfo bri=blockModelIds.get(modelID); + bri.renderInventoryBlock(block, metadata, modelID, renderer); } /** @@ -650,6 +648,10 @@ public class FMLClientHandler implements IFMLSidedHandler */ public boolean renderItemAsFull3DBlock(int modelId) { + BlockRenderInfo bri = blockModelIds.get(modelId); + if (bri!=null) { + return bri.shouldRender3DInInventory(); + } return false; } diff --git a/fml/client/net/minecraft/src/BaseMod.java b/fml/client/net/minecraft/src/BaseMod.java index d5cbd89a8..0bb375512 100644 --- a/fml/client/net/minecraft/src/BaseMod.java +++ b/fml/client/net/minecraft/src/BaseMod.java @@ -132,31 +132,6 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp { return false; } - - /** - * @param renderer - * @param block - * @param metadata - * @param modelID - */ - public final void onRenderInventoryBlock(Object renderer, Block block, int metadata, int modelID) - { - renderInvBlock((RenderBlocks)renderer, block, metadata, modelID); - } - - /** - * @param world - * @param x - * @param y - * @param z - * @param block - * @param modelID - * @param renderer - */ - public final boolean onRenderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) - { - return renderWorldBlock((RenderBlocks)renderer, world, x, y, z, block, modelID); - } // BASEMOD API /** * Override if you wish to provide a fuel item for the furnace and return the fuel value of the item diff --git a/fml/common/cpw/mods/fml/common/FMLModContainer.java b/fml/common/cpw/mods/fml/common/FMLModContainer.java index 52cc10b1c..f62cd2195 100644 --- a/fml/common/cpw/mods/fml/common/FMLModContainer.java +++ b/fml/common/cpw/mods/fml/common/FMLModContainer.java @@ -337,22 +337,4 @@ public class FMLModContainer implements ModContainer // TODO Auto-generated method stub return null; } - /* (non-Javadoc) - * @see cpw.mods.fml.common.ModContainer#renderInventoryBlock(net.minecraft.src.Block, int, int, java.lang.Object) - */ - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, Object renderer) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see cpw.mods.fml.common.ModContainer#renderWorldBlock(net.minecraft.src.IBlockAccess, int, int, int, net.minecraft.src.Block, int, java.lang.Object) - */ - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) - { - // TODO Auto-generated method stub - return false; - } } diff --git a/fml/common/cpw/mods/fml/common/IBlockRenderInfo.java b/fml/common/cpw/mods/fml/common/IBlockRenderInfo.java deleted file mode 100644 index 22c94bda8..000000000 --- a/fml/common/cpw/mods/fml/common/IBlockRenderInfo.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw - * - * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package cpw.mods.fml.common; - -/** - * @author cpw - * - */ -public interface IBlockRenderInfo -{ - public int getRenderId(); - public boolean getInventoryRendering(); -} diff --git a/fml/common/cpw/mods/fml/common/ModContainer.java b/fml/common/cpw/mods/fml/common/ModContainer.java index a4884139d..61d469bf5 100644 --- a/fml/common/cpw/mods/fml/common/ModContainer.java +++ b/fml/common/cpw/mods/fml/common/ModContainer.java @@ -203,22 +203,4 @@ public interface ModContainer } List getKeys(); - /** - * @param block - * @param metadata - * @param modelID - * @param renderer - */ - void renderInventoryBlock(Block block, int metadata, int modelID, Object renderer); - /** - * @param world - * @param x - * @param y - * @param z - * @param block - * @param modelID - * @param renderer - * @return - */ - boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer); } diff --git a/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java b/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java index 11a24c70b..3c9361cff 100644 --- a/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java +++ b/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java @@ -42,7 +42,6 @@ import cpw.mods.fml.common.IKeyHandler; import cpw.mods.fml.common.INetworkHandler; import cpw.mods.fml.common.IPickupNotifier; import cpw.mods.fml.common.IPlayerTracker; -import cpw.mods.fml.common.IBlockRenderInfo; import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.LoaderException; @@ -59,7 +58,6 @@ public class ModLoaderModContainer implements ModContainer private ArrayList dependencies; private ArrayList preDependencies; private ArrayList postDependencies; - private ArrayList blockRenderInfos; private ArrayList keyHandlers; private ModState state; @@ -592,18 +590,6 @@ public class ModLoaderModContainer implements ModContainer return ticks; } - /** - * @param renderId - * @param inventoryRenderer - */ - public void addRenderHandler(IBlockRenderInfo handler) - { - if (blockRenderInfos==null) { - blockRenderInfos=new ArrayList(); - } - blockRenderInfos.add(handler); - } - /** * @param keyHandler * @param allowRepeat @@ -624,24 +610,4 @@ public class ModLoaderModContainer implements ModContainer } return keyHandlers; } - - /** - * @param block - * @param metadata - * @param modelID - * @param renderer - */ - public void renderInventoryBlock(Block block, int metadata, int modelID, Object renderer) - { - mod.onRenderInventoryBlock(renderer, block, metadata, modelID); - } - - /* (non-Javadoc) - * @see cpw.mods.fml.common.ModContainer#renderWorldBlock(net.minecraft.src.IBlockAccess, int, int, int, net.minecraft.src.Block, int, java.lang.Object) - */ - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) - { - return mod.onRenderWorldBlock(world, x, y, z, block, modelID, renderer); - } } diff --git a/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs index 38dc83585..c3f07c424 100644 --- a/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs +++ b/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -LexicalSortingAction.isChecked=true content_assist_favorite_static_members= content_assist_lru_history= content_assist_number_of_computers=13 diff --git a/fml/patches/minecraft/net/minecraft/src/ChunkProvider.java.patch b/fml/patches/minecraft/net/minecraft/src/ChunkProvider.java.patch new file mode 100644 index 000000000..c30a340e4 --- /dev/null +++ b/fml/patches/minecraft/net/minecraft/src/ChunkProvider.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/src/ChunkProvider.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src-work/minecraft/net/minecraft/src/ChunkProvider.java 0000-00-00 00:00:00.000000000 -0000 +@@ -6,6 +6,8 @@ + import java.util.List; + import java.util.Set; + ++import cpw.mods.fml.client.FMLClientHandler; ++ + public class ChunkProvider implements IChunkProvider + { + private Set field_28065_a = new HashSet(); +@@ -162,6 +164,7 @@ + if (this.field_28070_c != null) + { + this.field_28070_c.func_534_a(p_534_1_, p_534_2_, p_534_3_); ++ FMLClientHandler.instance().onChunkPopulate(p_534_1_, p_534_2_, p_534_3_, field_28066_g, field_28070_c); + var4.func_1006_f(); + } + } diff --git a/fml/server/net/minecraft/src/BaseMod.java b/fml/server/net/minecraft/src/BaseMod.java index 27de52d26..266015e7a 100644 --- a/fml/server/net/minecraft/src/BaseMod.java +++ b/fml/server/net/minecraft/src/BaseMod.java @@ -122,31 +122,6 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp { return onServerCommand(command, (String)data[0], (ICommandListener)data[1]); } - - /** - * @param renderer - * @param block - * @param metadata - * @param modelID - */ - public final void onRenderInventoryBlock(Object renderer, Block block, int metadata, int modelID) - { - // NOOP - } - - /** - * @param world - * @param x - * @param y - * @param z - * @param block - * @param modelID - * @param renderer - */ - public final boolean onRenderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) - { - return false; - } // BASEMOD API /** * Override if you wish to provide a fuel item for the furnace and return the fuel value of the item