Merge pull request #1163 from TheCountryGamer/master
Added RenderBlockOverlayEvent
This commit is contained in:
commit
a6b7ba06c6
2 changed files with 82 additions and 0 deletions
|
@ -121,3 +121,34 @@
|
|||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@@ -507,6 +538,7 @@
|
||||
|
||||
if (this.field_78455_a.field_71439_g.func_70027_ad())
|
||||
{
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.FIRE, Blocks.field_150480_ab, MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70165_t), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70163_u), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70161_v))))
|
||||
this.func_78442_d(p_78447_1_);
|
||||
}
|
||||
|
||||
@@ -519,6 +551,7 @@
|
||||
|
||||
if (this.field_78455_a.field_71441_e.func_147439_a(i, j, k).func_149721_r())
|
||||
{
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, block, i, j, k)))
|
||||
this.func_78446_a(p_78447_1_, block.func_149733_h(2));
|
||||
}
|
||||
else
|
||||
@@ -541,12 +574,14 @@
|
||||
|
||||
if (block.func_149688_o() != Material.field_151579_a)
|
||||
{
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, block, i, j, k)))
|
||||
this.func_78446_a(p_78447_1_, block.func_149733_h(2));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h))
|
||||
{
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.WATER, Blocks.field_150355_j, MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70165_t), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70163_u), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70161_v))))
|
||||
this.func_78448_c(p_78447_1_);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called when a block's texture is going to be overlaid on the player's HUD. Cancel this event to prevent the overlay.
|
||||
*/
|
||||
@Cancelable
|
||||
public class RenderBlockOverlayEvent extends Event {
|
||||
|
||||
public static enum OverlayType {
|
||||
FIRE, BLOCK, WATER
|
||||
}
|
||||
|
||||
/**
|
||||
* The player which the overlay will apply to
|
||||
*/
|
||||
public final EntityPlayer player;
|
||||
public final float renderPartialTicks;
|
||||
/**
|
||||
* The type of overlay to occur
|
||||
*/
|
||||
public final OverlayType overlayType;
|
||||
/**
|
||||
* If the overlay type is BLOCK, then this is the block which the overlay is getting it's icon from
|
||||
*/
|
||||
public final Block blockForOverlay;
|
||||
public final int blockX;
|
||||
public final int blockY;
|
||||
public final int blockZ;
|
||||
|
||||
public RenderBlockOverlayEvent(EntityPlayer player, float renderPartialTicks, OverlayType type, Block block, int blockX, int blockY, int blockZ)
|
||||
{
|
||||
this.player = player;
|
||||
this.renderPartialTicks = renderPartialTicks;
|
||||
this.overlayType = type;
|
||||
if (this.overlayType == OverlayType.BLOCK)
|
||||
this.blockForOverlay = block;
|
||||
else
|
||||
this.blockForOverlay = null;
|
||||
this.blockX = blockX;
|
||||
this.blockY = blockY;
|
||||
this.blockZ = blockZ;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue