mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-23 21:49:46 +00:00
This commit is contained in:
1 parent
5c88451f6f
commit
5d0fb2967c
2 files changed
+54
No files matched your search
@@ -19,12 +19,19 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
|
||||
/**
|
||||
* An event called whenever the selection highlight around blocks is about to be rendered.
|
||||
* Canceling this event stops the selection highlight from being rendered.
|
||||
*/
|
||||
//TODO: in 1.15 rename to DrawHighlightEvent
|
||||
@Cancelable
|
||||
public class DrawBlockHighlightEvent extends Event
|
||||
{
|
||||
@@ -48,4 +55,41 @@ public class DrawBlockHighlightEvent extends Event
|
||||
public RayTraceResult getTarget() { return target; }
|
||||
public int getSubID() { return subID; }
|
||||
public float getPartialTicks() { return partialTicks; }
|
||||
|
||||
/**
|
||||
* A variant of the DrawBlockHighlightEvent only called when a block is highlighted.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class HighlightBlock extends DrawBlockHighlightEvent
|
||||
{
|
||||
public HighlightBlock(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
{
|
||||
super(context, info, target, subID, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRayTraceResult getTarget()
|
||||
{
|
||||
return (BlockRayTraceResult) super.target;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A variant of the DrawBlockHighlightEvent only called when an entity is highlighted.
|
||||
* Canceling this event has no effect.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class HighlightEntity extends DrawBlockHighlightEvent
|
||||
{
|
||||
public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
{
|
||||
super(context, info, target, subID, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRayTraceResult getTarget()
|
||||
{
|
||||
return (EntityRayTraceResult) super.target;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user