Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8][SOLVED]Trying to Replace Player Renderer In Event Handler
The update for 1.13 is being worked on - please be patient. (Updated 02/19/19)
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
gummby8

[1.8][SOLVED]Trying to Replace Player Renderer In Event Handler

Started by gummby8, October 27, 2016

16 posts in this topic

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

Pretty sure this should be an easy fix, but well see

 

Replacing the player renderererer so I can make a player knockdown effect. The below code works on the client in SP, but when I try to launch a server, it crashes.

 

I think it is crashing because the RenderKnockedDown class doesn't belong on a server.

 

[19:04:44] [server thread/ERROR] [FML]: Caught exception from mb
java.lang.NoClassDefFoundError: com/Splosions/ModularBosses/client/render/entity/RenderKnockedDown

 

 

public class MBEventHandler {


private final RenderKnockedDown knockedDown = new RenderKnockedDown(Minecraft.getMinecraft().getRenderManager());

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Pre event) {

	if (ModularBosses.instance.playerTarget != null && MBExtendedPlayer.get((EntityPlayer) event.entity).knockdownTime > 0) {

		 event.setCanceled(true);

		 knockedDown.doRender(event.entity, 0D, 0D, 0D, 0.0625F, 0.0625F);

	}

}

 

The render is registered right along with all my other renders. And as I said it works just fine when in single player.

 

so where am I supposed to put this line so it doesn't run on the server?

 

private final RenderKnockedDown knockedDown = new RenderKnockedDown(Minecraft.getMinecraft().getRenderManager());

 

Or am I registering my event handler improperly?

 

 

@Mod.EventHandler
public void load(FMLInitializationEvent event) {
	MinecraftForge.EVENT_BUS.register(new MBEventHandler());
}

Share this post


Link to post
Share on other sites

LexManos    1470

LexManos

LexManos    1470

  • Reality Controller
  • LexManos
  • Forge Code God
  • 1470
  • 8364 posts
  • Report post
Posted October 27, 2016

Never use @SideOnly in your code.

You should use standard practices for Java to make code not run on the server side.

As in, only reference/load this class IF you're on the client.

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

Never use @SideOnly in your code.

You should use standard practices for Java to make code not run on the server side.

As in, only reference/load this class IF you're on the client.

 

So you are saying I need to make a client side only event handler?

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

Ok I made a new event handler and registered it in the client proxy, hope that is the right thing to do

 


@Override
public void preInit() {
	super.preInit();
	FMLCommonHandler.instance().bus().register(new RenderTickHandler());
	ModModelManager.INSTANCE.registerAllModels();
	MinecraftForge.EVENT_BUS.register(new MBClientEventHandler()); // <--- THERE IT IS
}

 

 

Still using the same thing for the render swap in the event handler...minus the client side part

 

 


private final RenderKnockedDown knockedDown = new RenderKnockedDown(Minecraft.getMinecraft().getRenderManager());

@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Pre event) {

	if (ModularBosses.instance.playerTarget != null && MBExtendedPlayer.get((EntityPlayer) event.entity).knockdownTime > 0) {

		 event.setCanceled(true);

		 knockedDown.doRender(event.entity, 0D, 0D, 0D, 0.0625F, 0.0625F);


	}

}

 

 

Renderer


public class RenderKnockedDown extends RenderPlayer
{
    /** this field is used to indicate the 3-pixel wide arms */
    private boolean smallArms;
    private static final String __OBFID = "CL_00001020";

    public RenderKnockedDown(RenderManager renderManager)
    {
        this(renderManager, false);
    }

    public RenderKnockedDown(RenderManager renderManager, boolean useSmallArms)
    {
        super(renderManager);
        this.smallArms = useSmallArms;
        this.addLayer(new LayerBipedArmor(this));
        this.addLayer(new LayerHeldItem(this));
        this.addLayer(new LayerArrow(this));
        this.addLayer(new LayerDeadmau5Head(this));
        this.addLayer(new LayerCape(this));
        this.addLayer(new LayerCustomHead(this.getPlayerModel().bipedHead));
    }

    @Override
    public void doRender(EntityLivingBase entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    	GL11.glPushMatrix();
	GL11.glTranslatef(0, 0.15f, 0);
	GL11.glRotatef(-90, 1, 0, 0);
	GL11.glRotatef(-entity.rotationYaw, 0, 0, 1);
	GL11.glRotatef(entity.rotationYaw, 0, 1, 0);
      	func_180596_a((AbstractClientPlayer)entity, x, y, z, p_76986_8_, partialTicks);//	<--------------Crashes Here
      	GL11.glPopMatrix();
        
    }

}

 

 

 

Crash Log

Not sure if there is more or not, it just spams this till the client crashes. Even if I put in a try/catch with a print stacktrace it just keeps doing this

