diff --git a/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java b/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java index f75dbbcb8..e0d27efe6 100644 --- a/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java +++ b/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java @@ -9,11 +9,29 @@ import net.minecraft.src.Block; import net.minecraft.src.ModLoader; import net.minecraft.src.RenderBlocks; import net.minecraft.src.Tessellator; +import net.minecraft.src.RenderGlobal; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.MovingObjectPosition; +import net.minecraft.src.ItemStack; import org.lwjgl.opengl.GL11; import java.util.*; public class ForgeHooksClient { + + public static boolean onBlockHighlight(RenderGlobal renderglobal, + EntityPlayer player, MovingObjectPosition mop, int i, + ItemStack itemstack, float f) { + for (IHighlightHandler handler : highlightHandlers) { + if(handler.onBlockHighlight(renderglobal,player,mop, + i,itemstack,f)) + return true; + } + return false; + } + + static LinkedList highlightHandlers = new LinkedList(); + public static boolean canRenderInPass(Block block, int pass) { if(block instanceof IMultipassRender) { IMultipassRender impr = (IMultipassRender) block; @@ -23,7 +41,6 @@ public class ForgeHooksClient { return false; } - static HashMap tessellators=new HashMap(); static HashMap textures=new HashMap(); static boolean inWorld=false; diff --git a/forge/forge_client/src/net/minecraft/src/forge/IHighlightHandler.java b/forge/forge_client/src/net/minecraft/src/forge/IHighlightHandler.java new file mode 100644 index 000000000..a2fc3ce09 --- /dev/null +++ b/forge/forge_client/src/net/minecraft/src/forge/IHighlightHandler.java @@ -0,0 +1,23 @@ +/* + * This software is provided under the terms of the Minecraft Forge Public + * License v1.0. + */ +package net.minecraft.src.forge; + +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.EnumStatus; +import net.minecraft.src.RenderGlobal; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.MovingObjectPosition; +import net.minecraft.src.ItemStack; + +public interface IHighlightHandler { + /** + * Allow custom handling of highlights. Return true if the hilight has + * been handled. + */ + public boolean onBlockHighlight(RenderGlobal renderglobal, + EntityPlayer player, MovingObjectPosition mop, int i, + ItemStack itemstack, float f); +} + diff --git a/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java b/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java index 86d685eea..3256dfc95 100755 --- a/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java +++ b/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java @@ -12,6 +12,13 @@ import net.minecraft.src.Tessellator; import org.lwjgl.opengl.GL11; public class MinecraftForgeClient { + /** + * Registers a new block highlight handler. + */ + public static void registerHighlightHandler(IHighlightHandler handler) { + ForgeHooksClient.highlightHandlers.add(handler); + } + /** Bind a texture. This is used to bind a texture file when * performing your own rendering, rather than using ITextureProvider. * diff --git a/forge/minecraft.patch b/forge/minecraft.patch index bae16af76..c232072d2 100644 --- a/forge/minecraft.patch +++ b/forge/minecraft.patch @@ -1044,6 +1044,43 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityPla if(!worldObj.multiplayerWorld) { if(isPlayerSleeping() || !isEntityAlive()) +diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityRenderer.java ../src_work/minecraft/net/minecraft/src/EntityRenderer.java +--- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java 2011-08-11 17:02:11.000000000 -0400 ++++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 2011-08-20 06:25:56.000000000 -0400 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.ForgeHooksClient; + + import java.nio.FloatBuffer; + import java.util.List; +@@ -573,8 +574,12 @@ + { + EntityPlayer entityplayer = (EntityPlayer)entityliving; + GL11.glDisable(3008 /*GL_ALPHA_TEST*/); ++ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer, ++ mc.objectMouseOver,0, ++ entityplayer.inventory.getCurrentItem(),f)) { + renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); + renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); ++ } + GL11.glEnable(3008 /*GL_ALPHA_TEST*/); + } + GL11.glBlendFunc(770, 771); +@@ -619,8 +624,12 @@ + { + EntityPlayer entityplayer1 = (EntityPlayer)entityliving; + GL11.glDisable(3008 /*GL_ALPHA_TEST*/); ++ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer1, ++ mc.objectMouseOver,0, ++ entityplayer1.inventory.getCurrentItem(),f)) { + renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); + renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); ++ } + GL11.glEnable(3008 /*GL_ALPHA_TEST*/); + } + renderRainSnow(f); diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Explosion.java ../src_work/minecraft/net/minecraft/src/Explosion.java --- ../src_base/minecraft/net/minecraft/src/Explosion.java 2011-08-11 17:02:11.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-08-11 17:02:12.000000000 -0400