Posted December 2, 20168 yr added an overlay string that displays the block you are looking at(Pretty much like waila) and when I wanted to check the metadata it worked pretty good until I stared at a door and rip client When I crashed I received a java.lang.NullPointerException error and I am curious on why this is happening public lookGUI(Minecraft mc, EntityPlayer player ) { renderIt(mc, player); } public void renderIt(Minecraft mc, EntityPlayer player ) { if(mc.currentScreen == null ) { mc.getTextureManager().bindTexture(new ResourceLocation("allthethings:textures/map/map_background.png")); int x = mc.getRenderViewEntity().rayTrace(5, 1).getBlockPos().getX(); int y = mc.getRenderViewEntity().rayTrace(5, 1).getBlockPos().getY(); int z = mc.getRenderViewEntity().rayTrace(5, 1).getBlockPos().getZ(); Block blockLookingAt = mc.theWorld.getBlockState(new BlockPos(x, y, z)).getBlock(); String name =""; if(!(blockLookingAt.equals(Blocks.AIR))) { int meta = blockLookingAt.getMetaFromState(mc.theWorld.getBlockState(new BlockPos(x,y,z) ) ); name = new ItemStack(blockLookingAt,1,meta).getDisplayName(); ScaledResolution scale = new ScaledResolution(mc); int width = scale.getScaledWidth(); int height = scale.getScaledHeight(); if(blockLookingAt != null)drawCenteredString(mc.fontRendererObj, name, width/2, 5, Integer.parseInt("FFAA00", 16)); } } } } [21:15:07] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ---- // Hey, that tickles! Hehehe! Time: 12/1/16 9:15 PM Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraft.item.ItemStack.getDisplayName(ItemStack.java:614) at com.burpingdog1.allthethings.client.GUI.lookGUI.renderIt(lookGUI.java:49) at com.burpingdog1.allthethings.client.GUI.lookGUI.<init>(lookGUI.java:28) at com.burpingdog1.allthethings.client.GUI.renderGUIHandler.onRenderGUI(renderGUIHandler.java:15) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_renderGUIHandler_onRenderGUI_Post.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:888) at net.minecraftforge.client.GuiIngameForge.renderExperience(GuiIngameForge.java:586) at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:167) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1125) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) at net.minecraft.client.Minecraft.run(Minecraft.java:406) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraft.item.ItemStack.getDisplayName(ItemStack.java:614) at com.burpingdog1.allthethings.client.GUI.lookGUI.renderIt(lookGUI.java:49) at com.burpingdog1.allthethings.client.GUI.lookGUI.<init>(lookGUI.java:28) at com.burpingdog1.allthethings.client.GUI.renderGUIHandler.onRenderGUI(renderGUIHandler.java:15) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_renderGUIHandler_onRenderGUI_Post.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:888) at net.minecraftforge.client.GuiIngameForge.renderExperience(GuiIngameForge.java:586) at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:167) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Burpingdog1'/361, l='MpServer', x=140.06, y=72.00, z=194.66]] Chunk stats: MultiplayerChunkCache: 679, 679 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (212,64,124), Chunk: (at 4,4,12 in 13,7; contains blocks 208,0,112 to 223,255,127), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 29425 game time, 29425 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: 98 total; [EntityCreeper['Creeper'/26, l='MpServer', x=61.50, y=16.00, z=174.50], EntityChicken['Chicken'/30, l='MpServer', x=60.53, y=79.00, z=265.78], EntityChicken['Chicken'/35, l='MpServer', x=67.42, y=81.00, z=268.87], EntityChicken['Chicken'/41, l='MpServer', x=72.32, y=64.00, z=137.89], EntityChicken['Chicken'/42, l='MpServer', x=67.12, y=64.00, z=131.58], EntityCreeper['Creeper'/44, l='MpServer', x=66.50, y=16.00, z=173.50], EntitySkeleton['Skeleton'/45, l='MpServer', x=64.50, y=16.00, z=172.50], EntitySkeleton['Skeleton'/46, l='MpServer', x=69.50, y=25.00, z=184.50], EntityZombie['Zombie'/47, l='MpServer', x=68.50, y=25.00, z=192.50], EntityBat['Bat'/48, l='MpServer', x=80.15, y=25.69, z=274.45], EntityChicken['Chicken'/62, l='MpServer', x=91.64, y=74.00, z=156.95], EntityChicken['Chicken'/63, l='MpServer', x=82.22, y=70.00, z=173.88], EntityChicken['Chicken'/64, l='MpServer', x=91.45, y=74.00, z=161.88], EntityItem['item.item.egg'/65, l='MpServer', x=84.07, y=71.00, z=174.34], EntitySkeleton['Skeleton'/66, l='MpServer', x=87.50, y=26.00, z=198.50], EntityCreeper['Creeper'/67, l='MpServer', x=89.50, y=19.00, z=254.50], EntitySkeleton['Skeleton'/68, l='MpServer', x=80.50, y=15.00, z=266.50], EntityZombie['Zombie'/69, l='MpServer', x=82.24, y=17.00, z=271.51], EntityCreeper['Creeper'/70, l='MpServer', x=89.50, y=18.00, z=256.50], EntityChicken['Chicken'/100, l='MpServer', x=108.20, y=80.00, z=127.92], EntityZombie['Zombie'/101, l='MpServer', x=100.50, y=54.00, z=133.19], EntityChicken['Chicken'/102, l='MpServer', x=103.29, y=80.00, z=145.14], EntityZombie['Zombie'/103, l='MpServer', x=102.50, y=32.00, z=148.50], EntityZombie['Zombie'/104, l='MpServer', x=99.50, y=32.00, z=146.50], EntityZombie['Zombie'/105, l='MpServer', x=110.59, y=33.00, z=146.23], EntitySkeleton['Skeleton'/106, l='MpServer', x=103.50, y=32.00, z=152.50], EntityChicken['Chicken'/107, l='MpServer', x=99.20, y=72.00, z=167.20], EntityItem['item.item.egg'/108, l='MpServer', x=99.13, y=72.00, z=167.68], EntityChicken['Chicken'/109, l='MpServer', x=105.42, y=63.00, z=207.83], EntityChicken['Chicken'/110, l='MpServer', x=103.96, y=62.67, z=218.31], EntityItem['item.item.egg'/111, l='MpServer', x=104.56, y=63.00, z=208.55], EntityItem['item.item.egg'/112, l='MpServer', x=104.94, y=61.00, z=218.13], EntityChicken['Chicken'/113, l='MpServer', x=97.87, y=67.00, z=217.38], EntityChicken['Chicken'/114, l='MpServer', x=99.80, y=64.00, z=212.10], EntityItem['item.item.egg'/116, l='MpServer', x=97.41, y=67.00, z=217.20], EntityCreeper['Creeper'/117, l='MpServer', x=105.50, y=20.00, z=230.50], EntityBat['Bat'/118, l='MpServer', x=97.52, y=18.94, z=231.24], EntityBat['Bat'/119, l='MpServer', x=104.75, y=26.00, z=239.75], EntitySpider['Spider'/120, l='MpServer', x=109.01, y=15.00, z=239.70], EntityWitch['Witch'/121, l='MpServer', x=98.99, y=47.00, z=231.30], EntityWitch['Witch'/122, l='MpServer', x=98.30, y=47.00, z=231.30], EntityZombie['Zombie'/123, l='MpServer', x=104.50, y=26.00, z=241.50], EntityZombie['Zombie'/127, l='MpServer', x=119.35, y=19.00, z=125.35], EntityZombie['Zombie'/128, l='MpServer', x=120.35, y=19.00, z=124.35], EntitySkeleton['Skeleton'/129, l='MpServer', x=120.50, y=75.00, z=132.50], EntityChicken['Chicken'/130, l='MpServer', x=118.31, y=83.00, z=132.80], EntityChicken['Chicken'/131, l='MpServer', x=115.89, y=82.00, z=129.59], EntityItem['item.item.egg'/132, l='MpServer', x=116.23, y=81.00, z=141.93], EntityEnderman['Enderman'/133, l='MpServer', x=125.87, y=20.00, z=172.50], EntityBat['Bat'/134, l='MpServer', x=110.30, y=47.21, z=184.43], EntitySkeleton['Skeleton'/135, l='MpServer', x=117.69, y=72.00, z=183.51], EntityCreeper['Creeper'/136, l='MpServer', x=121.46, y=49.00, z=217.83], EntitySquid['Squid'/137, l='MpServer', x=120.26, y=58.68, z=222.41], EntitySquid['Squid'/138, l='MpServer', x=123.40, y=56.00, z=207.40], EntitySkeleton['Skeleton'/139, l='MpServer', x=118.50, y=19.00, z=237.50], EntityCreeper['Creeper'/140, l='MpServer', x=114.50, y=20.00, z=248.50], EntityCreeper['Creeper'/141, l='MpServer', x=113.50, y=20.00, z=249.50], EntityItem['item.item.egg'/142, l='MpServer', x=127.53, y=63.00, z=243.61], EntityZombie['Zombie'/143, l='MpServer', x=126.50, y=17.00, z=271.50], EntitySkeleton['Skeleton'/144, l='MpServer', x=121.50, y=17.00, z=268.50], EntityBat['Bat'/145, l='MpServer', x=117.76, y=49.18, z=267.51], EntitySkeleton['Skeleton'/158, l='MpServer', x=138.50, y=16.00, z=154.50], EntityEnderman['Enderman'/159, l='MpServer', x=134.50, y=22.00, z=174.50], EntitySkeleton['Skeleton'/160, l='MpServer', x=130.50, y=42.00, z=188.50], EntitySkeleton['Skeleton'/161, l='MpServer', x=130.79, y=42.00, z=186.46], EntityBat['Bat'/162, l='MpServer', x=131.75, y=44.10, z=195.55], EntityBat['Bat'/163, l='MpServer', x=129.75, y=43.10, z=199.75], EntityBat['Bat'/164, l='MpServer', x=131.75, y=43.10, z=196.55], EntityZombie['Zombie'/165, l='MpServer', x=132.50, y=45.00, z=196.49], EntityBat['Bat'/166, l='MpServer', x=129.75, y=44.10, z=198.55], EntityBat['Bat'/167, l='MpServer', x=129.75, y=43.10, z=199.47], EntityBat['Bat'/168, l='MpServer', x=130.10, y=43.10, z=198.75], EntitySquid['Squid'/169, l='MpServer', x=130.30, y=62.55, z=220.59], EntityChicken['Chicken'/170, l='MpServer', x=130.10, y=63.00, z=239.34], EntityItem['item.item.egg'/171, l='MpServer', x=130.95, y=63.00, z=239.28], EntityChicken['Chicken'/172, l='MpServer', x=128.32, y=63.00, z=243.57], EntityCreeper['Creeper'/173, l='MpServer', x=129.50, y=17.00, z=269.50], EntityZombie['Zombie'/177, l='MpServer', x=129.50, y=17.00, z=274.50], EntityEnderman['Enderman'/178, l='MpServer', x=130.50, y=17.00, z=272.50], EntityZombie['Zombie'/192, l='MpServer', x=151.19, y=19.00, z=163.81], EntityZombie['Zombie'/193, l='MpServer', x=150.35, y=19.00, z=161.35], EntitySquid['Squid'/194, l='MpServer', x=148.20, y=61.95, z=220.65], EntitySkeleton['Skeleton'/208, l='MpServer', x=172.50, y=31.00, z=179.50], EntitySkeleton['Skeleton'/209, l='MpServer', x=173.50, y=31.00, z=178.73], EntityPlayerSP['Burpingdog1'/361, l='MpServer', x=140.06, y=72.00, z=194.66], EntitySquid['Squid'/210, l='MpServer', x=163.60, y=58.00, z=214.60], EntityItem['item.item.rottenFlesh'/211, l='MpServer', x=165.98, y=63.00, z=230.44], EntityChicken['Chicken'/212, l='MpServer', x=185.80, y=72.00, z=122.66], EntitySkeleton['Skeleton'/214, l='MpServer', x=191.21, y=20.00, z=140.50], EntityZombie['Zombie'/215, l='MpServer', x=177.50, y=21.00, z=139.50], EntitySkeleton['Skeleton'/220, l='MpServer', x=206.50, y=18.00, z=116.50], EntityCreeper['Creeper'/221, l='MpServer', x=200.50, y=12.00, z=153.50], EntityZombie['Zombie'/222, l='MpServer', x=202.50, y=12.00, z=153.50], EntityChicken['Chicken'/223, l='MpServer', x=199.60, y=64.00, z=262.90], EntityChicken['Chicken'/244, l='MpServer', x=211.39, y=64.00, z=202.02], EntityChicken['Chicken'/247, l='MpServer', x=213.88, y=64.00, z=208.48], EntityChicken['Chicken'/248, l='MpServer', x=214.51, y=74.00, z=264.83], EntityChicken['Chicken'/249, l='MpServer', x=212.35, y=72.00, z=257.92]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:451) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2779) at net.minecraft.client.Minecraft.run(Minecraft.java:435) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) Using a 1.10.2 version of Forge
December 2, 20168 yr ItemStack#getDisplayName will throw a NullPointerException when you call it on an ItemStack with a null Item . Side note: Why are you raytracing once for each coordinate of the block and then immediately creating a BlockPos from those coordinates? Raytrace once and use the BlockPos from the RayTraceResult directly. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
December 2, 20168 yr ItemStack#getDisplayName will throw a NullPointerException when you call it on an ItemStack with a null Item . To clarify: when you create an ItemStack from a Block , it will get the corresponding ItemBlock . Since BlockDoor doesn't have a corresponding ItemBlock , it will create an ItemStack with a null Item . To fix this, you should probably use Block#getPickBlock(...) . Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
December 2, 20168 yr Also why are you re-requesting the block state? int meta = blockLookingAt.getMetaFromState(mc.theWorld.getBlockState(new BlockPos(x,y,z) ) ); You already looked it up here: Block blockLookingAt = mc.theWorld.getBlockState(new BlockPos(x, y, z)).getBlock(); Why not get the block state, then save a reference to that? IBlockState state = mc.theWorld.getBlockState(pos); //use pos from Choonster's post if(!state.getBlock().isAir(state, world, pos)) { int meta = state.getBlock().getMetaFromState(state); } 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.
December 2, 20168 yr You should not be using metadata, at all, ever. Except when you do, such as registering variant ItemBlock models... Mind, that's the only time I've had need of it, and there's currently at least one spot in Custom Ore Gen that uses it (admittedly because it was easier to update by saying "convert back to metadata" than "change the way 44 config files are structured and parsed." Correct? No, but faster so that at least the mod was available on 1.10). And vanilla uses it to create an ItemStack of metadata blocks, which is a Thing that I could see a mod wanting to do (such as the OP is trying to do). 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.
December 2, 20168 yr And vanilla uses it to create an ItemStack of metadata blocks, which is a Thing that I could see a mod wanting to do (such as the OP is trying to do).No, it doesn't, really...There is no visible relationship between ItemStack damage value and block metadata Let's see...where is getMetaFromState invoked in vanilla... Block#createStackedBlock (creating an ItemStack) which is called by Block#harvestBlock BlockNewLeaf#getItem (creating an ItemStack) BlockSilverfish#getItem (creating an ItemStack) BlockTallGrass#getItem (creating an ItemStack) GuiCreateFlatWorld#drawSlot (creating an ItemStack) And then four different commands (Clone, ExecuteAt, Fill, TestForBlock) as well as writeEntityToNBT in both EntityMinecart and EnttiyFallingBlock (for other purposes). It would appear that block state->meta is correlated with ItemStack metadata (due to the default implementation of harvestBlock and createStackedBlock). getMetaFromState is also not marked @Deprecated. It's getStateFromMeta that's deprecated. As for using it, yes, I agree it should be used as sparingly as possible. But it's not inherently wrong. 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.
December 2, 20168 yr Author Reasoning of me using metadata was to get the exact names of the block I was looking at (Looking at a red wool block would just return wool block instead of red wool block when I wasn't using metadata) Thanks for the help and tips everyone even though my code can be written better P:
December 2, 20168 yr Reasoning of me using metadata was to get the exact names of the block I was looking at (Looking at a red wool block would just return wool block instead of red wool block when I wasn't using metadata) Thanks for the help and tips everyone even though my code can be written better P: The problem there is that both: a) the block might not have an ItemBlock (most crops, cake, door, many redstone objects) b) the given state might not correspond to a special item (leaves, for example: the 4th bit is just a "did the player place this" flag) The latter is probably not something that will cause an error (maybe not even unexpected behavior), but the former absolutely will. 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.
December 2, 20168 yr Again, though, the method is not marked as @Deprecated. 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.
December 2, 20168 yr Author Took out the metadata part and replaced it w/ the getPickBlock method and it works like a beauty thanks again for the help
December 2, 20168 yr Author Actually there is still one problem.. Looking at blocks that do not have an item setup when you do getpickblock crashes the game(such as liquids), tried checking if getpickblock was null but same thing
December 2, 20168 yr Actually there is still one problem.. Looking at blocks that do not have an item setup when you do getpickblock crashes the game(such as liquids), tried checking if getpickblock was null but same thing Always post the crash log. 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.
December 2, 20168 yr Author Actually there is still one problem.. Looking at blocks that do not have an item setup when you do getpickblock crashes the game(such as liquids), tried checking if getpickblock was null but same thing Always post the crash log. Time: 12/2/16 3:49 PM Description: Unexpected error java.lang.NullPointerException: Unexpected error at com.burpingdog1.allthethings.client.GUI.lookGUI.<init>(lookGUI.java:44) at com.burpingdog1.allthethings.client.GUI.renderGUIHandler.onRenderGUI(renderGUIHandler.java:15) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_renderGUIHandler_onRenderGUI_Post.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:888) at net.minecraftforge.client.GuiIngameForge.renderExperience(GuiIngameForge.java:586) at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:167) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1125) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) at net.minecraft.client.Minecraft.run(Minecraft.java:406) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at com.burpingdog1.allthethings.client.GUI.lookGUI.<init>(lookGUI.java:44) at com.burpingdog1.allthethings.client.GUI.renderGUIHandler.onRenderGUI(renderGUIHandler.java:15) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_renderGUIHandler_onRenderGUI_Post.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:888) at net.minecraftforge.client.GuiIngameForge.renderExperience(GuiIngameForge.java:586) at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:167)
December 2, 20168 yr And what is at/around lookGUI.java line 44? (Also, why does that classname start with a lowercase letter?) 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.
December 2, 20168 yr Author Ah thanks for the reminder of that, derpy old me public class LookGUI extends GuiScreen { public LookGUI(Minecraft mc, EntityPlayer player ) { if(mc.currentScreen == null ) { ScaledResolution scale = new ScaledResolution(mc); int width = scale.getScaledWidth(); int height = scale.getScaledHeight(); RayTraceResult coords = mc.getRenderViewEntity().rayTrace(5, 1); Block blockLookingAt = mc.theWorld.getBlockState(coords.getBlockPos()).getBlock() ; String name =""; if(!(blockLookingAt.equals(Blocks.AIR))) { if(blockLookingAt.getPickBlock(mc.theWorld.getBlockState(coords.getBlockPos()), coords, mc.theWorld, coords.getBlockPos(), player).getDisplayName().equals(null)) name=blockLookingAt.getLocalizedName(); else name = blockLookingAt.getPickBlock(mc.theWorld.getBlockState(coords.getBlockPos()), coords, mc.theWorld, coords.getBlockPos(), player).getDisplayName(); if(name != null)drawCenteredString(mc.fontRendererObj, name, width/2, 5, Integer.parseInt("FFAA00", 16)); } } } } line 44 is near the null checker I have the if(blockLookingAt.getPickBlock(mc.theWorld.getBlockState(coords.getBlockPos()), coords, mc.theWorld, coords.getBlockPos(), player).getDisplayName().equals(null))
December 2, 20168 yr Which null check, mc.currentScreen == null or .getDisplayName().equals(null) ? Because the latter won't work if the result of getPickBlock() is null, because you're taking null, asking for its name (crash!), then comparing the result to null. 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.
December 2, 20168 yr Author the getDisplayName().equals() one, how would I check if the block doesnt have a pickItem?
December 2, 20168 yr [/null]Someone is tired https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcROlbWTJqFGprIkYTopxtQ7BTuaCdEI9YJKPw-lR6SO0doaSzBa[/img] 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.
December 2, 20168 yr the getDisplayName().equals() one, how would I check if the block doesnt have a pickItem? Getting the pickblock, saving it to a variable, and checking if it is null? Like, how else? 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.
December 2, 20168 yr Author the getDisplayName().equals() one, how would I check if the block doesnt have a pickItem? Getting the pickblock, saving it to a variable, and checking if it is null? Like, how else? Yeah, forgot to take out the getDisplayName so kept crashing... Seems as if I had a long day lol
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.