at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.doRender(RenderKnockedDown.java:65) ~[RenderKnockedDown.class:?]
at com.Splosions.ModularBosses.handler.MBClientEventHandler.onRenderPlayer(MBClientEventHandler.java:43) ~[MBClientEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_7_MBClientEventHandler_onRenderPlayer_Pre.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(Unknown Source) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(Unknown Source) ~[EventBus.class:?]
at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(Unknown Source) ~[RenderPlayer.class:?]

 

 

So now I am at a loss

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12867 posts
  • Report post
Posted October 27, 2016

btw, this:

private static final String __OBFID = "CL_00001020";

Remove that.  That's used by gradle to reobfuscate vanilla class files.

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

K did that

 

I output the log to a file and found it is a stack overflow, usually that means an infinite loop right?

 

 


[20:23:09] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.RenderPlayerEvent$Pre@3644ae12:
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_111]
at java.io.FilePermission.init(Unknown Source) ~[?:1.8.0_111]
at java.io.FilePermission.<init>(Unknown Source) ~[?:1.8.0_111]
at java.lang.SecurityManager.checkRead(Unknown Source) ~[?:1.8.0_111]
at java.io.File.exists(Unknown Source) ~[?:1.8.0_111]
at java.io.WinNTFileSystem.canonicalize(Unknown Source) ~[?:1.8.0_111]
at java.io.File.getCanonicalPath(Unknown Source) ~[?:1.8.0_111]
at java.io.FilePermission$1.run(Unknown Source) ~[?:1.8.0_111]
at java.io.FilePermission$1.run(Unknown Source) ~[?:1.8.0_111]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_111]
at java.io.FilePermission.init(Unknown Source) ~[?:1.8.0_111]
at java.io.FilePermission.<init>(Unknown Source) ~[?:1.8.0_111]
at java.lang.SecurityManager.checkRead(Unknown Source) ~[?:1.8.0_111]
at java.io.File.exists(Unknown Source) ~[?:1.8.0_111]
at sun.misc.URLClassPath$FileLoader.getResource(Unknown Source) ~[?:1.8.0_111]
at sun.misc.URLClassPath.getResource(Unknown Source) ~[?:1.8.0_111]
at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_111]
at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_111]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_111]
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_111]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_111]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[?:1.8.0_111]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_111]
at org.apache.logging.log4j.core.impl.Log4jLogEvent.<init>(Log4jLogEvent.java:114) ~[log4j-core-2.0-beta9.jar:2.0-beta9]
at org.apache.logging.log4j.core.impl.Log4jLogEvent.<init>(Log4jLogEvent.java:90) ~[log4j-core-2.0-beta9.jar:2.0-beta9]
at org.apache.logging.log4j.core.impl.DefaultLogEventFactory.createEvent(DefaultLogEventFactory.java:49) ~[log4j-core-2.0-beta9.jar:2.0-beta9]
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:365) ~[log4j-core-2.0-beta9.jar:2.0-beta9]
at org.apache.logging.log4j.core.Logger.log(Logger.java:110) ~[log4j-core-2.0-beta9.jar:2.0-beta9]
at org.apache.logging.log4j.spi.AbstractLogger.log(AbstractLogger.java:1448) ~[log4j-api-2.0-beta9.jar:2.0-beta9]
at net.minecraftforge.fml.relauncher.FMLRelaunchLog.log(Unknown Source) ~[forgeSrc-1.8-11.14.3.1521.jar:?]
at net.minecraftforge.fml.common.FMLLog.log(Unknown Source) ~[FMLLog.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.handleException(Unknown Source) ~[EventBus.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(Unknown Source) ~[EventBus.class:?]
at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(Unknown Source) ~[RenderPlayer.class:?]
at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.doRender(RenderKnockedDown.java:65) ~[RenderKnockedDown.class:?]
at com.Splosions.ModularBosses.handler.MBClientEventHandler.onRenderPlayer(MBClientEventHandler.java:43) ~[MBClientEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_7_MBClientEventHandler_onRenderPlayer_Pre.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(Unknown Source) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(Unknown Source) ~[EventBus.class:?]

 

 

So breaking the event, setting another renderer and telling that render to doRender is firing the event again......I think that is where the loop is.

 

What can I add to the if statement in the event handler to break the loop after it has rendered with the proper renderer?

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12867 posts
  • Report post
Posted October 27, 2016

Generally speaking, yes.

 

My guess is that func_180596_a eventually makes a call back to your renderer.

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

ok, I fixed the infinite loop

 

!(event.renderer instanceof RenderKnockedDown)

 


	if (ModularBosses.instance.playerTarget != null && MBExtendedPlayer.get((EntityPlayer) event.entity).knockdownTime > 0 && !(event.renderer instanceof RenderKnockedDown)) {

		 event.setCanceled(true);

		knockedDown.doRender(event.entityPlayer, 0D, 0D, 0D, 0.0625F, 0.0625F);

		EntityPlayer player = event.entityPlayer;
}

 

so now it doesnt get a stackoverflow any more, instead I get NPE errors YAY! No idea why. It is definitely passing info to the method

 

 

[21:12:25] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.RenderPlayerEvent$Pre@583eecde:
java.lang.NullPointerException
at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(Unknown Source) ~[RenderPlayer.class:?]
at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.doRender(RenderKnockedDown.java:64) ~[RenderKnockedDown.class:?]
at com.Splosions.ModularBosses.handler.MBClientEventHandler.onRenderPlayer(MBClientEventHandler.java:49) ~[MBClientEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_7_MBClientEventHandler_onRenderPlayer_Pre.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(Unknown Source) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(Unknown Source) [EventBus.class:?]
at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(Unknown Source) [RenderPlayer.class:?]
at net.minecraft.client.renderer.entity.RenderPlayer.doRender(Unknown Source) [RenderPlayer.class:?]
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(Unknown Source) [RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(Unknown Source) [RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(Unknown Source) [RenderManager.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(Unknown Source) [RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(Unknown Source) [EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(Unknown Source) [EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(Unknown Source) [EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Unknown Source) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Unknown Source) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Unknown Source) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
[21:12:25] [Client thread/ERROR] [FML]: Index: 1 Listeners:
[21:12:25] [Client thread/ERROR] [FML]: 0: NORMAL
[21:12:25] [Client thread/ERROR] [FML]: 1: ASM: com.Splosions.ModularBosses.handler.MBClientEventHandler@20f1c8ed onRenderPlayer(Lnet/minecraftforge/client/event/RenderPlayerEvent$Pre;)V
[21:12:26] [server thread/INFO]: Stopping server
[21:12:26] [server thread/INFO]: Saving players
[21:12:26] [server thread/INFO]: Saving worlds
[21:12:26] [server thread/INFO]: Saving chunks for level 'Copy of New World'/Overworld
[21:12:26] [server thread/INFO]: Saving chunks for level 'Copy of New World'/Nether
[21:12:26] [server thread/INFO]: Saving chunks for level 'Copy of New World'/The End
[21:12:26] [server thread/INFO]: Saving chunks for level 'Copy of New World'/BossDimension
[21:12:26] [server thread/INFO] [FML]: Unloading dimension 0
[21:12:26] [server thread/INFO] [FML]: Unloading dimension -1
[21:12:26] [server thread/INFO] [FML]: Unloading dimension 1
[21:12:26] [server thread/INFO] [FML]: Unloading dimension -3
[21:12:26] [server thread/INFO] [FML]: Applying holder lookups
[21:12:26] [server thread/INFO] [FML]: Holder lookups applied
[21:12:27] [Client thread/FATAL]: Unreported exception thrown!
java.lang.NullPointerException
at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source) ~[CrashReportCategory.class:?]
at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source) ~[CrashReport.class:?]
at net.minecraft.crash.CrashReport.makeCategory(Unknown Source) ~[CrashReport.class:?]
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(Unknown Source) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(Unknown Source) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(Unknown Source) ~[RenderManager.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(Unknown Source) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(Unknown Source) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(Unknown Source) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(Unknown Source) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Unknown Source) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Unknown Source) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Unknown Source) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
[21:12:27] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:-1]: ---- Minecraft Crash Report ----
// I blame Dinnerbone.

Time: 10/26/16 9:12 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source)
at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source)
at net.minecraft.crash.CrashReport.makeCategory(Unknown Source)
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(Unknown Source)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(Unknown Source)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(Unknown Source)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(Unknown Source)
at net.minecraft.client.Minecraft.runGameLoop(Unknown Source)
at net.minecraft.client.Minecraft.run(Unknown Source)
at net.minecraft.client.main.Main.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source)
at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source)
at net.minecraft.crash.CrashReport.makeCategory(Unknown Source)
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(Unknown Source)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(Unknown Source)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(Unknown Source)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(Unknown Source)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player649'/1, l='MpServer', x=130.69, y=56.00, z=-1312.75]]
Chunk stats: MultiplayerChunkCache: 599, 599
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options: 
Level spawn location: 147.00,4.00,-1324.00 - World: (147,4,-1324), Chunk: (at 3,0,4 in 9,-83; contains blocks 144,0,-1328 to 159,255,-1313), Region: (0,-3; contains chunks 0,-96 to 31,-65, blocks 0,0,-1536 to 511,255,-1025)
Level time: 2629 game time, 2629 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 2 total; [EntityShadeHowler['entity.mb.ShadeHowler.name'/0, l='MpServer', x=138.50, y=56.00, z=-1310.53], EntityPlayerSP['Player649'/1, l='MpServer', x=130.69, y=56.00, z=-1312.75]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(Unknown Source)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Unknown Source)
at net.minecraft.client.Minecraft.run(Unknown Source)
at net.minecraft.client.main.Main.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_111, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 686266240 bytes (654 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1521 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1521.jar) 
UCHIJAAAA	Forge{11.14.3.1521} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1521.jar) 
UCHIJAAAA	mb{1.0} [Modular Bosses] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 361.75' Renderer: 'GeForce GTX 960/PCIe/SSE2'
Launched Version: 1.8
LWJGL: 2.9.1
OpenGL: GeForce GTX 960/PCIe/SSE2 GL version 4.5.0 NVIDIA 361.75, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: No
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: [converted-old-zeldaLTTP-converted-1407124408682.zip]
Current Language: English (US)
Profiler Position: N/A (disabled)
[21:12:27] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:-1]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Dropbox\Java\1.8\Mod\run\.\crash-reports\crash-2016-10-26_21.12.27-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release


 

 

