Jump to content

Recommended Posts

Posted

Why I receive this error in my new player renderer?

FATAL ERROR in native method: Thread[modloading-worker-1,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.

My Handler:

package soren.mymdl;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class PlayerManage {

	private final NewRenderer test = new NewRenderer(Minecraft.getInstance().getRenderManager());
	
	  @SubscribeEvent 
	  public void renderPlayerPre(RenderPlayerEvent.Pre event) {
		  
		  event.setCanceled(true);
		  test.doRender((AbstractClientPlayerEntity) event.getEntity(), 1, 1, 1, 0.625F, 0.625F);
		  
	  }
}

 

Posted

Post your full log and your code (preferably as a GitHub repo)

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
32 minutes ago, Cadiboo said:

Post your full log and your code (preferably as a GitHub repo)

[20:02:01.217] [modloading-worker-2/INFO] [ne.mi.co.ForgeMod/FORGEMOD]: Forge mod loading, version 27.0.25, for MC 1.14.3 with MCP 20190624.152911
[20:02:01.217] [modloading-worker-2/INFO] [ne.mi.co.MinecraftForge/FORGE]: MinecraftForge v27.0.25 Initialized
FATAL ERROR in native method: Thread[modloading-worker-1,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
	at org.lwjgl.opengl.GL11C.nglGenTextures(Native Method)
	at org.lwjgl.opengl.GL11C.glGenTextures(GL11C.java:664)
	at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:2492)
	at com.mojang.blaze3d.platform.GlStateManager.genTexture(GlStateManager.java:419)
	at com.mojang.blaze3d.platform.TextureUtil.generateTextureId(TextureUtil.java:27)
	at net.minecraft.client.renderer.texture.Texture.getGlTextureId(Texture.java:45)
	at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:22)
	at net.minecraft.client.renderer.entity.LivingRenderer.<clinit>(LivingRenderer.java:31)
	at soren.mymdl.PlayerManage.<init>(PlayerManage.java:11)
	at soren.mymdl.SorenMod.<init>(SorenMod.java:33)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:131)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer$$Lambda$1957/1324518852.accept(Unknown Source)
	at java.util.function.Consumer.lambda$andThen$0(Unknown Source)
	at java.util.function.Consumer$$Lambda$1956/1300011842.accept(Unknown Source)
	at java.util.function.Consumer.lambda$andThen$0(Unknown Source)
	at java.util.function.Consumer$$Lambda$1956/1300011842.accept(Unknown Source)
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
	at net.minecraftforge.fml.ModList.lambda$null$9(ModList.java:119)
	at net.minecraftforge.fml.ModList$$Lambda$2011/1533322181.accept(Unknown Source)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
	at java.util.concurrent.CountedCompleter.exec(Unknown Source)
	at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source)
	at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
	at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.util.stream.ReferencePipeline.forEach(Unknown Source)
	at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
	at net.minecraftforge.fml.ModList.lambda$dispatchParallelEvent$10(ModList.java:119)
	at net.minecraftforge.fml.ModList$$Lambda$2009/1340737883.run(Unknown Source)
	at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
	at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
	at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

And the Code: https://github.com/avphonix0/Minecraft-1.14.3/tree/master/src/main

Posted
9 hours ago, diesieben07 said:

You are trying to create a new instance of your renderer while your mod is being loaded. Mods are loaded in parallel, on separate threads. You have to create your renderer on the main thread.

Like this?

 

package soren.mymdl;

// imports //

@Mod("sorenmod")
public class SorenMod {

	public static IProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy());

	private static final Logger LOGGER = LogManager.getLogger();
	public static NewRenderer test = new NewRenderer(Minecraft.getInstance().getRenderManager());

	public SorenMod() {

		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
		MinecraftForge.EVENT_BUS.register(new PlayerManage());

	}

	private void setup(final FMLCommonSetupEvent event) {
		proxy.getClientWorld();
			
	}

	@SubscribeEvent
	public void onServerStarting(FMLServerStartingEvent event) {
	}


	@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
	public static class RegistryEvents {
   
	}
}
package soren.mymdl;

// imports //

public class PlayerManage {

	@SubscribeEvent 
	  public void renderPlayerPre(RenderPlayerEvent.Pre event) {
		  
		  event.setCanceled(true);
		  SorenMod.test.doRender((AbstractClientPlayerEntity) event.getEntity(), 1, 1, 1, 0.625F, 0.625F);

	  }
}

 

No more errors, but the player have not rendered.

Posted

The error LOG:

