zlappedx3 Posted September 29, 2016 Share Posted September 29, 2016 I use LivingAttackEvent and ExtendedPlayer implements by IExtendedEntityProperties. @SubscribeEvent public void onEvent(LivingAttackEvent event){ if(event.entity instanceof EntityPlayer){ EntityPlayer ishit = (EntityPlayer)event.source.getEntity(); ExtendedPlayer player = ExtendedPlayer.get(ishit); EntityPlayer isDeath = (EntityPlayer)event.entity; ExtendedPlayer player2 = ExtendedPlayer.get(isDeath); if(player.getTeam() != 0 && player.getTeam() == player2.getTeam()){ event.setCanceled(true); } } } And I use hitEntity in sword by spawn EntityLightningBolt while hit. public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { World world = par2EntityLivingBase.worldObj; EntityLightningBolt lightningBolt = new EntityLightningBolt(world, par2EntityLivingBase.posX, par2EntityLivingBase.posY, par2EntityLivingBase.posZ); par1ItemStack.damageItem(1, par3EntityLivingBase); world.spawnEntityInWorld(lightningBolt); world.addWeatherEffect(lightningBolt); return true; } And this is log Error. [12:56:04] [server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.living.LivingAttackEvent@1aa2040: java.lang.NullPointerException at OnerGamer.Entity.Player.ExtendedPlayer.get(ExtendedPlayer.java:77) ~[ExtendedPlayer.class:?] at OnerGamer.Register.Event.onEvent(Event.java:76) ~[Event.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_Event_onEvent_LivingAttackEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?] at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:294) [ForgeHooks.class:?] at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1105) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:532) [EntityPlayerMP.class:?] at net.minecraft.entity.Entity.dealFireDamage(Entity.java:1042) [Entity.class:?] at net.minecraft.entity.Entity.onStruckByLightning(Entity.java:2159) [Entity.class:?] at net.minecraft.entity.effect.EntityLightningBolt.onUpdate(EntityLightningBolt.java:112) [EntityLightningBolt.class:?] at net.minecraft.world.World.updateEntities(World.java:2029) [World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [12:56:04] [server thread/ERROR] [FML]: Index: 1 Listeners: [12:56:04] [server thread/ERROR] [FML]: 0: NORMAL [12:56:04] [server thread/ERROR] [FML]: 1: ASM: OnerGamer.Register.Event@1ffa60 onEvent(Lnet/minecraftforge/event/entity/living/LivingAttackEvent;)V [12:56:04] [server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:709) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.NullPointerException at OnerGamer.Entity.Player.ExtendedPlayer.get(ExtendedPlayer.java:77) ~[ExtendedPlayer.class:?] at OnerGamer.Register.Event.onEvent(Event.java:76) ~[Event.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_Event_onEvent_LivingAttackEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?] at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:294) ~[ForgeHooks.class:?] at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1105) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:532) ~[EntityPlayerMP.class:?] at net.minecraft.entity.Entity.dealFireDamage(Entity.java:1042) ~[Entity.class:?] at net.minecraft.entity.Entity.onStruckByLightning(Entity.java:2159) ~[Entity.class:?] at net.minecraft.entity.effect.EntityLightningBolt.onUpdate(EntityLightningBolt.java:112) ~[EntityLightningBolt.class:?] at net.minecraft.world.World.updateEntities(World.java:2029) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) ~[MinecraftServer.class:?] ... 4 more [12:56:04] [server thread/ERROR]: This crash report has been saved to: D:\Project\minecraft\mcp\Moba\eclipse\.\crash-reports\crash-2016-09-29_12.56.04-server.txt [12:56:04] [server thread/INFO]: Stopping server [12:56:04] [server thread/INFO]: Saving players [12:56:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // I blame Dinnerbone. Time: 9/29/16 12:56 PM Description: Ticking entity java.lang.NullPointerException: Ticking entity at OnerGamer.Entity.Player.ExtendedPlayer.get(ExtendedPlayer.java:77) at OnerGamer.Register.Event.onEvent(Event.java:76) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_Event_onEvent_LivingAttackEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:294) at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1105) at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:532) at net.minecraft.entity.Entity.dealFireDamage(Entity.java:1042) at net.minecraft.entity.Entity.onStruckByLightning(Entity.java:2159) at net.minecraft.entity.effect.EntityLightningBolt.onUpdate(EntityLightningBolt.java:112) at net.minecraft.world.World.updateEntities(World.java:2029) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at OnerGamer.Entity.Player.ExtendedPlayer.get(ExtendedPlayer.java:77) at OnerGamer.Register.Event.onEvent(Event.java:76) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_Event_onEvent_LivingAttackEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:294) at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1105) at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:532) at net.minecraft.entity.Entity.dealFireDamage(Entity.java:1042) at net.minecraft.entity.Entity.onStruckByLightning(Entity.java:2159) at net.minecraft.entity.effect.EntityLightningBolt.onUpdate(EntityLightningBolt.java:112) -- Entity being ticked -- Details: Entity Type: null (net.minecraft.entity.effect.EntityLightningBolt) Entity ID: 3806 Entity Name: unknown Entity's Exact location: -93.50, 62.11, 284.50 Entity's Block location: World: (-94,62,284), Chunk: (at 2,3,12 in -6,17; contains blocks -96,0,272 to -81,255,287), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Entity's Momentum: 0.00, 0.00, 0.00 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2029) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) -- Affected level -- Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player687'/263, l='New World', x=-93.13, y=62.00, z=282.69]] Chunk stats: ServerChunkCache: 351 Drop: 0 Level seed: 5604017937256866434 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (-76,64,256), Chunk: (at 4,4,0 in -5,16; contains blocks -80,0,256 to -65,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 1098 game time, 1098 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 103251 (now: false), thunder time: 31395 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.7.0_79, Oracle Corporation Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation Memory: 696713232 bytes (664 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-10.13.4.1448-1.10.2.jar) UCHIJAAAA Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.10.2-10.13.4.1448-1.10.2.jar) UCHIJAAAA DotK{1.0} [Defense of the King] (bin) GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player687'/263, l='New World', x=-93.13, y=62.00, z=282.69]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [12:56:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2016-09-29_12.56.04-server.txt Quote Link to comment Share on other sites More sharing options...
larsgerrits Posted September 29, 2016 Share Posted September 29, 2016 1) Update your Forge, yours is really old. 2) Don't use IExtendedEntityProperties . Use the new Capabilities instead. Here's how you can switch over: http://mcforge.readthedocs.io/en/latest/datastorage/capabilities/ (on the bottom of the page) Quote 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/ Link to comment Share on other sites More sharing options...
Recommended Posts
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.