The line 64 it refers to is the doRender portion of the render class

 

public class RenderKnockedDown extends RenderPlayer
{
    /** this field is used to indicate the 3-pixel wide arms */
    private boolean smallArms;

    public RenderKnockedDown(RenderManager renderManager)
    {
        this(renderManager, false);
    }

    public RenderKnockedDown(RenderManager renderManager, boolean useSmallArms)
    {
        super(renderManager);
        this.smallArms = useSmallArms;
        this.addLayer(new LayerBipedArmor(this));
        this.addLayer(new LayerHeldItem(this));
        this.addLayer(new LayerArrow(this));
        this.addLayer(new LayerDeadmau5Head(this));
        this.addLayer(new LayerCape(this));
        this.addLayer(new LayerCustomHead(this.getPlayerModel().bipedHead));
    }

    @Override
    public void doRender(EntityLivingBase entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    	GL11.glPushMatrix();
	GL11.glTranslatef(0, 0.15f, 0);
	GL11.glRotatef(-90, 1, 0, 0);
	GL11.glRotatef(-entity.rotationYaw, 0, 0, 1);
	GL11.glRotatef(entity.rotationYaw, 0, 1, 0);
      	func_180596_a((AbstractClientPlayer)entity, x, y, z, p_76986_8_, partialTicks);	 <--------------THIS LINE CRASHES
      	GL11.glPopMatrix();
        
    }

}

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12867 posts
  • Report post
