Jump to content

Recommended Posts

Posted

I want to make an overlay on the player's eyes that is as close to the player skin as possible, but the only way I've found on how to do this is to make an armour with a custom model. My problem is, that the example code I used works perfectly fine, but when I try to do the same with my own model, it just doesn't want to render the armour model. (I'm new to coding but I somewhat understand the basics of it)

Here's the error:

[12:27:01] [Client thread/ERROR]: Couldn't render entity
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(Unknown Source) ~[?:1.8.0_121]
	at flash.twosskillmod.armor.ArmorTM.getArmorTexture(ArmorTM.java:104) ~[ArmorTM.class:?]
	at net.minecraftforge.client.ForgeHooksClient.getArmorTexture(ForgeHooksClient.java:80) ~[ForgeHooksClient.class:?]
	at net.minecraft.client.renderer.entity.RenderBiped.getArmorResource(RenderBiped.java:411) ~[RenderBiped.class:?]
	at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:70) ~[RenderPlayer.class:?]
	at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:517) ~[RenderPlayer.class:?]
	at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:173) [RendererLivingEntity.class:?]
	at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:167) [RenderPlayer.class:?]
	at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:565) [RenderPlayer.class:?]
	at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300) [RenderManager.class:?]
	at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:283) [RenderManager.class:?]
	at net.minecraft.client.gui.inventory.GuiInventory.func_147046_a(GuiInventory.java:112) [GuiInventory.class:?]
	at net.minecraft.client.gui.inventory.GuiContainerCreative.drawGuiContainerBackgroundLayer(GuiContainerCreative.java:839) [GuiContainerCreative.class:?]
	at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:93) [GuiContainer.class:?]
	at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:44) [InventoryEffectRenderer.class:?]
	at net.minecraft.client.gui.inventory.GuiContainerCreative.drawScreen(GuiContainerCreative.java:673) [GuiContainerCreative.class:?]
	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137) [EntityRenderer.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]
	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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
	at GradleStart.main(Unknown Source) [start/:?]


What line 104 in ArmorTM.java says:

name = name.substring(0, name.indexOf('_'));



And here are all the classes:

ClientProxy:
https://pastebin.com/dHmNYtdE

Main:
https://pastebin.com/42rrrPr8

Armor:
https://pastebin.com/P7a4h2ze

Model:
https://pastebin.com/2Lf2HVb8

 

Resource:

package flash.twosskillmod;


public class Resource {
	public static final String RESOURCE_PREFIX = References.mod_id+":";
}

 

References:

package flash.twosskillmod;

public class References {
	
	public final static String name = "TWOS Skills Mod";
	public final static String version = "1.0";
	public final static String mod_id = "twos";
	public final static String proxy_client = "flash.twosskillmod.proxy.ProxyClient";
	public final static String proxy_common = "flash.twosskillmod.proxy.ProxyCommon";
	
}



Help would be appreciated!

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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