Spoiler

[21:07:06.754] [Client thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: null
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: soren.mymdl.PlayerManage@616e6f71 renderPlayerPre(Lnet/minecraftforge/client/event/RenderPlayerEvent$Pre;)V
java.lang.NullPointerException
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:56)
	at soren.mymdl.NewRenderer.doRender(NewRenderer.java:71)
	at soren.mymdl.PlayerManage.renderPlayerPre(PlayerManage.java:15)
	at net.minecraftforge.eventbus.ASMEventHandler_0_PlayerManage_renderPlayerPre_Pre.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:58)
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:33)
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntity(EntityRendererManager.java:370)
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:359)
	at net.minecraft.client.renderer.WorldRenderer.func_215326_a(WorldRenderer.java:549)
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:727)
	at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:655)
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:509)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:920)
	at net.minecraft.client.Minecraft.run(Minecraft.java:384)
	at net.minecraft.client.main.Main.main(Main.java:127)
	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.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:77)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:62)
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)

[21:07:06.904] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[21:07:06.905] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[21:07:06.918] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Dev lost connection: Disconnected
[21:07:06.918] [Server thread/INFO] [minecraft/MinecraftServer]: Dev left the game
[21:07:06.935] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Stopping singleplayer server as player logged out
[21:07:06.935] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds
[21:07:06.936] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'JavaTest'/minecraft:overworld
[21:07:07.122] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (JavaTest): All chunks are saved
[21:07:07.122] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save JavaTest
[21:07:07.138] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (JavaTest): All chunks are saved
[21:07:07.637] [Client thread/FATAL] [minecraft/Minecraft]: Reported exception thrown!
net.minecraft.crash.ReportedException: Rendering entity in world
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntity(EntityRendererManager.java:401) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:359) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.func_215326_a(WorldRenderer.java:549) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:727) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:655) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:509) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:920) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:384) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:127) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_211] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:77) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:62) [modlauncher-2.1.5.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {}
Caused by: java.lang.NullPointerException
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:56) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at soren.mymdl.NewRenderer.doRender(NewRenderer.java:71) ~[main/:?] {pl:runtimedistcleaner:A}
	at soren.mymdl.PlayerManage.renderPlayerPre(PlayerManage.java:15) ~[main/:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler_0_PlayerManage_renderPlayerPre_Pre.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-0.10.3-milestone.0.1+1a5fa31-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-0.10.3-milestone.0.1+1a5fa31-service.jar:?] {}
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:58) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:33) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntity(EntityRendererManager.java:370) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	... 19 more
[21:07:07.658] [Client thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:106]: ---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 7/14/19 9:07 PM
Description: Rendering entity in world

java.lang.NullPointerException: Rendering entity in world
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:56) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at soren.mymdl.NewRenderer.doRender(NewRenderer.java:71) ~[main/:?] {pl:runtimedistcleaner:A}
	at soren.mymdl.PlayerManage.renderPlayerPre(PlayerManage.java:15) ~[main/:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler_0_PlayerManage_renderPlayerPre_Pre.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-0.10.3-milestone.0.1+1a5fa31-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-0.10.3-milestone.0.1+1a5fa31-service.jar:?] {}
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:58) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.PlayerRenderer.doRender(PlayerRenderer.java:33) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntity(EntityRendererManager.java:370) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:359) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.func_215326_a(WorldRenderer.java:549) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:727) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:655) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:509) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:920) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:384) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:127) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_211] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_211] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:77) [modlauncher-2.1.5.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:62) [modlauncher-2.1.5.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.3-27.0.25_mapped_snapshot_20190621-1.14.2-recomp.jar:?] {}

 

 

Posted
35 minutes ago, SorenCabral said:

public static NewRenderer test = new NewRenderer(Minecraft.getInstance().getRenderManager());

No. You're now creating it in your main mod class which will crash on the server. You're problem is caused by something being null on the first line of PlayerRenderer#doRender. You are also calling PlayerRenderer#doRender from inside your replacement renderer, which will probably result in a StackOverflow.

Please post your NewRenderer class.

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

(For while is one copy, that render the same model. After fix all erros, I will try apply the changes).

How Im are new in modding, am learning per steps.

Spoiler

package soren.mymdl;

import com.mojang.blaze3d.platform.GlStateManager;