Posted October 27, 2016

Actually it crashes inside func_180596_a, not where you call func_180596_a.

 

>	at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(Unknown Source) ~[RenderPlayer.class:?]
at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.doRender(RenderKnockedDown.java:64)

 

You will need to figure out what is null inside that method.

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

Copied that method into my class

 

    @Override
    public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_)
    {
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return;
        if (p_180596_1_ != null){
        if (!p_180596_1_.isUser() || this.renderManager.livingPlayer == p_180596_1_) <-------------- NPE CRASHES HERE
        {
            double d3 = p_180596_4_;

            if (p_180596_1_.isSneaking() && !(p_180596_1_ instanceof EntityPlayerSP))
            {
                d3 = p_180596_4_ - 0.125D;
            }

            this.func_177137_d(p_180596_1_);
            super.doRender((EntityLivingBase)p_180596_1_, p_180596_2_, d3, p_180596_6_, p_180596_8_, p_180596_9_);
        }
}
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_));
    }

 

 

Not sure why I am getting NPE there in relation to the entity that is passed. I even set a != null check and it goes through, then crashes at the same spot saying NPE.

 

I output the p_180596_1_ to the console and it prints out my playername, so it isn't null

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12867 posts
  • Report post
Posted October 27, 2016

P_180596_1 can't be null there (not only can it throw an NPE there,  but there's a != null check two lines up). It's the render manager that is.

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

I feel like this is getting out of hand and perhaps I am going about this the wrong way?

 

I have copied the methods that are causing the NPE errors into my renderer and pointed the angry lines to them. This solves most of the NPE errors.

 

But then it starts looping on itself again

 

So I copy those methods to the render class

 

Now I think I am down to 1 NPE error that I have no idea how it is happening

 


package com.Splosions.ModularBosses.client.render.entity;

import org.lwjgl.opengl.GL11;

import com.Splosions.ModularBosses.ModularBosses;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.client.renderer.entity.layers.LayerArrow;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.layers.LayerCape;
import net.minecraft.client.renderer.entity.layers.LayerCustomHead;
import net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head;
import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


public class RenderKnockedDown extends RenderPlayer
{
    /** this field is used to indicate the 3-pixel wide arms */
    private boolean smallArms;
    

    public RenderKnockedDown(RenderManager renderManager)
    {
        this(renderManager, false);
    }

    public RenderKnockedDown(RenderManager renderManager, boolean useSmallArms)
    {
        super(renderManager);
        this.smallArms = useSmallArms;
        this.addLayer(new LayerBipedArmor(this));
        this.addLayer(new LayerHeldItem(this));
        this.addLayer(new LayerArrow(this));
        this.addLayer(new LayerDeadmau5Head(this));
        this.addLayer(new LayerCape(this));
        this.addLayer(new LayerCustomHead(this.getPlayerModel().bipedHead));
    }

