Posted September 1, 20214 yr hi this is my code im having an issue with pig.getLastDamageSource().getTrueSource() this method causes minecraft to crash on me when either i (the player) kill a pig and sometimes when the creeper explode i tried fixing the issue for 40 minutes and couldnt really fix it Spoiler @SubscribeEvent public static void ExplodedPigs(EntityLeaveWorldEvent event) { if (!(event.getEntity() instanceof PigEntity)) return; PigEntity pig = (PigEntity) event.getEntity(); if(pig.getLastDamageSource().getTrueSource() instanceof CreeperEntity) pig.entityDropItem(Items.DIAMOND); }
September 1, 20214 yr 41 minutes ago, BlueKnight009 said: Hide contents pig.getLastDamageSource() This can be null. Post the crash log please.
September 2, 20214 yr Author 12 hours ago, poopoodice said: This can be null. Post the crash log please. Spoiler java.lang.NullPointerException: Unexpected error at com.example.examplemod.common.events.MobEvents.ExplodedPigs(MobEvents.java:39) ~[main/:?] {re:classloading} at net.minecraftforge.eventbus.ASMEventHandler_0_MobEvents_ExplodedPigs_EntityLeaveWorldEvent.invoke(.dynamic) ~[?:?] {} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.5-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.5-service.jar:?] {} at net.minecraft.client.world.ClientWorld.removeEntity(ClientWorld.java:321) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.world.ClientWorld.tickEntities(ClientWorld.java:174) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1530) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:979) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_301] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_301] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_301] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_301] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.6.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} here is the log
September 2, 20214 yr Author oh wow thanks for this life changing advice man , listen i don't know whats your problem bro but if you don't want to help or at least guide with clear instructions then don't waste your time trash talking , wtf is Learn basic java even mean??? if you don't have something meaningful to say just don't reply at all this will be better than mocking beginners just because you know how to code
September 2, 20214 yr Author hi i just fixed it anyway so THANKS FOR NOTHING DIESIEBEN and thanks poopoodice i really apreacite the highlight
September 3, 20214 yr 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.
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.