Merge remote-tracking branch 'origin/pr/3115' into 1.10.x

This commit is contained in:
cpw 2016-07-24 10:38:20 -04:00
commit 31b3825069
4 changed files with 111 additions and 5 deletions

View File

@ -9,7 +9,23 @@
{
EnumHand enumhand1 = abstractclientplayer.func_184600_cs();
flag = enumhand1 == EnumHand.MAIN_HAND;
@@ -361,7 +361,7 @@
@@ -334,6 +334,7 @@
{
float f3 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F;
float f5 = 1.0F - (this.field_187470_g + (this.field_187469_f - this.field_187470_g) * p_78440_1_);
+ if(!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHandSpecific(EnumHand.MAIN_HAND, p_78440_1_, f1, f3, f5, this.field_187467_d))
this.func_187457_a(abstractclientplayer, p_78440_1_, f1, EnumHand.MAIN_HAND, f3, this.field_187467_d, f5);
}
@@ -341,6 +342,7 @@
{
float f4 = enumhand == EnumHand.OFF_HAND ? f : 0.0F;
float f6 = 1.0F - (this.field_187472_i + (this.field_187471_h - this.field_187472_i) * p_78440_1_);
+ if(!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHandSpecific(EnumHand.OFF_HAND, p_78440_1_, f1, f4, f6, this.field_187468_e))
this.func_187457_a(abstractclientplayer, p_78440_1_, f1, EnumHand.OFF_HAND, f4, this.field_187468_e, f6);
}
@@ -361,7 +363,7 @@
this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside);
}
}
@ -18,7 +34,7 @@
{
if (flag && this.field_187468_e == null)
{
@@ -445,6 +445,7 @@
@@ -445,6 +447,7 @@
if (this.field_78455_a.field_71439_g.func_70094_T())
{
IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g));
@ -26,7 +42,7 @@
EntityPlayer entityplayer = this.field_78455_a.field_71439_g;
for (int i = 0; i < 8; ++i)
@@ -458,11 +459,13 @@
@@ -458,11 +461,13 @@
if (iblockstate1.func_177230_c().func_176214_u())
{
iblockstate = iblockstate1;
@ -40,7 +56,7 @@
this.func_178108_a(p_78447_1_, this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(iblockstate));
}
}
@@ -471,11 +474,13 @@
@@ -471,11 +476,13 @@
{
if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h))
{
@ -54,7 +70,7 @@
this.func_78442_d(p_78447_1_);
}
}
@@ -597,8 +602,8 @@
@@ -597,8 +604,8 @@
else
{
float f = entityplayersp.func_184825_o(1.0F);

View File

@ -80,6 +80,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -98,6 +99,7 @@ import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.event.RenderHandEventSpecific;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.ScreenshotEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
@ -169,6 +171,11 @@ public class ForgeHooksClient
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(context, partialTicks, renderPass));
}
public static boolean renderFirstPersonHandSpecific(EnumHand hand, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack)
{
return MinecraftForge.EVENT_BUS.post(new RenderHandEventSpecific(hand, partialTicks, interpPitch, swingProgress, equipProgress, stack));
}
public static void onTextureStitchedPre(TextureMap map)
{
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map));

View File

@ -23,6 +23,12 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.client.renderer.RenderGlobal;
/**
* This event is fired on {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
* before both hands are rendered.
* Canceling this event prevents either hand from being rendered,
* and prevents {@link RenderHandEventSpecific} from firing.
*/
@Cancelable
public class RenderHandEvent extends Event
{

View File

@ -0,0 +1,77 @@
package net.minecraftforge.client.event;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import javax.annotation.Nullable;
/**
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
* whenever a hand is rendered in first person.
* Canceling the event causes the hand to not render.
*/
@Cancelable
public class RenderHandEventSpecific extends Event
{
private final EnumHand hand;
private final float partialTicks;
private final float interpolatedPitch;
private final float swingProgress;
private final float equipProgress;
private final ItemStack stack;
public RenderHandEventSpecific(EnumHand hand, float partialTicks, float interpolatedPitch, float swingProgress, float equipProgress, ItemStack stack)
{
this.hand = hand;
this.partialTicks = partialTicks;
this.interpolatedPitch = interpolatedPitch;
this.swingProgress = swingProgress;
this.equipProgress = equipProgress;
this.stack = stack;
}
public EnumHand getHand()
{
return hand;
}
public float getPartialTicks()
{
return partialTicks;
}
/**
* @return The interpolated pitch of the player entity
*/
public float getInterpolatedPitch()
{
return interpolatedPitch;
}
/**
* @return The swing progress of the hand being rendered
*/
public float getSwingProgress()
{
return swingProgress;
}
/**
* @return The progress of the equip animation. 1.0 is fully equipped.
*/
public float getEquipProgress()
{
return equipProgress;
}
/**
* @return The ItemStack to be rendered, or null.
*/
@Nullable
public ItemStack getItemStack()
{
return stack;
}
}