    @Override
    public void doRender(EntityLivingBase entity, double x, double y, double z, float yaw, float partialTicks)
    {
    	GL11.glPushMatrix();
	GL11.glTranslatef(0, 0.15f, 0);
	GL11.glRotatef(-90, 1, 0, 0);
	GL11.glRotatef(-entity.rotationYaw, 0, 0, 1);
	GL11.glRotatef(entity.rotationYaw, 0, 1, 0);

	try {
		func_180596_a((AbstractClientPlayer)entity, x, y, z, yaw, partialTicks);
	} catch(Exception e) {
		e.printStackTrace();
	}
      		
      	GL11.glPopMatrix();
        
    }
    
    
    
    public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_)
    {
    	
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return;

        if (!p_180596_1_.isUser() || Minecraft.getMinecraft().getRenderManager().livingPlayer == p_180596_1_)
        {
            double d3 = p_180596_4_;

            if (p_180596_1_.isSneaking() && !(p_180596_1_ instanceof EntityPlayerSP))
            {
                d3 = p_180596_4_ - 0.125D;
            }

            this.func_177137_d(p_180596_1_);
            mDoRender((EntityLivingBase)p_180596_1_, p_180596_2_, d3, p_180596_6_, p_180596_8_, p_180596_9_);
        }
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_));
    }
    
    
    public void mDoRender(EntityLivingBase entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return;
        GlStateManager.pushMatrix();
        GlStateManager.disableCull();
        this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks);
        this.mainModel.isRiding = entity.isRiding();
        this.mainModel.isChild = entity.isChild();

        try
        {
            float f2 = this.interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTicks);
            float f3 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks);
            float f4 = f3 - f2;
            float f5;

            if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase)
            {
                EntityLivingBase entitylivingbase1 = (EntityLivingBase)entity.ridingEntity;
                f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset, partialTicks);
                f4 = f3 - f2;
                f5 = MathHelper.wrapAngleTo180_float(f4);

                if (f5 < -85.0F)
                {
                    f5 = -85.0F;
                }

                if (f5 >= 85.0F)
                {
                    f5 = 85.0F;
                }

                f2 = f3 - f5;

                if (f5 * f5 > 2500.0F)
                {
                    f2 += f5 * 0.2F;
                }
            }

            float f9 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
            this.renderLivingAt(entity, x, y, z);
            f5 = this.handleRotationFloat(entity, partialTicks);
            this.rotateCorpse(entity, f5, f2, partialTicks);
            GlStateManager.enableRescaleNormal();
            GlStateManager.scale(-1.0F, -1.0F, 1.0F);
            this.preRenderCallback(entity, partialTicks);
            float f6 = 0.0625F;
            GlStateManager.translate(0.0F, -1.5078125F, 0.0F);
            float f7 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * partialTicks;
            float f8 = entity.limbSwing - entity.limbSwingAmount * (1.0F - partialTicks);

            if (entity.isChild())
            {
                f8 *= 3.0F;
            }

            if (f7 > 1.0F)
            {
                f7 = 1.0F;
            }

            GlStateManager.enableAlpha();
            this.mainModel.setLivingAnimations(entity, f8, f7, partialTicks);
            this.mainModel.setRotationAngles(f8, f7, f5, f4, f9, 0.0625F, entity);
            boolean flag;

            if (this.renderOutlines)
            {
                flag = this.func_177088_c(entity);
                this.renderModel(entity, f8, f7, f5, f4, f9, 0.0625F);

                if (flag)
                {
                    this.func_180565_e();
                }
            }
            else
            {
                flag = this.func_177090_c(entity, partialTicks);
                this.renderModel(entity, f8, f7, f5, f4, f9, 0.0625F);

                if (flag)
                {
                    this.func_177091_f();
                }

                GlStateManager.depthMask(true);

                if (!(entity instanceof EntityPlayer) || !((EntityPlayer)entity).isSpectator())
                {
                    this.func_177093_a(entity, f8, f7, partialTicks, f5, f4, f9, 0.0625F);
                }
            }

            GlStateManager.disableRescaleNormal();
        } catch(Exception e) {

	e.printStackTrace();
        }

        GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GlStateManager.enableTexture2D();
        GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
        GlStateManager.enableCull();
        GlStateManager.popMatrix();

        if (!this.renderOutlines)
        {
           // super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
        }
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z));
    }
    
    
    
    protected void renderModel(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_)
    {
        boolean flag = !p_77036_1_.isInvisible();
        boolean flag1 = !flag && !p_77036_1_.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer);

        if (flag || flag1)
        {
            if (!this.bindEntityTexture(p_77036_1_))
            {
                return;
            }

            if (flag1)
            {
                GlStateManager.pushMatrix();
                GlStateManager.color(1.0F, 1.0F, 1.0F, 0.15F);
                GlStateManager.depthMask(false);
                GlStateManager.enableBlend();
                GlStateManager.blendFunc(770, 771);
                GlStateManager.alphaFunc(516, 0.003921569F);
            }

            this.mainModel.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);

            if (flag1)
            {
                GlStateManager.disableBlend();
                GlStateManager.alphaFunc(516, 0.1F);
                GlStateManager.popMatrix();
                GlStateManager.depthMask(true);
            }
        }
    }
    
    protected boolean bindEntityTexture(Entity entity)
    {
        ResourceLocation resourcelocation = this.getEntityTexture((EntityPlayer)entity);
        
        if (resourcelocation == null)
        {
            return false;
        }
        else
        {
        	System.out.println(resourcelocation);
        	this.bindTexture(resourcelocation);     
            return true;
        }
    }
    
    
    
    
    public void bindTexture(ResourceLocation location)
    {
        this.renderManager.renderEngine.bindTexture(location);  <---------------------------CRASHES HERE
    }
    
       
    
    
    
    private void func_177137_d(AbstractClientPlayer p_177137_1_)
    {
        ModelPlayer modelplayer = this.getPlayerModel();

        if (p_177137_1_.isSpectator())
        {
            modelplayer.setInvisible(false);
            modelplayer.bipedHead.showModel = true;
            modelplayer.bipedHeadwear.showModel = true;
        }
        else
        {
            ItemStack itemstack = p_177137_1_.inventory.getCurrentItem();
            modelplayer.setInvisible(true);
            modelplayer.bipedHeadwear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.HAT);
            modelplayer.bipedBodyWear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.JACKET);
            modelplayer.bipedLeftLegwear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.LEFT_PANTS_LEG);
            modelplayer.bipedRightLegwear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.RIGHT_PANTS_LEG);
            modelplayer.bipedLeftArmwear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.LEFT_SLEEVE);
            modelplayer.bipedRightArmwear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.RIGHT_SLEEVE);
            modelplayer.heldItemLeft = 0;
            modelplayer.aimedBow = false;
            modelplayer.isSneak = p_177137_1_.isSneaking();

            if (itemstack == null)
            {
                modelplayer.heldItemRight = 0;
            }
            else
            {
                modelplayer.heldItemRight = 1;

                if (p_177137_1_.getItemInUseCount() > 0)
                {
                    EnumAction enumaction = itemstack.getItemUseAction();

                    if (enumaction == EnumAction.BLOCK)
                    {
                        modelplayer.heldItemRight = 3;
                    }
                    else if (enumaction == EnumAction.BOW)
                    {
                        modelplayer.aimedBow = true;
                    }
                }
            }
        }
    }

}

 

