mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Merge pull request #2476 from Abastro/fovfixes
Added Event: EntityViewRenderEvent#FOVModifier
This commit is contained in:
commit
250a77b359
4 files changed
+65
-2
No files matched your search
@@ -196,6 +196,12 @@ public class ForgeHooksClient
|
||||
MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
|
||||
return fovUpdateEvent.newfov;
|
||||
}
|
||||
|
||||
public static float getFOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) {
|
||||
EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, block, renderPartialTicks, fov);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getFOV();
|
||||
}
|
||||
|
||||
private static int skyX, skyZ;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Event that hooks into EntityRenderer, allowing any feature to customize visual attributes of
|
||||
* fog the player sees.
|
||||
* Event that hooks into EntityRenderer, allowing any feature to customize visual attributes
|
||||
* the player sees.
|
||||
*/
|
||||
public abstract class EntityViewRenderEvent extends Event
|
||||
{
|
||||
@@ -94,4 +94,26 @@ public abstract class EntityViewRenderEvent extends Event
|
||||
this.roll = roll;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event that allows mods to alter the raw FOV itself.
|
||||
* This directly affects to the FOV without being modified.
|
||||
* */
|
||||
public static class FOVModifier extends EntityViewRenderEvent
|
||||
{
|
||||
private float fov;
|
||||
|
||||
public FOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) {
|
||||
super(renderer, entity, block, renderPartialTicks);
|
||||
this.setFOV(fov);
|
||||
}
|
||||
|
||||
public float getFOV() {
|
||||
return fov;
|
||||
}
|
||||
|
||||
public void setFOV(float fov) {
|
||||
this.fov = fov;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user