Render local player when the renderViewEntity is not the local player (#7216)
This commit is contained in:
parent
0d7f507f4e
commit
8c68731838
|
@ -47,6 +47,15 @@
|
|||
this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2);
|
||||
if (this.field_72769_h.func_239132_a_().func_239217_c_()) {
|
||||
RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_());
|
||||
@@ -972,7 +979,7 @@
|
||||
IRenderTypeBuffer.Impl irendertypebuffer$impl = this.field_228415_m_.func_228487_b_();
|
||||
|
||||
for(Entity entity : this.field_72769_h.func_217416_b()) {
|
||||
- if ((this.field_175010_j.func_229086_a_(entity, clippinghelper, d0, d1, d2) || entity.func_184215_y(this.field_72777_q.field_71439_g)) && (entity != p_228426_6_.func_216773_g() || p_228426_6_.func_216770_i() || p_228426_6_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_228426_6_.func_216773_g()).func_70608_bn()) && (!(entity instanceof ClientPlayerEntity) || p_228426_6_.func_216773_g() == entity)) {
|
||||
+ if ((this.field_175010_j.func_229086_a_(entity, clippinghelper, d0, d1, d2) || entity.func_184215_y(this.field_72777_q.field_71439_g)) && (entity != p_228426_6_.func_216773_g() || p_228426_6_.func_216770_i() || p_228426_6_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_228426_6_.func_216773_g()).func_70608_bn()) && (!(entity instanceof ClientPlayerEntity) || p_228426_6_.func_216773_g() == entity || (entity == field_72777_q.field_71439_g && !field_72777_q.field_71439_g.func_175149_v()))) { //FORGE: render local player entity when it is not the renderViewEntity
|
||||
++this.field_72749_I;
|
||||
if (entity.field_70173_aa == 0) {
|
||||
entity.field_70142_S = entity.func_226277_ct_();
|
||||
@@ -1010,6 +1017,7 @@
|
||||
List<TileEntity> list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b();
|
||||
if (!list.isEmpty()) {
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package net.minecraftforge.debug.client.rendering;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod(RenderLocalPlayerTest.MODID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||
public class RenderLocalPlayerTest
|
||||
{
|
||||
public static final String MODID = "render_local_player_test";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onItemRightClickEntity(final PlayerInteractEvent.EntityInteract event)
|
||||
{
|
||||
if (ENABLED && event.getItemStack().getItem() == Items.STICK)
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.getRenderViewEntity() == mc.player)
|
||||
{
|
||||
mc.setRenderViewEntity(event.getTarget());
|
||||
|
||||
event.setCancellationResult(ActionResultType.SUCCESS);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onItemRightClick(final PlayerInteractEvent.RightClickItem event)
|
||||
{
|
||||
if (ENABLED && event.getItemStack().getItem() == Items.STICK)
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.getRenderViewEntity() != mc.player)
|
||||
{
|
||||
mc.setRenderViewEntity(mc.player);
|
||||
|
||||
event.setCancellationResult(ActionResultType.SUCCESS);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -94,3 +94,5 @@ license="LGPL v2.1"
|
|||
modId="structure_spawn_list_event_test"
|
||||
[[mods]]
|
||||
modId="forge_codecs_test"
|
||||
[[mods]]
|
||||
modId="render_local_player_test"
|
Loading…
Reference in New Issue