It throws NPEs at the bindtexture method, but there are already != null checks there, so I am not sure how I am getting NPE errors there. And the print shows that the resource location is not null.

 

 

[05:36:36] [Client thread/INFO] [sTDOUT]: [com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown:bindEntityTexture:267]: minecraft:skins/2cce44e913e9726c4bb39458f1401f31ab7bf44a6921c86df9411227c8d1
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NullPointerException
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.bindTexture(RenderKnockedDown.java:278)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.bindEntityTexture(RenderKnockedDown.java:268)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.renderModel(RenderKnockedDown.java:230)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.mDoRender(RenderKnockedDown.java:187)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.func_180596_a(RenderKnockedDown.java:100)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.client.render.entity.RenderKnockedDown.doRender(RenderKnockedDown.java:74)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.Splosions.ModularBosses.handler.MBClientEventHandler.onRenderPlayer(MBClientEventHandler.java:47)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_7_MBClientEventHandler_onRenderPlayer_Pre.invoke(.dynamic)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.common.eventhandler.EventBus.post(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.entity.RenderPlayer.doRender(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.RenderGlobal.renderEntities(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.EntityRenderer.renderWorld(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.runGameLoop(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.run(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.main.Main.main(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
[05:36:36] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at GradleStart.main(Unknown Source)

 

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12867 posts
  • Report post
Posted October 27, 2016

Ok, again, you're providing debug lines for the one thing that can't possibly throw an NPE.

renderManager.renderEngine.bindTexture(null)

is perfectly valid code. 

null.renderEngine.bindTexture(location)

or

renderManager.null.bindTexture(location)

are the only possible options that would cause an NPE.

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 27, 2016

Lol yeah I realized that after I got some caffeine in me this morning. Amazing that brains work better when they are awake.

 

Ok, no more NPEs and the player model does render now WOOT!

 

new problem

 

		event.setCanceled(true);
		knockedDown.doRender(player, 0, 0, 0, 0.0625F, event.partialRenderTick);

 

Those zeros

 

Those are not supposed to be zeros. Those are suppsoed to be xyz numbers. Because of those the player appears glued to the feet of the spectator

 

width=800 height=477https://dl.dropbox.com/s/l2kah4pmx6hycxe/Screenshot%202016-10-27%2009.12.11.png?dl=0[/img]

 

The shadow on the ground is where the player is, but as you see it is appearing by the spectators foot.

 

I tried using the call hierarchy to find what normally passes the xyz variables to the render, but never could find it.

Would you know what math I need to whip up to place the player back where it is supposed to be ?

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12867 posts
  • Report post
Posted October 27, 2016

Those are not supposed to be zeros. Those are suppsoed to be xyz numbers. Because of those the player appears glued to the feet of the spectator

 

event.getX(), event.getY(), event.getZ()?

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
  • Report post
Posted October 28, 2016

OK

 

I got it working...the worst part is...I have no idea how....sortof

 

I had to replace both the renderer and the model. The player has to be rotated in the model, but the player armor has to be rotated in the renderer.

 

I am going to try and clean up the render class in teh morning because it is full of commented out code trying to figure out which obfuscated method I was supposed to mess with.

 

RenderKnockDown

https://github.com/gummby8/ModularBosses/blob/master/main/java/com/Splosions/ModularBosses/client/render/entity/RenderKnockedDown.java

 

ModelKnockDown

https://github.com/gummby8/ModularBosses/blob/master/main/java/com/Splosions/ModularBosses/client/models/entity/ModelKnockdown.java

 

ClientEventHandler

https://github.com/gummby8/ModularBosses/blob/master/main/java/com/Splosions/ModularBosses/handler/MBClientEventHandler.java

 

YAY!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0
Go To Topic Listing Modder Support

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Drachenbauer
      Error with block registration

      By Drachenbauer · Posted 44 minutes ago

      Here is the whole new error log   I added the registry name thing to all my blocks. what also goes wrong here?
    • gunnerwolf
      Thank you Forge Developers

      By gunnerwolf · Posted 57 minutes ago

      Agreed. Forge is the vehicle that the modding community has driven to get as far as it has. There were solutions before, such as Risugami's Mod Loader, but they were just ways of applying multiple mods at once without conflicts, not actual APIs.

      Not only that, but it's my understanding that Forge makes some significant improvements and optimizations to Minecraft's code, and from status updates given in the past by Forge devs, I've seen several instances of devs not only taking their own free time to work on forge, but take time away from friends and family, and even time off work to help push Forge forwards.

      Thank you forge devs, for your hard work and dedication. I'm sure you guys have received a ton of hate from impatient people who don't understand how much work something like Forge is, so thank you for sticking with it.
    • wilechaote
      Local ForgeGradle build dependency caching

      By wilechaote · Posted 1 hour ago

      Quickly FTR, my working approach for this is to use the possibility to globally override the gradle properties: In build.gradle: In gradle.properties: These are then changed to a "file://" location in a local GIT repository containing the downloaded files. However, this might not yet be enough, as further resources appear to be loaded. More introspection needed here ;). [is there a way to move this thread to the ForgeGradle sub forum? I accidentally posted this here]?
    • Draco18s
      [1.13.2] how do i load my my custom block-models?

      By Draco18s · Posted 2 hours ago

      Yes. Evertything is automatic.
    • Mango106
      [1.12.2] extended class of FoodBase.java doesn't work

      By Mango106 · Posted 2 hours ago

      I made a bowl food item called fruit_salad, but when eat it, it doesn't restore any hunger or saturation.   I have a class that i created to add food items to my mod called FoodBase.java (code for that file below)   package com.citrine.testmod.items.food; import com.citrine.testmod.Main; import com.citrine.testmod.init.ModItems; import com.citrine.testmod.util.IHasModel; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemFood; public class FoodBase extends ItemFood implements IHasModel { public FoodBase(String name, int amount, float saturation, boolean isAnimalFood) /* * amount is shanks filled * saturation is saturation * isAnimalFood determines whether or not you can feed it to dogs * */ { super(amount, saturation, isAnimalFood); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.FOOD); ModItems.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } }   I use this class for adding normal food in my ModItems.java class in the init package. I wanted to add bowl items, that can only stack to one, and return a bowl to the player's inventory when eaten, so i made a new class that extends FoodBase called SoupBase.java (code below)   package com.citrine.testmod.items.food; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.items.ItemHandlerHelper; public class SoupBase extends FoodBase { private Item ReturnStack; public SoupBase(String name, int amount, float saturation, boolean isAnimalFood, Item item) { super(name, amount, saturation, isAnimalFood); this.setMaxStackSize(1); this.ReturnStack = item; } public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase living) { super.onFoodEaten(stack, world, (EntityPlayer)living); return new ItemStack(ReturnStack); } }   Now that i did that, i added a new SoupBase item called fruit_salad in ModItems.java   public static final Item FRUIT_SALAD = new SoupBase("fruit_salad", 11, 6.6f, false, Items.BOWL);   Heres the full ModItems.java class:   package com.citrine.testmod.init; import java.util.ArrayList; import java.util.List; import com.citrine.testmod.items.ItemBase; import com.citrine.testmod.items.armor.ArmorBase; import com.citrine.testmod.items.food.FoodBase; import com.citrine.testmod.items.food.FoodEffectBase; import com.citrine.testmod.items.food.SoupBase; import com.citrine.testmod.items.tools.ToolAxe; import com.citrine.testmod.items.tools.ToolHoe; import com.citrine.testmod.items.tools.ToolPickaxe; import com.citrine.testmod.items.tools.ToolSpade; import com.citrine.testmod.items.tools.ToolSword; import com.citrine.testmod.util.Reference; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.MobEffects; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.common.util.EnumHelper; public class ModItems { public static final List<Item> ITEMS = new ArrayList<Item>(); //Materials public static final ToolMaterial MATERIAL_AQUAMARINE = EnumHelper.addToolMaterial("material_aquamarine", 3, 2124, 9.0f, 4.0f, 25); public static final ArmorMaterial ARMOR_MATERIAL_SUGILITE = EnumHelper.addArmorMaterial("armo r_material_sugilite", Reference.MOD_ID + ":sugilite", 15, new int[] {3, 7, 9, 4} , 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0f); //add items public static final Item SUGILITE = new ItemBase("sugilite"); public static final Item URANIUM = new ItemBase("uranium"); public static final Item URANIUM_SUGILITE_FUSION = new ItemBase("uranium_sugilite_fusion"); public static final Item AQUAMARINE = new ItemBase("aquamarine"); //food //public static final Item BLUEBERRY = new FoodBase("blueberry", 3, 4.0f, false); (60*20 is one minute of ppotion effect) public static final Item BLUEBERRY = new FoodEffectBase ("blueberry", 3, 2.0f, false, new PotionEffect(MobEffects.SPEED, /*how long its lasts(3 seconds)*/(3*20),/*potion effect lvl*/ 2, /*whether or not it comes from a beacon*/false, /*shows whether or not particles are shown*/false)); public static final Item POO = new FoodEffectBase ("poo", 3, 0.0f, false, new PotionEffect(MobEffects.HUNGER, (12*20), 100, false, true)); public static final Item FISH_AND_CHIPS = new FoodBase("fish_and_chips", 10, 12.8f, false); public static final Item FRIED_EGG = new FoodBase("fried_egg", 5, 6, false); //public static final Item FRUIT_SALAD = new SoupBase("fruit_salad", 11, 6.6f, false), onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player); public static final Item FRUIT_SALAD = new SoupBase("fruit_salad", 11, 6.6f, false, Items.BOWL); //Tools public static final ItemSword AQUAMARINE_SWORD = new ToolSword("aquamarine_sword", MATERIAL_AQUAMARINE); public static final ItemSpade AQUAMARINE_SHOVEL = new ToolSpade("aquamarine_shovel", MATERIAL_AQUAMARINE); public static final ItemPickaxe AQUAMARINE_PICKAXE = new ToolPickaxe("aquamarine_pickaxe", MATERIAL_AQUAMARINE); public static final ItemAxe AQUAMARINE_AXE = new ToolAxe("aquamarine_axe", MATERIAL_AQUAMARINE); public static final ItemHoe AQUAMARINE_HOE = new ToolHoe("aquamarine_hoe", MATERIAL_AQUAMARINE); //armor public static final Item SUGILITE_HELMET = new ArmorBase("sugilite_helmet", ARMOR_MATERIAL_SUGILITE, 1, EntityEquipmentSlot.HEAD); public static final Item SUGILITE_CHESTPLATE = new ArmorBase("sugilite_chestplate", ARMOR_MATERIAL_SUGILITE, 1, EntityEquipmentSlot.CHEST); public static final Item SUGILITE_LEGGINGS = new ArmorBase("sugilite_leggings", ARMOR_MATERIAL_SUGILITE, 2, EntityEquipmentSlot.LEGS); public static final Item SUGILITE_BOOTS = new ArmorBase("sugilite_boots", ARMOR_MATERIAL_SUGILITE, 1, EntityEquipmentSlot.FEET); }   When I run client and test out the mod, I can eat the fruit salad, it stacks to 1 like i wanted, and it returns a bowl when its eaten. The only problem is that no hunger or saturation is restored when i eat it, for some reason. I'm quite sure what i did wrong, but I think it has something to do with SoupBase.java, as I don't have this problem with the normal class that it extends from. Does anyone know how to fix this?
  • Topics

    • Drachenbauer
      10
      Error with block registration

      By Drachenbauer
      Started 22 hours ago

    • PoofyKittens
      1
      Thank you Forge Developers

      By PoofyKittens
      Started 18 hours ago

    • wilechaote
      1
      Local ForgeGradle build dependency caching

      By wilechaote
      Started Friday at 02:01 PM

    • Drachenbauer
      8
      [1.13.2] how do i load my my custom block-models?

      By Drachenbauer
      Started Monday at 08:52 PM

    • Mango106
      0
      [1.12.2] extended class of FoodBase.java doesn't work

      By Mango106
      Started 2 hours ago

  • Who's Online (See full list)

    • wilechaote
    • Whodundid
    • unassigned
    • ZigTheHedge
    • DoctorLOGiQ
    • Paulon_the_brave
    • Socrates
    • SorenCabral
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8][SOLVED]Trying to Replace Player Renderer In Event Handler
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community