import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.LivingRenderer;
import net.minecraft.client.renderer.entity.PlayerRenderer;
import net.minecraft.client.renderer.entity.layers.ArrowLayer;
import net.minecraft.client.renderer.entity.layers.BipedArmorLayer;
import net.minecraft.client.renderer.entity.layers.CapeLayer;
import net.minecraft.client.renderer.entity.layers.Deadmau5HeadLayer;
import net.minecraft.client.renderer.entity.layers.ElytraLayer;
import net.minecraft.client.renderer.entity.layers.HeadLayer;
import net.minecraft.client.renderer.entity.layers.HeldItemLayer;
import net.minecraft.client.renderer.entity.layers.ParrotVariantLayer;
import net.minecraft.client.renderer.entity.layers.SpinAttackEffectLayer;
import net.minecraft.client.renderer.entity.model.BipedModel;
import net.minecraft.client.renderer.entity.model.PlayerModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerModelPart;
import net.minecraft.item.CrossbowItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.Hand;
import net.minecraft.util.HandSide;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class NewRenderer extends PlayerRenderer {
   public NewRenderer(EntityRendererManager renderManager) {
      this(renderManager, false);
   }

   public NewRenderer(EntityRendererManager renderManager, boolean useSmallArms) {
      super(renderManager);
      this.addLayer(new BipedArmorLayer<>(this, new BipedModel(0.5F), new BipedModel(1.0F)));
      this.addLayer(new HeldItemLayer<>(this));
      this.addLayer(new ArrowLayer<>(this));
      this.addLayer(new Deadmau5HeadLayer(this));
      this.addLayer(new CapeLayer(this));
      this.addLayer(new HeadLayer<>(this));
      this.addLayer(new ElytraLayer<>(this));
      this.addLayer(new ParrotVariantLayer<>(this));
      this.addLayer(new SpinAttackEffectLayer<>(this));
   }

   /**
    * Renders the desired {@code T} type Entity.
    */
   @Override
   public void doRender(AbstractClientPlayerEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
	   System.out.println("FON");
 //     if (!entity.isUser() || this.renderManager.info != null && this.renderManager.info.func_216773_g() == entity) {
         double d0 = y;
 //     if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return;
  //       if (entity.func_213287_bg()) {
            d0 = y - 0.125D;
  //       }

         this.setModelVisibilities(entity);
         GlStateManager.setProfile(GlStateManager.Profile.PLAYER_SKIN);
         super.doRender(entity, x, d0, z, entityYaw, partialTicks);
         GlStateManager.unsetProfile(GlStateManager.Profile.PLAYER_SKIN);
  //    }
 //     net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z));
   }

   private void setModelVisibilities(AbstractClientPlayerEntity clientPlayer) {
      PlayerModel<AbstractClientPlayerEntity> playermodel = this.getEntityModel();
      if (clientPlayer.isSpectator()) {
         playermodel.setVisible(false);
         playermodel.field_78116_c.showModel = true;
         playermodel.bipedHeadwear.showModel = true;
      } else {
         ItemStack itemstack = clientPlayer.getHeldItemMainhand();
         ItemStack itemstack1 = clientPlayer.getHeldItemOffhand();
         playermodel.setVisible(true);
         playermodel.bipedHeadwear.showModel = clientPlayer.isWearing(PlayerModelPart.HAT);
         playermodel.bipedBodyWear.showModel = clientPlayer.isWearing(PlayerModelPart.JACKET);
         playermodel.bipedLeftLegwear.showModel = clientPlayer.isWearing(PlayerModelPart.LEFT_PANTS_LEG);
         playermodel.bipedRightLegwear.showModel = clientPlayer.isWearing(PlayerModelPart.RIGHT_PANTS_LEG);
         playermodel.bipedLeftArmwear.showModel = clientPlayer.isWearing(PlayerModelPart.LEFT_SLEEVE);
         playermodel.bipedRightArmwear.showModel = clientPlayer.isWearing(PlayerModelPart.RIGHT_SLEEVE);
         playermodel.isSneak = clientPlayer.func_213287_bg();
         BipedModel.ArmPose bipedmodel$armpose = this.func_217766_a(clientPlayer, itemstack, itemstack1, Hand.MAIN_HAND);
         BipedModel.ArmPose bipedmodel$armpose1 = this.func_217766_a(clientPlayer, itemstack, itemstack1, Hand.OFF_HAND);
         if (clientPlayer.getPrimaryHand() == HandSide.RIGHT) {
            playermodel.rightArmPose = bipedmodel$armpose;
            playermodel.leftArmPose = bipedmodel$armpose1;
         } else {
            playermodel.rightArmPose = bipedmodel$armpose1;
            playermodel.leftArmPose = bipedmodel$armpose;
         }
      }

   }

   private BipedModel.ArmPose func_217766_a(AbstractClientPlayerEntity p_217766_1_, ItemStack p_217766_2_, ItemStack p_217766_3_, Hand p_217766_4_) {
      BipedModel.ArmPose bipedmodel$armpose = BipedModel.ArmPose.EMPTY;
      ItemStack itemstack = p_217766_4_ == Hand.MAIN_HAND ? p_217766_2_ : p_217766_3_;
      if (!itemstack.isEmpty()) {
         bipedmodel$armpose = BipedModel.ArmPose.ITEM;
         if (p_217766_1_.getItemInUseCount() > 0) {
            UseAction useaction = itemstack.getUseAction();
            if (useaction == UseAction.BLOCK) {
               bipedmodel$armpose = BipedModel.ArmPose.BLOCK;
            } else if (useaction == UseAction.BOW) {
               bipedmodel$armpose = BipedModel.ArmPose.BOW_AND_ARROW;
            } else if (useaction == UseAction.SPEAR) {
               bipedmodel$armpose = BipedModel.ArmPose.THROW_SPEAR;
            } else if (useaction == UseAction.CROSSBOW && p_217766_4_ == p_217766_1_.getActiveHand()) {
               bipedmodel$armpose = BipedModel.ArmPose.CROSSBOW_CHARGE;
            }
         } else {
            boolean flag3 = p_217766_2_.getItem() == Items.CROSSBOW;
            boolean flag = CrossbowItem.isCharged(p_217766_2_);
            boolean flag1 = p_217766_3_.getItem() == Items.CROSSBOW;
            boolean flag2 = CrossbowItem.isCharged(p_217766_3_);
            if (flag3 && flag) {
               bipedmodel$armpose = BipedModel.ArmPose.CROSSBOW_HOLD;
            }

            if (flag1 && flag2 && p_217766_2_.getItem().getUseAction(p_217766_2_) == UseAction.NONE) {
               bipedmodel$armpose = BipedModel.ArmPose.CROSSBOW_HOLD;
            }
         }
      }

      return bipedmodel$armpose;
   }

   /**
    * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
    */
   public ResourceLocation getEntityTexture(AbstractClientPlayerEntity entity) {
      return entity.getLocationSkin();
   }

   /**
    * Allows the render to do state modifications necessary before the model is rendered.
    */
   protected void preRenderCallback(AbstractClientPlayerEntity entitylivingbaseIn, float partialTickTime) {
      float f = 0.9375F;
      GlStateManager.scalef(0.9375F, 0.9375F, 0.9375F);
   }

   protected void renderEntityName(AbstractClientPlayerEntity entityIn, double x, double y, double z, String name, double distanceSq) {
      if (distanceSq < 100.0D) {
         Scoreboard scoreboard = entityIn.getWorldScoreboard();
         ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);
         if (scoreobjective != null) {
            Score score = scoreboard.getOrCreateScore(entityIn.getScoreboardName(), scoreobjective);
            this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName().getFormattedText(), x, y, z, 64);
            y += (double)(9.0F * 1.15F * 0.025F);
         }
      }

      super.renderEntityName(entityIn, x, y, z, name, distanceSq);
   }

   public void renderRightArm(AbstractClientPlayerEntity clientPlayer) {
      float f = 1.0F;
      GlStateManager.color3f(1.0F, 1.0F, 1.0F);
      float f1 = 0.0625F;
      PlayerModel<AbstractClientPlayerEntity> playermodel = this.getEntityModel();
      this.setModelVisibilities(clientPlayer);
      GlStateManager.enableBlend();
      playermodel.swingProgress = 0.0F;
      playermodel.isSneak = false;
      playermodel.field_205061_a = 0.0F;
      playermodel.setRotationAngles(clientPlayer, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
      playermodel.bipedRightArm.rotateAngleX = 0.0F;
      playermodel.bipedRightArm.render(0.0625F);
      playermodel.bipedRightArmwear.rotateAngleX = 0.0F;
      playermodel.bipedRightArmwear.render(0.0625F);
      GlStateManager.disableBlend();
   }

   public void renderLeftArm(AbstractClientPlayerEntity clientPlayer) {
      float f = 1.0F;
      GlStateManager.color3f(1.0F, 1.0F, 1.0F);
      float f1 = 0.0625F;
      PlayerModel<AbstractClientPlayerEntity> playermodel = this.getEntityModel();
      this.setModelVisibilities(clientPlayer);
      GlStateManager.enableBlend();
      playermodel.isSneak = false;
      playermodel.swingProgress = 0.0F;
      playermodel.field_205061_a = 0.0F;
      playermodel.setRotationAngles(clientPlayer, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
      playermodel.bipedLeftArm.rotateAngleX = 0.0F;
      playermodel.bipedLeftArm.render(0.0625F);
      playermodel.bipedLeftArmwear.rotateAngleX = 0.0F;
      playermodel.bipedLeftArmwear.render(0.0625F);
      GlStateManager.disableBlend();
   }

   protected void applyRotations(AbstractClientPlayerEntity entityLiving, float ageInTicks, float rotationYaw, float partialTicks) {
      float f = entityLiving.getSwimAnimation(partialTicks);
      if (entityLiving.isElytraFlying()) {
         super.applyRotations(entityLiving, ageInTicks, rotationYaw, partialTicks);
         float f1 = (float)entityLiving.getTicksElytraFlying() + partialTicks;
         float f2 = MathHelper.clamp(f1 * f1 / 100.0F, 0.0F, 1.0F);
         if (!entityLiving.isSpinAttacking()) {
            GlStateManager.rotatef(f2 * (-90.0F - entityLiving.rotationPitch), 1.0F, 0.0F, 0.0F);
         }

         Vec3d vec3d = entityLiving.getLook(partialTicks);
         Vec3d vec3d1 = entityLiving.getMotion();
         double d0 = Entity.func_213296_b(vec3d1);
         double d1 = Entity.func_213296_b(vec3d);
         if (d0 > 0.0D && d1 > 0.0D) {
            double d2 = (vec3d1.x * vec3d.x + vec3d1.z * vec3d.z) / (Math.sqrt(d0) * Math.sqrt(d1));
            double d3 = vec3d1.x * vec3d.z - vec3d1.z * vec3d.x;
            GlStateManager.rotatef((float)(Math.signum(d3) * Math.acos(d2)) * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
         }
      } else if (f > 0.0F) {
         super.applyRotations(entityLiving, ageInTicks, rotationYaw, partialTicks);
         float f3 = entityLiving.isInWater() ? -90.0F - entityLiving.rotationPitch : -90.0F;
         float f4 = MathHelper.lerp(f, 0.0F, f3);
         GlStateManager.rotatef(f4, 1.0F, 0.0F, 0.0F);
         if (entityLiving.func_213314_bj()) {
            GlStateManager.translatef(0.0F, -1.0F, 0.3F);
         }
      } else {
         super.applyRotations(entityLiving, ageInTicks, rotationYaw, partialTicks);
      }

   }
}

 

 

Posted (edited)
5 hours ago, diesieben07 said:

Again, the problem is that you are creating your NewRenderer instance on the mod loading thread. Normally when registering renderers you use RenderingRegistry.registerEntityRenderingHandler. However in this case you need to manually do it on the main thread.

Im trying again, but I dont know how create my new renderer correctly.

Spoiler

package soren.mymdl;

import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import soren.mymdl.parts.MyRenderPlayer;

public class RenderHandler {
	
	private static void registerEntityRenders() {
		RenderingRegistry.registerEntityRenderingHandler(PlayerEntity.class, new IRenderFactory<PlayerEntity>() {

			@Override
			public EntityRenderer<? super PlayerEntity> createRenderFor(EntityRendererManager manager) {
				return new MyRenderPlayer();
			}
		});
	}
}

 

I try follow one 1.12.2 tutorial to learn how register, but is different in this part (Renderer Creation) causing error in this code above, prohibiting me to continue:

Spoiler

In 1.12.2:


public class MyRenderPlayer extends RenderLiving<PlayerEntity>
{
..
}

In 1.14.3:


public class MyRenderPlayer extends LivingRenderer<PlayerEntity, PlayerModel<T>> // <<-- (RenderLiving = LivingRender, but the body is not equal. Error in [PlayerModel<T>] type) // What need I to insert in this T type?
{
..
}

 

 

Edited by SorenCabral

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } }  
    • All versions of Minecraft Forge suddenly black screen even without mods (tried reinstalling original Minecraft, Java, updating drivers doesn't work)
    • When i join minecraft all ok, when i join world all working fine, but when i open indentity menu, i get this The game crashed whilst unexpected error Error: java.lang.NullPointerException: Cannot invoke "top.ribs.scguns.common.Gun$Projectile.getDamage()" because "this.projectile" is null crash report here https://paste.ee/p/0vKaf
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.