je rencontre un probleme un peu bizard en rapport je pense avec mon hit handler
:::
–-- Minecraft Crash Report ----
// Who set us up the TNT?
Time: 22/09/15 09:39
Description: Ticking entity
java.lang.ClassCastException: virusz.mob.passive.EntityBoar cannot be cast to net.minecraft.entity.player.EntityPlayer
at virusz.event.HitHandler.onHit(HitHandler.java:28)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_35_HitHandler_onHit_LivingHurtEvent.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.onLivingHurt(ForgeHooks.java:300)
at net.minecraft.entity.EntityLivingBase.damageEntity(EntityLivingBase.java:1261)
at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:870)
at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:224)
at net.minecraft.entity.monster.EntityMob.attackEntityAsMob(EntityMob.java:140)
at net.minecraft.entity.ai.EntityAIAttackOnCollide.updateTask(EntityAIAttackOnCollide.java:167)
at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:125)
at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:613)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:1983)
at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:431)
at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)
at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:250)
at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47)
at virusz.mob.zombie.EntityTermite.onUpdate(EntityTermite.java:113)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684)
at net.minecraft.world.World.updateEntity(World.java:2258)
at net.minecraft.world.World.updateEntities(World.java:2108)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
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 virusz.event.HitHandler.onHit(HitHandler.java:28)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_35_HitHandler_onHit_LivingHurtEvent.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.onLivingHurt(ForgeHooks.java:300)
at net.minecraft.entity.EntityLivingBase.damageEntity(EntityLivingBase.java:1261)
at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:870)
at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:224)
at net.minecraft.entity.monster.EntityMob.attackEntityAsMob(EntityMob.java:140)
at net.minecraft.entity.ai.EntityAIAttackOnCollide.updateTask(EntityAIAttackOnCollide.java:167)
at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:125)
at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:613)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:1983)
at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:431)
at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)
at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:250)
at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47)
at virusz.mob.zombie.EntityTermite.onUpdate(EntityTermite.java:113)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684)
at net.minecraft.world.World.updateEntity(World.java:2258)
– Entity being ticked –
Details:
Entity Type: EntityTermite (virusz.mob.zombie.EntityTermite)
Entity ID: 219
Entity Name: entity.EntityTermite.name
Entity’s Exact location: -117,29, 66,75, 162,14
Entity’s Block location: World: (-118,66,162), Chunk: (at 10,4,2 in -8,10; contains blocks -128,0,160 to -113,255,175), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity’s Momentum: -0,03, 0,25, -0,08
Stacktrace:
at net.minecraft.world.World.updateEntities(World.java:2108)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
– Affected level –
Details:
Level name: world
All players: 0 total; []
Chunk stats: ServerChunkCache: 429 Drop: 0
Level seed: 5605351470870339068
Level generator: ID 00 - default, ver 1. Features enabled: true
Level generator options:
Level spawn location: World: (-28,64,236), Chunk: (at 4,4,12 in -2,14; contains blocks -32,0,224 to -17,255,239), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 25505 game time, 585 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 48799 (now: false), thunder time: 85593 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
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.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_45, Oracle Corporation
Java VM Version: Java HotSpot
64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 958588896 bytes (914 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 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: 1, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 7 mods loaded, 7 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
flansmod{@VERSION@} [Flan’s Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
MapWriter{2.1.1} [MapWriter] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
craftguide{@MOD_VERSION@} [CraftGuide] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
VirusZ{beta-0.1} [VirusZ] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 0 / 20; []
Is Modded: Definitely; Server brand changed to ‘fml,forge’
Type: Dedicated Server (map_server.txt)
:::
:::
| |
| package virusz.event; |
| import virusz.core.ExtendedPlayer; |
| import virusz.core.VirusZCore; |
| import net.minecraft.entity.Entity; |
| import net.minecraft.entity.EntityLiving; |
| import net.minecraft.entity.IProjectile; |
| import net.minecraft.entity.boss.EntityDragon; |
| import net.minecraft.entity.boss.EntityWither; |
| import net.minecraft.entity.monster.EntityMagmaCube; |
| import net.minecraft.entity.monster.EntityMob; |
| import net.minecraft.entity.monster.EntitySlime; |
| import net.minecraft.entity.passive.EntityAnimal; |
| import net.minecraft.entity.passive.EntityVillager; |
| import net.minecraft.entity.passive.EntityWaterMob; |
| import net.minecraft.entity.player.EntityPlayer; |
| import net.minecraft.entity.player.EntityPlayerMP; |
| import net.minecraftforge.event.entity.living.LivingHurtEvent; |
| import cpw.mods.fml.common.eventhandler.SubscribeEvent; |
| |
| public class HitHandler |
| { |
| @SubscribeEvent |
| public void onHit(LivingHurtEvent e) |
| { |
| if(e.entity instanceof EntityPlayer || e.source.getEntity() instanceof EntityMob){ |
| EntityPlayer player =(EntityPlayer)e.entity; |
| ExtendedPlayer.get(player).consumeCombat(1); |
| System.out.println("hit"); |
| System.out.println(ExtendedPlayer.get(player).getCurrentCombat()); |
| } |
| if(e.entity instanceof EntityPlayer && e.source.getEntity() instanceof EntityPlayer){ |
| EntityPlayer player =(EntityPlayer)e.entity; |
| ExtendedPlayer.get(player).consumeCombat(1); |
| System.out.println("hitplayer"); |
| System.out.println(ExtendedPlayer.get(player).getCurrentCombat()); |
| } |
| |
| if(e.entity instanceof EntityPlayer)return; |
| if(e.source.isProjectile()) |
| { |
| Entity en = e.source.getSourceOfDamage(); |
| if (e.entity instanceof EntityLiving&&en instanceof IProjectile||VirusZCore.EntityBullet.isInstance(en)) |
| { |
| |
| if(e.entity.posY+e.entity.getEyeHeight()-0.4F <en.posy &&="" en.posy<e.entity.posy+e.entity.geteyeheight()+0.4f&&!isbadentity(e.entity))<br="">{ |
| System.out.println("DEBUG "+e.entity.toString()); |
| e.ammount=e.ammount*10; |
| ((EntityLiving) e.entityLiving).setCustomNameTag("HEADSHOT!"); |
| ((EntityLiving) e.entityLiving).setAlwaysRenderNameTag(true); |
| } |
| |
| } |
| } |
| } |
| |
| private boolean isBadEntity(Entity e) |
| { |
| if(e instanceof EntityVillager)return false; |
| if(e instanceof EntityAnimal)return true; |
| if(e instanceof EntityWaterMob)return true; |
| if(e instanceof EntitySlime || e instanceof EntityMagmaCube)return true; |
| if(e instanceof EntityDragon|| e instanceof EntityWither)return true; |
| return false; |
| } |
| |
| } |
| |
:::</en.posy>