Jump to content

Recommended Posts

Posted

I'm trying to make it when you hold red dye and right-click on a candle it turns into a red candle but it doesn't work when I have it check the current Item, only works when I have it simply right-clicked.

 

     
ItemStack redDye = new ItemStack(Item.dyePowder, 1, 1);
ItemStack test;

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
int blockMeta = par1World.getBlockMetadata(par2, par3, par4);

if (blockMeta == 0){
	par5EntityPlayer.inventory.hasItemStack(redDye);
	test = par5EntityPlayer.getCurrentEquippedItem();
	System.out.println(test);

	if(par5EntityPlayer.getCurrentEquippedItem() == redDye){
		par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, Blocks.candle.blockID);

	}
}

    return false;
}

Posted

par5EntityPlayer.getCurrentEquippedItem().itemID == redDye.itemID

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

par5EntityPlayer.getCurrentEquippedItem().itemID == redDye.itemID

 

The problem with that is, that any dye can be used when I only want red and also the game crashes if it's anything else :/

Posted

I couldn't say why the game crashes, but you could try adding the requirement

&& par5EntityPlayer.getCurrentEquippedItem().getItemDamage() == redDye.getItemDamage()

to specify red dye

Posted

I couldn't say why the game crashes, but you could try adding the requirement

&& par5EntityPlayer.getCurrentEquippedItem().getItemDamage() == redDye.getItemDamage()

to specify red dye

 

Awesome! It works :D! But the only thing that still is a problem is that the game crashes when you right-click it with an empty hand.

 

Here is the Crash Report:

java.lang.NullPointerException
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at wintercraft.blocks.BlockCandle.onBlockActivated(BlockCandle.java:119)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:371)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1390)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1868)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:910)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:838)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.client.main.Main.main(Main.java:93)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
2013-12-08 01:20:37 [iNFO] [sTDERR] 	at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2013-12-08 01:20:37 [iNFO] [sTDOUT] ---- Minecraft Crash Report ----
2013-12-08 01:20:37 [iNFO] [sTDOUT] // You're mean.
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] Time: 12/8/13 1:20 AM
2013-12-08 01:20:37 [iNFO] [sTDOUT] Description: Unexpected error
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] java.lang.NullPointerException
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at wintercraft.blocks.BlockCandle.onBlockActivated(BlockCandle.java:119)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:371)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1390)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1868)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:910)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.run(Minecraft.java:838)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.main.Main.main(Main.java:93)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2013-12-08 01:20:37 [iNFO] [sTDOUT] ---------------------------------------------------------------------------------------
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] -- Head --
2013-12-08 01:20:37 [iNFO] [sTDOUT] Stacktrace:
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at wintercraft.blocks.BlockCandle.onBlockActivated(BlockCandle.java:119)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:371)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1390)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] -- Affected level --
2013-12-08 01:20:37 [iNFO] [sTDOUT] Details:
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level name: MpServer
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	All players: 1 total; [EntityClientPlayerMP['Player498'/265, l='MpServer', x=-203.73, y=70.62, z=221.20]]
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Chunk stats: MultiplayerChunkCache: 190
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level seed: 0
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level generator: ID 00 - default, ver 1. Features enabled: false
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level generator options: 
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level spawn location: World: (-236,64,240), Chunk: (at 4,4,0 in -15,15; contains blocks -240,0,240 to -225,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level time: 72344 game time, 72344 day time
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level dimension: 0
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level storage version: 0x00000 - Unknown?
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Forced entities: 87 total; [EntitySkeleton['Skeleton'/137, l='MpServer', x=-217.50, y=14.00, z=190.50], EntityBat['Bat'/136, l='MpServer', x=-210.50, y=32.06, z=177.82], EntitySkeleton['Skeleton'/139, l='MpServer', x=-220.22, y=17.00, z=196.25], EntitySpider['Spider'/138, l='MpServer', x=-213.28, y=16.00, z=192.28], EntityCreeper['Creeper'/141, l='MpServer', x=-211.66, y=17.47, z=192.97], EntitySkeleton['Skeleton'/140, l='MpServer', x=-214.53, y=18.00, z=198.64], EntityCreeper['Creeper'/143, l='MpServer', x=-209.50, y=17.00, z=209.50], EntityZombie['Zombie'/142, l='MpServer', x=-218.50, y=17.00, z=193.50], EntityZombie['Zombie'/129, l='MpServer', x=-214.31, y=45.00, z=143.84], EntityCow['Cow'/135, l='MpServer', x=-222.53, y=67.00, z=154.50], EntityBat['Bat'/152, l='MpServer', x=-198.25, y=23.10, z=158.50], EntityZombie['Zombie'/153, l='MpServer', x=-195.16, y=50.00, z=157.50], EntityZombie['Zombie'/154, l='MpServer', x=-204.88, y=19.00, z=164.75], EntityZombie['Zombie'/155, l='MpServer', x=-198.72, y=52.00, z=161.04], EntitySpider['Spider'/156, l='MpServer', x=-202.82, y=12.14, z=200.09], EntityBat['Bat'/157, l='MpServer', x=-203.48, y=12.28, z=199.99], EntityCreeper['Creeper'/158, l='MpServer', x=-200.50, y=19.00, z=199.50], EntityBat['Bat'/159, l='MpServer', x=-207.29, y=17.81, z=198.78], EntityClientPlayerMP['Player498'/265, l='MpServer', x=-203.73, y=70.62, z=221.20], EntityCreeper['Creeper'/144, l='MpServer', x=-213.50, y=17.00, z=208.50], EntityCow['Cow'/145, l='MpServer', x=-223.41, y=63.00, z=300.34], EntityCreeper['Creeper'/151, l='MpServer', x=-199.52, y=24.10, z=158.50], EntitySkeleton['Skeleton'/169, l='MpServer', x=-188.50, y=17.00, z=153.50], EntitySquid['Squid'/175, l='MpServer', x=-178.31, y=58.96, z=171.60], EntitySquid['Squid'/174, l='MpServer', x=-180.54, y=57.37, z=168.46], EntityBat['Bat'/163, l='MpServer', x=-192.54, y=14.72, z=284.53], EntityBat['Bat'/162, l='MpServer', x=-197.25, y=58.10, z=208.75], EntityCreeper['Creeper'/161, l='MpServer', x=-204.50, y=37.00, z=219.50], EntityZombie['Zombie'/160, l='MpServer', x=-204.53, y=55.00, z=202.91], EntitySquid['Squid'/186, l='MpServer', x=-170.17, y=58.38, z=169.70], EntitySkeleton['Skeleton'/187, l='MpServer', x=-175.50, y=15.00, z=204.50], EntitySkeleton['Skeleton'/184, l='MpServer', x=-168.50, y=15.00, z=170.50], EntityBat['Bat'/185, l='MpServer', x=-165.52, y=13.65, z=170.41], EntityBat['Bat'/190, l='MpServer', x=-165.37, y=41.19, z=242.78], EntityBat['Bat'/191, l='MpServer', x=-164.59, y=40.64, z=243.26], EntityZombie['Zombie'/188, l='MpServer', x=-162.50, y=41.00, z=238.50], EntitySkeleton['Skeleton'/189, l='MpServer', x=-163.16, y=41.00, z=229.66], EntityCreeper['Creeper'/178, l='MpServer', x=-185.38, y=21.00, z=210.09], EntitySquid['Squid'/176, l='MpServer', x=-179.78, y=60.38, z=172.74], EntitySkeleton['Skeleton'/177, l='MpServer', x=-180.22, y=15.00, z=205.38], EntityBat['Bat'/205, l='MpServer', x=-158.54, y=18.78, z=248.64], EntityBat['Bat'/204, l='MpServer', x=-144.47, y=19.10, z=233.75], EntitySpider['Spider'/201, l='MpServer', x=-146.26, y=24.01, z=219.72], EntityCreeper['Creeper'/200, l='MpServer', x=-144.94, y=22.00, z=221.69], EntitySquid['Squid'/203, l='MpServer', x=-157.53, y=56.00, z=210.53], EntityZombie['Zombie'/202, l='MpServer', x=-159.50, y=44.00, z=218.50], EntityCreeper['Creeper'/197, l='MpServer', x=-156.47, y=28.00, z=149.00], EntityCreeper['Creeper'/196, l='MpServer', x=-153.50, y=27.00, z=145.50], EntitySpider['Spider'/199, l='MpServer', x=-159.50, y=37.00, z=145.00], EntitySpider['Spider'/198, l='MpServer', x=-154.03, y=27.00, z=147.78], EntityCreeper['Creeper'/193, l='MpServer', x=-160.69, y=37.00, z=295.94], EntityZombie['Zombie'/192, l='MpServer', x=-175.59, y=14.00, z=281.94], EntityCreeper['Creeper'/195, l='MpServer', x=-152.31, y=27.00, z=147.53], EntitySkeleton['Skeleton'/194, l='MpServer', x=-159.50, y=37.00, z=143.31], EntityCow['Cow'/85, l='MpServer', x=-281.19, y=63.00, z=212.75], EntityZombie['Zombie'/220, l='MpServer', x=-136.50, y=15.00, z=249.50], EntityBat['Bat'/84, l='MpServer', x=-275.43, y=24.73, z=218.56], EntityZombie['Zombie'/221, l='MpServer', x=-135.50, y=15.00, z=247.50], EntityChicken['Chicken'/87, l='MpServer', x=-279.24, y=63.00, z=212.29], EntityMinecartChest['entity.MinecartChest.name'/222, l='MpServer', x=-142.50, y=19.50, z=251.50], EntitySkeleton['Skeleton'/223, l='MpServer', x=-137.66, y=25.00, z=258.63], EntitySkeleton['Skeleton'/216, l='MpServer', x=-134.50, y=29.00, z=173.50], EntityCow['Cow'/83, l='MpServer', x=-275.94, y=69.00, z=174.38], EntitySpider['Spider'/218, l='MpServer', x=-136.50, y=19.00, z=234.50], EntityZombie['Zombie'/219, l='MpServer', x=-140.50, y=19.00, z=234.50], EntityPig['Pig'/89, l='MpServer', x=-273.97, y=63.00, z=229.06], EntityCow['Cow'/88, l='MpServer', x=-280.41, y=63.00, z=230.44], EntityCow['Cow'/91, l='MpServer', x=-277.16, y=63.00, z=288.44], EntityCow['Cow'/90, l='MpServer', x=-281.28, y=64.00, z=249.28], EntityPig['Pig'/102, l='MpServer', x=-256.69, y=65.00, z=166.53], EntityCow['Cow'/103, l='MpServer', x=-259.97, y=63.00, z=206.97], EntitySkeleton['Skeleton'/100, l='MpServer', x=-268.97, y=12.01, z=161.47], EntityPig['Pig'/101, l='MpServer', x=-265.19, y=67.00, z=173.13], EntityCow['Cow'/108, l='MpServer', x=-263.63, y=63.00, z=250.91], EntityBat['Bat'/106, l='MpServer', x=-265.52, y=24.49, z=217.55], EntityCreeper['Creeper'/107, l='MpServer', x=-264.50, y=28.00, z=224.50], EntityCow['Cow'/104, l='MpServer', x=-259.47, y=63.00, z=194.53], EntitySpider['Spider'/224, l='MpServer', x=-131.63, y=41.00, z=302.28], EntityCow['Cow'/105, l='MpServer', x=-266.25, y=64.00, z=196.50], EntityCreeper['Creeper'/118, l='MpServer', x=-248.50, y=20.00, z=224.50], EntityCreeper['Creeper'/117, l='MpServer', x=-245.50, y=27.00, z=229.69], EntityCreeper['Creeper'/116, l='MpServer', x=-246.44, y=27.00, z=228.97], EntityCreeper['Creeper'/115, l='MpServer', x=-254.50, y=28.00, z=223.50], EntityChicken['Chicken'/114, l='MpServer', x=-254.44, y=64.00, z=202.56], EntityCow['Cow'/113, l='MpServer', x=-251.75, y=64.00, z=155.78], EntitySkeleton['Skeleton'/123, l='MpServer', x=-239.50, y=20.00, z=179.50], EntityZombie['Zombie'/243, l='MpServer', x=-125.50, y=15.00, z=243.50]]
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Retry entities: 0 total; []
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Server brand: fml,forge
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Server type: Integrated singleplayer server
2013-12-08 01:20:37 [iNFO] [sTDOUT] Stacktrace:
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2312)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.Minecraft.run(Minecraft.java:863)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.client.main.Main.main(Main.java:93)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 
2013-12-08 01:20:37 [iNFO] [sTDOUT] -- System Details --
2013-12-08 01:20:37 [iNFO] [sTDOUT] Details:
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Minecraft Version: 1.6.4
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Operating System: Windows 7 (amd64) version 6.1
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Java Version: 1.7.0_21, Oracle Corporation
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Memory: 1808830464 bytes (1725 MB) / 2087452672 bytes (1990 MB) up to 2087452672 bytes (1990 MB)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	JVM Flags: 3 total; -Xincgc -Xmx2024M -Xms2024M
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	AABB Pool Size: 22931 (1284136 bytes; 1 MB) allocated, 2 (112 bytes; 0 MB) used
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Suspicious classes: FML and Forge are installed
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	IntCache: cache: 15, tcache: 0, allocated: 3, tallocated: 63
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	FML: MCP v8.11 FML v6.4.31.935 Minecraft Forge 9.11.1.935 5 mods loaded, 5 mods active
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	FML{6.4.31.935} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Forge{9.11.1.935} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	EnchantedWoodlands{0.0.1} [EnchantedWoodlands] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Wintercraft{1.0.2} [Wintercraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Launched Version: 1.6
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	LWJGL: 2.9.0
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	OpenGL: AMD Radeon HD 7900 Series GL version 4.3.12458 Compatibility Profile Context 13.200.16.0, ATI Technologies Inc.
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Is Modded: Definitely; Client brand changed to 'fml,forge'
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Type: Client (map_client.txt)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Resource Pack: Default
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Current Language: English (US)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Profiler Position: N/A (disabled)
2013-12-08 01:20:37 [iNFO] [sTDOUT] 	Vec3 Pool Size: 5650 (316400 bytes; 0 MB) allocated, 19 (1064 bytes; 0 MB) used
2013-12-08 01:20:37 [iNFO] [sTDOUT] #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Robert\Desktop\forge 2.1\mcp\jars\.\crash-reports\crash-2013-12-08_01.20.37-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed

Posted

Hi

 

If you have nothing in your hand,

par5EntityPlayer.getCurrentEquippedItem() returns null.

 

If you try to call a method on it, you get a null pointer exception.  So you need to make sure it's not null first.

 

-TGG

Posted

Hi

 

If you have nothing in your hand,

par5EntityPlayer.getCurrentEquippedItem() returns null.

 

If you try to call a method on it, you get a null pointer exception.  So you need to make sure it's not null first.

 

-TGG

 

Awesome! Thanks, now everything works just as I needed! :)

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.