Added fov hook
Small formatting changes (opening braces on new line)
This commit is contained in:
parent
6da6e9da07
commit
ee0cb12810
|
@ -7,6 +7,8 @@ import java.util.TreeSet;
|
|||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -21,11 +23,9 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -326,14 +326,23 @@ public class ForgeHooksClient
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean postMouseEvent() {
|
||||
public static boolean postMouseEvent()
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new MouseEvent());
|
||||
}
|
||||
|
||||
public static float getOffsetFOV(EntityPlayerSP entity, float fov)
|
||||
{
|
||||
FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
|
||||
MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
|
||||
return fovUpdateEvent.newfov;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of Forge Renderers.
|
||||
*/
|
||||
static {
|
||||
static
|
||||
{
|
||||
FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
/**
|
||||
* Author: MachineMuse (Claire Semple)
|
||||
* Created: 6:07 PM, 9/5/13
|
||||
*/
|
||||
public class FOVUpdateEvent extends Event
|
||||
{
|
||||
public final EntityPlayerSP entity;
|
||||
public final float fov;
|
||||
public float newfov;
|
||||
|
||||
public FOVUpdateEvent(EntityPlayerSP entity, float fov)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.fov = fov;
|
||||
this.newfov = fov;
|
||||
}
|
||||
}
|
|
@ -9,7 +9,8 @@ import org.lwjgl.input.Mouse;
|
|||
* Created: 2:46 PM, 9/4/13
|
||||
*/
|
||||
@Cancelable
|
||||
public class MouseEvent extends Event {
|
||||
public class MouseEvent extends Event
|
||||
{
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int dx;
|
||||
|
@ -19,7 +20,8 @@ public class MouseEvent extends Event {
|
|||
public final boolean buttonstate;
|
||||
public final long nanoseconds;
|
||||
|
||||
public MouseEvent() {
|
||||
public MouseEvent()
|
||||
{
|
||||
this.x = Mouse.getEventX();
|
||||
this.y = Mouse.getEventY();
|
||||
this.dx = Mouse.getEventDX();
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
--- ../src_base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
|
||||
+++ ../src_work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
|
||||
@@ -49,6 +49,8 @@
|
||||
@@ -49,6 +49,9 @@
|
||||
import net.minecraft.util.MovementInput;
|
||||
import net.minecraft.util.Session;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.client.ForgeHooksClient;
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
+import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class EntityPlayerSP extends AbstractClientPlayer
|
||||
@@ -570,18 +572,66 @@
|
||||
@@ -343,7 +346,7 @@
|
||||
f *= 1.0F - f1 * 0.15F;
|
||||
}
|
||||
|
||||
- return f;
|
||||
+ return ForgeHooksClient.getOffsetFOV(this, f);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,18 +573,66 @@
|
||||
*/
|
||||
protected boolean pushOutOfBlocks(double par1, double par3, double par5)
|
||||
{
|
||||
|
@ -82,7 +92,7 @@
|
|||
byte b0 = -1;
|
||||
double d5 = 9999.0D;
|
||||
|
||||
@@ -685,6 +735,12 @@
|
||||
@@ -685,6 +736,12 @@
|
||||
|
||||
public void playSound(String par1Str, float par2, float par3)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue