Jump to content

Recommended Posts

Posted

Does anyone know how to bind textures in the newest Forge?

 

I checked and my filename does match the parameters of the resourcePath.

My complete path is: C:\Users\Me\Dropbox\1.6.4 Modding\forge\mcp\src\minecraft\assets\more_apples\textures\gui\container

 

Here is my custom potion class and I though that I binded the texture correctly, but I am getting a NullPointerException.

 

 

package eclipse.MoreApples.potion;


import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureObject;
import net.minecraft.client.resources.ReloadableResourceManager;
import net.minecraft.client.resources.Resource;
import net.minecraft.client.resources.SimpleReloadableResourceManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.src.ModLoader;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingFallEvent;

public class FlyingPotion extends CustomPotionBase
{


public FlyingPotion(int par1, boolean par2, int par3) 
	{
	super(par1, par2, par3);

	}


public Potion setIconIndex(int par1, int par2) 
	{
	super.setIconIndex(0,2);
	return this;
	}

@Override
public int getStatusIconIndex()
{
	ResourceLocation r = new ResourceLocation("assets/more_apples:textures/gui/container/Status Effect Icons.png");

	TextureObject texture = Minecraft.getMinecraft().renderEngine.getTexture(r);

	boolean succeded = Minecraft.getMinecraft().renderEngine.loadTexture(r, texture);


	Minecraft.getMinecraft().renderEngine.bindTexture(r);


	return super.getStatusIconIndex();
}


}

 

 

So, does anyone know how to bind texture properly?

 

Thanks for reading! =)

Posted

new ResourceLocation("assets/more_apples:textures/gui/container/Status Effect Icons.png");

 

"assets" is implied, you don't need it.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I tried that and it didn't work. =(

 

Here's the crash report:

 

 

---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 10/19/13 10:55 PM
Description: Registering texture

java.lang.NullPointerException
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:84)
at eclipse.MoreApples.potion.FlyingPotion.getStatusIconIndex(FlyingPotion.java:48)
at net.minecraft.client.renderer.InventoryEffectRenderer.displayDebuffEffects(InventoryEffectRenderer.java:82)
at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:47)
at net.minecraft.client.gui.inventory.GuiInventory.drawScreen(GuiInventory.java:80)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1036)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:944)
at net.minecraft.client.Minecraft.run(Minecraft.java:836)
at net.minecraft.client.main.Main.main(Main.java:93)
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:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)


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

-- Resource location being registered --
Details:
Resource location: more_apples:textures/gui/container/Status Effect Icons.png
Texture object class: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:84)
at eclipse.MoreApples.potion.FlyingPotion.getStatusIconIndex(FlyingPotion.java:48)
at net.minecraft.client.renderer.InventoryEffectRenderer.displayDebuffEffects(InventoryEffectRenderer.java:82)
at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:47)
at net.minecraft.client.gui.inventory.GuiInventory.drawScreen(GuiInventory.java:80)

-- Screen render details --
Details:
Screen name: net.minecraft.client.gui.inventory.GuiInventory
Mouse location: Scaled: (213, 119). Absolute: (427, 240)
Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player405'/386, l='MpServer', x=-193.31, y=66.62, z=174.17]]
Chunk stats: MultiplayerChunkCache: 185
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-204,64,245), Chunk: (at 4,4,5 in -13,15; contains blocks -208,0,240 to -193,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 45058 game time, 8722 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: survival (ID 0). Hardcore: false. Cheats: false
Forced entities: 109 total; [EntityHorse['Horse'/275, l='MpServer', x=-137.25, y=64.00, z=235.46], EntityOcelot['Ocelot'/274, l='MpServer', x=-136.69, y=66.00, z=221.25], EntityChicken['Chicken'/273, l='MpServer', x=-133.50, y=64.00, z=220.50], EntityChicken['Chicken'/272, l='MpServer', x=-132.50, y=65.00, z=219.50], EntityChicken['Chicken'/279, l='MpServer', x=-143.47, y=65.00, z=249.53], EntityHorse['Horse'/277, l='MpServer', x=-143.94, y=63.00, z=240.97], EntityOcelot['Ocelot'/276, l='MpServer', x=-133.68, y=69.00, z=236.44], EntityZombie['Zombie'/286, l='MpServer', x=-113.76, y=18.23, z=95.51], EntityCreeper['Creeper'/262, l='MpServer', x=-149.50, y=25.00, z=160.50], EntityOcelot['Ocelot'/263, l='MpServer', x=-151.09, y=71.00, z=222.66], EntityCow['Cow'/260, l='MpServer', x=-155.03, y=65.00, z=133.91], EntityZombie['Zombie'/261, l='MpServer', x=-145.00, y=19.00, z=149.91], EntityCow['Cow'/267, l='MpServer', x=-140.13, y=64.00, z=127.84], EntityHorse['Horse'/264, l='MpServer', x=-148.00, y=65.00, z=228.13], EntityHorse['Horse'/265, l='MpServer', x=-147.13, y=64.00, z=252.81], EntitySquid['Squid'/270, l='MpServer', x=-138.47, y=58.53, z=182.54], EntityOcelot['Ocelot'/271, l='MpServer', x=-128.53, y=68.00, z=180.47], EntityZombie['Zombie'/268, l='MpServer', x=-142.69, y=25.00, z=155.47], EntitySkeleton['Skeleton'/269, l='MpServer', x=-139.50, y=25.00, z=156.50], EntitySheep['Sheep'/288, l='MpServer', x=-114.97, y=64.00, z=102.53], EntityZombie['Zombie'/289, l='MpServer', x=-114.50, y=13.00, z=147.50], EntityZombie['Zombie'/290, l='MpServer', x=-117.50, y=13.00, z=146.50], EntityCreeper['Creeper'/291, l='MpServer', x=-124.50, y=21.00, z=157.50], EntityBat['Bat'/292, l='MpServer', x=-125.93, y=21.00, z=158.66], EntityChicken['Chicken'/293, l='MpServer', x=-118.59, y=69.00, z=211.88], EntityOcelot['Ocelot'/294, l='MpServer', x=-124.59, y=64.00, z=241.26], EntityHorse['Horse'/115, l='MpServer', x=-272.33, y=64.00, z=156.22], EntityCreeper['Creeper'/114, l='MpServer', x=-273.00, y=47.00, z=156.56], EntitySpider['Spider'/113, l='MpServer', x=-273.50, y=45.00, z=154.50], EntityCreeper['Creeper'/137, l='MpServer', x=-268.00, y=45.00, z=156.59], EntityHorse['Horse'/136, l='MpServer', x=-262.84, y=64.00, z=140.06], EntitySkeleton['Skeleton'/139, l='MpServer', x=-266.50, y=30.00, z=241.50], EntityClientPlayerMP['Player405'/386, l='MpServer', x=-193.31, y=66.62, z=174.17], EntityHorse['Horse'/138, l='MpServer', x=-256.97, y=68.00, z=232.13], EntityHorse['Donkey'/129, l='MpServer', x=-271.88, y=66.00, z=104.13], EntityHorse['Horse'/131, l='MpServer', x=-261.22, y=63.00, z=120.75], EntitySkeleton['Skeleton'/130, l='MpServer', x=-256.78, y=44.00, z=121.59], EntitySkeleton['Skeleton'/133, l='MpServer', x=-261.50, y=44.00, z=130.50], EntityMinecartChest['entity.MinecartChest.name'/132, l='MpServer', x=-264.50, y=44.50, z=141.50], EntityHorse['Horse'/135, l='MpServer', x=-259.34, y=64.00, z=131.41], EntityEnderman['Enderman'/134, l='MpServer', x=-256.46, y=44.00, z=136.93], EntityHorse['Horse'/152, l='MpServer', x=-243.28, y=64.00, z=123.94], EntityBat['Bat'/153, l='MpServer', x=-244.09, y=44.10, z=149.25], EntityZombie['Zombie'/154, l='MpServer', x=-245.24, y=40.00, z=159.27], EntityCreeper['Creeper'/155, l='MpServer', x=-241.50, y=34.00, z=165.50], EntityHorse['Horse'/156, l='MpServer', x=-242.75, y=67.00, z=182.00], EntityHorse['Horse'/157, l='MpServer', x=-240.22, y=67.00, z=183.34], EntityHorse['Horse'/158, l='MpServer', x=-248.81, y=66.00, z=209.72], EntityHorse['Horse'/159, l='MpServer', x=-250.59, y=68.00, z=228.91], EntityHorse['Horse'/146, l='MpServer', x=-248.78, y=63.00, z=105.97], EntityHorse['Horse'/147, l='MpServer', x=-248.00, y=63.00, z=96.94], EntityZombie['Zombie'/148, l='MpServer', x=-244.66, y=43.00, z=118.47], EntityZombie['Zombie'/149, l='MpServer', x=-252.50, y=44.00, z=118.50], EntitySkeleton['Skeleton'/150, l='MpServer', x=-245.53, y=43.00, z=118.09], EntityZombie['Zombie'/151, l='MpServer', x=-254.75, y=46.00, z=119.47], EntityHorse['Horse'/170, l='MpServer', x=-237.88, y=67.00, z=177.34], EntityCow['Cow'/169, l='MpServer', x=-226.56, y=64.00, z=153.19], EntityCow['Cow'/168, l='MpServer', x=-228.60, y=64.00, z=155.97], EntitySpider['Spider'/163, l='MpServer', x=-239.63, y=44.00, z=118.72], EntityCreeper['Creeper'/167, l='MpServer', x=-230.75, y=39.00, z=159.66], EntityBat['Bat'/166, l='MpServer', x=-238.56, y=42.29, z=150.31], EntityCreeper['Creeper'/165, l='MpServer', x=-224.59, y=35.00, z=153.88], EntityHorse['Horse'/164, l='MpServer', x=-233.81, y=64.00, z=112.47], EntityCreeper['Creeper'/186, l='MpServer', x=-219.50, y=25.00, z=132.50], EntityZombie['Zombie'/187, l='MpServer', x=-217.50, y=35.00, z=132.50], EntityZombie['Zombie'/184, l='MpServer', x=-210.50, y=32.00, z=123.50], EntitySkeleton['Skeleton'/185, l='MpServer', x=-219.81, y=37.31, z=120.47], EntityZombie['Zombie'/190, l='MpServer', x=-221.50, y=33.00, z=153.50], EntityBat['Bat'/191, l='MpServer', x=-208.56, y=41.10, z=162.75], EntityBat['Bat'/188, l='MpServer', x=-221.82, y=45.72, z=132.31], EntityBat['Bat'/189, l='MpServer', x=-215.35, y=30.93, z=147.44], EntityBat['Bat'/179, l='MpServer', x=-210.77, y=35.78, z=99.24], EntityCreeper['Creeper'/182, l='MpServer', x=-222.49, y=37.00, z=109.61], EntityZombie['Zombie'/183, l='MpServer', x=-222.50, y=37.00, z=105.50], EntityZombie['Zombie'/180, l='MpServer', x=-213.66, y=31.00, z=99.50], EntitySpider['Spider'/181, l='MpServer', x=-214.16, y=35.00, z=100.28], EntityHorse['Horse'/196, l='MpServer', x=-208.88, y=68.00, z=212.13], EntityCreeper['Creeper'/193, l='MpServer', x=-209.03, y=39.00, z=187.09], EntityCreeper['Creeper'/192, l='MpServer', x=-208.31, y=39.00, z=188.06], EntityHorse['Horse'/195, l='MpServer', x=-219.38, y=64.00, z=206.00], EntityCreeper['Creeper'/194, l='MpServer', x=-209.44, y=39.00, z=182.38], EntityCreeper['Creeper'/220, l='MpServer', x=-202.50, y=30.00, z=111.50], EntityMinecartChest['entity.MinecartChest.name'/221, l='MpServer', x=-200.50, y=38.50, z=99.50], EntityBat['Bat'/222, l='MpServer', x=-202.34, y=39.10, z=98.13], EntityZombie['Zombie'/223, l='MpServer', x=-194.16, y=36.00, z=99.44], EntityZombie['Zombie'/215, l='MpServer', x=-199.03, y=38.00, z=95.53], EntityVillager['Villager'/239, l='MpServer', x=-189.25, y=66.00, z=159.50], EntityVillager['Villager'/238, l='MpServer', x=-183.44, y=65.00, z=136.84], EntityVillager['Villager'/237, l='MpServer', x=-185.50, y=62.00, z=137.66], EntityCreeper['Creeper'/236, l='MpServer', x=-183.50, y=37.00, z=105.50], EntityBat['Bat'/235, l='MpServer', x=-188.75, y=37.10, z=101.28], EntityHorse['Horse'/231, l='MpServer', x=-197.97, y=67.00, z=222.59], EntityBat['Bat'/230, l='MpServer', x=-194.38, y=40.00, z=193.48], EntityBat['Bat'/229, l='MpServer', x=-193.30, y=40.00, z=194.65], EntityVillager['Villager'/228, l='MpServer', x=-197.22, y=65.00, z=152.50], EntityZombie['Zombie'/227, l='MpServer', x=-206.84, y=32.00, z=99.50], EntitySkeleton['Skeleton'/226, l='MpServer', x=-200.72, y=38.00, z=105.13], EntityZombie['Zombie'/225, l='MpServer', x=-201.66, y=38.00, z=97.75], EntitySkeleton['Skeleton'/224, l='MpServer', x=-205.50, y=33.00, z=96.78], EntityVillager['Villager'/250, l='MpServer', x=-170.50, y=63.00, z=144.72], EntityChicken['Chicken'/251, l='MpServer', x=-162.59, y=63.00, z=232.38], EntityCow['Cow'/248, l='MpServer', x=-161.75, y=63.00, z=140.78], EntityVillager['Villager'/249, l='MpServer', x=-169.13, y=65.00, z=143.47], EntityVillager['Villager'/246, l='MpServer', x=-174.50, y=63.00, z=144.00], EntityVillager['Villager'/247, l='MpServer', x=-175.59, y=62.03, z=136.66], EntityCow['Cow'/244, l='MpServer', x=-163.59, y=63.00, z=132.53], EntityVillager['Villager'/245, l='MpServer', x=-174.59, y=62.02, z=140.00], EntityVillager['Villager'/240, l='MpServer', x=-176.16, y=65.00, z=145.63], EntityVillager['Villager'/241, l='MpServer', x=-180.94, y=65.00, z=161.47]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2310)
at net.minecraft.client.Minecraft.run(Minecraft.java:854)
at net.minecraft.client.main.Main.main(Main.java:93)
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:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

-- System Details --
Details:
Minecraft Version: 1.6.4
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 695035008 bytes (662 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 21251 (1190056 bytes; 1 MB) allocated, 1625 (91000 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 15, tcache: 0, allocated: 3, tallocated: 63
FML: MCP v8.11 FML v6.4.6.884 Minecraft Forge 9.11.0.884 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{6.4.6.884} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{9.11.0.884} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
More_Apples{0.1 Alpha} [More Apples] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: GeForce GTX 660/PCIe/SSE2 GL version 4.3.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Pack: Default
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 3444 (192864 bytes; 0 MB) allocated, 323 (18088 bytes; 0 MB) used

 

Posted

TextureObject texture = Minecraft.getMinecraft().renderEngine.getTexture(r);
boolean succeded = Minecraft.getMinecraft().renderEngine.loadTexture(r, texture);

 

Remove those.

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



×
×
  • Create New...

Important Information

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