Résolu Crash Ticking entity
-
Bonsoir,
J’ai un crash que je n’arrive vraiment pas à résoudre je suis ouvert à toutes réponses ::D (le principe est que ça affiche les gens qui se tuent dans la console avec quel item si y a)
Voici le crash:
–-- Minecraft Crash Report ----
// You should try our sister game, Minceraft!Time: 09/11/15 20:27
Description: Ticking entityjava.lang.NullPointerException: Ticking entity
at diabolicatrix.project.ForgeT4EventHandler.onPlayerKill(ForgeT4EventHandler.java:77)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_48_ForgeT4EventHandler_onPlayerKill_LivingDeathEvent.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.onLivingDeath(ForgeHooks.java:313)
at net.minecraft.entity.player.EntityPlayerMP.func_70645_a(EntityPlayerMP.java:521)
at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:980)
at net.minecraft.entity.player.EntityPlayer.func_70097_a(EntityPlayer.java:1158)
at net.minecraft.entity.player.EntityPlayerMP.func_70097_a(EntityPlayerMP.java:646)
at mcheli.weapon.MCH_EntityBaseBullet.onImpactEntity(MCH_EntityBaseBullet.java:931)
at mcheli.weapon.MCH_EntityBaseBullet.onImpact(MCH_EntityBaseBullet.java:818)
at mcheli.weapon.MCH_EntityBullet.onUpdateCollided(MCH_EntityBullet.java:189)
at mcheli.weapon.MCH_EntityBaseBullet.func_70071_h_(MCH_EntityBaseBullet.java:496)
at mcheli.weapon.MCH_EntityBullet.func_70071_h_(MCH_EntityBullet.java:37)
at net.minecraft.world.World.func_72866_a(World.java:2629)
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:837)
at net.minecraft.world.World.func_72870_g(World.java:2581)
at net.minecraft.world.World.func_72939_s(World.java:2405)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:669)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:954)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:809)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669)
at java.lang.Thread.run(Unknown Source)A detailed walkthrough of the error, its code path and all known details is as follows:
– Head –
Stacktrace:
at diabolicatrix.project.ForgeT4EventHandler.onPlayerKill(ForgeT4EventHandler.java:77)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_48_ForgeT4EventHandler_onPlayerKill_LivingDeathEvent.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.onLivingDeath(ForgeHooks.java:313)
at net.minecraft.entity.player.EntityPlayerMP.func_70645_a(EntityPlayerMP.java:521)
at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:980)
at net.minecraft.entity.player.EntityPlayer.func_70097_a(EntityPlayer.java:1158)
at net.minecraft.entity.player.EntityPlayerMP.func_70097_a(EntityPlayerMP.java:646)
at mcheli.weapon.MCH_EntityBaseBullet.onImpactEntity(MCH_EntityBaseBullet.java:931)
at mcheli.weapon.MCH_EntityBaseBullet.onImpact(MCH_EntityBaseBullet.java:818)
at mcheli.weapon.MCH_EntityBullet.onUpdateCollided(MCH_EntityBullet.java:189)
at mcheli.weapon.MCH_EntityBaseBullet.func_70071_h_(MCH_EntityBaseBullet.java:496)
at mcheli.weapon.MCH_EntityBullet.func_70071_h_(MCH_EntityBullet.java:37)
at net.minecraft.world.World.func_72866_a(World.java:2629)
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:837)
at net.minecraft.world.World.func_72870_g(World.java:2581)– Entity being ticked –
Details:
Entity Type: mcheli.MCH.E.Bullet (mcheli.weapon.MCH_EntityBullet)
Entity ID: 663422
Entity Name: entity.mcheli.MCH.E.Bullet.name
Entity’s Exact location: -8753,07, 24,00, -3118,33
Entity’s Block location: World: (-8754,24,-3119), Chunk: (at 14,1,1 in -548,-195; contains blocks -8768,0,-3120 to -8753,255,-3105), Region: (-18,-7; contains chunks -576,-224 to -545,-193, blocks -9216,0,-3584 to -8705,255,-3073)
Entity’s Momentum: 3,03, -0,47, -2,41
Stacktrace:
at net.minecraft.world.World.func_72939_s(World.java:2405)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:669)– Affected level –
Details:
Level name: AltisCraft
All players: 19 total; [EntityPlayerMP[‘ELIAS2004’/519161, l=‘AltisCraft’, x=-8499,01, y=33,00, z=-3665,81](ELIAS2004 at -8499.013674545606,33.0,-3665.811448966133), EntityPlayerMP[‘JeanUnderstone’/612808, l=‘AltisCraft’, x=-7788,39, y=120,37, z=-5087,48](JeanUnderstone at -7788.387707710019,120.37114503979683,-5087.479478728275), EntityPlayerMP[‘lukas_mayauras’/626408, l=‘AltisCraft’, x=-8749,61, y=22,00, z=-3120,05](lukas_mayauras at -8749.606895364203,22.0,-3120.054992546315), EntityPlayerMP[‘Joe_Leroi’/632364, l=‘AltisCraft’, x=-8797,81, y=33,12, z=-3086,52](Joe_Leroi at -8797.808118732497,33.12496500985637,-3086.516152294512), EntityPlayerMP[‘ReedSnowe’/636498, l=‘AltisCraft’, x=-8504,59, y=33,00, z=-3684,07](ReedSnowe at -8504.590632483143,33.0,-3684.071690623879), EntityPlayerMP[‘baba38220’/639981, l=‘AltisCraft’, x=-6623,63, y=242,25, z=-7028,24](baba38220 at -6623.625374762341,242.24740229547024,-7028.243033941835), EntityPlayerMP[‘Clement_Brosseau’/642420, l=‘AltisCraft’, x=-8719,96, y=25,00, z=-3022,89](Clement_Brosseau at -8719.960493350727,25.0,-3022.8856207534973), EntityPlayerMP[‘FranceTVT’/643400, l=‘AltisCraft’, x=-8494,19, y=33,00, z=-3661,43](FranceTVT at -8494.192281753472,33.0,-3661.42671505201), EntityPlayerMP[‘FameKill’/644416, l=‘AltisCraft’, x=-8503,30, y=33,00, z=-3675,23](FameKill at -8503.300000011921,33.0,-3675.2292274403503), EntityPlayerMP[‘BLUR2001’/652890, l=‘AltisCraft’, x=-8496,94, y=33,00, z=-3792,65](BLUR2001 at -8496.936170853074,33.0,-3792.6507608567795), EntityPlayerMP[‘DarckGamer67’/657849, l=‘AltisCraft’, x=-7789,26, y=120,37, z=-5088,19](DarckGamer67 at -7789.257758915177,120.37114503979683,-5088.192665871482), EntityPlayerMP[‘789TITAN’/658558, l=‘AltisCraft’, x=-8491,81, y=33,00, z=-3660,42](789TITAN at -8491.810591007108,33.0,-3660.415068919214), EntityPlayerMP[‘tristan_martin’/658617, l=‘AltisCraft’, x=-8649,90, y=18,00, z=-3173,74](tristan_martin at -8649.899593148379,18.0,-3173.7403171047054), EntityPlayerMP[‘OaSis_PvPs’/659475, l=‘AltisCraft’, x=-1469,09, y=61,00, z=-8461,38](OaSis_PvPs at -1469.087905060969,61.0,-8461.376539539397), EntityPlayerMP[‘DunterZP03’/659547, l=‘AltisCraft’, x=-8509,56, y=34,25, z=-3855,68](DunterZP03 at -8509.56226340853,34.24918707874468,-3855.675237455979), EntityPlayerMP[‘ArcticLov’/660564, l=‘AltisCraft’, x=-8608,79, y=25,17, z=-3497,95](ArcticLov at -8608.785710464968,25.166109260938214,-3497.948056765577), EntityPlayerMP[‘nathanpruv’/660596, l=‘AltisCraft’, x=-8503,86, y=33,79, z=-3745,26](nathanpruv at -8503.859279296297,33.78502770378924,-3745.258784711232), EntityPlayerMP[‘Prince_Panda69’/661357, l=‘AltisCraft’, x=-8735,69, y=23,16, z=-3123,55](Prince_Panda69 at -8735.692597908945,23.156637801740857,-3123.550043539165), EntityPlayerMP[‘Masteur_PvP’/662636, l=‘AltisCraft’, x=-8508,82, y=34,17, z=-3721,83](Masteur_PvP at -8508.818324462625,34.170787077218804,-3721.833984371723)]
Chunk stats: ServerChunkCache: 3386 Drop: 0
Level seed: 27594263
Level generator: ID 02 - largeBiomes, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (0,99,0), Chunk: (at 0,6,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 311873390 game time, 323844229 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 18867 (now: false), thunder time: 85456 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Stacktrace:
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:954)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:809)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669)
at java.lang.Thread.run(Unknown Source)– System Details –
Details:
Minecraft Version: 1.7.10
KCauldron Version: pw.prok:KCauldron:1.7.10-1492.155
Operating System: Windows Server 2012 R2 (amd64) version 6.3
Java Version: 1.8.0_65, Oracle Corporation
Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1989149160 bytes (1897 MB) / 4704436224 bytes (4486 MB) up to 4772593664 bytes (4551 MB)
JVM Flags: 2 total; -Xms3G -Xmx5G
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 103
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1492 12 mods loaded, 12 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] (OpenMod-Prov2.jar)
UCHIJAAAA Forge{10.13.4.1492} [Minecraft Forge] (OpenMod-Prov2.jar)
UCHIJAAAA kimagine{0.1} [KImagine] (minecraft.jar)
UCHIJAAAA CarpentersBlocks{0.0.1 Beta} [AltisCraft.fr] (AltisCraft.fr.jar)
UCHIJAAAA flansmod{@VERSION@} [Flan’s Mod] (AltisCraft.fr.jar)
UCHIJAAAA thirstmod{1.8.14} [Thirst Mod] (AltisCraft.fr.jar)
UCHIJAAAA t4pro{1.0.1} [Project] (AltisCraft.fr.jar)
UCHIJAAAA altiscraft.MODID{1.0.0} [AltisCraft.fr] (AltisCraft.fr.jar)
UCHIJAAAA Backpack{2.0.1} [Backpack] (backpack-2.0.1-1.7.x.jar)
UCHIJAAAA gvc{0.6.1} [§aGliby’s§f Voice Chat Mod] (GlibysVC-1.7.10-0.6.1.jar)
UCHIJAAAA mcheli{0.10.6} [MC Helicopter] (mcheli)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 19 / 100; [EntityPlayerMP[‘ELIAS2004’/519161, l=‘AltisCraft’, x=-8499,01, y=33,00, z=-3665,81](ELIAS2004 at -8499.013674545606,33.0,-3665.811448966133), EntityPlayerMP[‘JeanUnderstone’/612808, l=‘AltisCraft’, x=-7788,39, y=120,37, z=-5087,48](JeanUnderstone at -7788.387707710019,120.37114503979683,-5087.479478728275), EntityPlayerMP[‘lukas_mayauras’/626408, l=‘AltisCraft’, x=-8749,61, y=22,00, z=-3120,05](lukas_mayauras at -8749.606895364203,22.0,-3120.054992546315), EntityPlayerMP[‘Joe_Leroi’/632364, l=‘AltisCraft’, x=-8797,81, y=33,12, z=-3086,52](Joe_Leroi at -8797.808118732497,33.12496500985637,-3086.516152294512), EntityPlayerMP[‘ReedSnowe’/636498, l=‘AltisCraft’, x=-8504,59, y=33,00, z=-3684,07](ReedSnowe at -8504.590632483143,33.0,-3684.071690623879), EntityPlayerMP[‘baba38220’/639981, l=‘AltisCraft’, x=-6623,63, y=242,25, z=-7028,24](baba38220 at -6623.625374762341,242.24740229547024,-7028.243033941835), EntityPlayerMP[‘Clement_Brosseau’/642420, l=‘AltisCraft’, x=-8719,96, y=25,00, z=-3022,89](Clement_Brosseau at -8719.960493350727,25.0,-3022.8856207534973), EntityPlayerMP[‘FranceTVT’/643400, l=‘AltisCraft’, x=-8494,19, y=33,00, z=-3661,43](FranceTVT at -8494.192281753472,33.0,-3661.42671505201), EntityPlayerMP[‘FameKill’/644416, l=‘AltisCraft’, x=-8503,30, y=33,00, z=-3675,23](FameKill at -8503.300000011921,33.0,-3675.2292274403503), EntityPlayerMP[‘BLUR2001’/652890, l=‘AltisCraft’, x=-8496,94, y=33,00, z=-3792,65](BLUR2001 at -8496.936170853074,33.0,-3792.6507608567795), EntityPlayerMP[‘DarckGamer67’/657849, l=‘AltisCraft’, x=-7789,26, y=120,37, z=-5088,19](DarckGamer67 at -7789.257758915177,120.37114503979683,-5088.192665871482), EntityPlayerMP[‘789TITAN’/658558, l=‘AltisCraft’, x=-8491,81, y=33,00, z=-3660,42](789TITAN at -8491.810591007108,33.0,-3660.415068919214), EntityPlayerMP[‘tristan_martin’/658617, l=‘AltisCraft’, x=-8649,90, y=18,00, z=-3173,74](tristan_martin at -8649.899593148379,18.0,-3173.7403171047054), EntityPlayerMP[‘OaSis_PvPs’/659475, l=‘AltisCraft’, x=-1469,09, y=61,00, z=-8461,38](OaSis_PvPs at -1469.087905060969,61.0,-8461.376539539397), EntityPlayerMP[‘DunterZP03’/659547, l=‘AltisCraft’, x=-8509,56, y=34,25, z=-3855,68](DunterZP03 at -8509.56226340853,34.24918707874468,-3855.675237455979), EntityPlayerMP[‘ArcticLov’/660564, l=‘AltisCraft’, x=-8608,79, y=25,17, z=-3497,95](ArcticLov at -8608.785710464968,25.166109260938214,-3497.948056765577), EntityPlayerMP[‘nathanpruv’/660596, l=‘AltisCraft’, x=-8503,86, y=33,79, z=-3745,26](nathanpruv at -8503.859279296297,33.78502770378924,-3745.258784711232), EntityPlayerMP[‘Prince_Panda69’/661357, l=‘AltisCraft’, x=-8735,69, y=23,16, z=-3123,55](Prince_Panda69 at -8735.692597908945,23.156637801740857,-3123.550043539165), EntityPlayerMP[‘Masteur_PvP’/662636, l=‘AltisCraft’, x=-8508,82, y=34,17, z=-3721,83](Masteur_PvP at -8508.818324462625,34.170787077218804,-3721.833984371723)]
Is Modded: Definitely; Server brand changed to ‘kcauldron,cauldron,craftbukkit,mcpc,fml,forge’
Type: Dedicated Server (map_server.txt)Voici la classe complète:
package diabolicatrix.project; import java.util.Random; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import diabolicatrix.project.proxy.ClientProxy; import diabolicatrix.project.proxy.CommonProxy; import fr.altiscraft.altiscraft.common.GuiCustomMainMenu; import fr.altiscraft.altiscraft.common.ModAltisCraft; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.resources.I18n; import net.minecraft.entity.DataWatcher; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.init.Items; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.RenderLivingEvent; import net.minecraftforge.event.entity.EntityEvent.EntityConstructing; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; public class ForgeT4EventHandler { @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer && EEPRestrained.get((EntityPlayer) event.entity) == null) EEPRestrained.register((EntityPlayer) event.entity); } @SubscribeEvent public void onLivingDeathEvent(LivingDeathEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = new NBTTagCompound(); ((EEPRestrained) (event.entity.getExtendedProperties(EEPRestrained.EXT_PROP_NAME))) .saveNBTDataMoney(playerData); CommonProxy.storeEntityData(((EntityPlayer) event.entity).getDisplayName(), playerData); EEPRestrained.saveProxyData((EntityPlayer) event.entity); } else { } } @SideOnly(Side.SERVER) @SubscribeEvent public void onPlayerKill(LivingDeathEvent event) { if(event.entity instanceof EntityPlayer) { if(event.source.getEntity() != null) { if(event.source.getEntity() instanceof EntityPlayer) { EntityPlayer playerSource = (EntityPlayer) event.source.getEntity(); EntityPlayer playerKilled = (EntityPlayer) event.entity; if(playerSource != null) { if(playerKilled != null) { System.out.println(playerSource.getDisplayName() + " tue " + playerKilled.getDisplayName() + " avec " + playerSource.inventory.getCurrentItem() != null ? playerSource.inventory.getCurrentItem().getDisplayName() : "rien " ); } } } } } } @SubscribeEvent public void handleConstruction(EntityConstructing event) { if(event.entity instanceof EntityMarketPNJ) { DataWatcher dw = event.entity.getDataWatcher(); dw.addObject(20, "Doucheb"); dw.addObject(21, "Marché"); dw.addObject(22, "Player"); } } @SubscribeEvent @SideOnly(Side.CLIENT) public void onEntityConstructingMarket(EntityConstructing event) { if(event.entity instanceof EntityMarketPNJ) { EntityMarketPNJ player = (EntityMarketPNJ)event.entity; player.registerExtendedProperties(EEPPNJ.EXT_PROP_NAME, new EEPPNJ()); } } @SubscribeEvent public void onLivingAttackEvent(LivingAttackEvent event) { if (event.source != null) { if (event.source.getSourceOfDamage() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage(); EEPRestrained props = EEPRestrained.get(player); if (player != null && props != null) { if (props.isRestrained()) { event.setCanceled(true); } } if (player.inventory.getCurrentItem() == null || event.ammount <= 1.0) { event.setCanceled(true); } } if (event.source.getSourceOfDamage() instanceof EntityThrowable) { if (event.ammount <= 1.0) { event.setCanceled(true); } } } } @SubscribeEvent @SideOnly(Side.CLIENT) public void onRenderLivingEventSpecialsPre(RenderLivingEvent.Specials.Pre event) { event.renderer.NAME_TAG_RANGE = 0; event.renderer.NAME_TAG_RANGE_SNEAK = 0; } @SubscribeEvent public void onPlayerUseItemEvent(PlayerUseItemEvent.Start event) { EntityPlayer player = (EntityPlayer) event.entityPlayer; EEPRestrained props = EEPRestrained.get(player); if (!(event.item.getItem() instanceof ItemFood)) { if (player != null && props != null) { if (props.isRestrained()) { event.setCanceled(true); } } } } @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = CommonProxy.getEntityData(((EntityPlayer) event.entity).getDisplayName()); if (playerData != null) { ((EEPRestrained) (event.entity.getExtendedProperties(EEPRestrained.EXT_PROP_NAME))) .loadNBTData(playerData); } ((EEPRestrained) (event.entity.getExtendedProperties(EEPRestrained.EXT_PROP_NAME))).sync(); } } /* @SubscribeEvent @SideOnly(Side.CLIENT) public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) { if(event.entity instanceof EntityPlayer && event.entity.worldObj != null) { EntityPlayer player = (EntityPlayer) event.entity; Base.instance.networkAC.sendToServer(new PacketCommandAsOp("chc open " + "" + player.getDisplayName())); } }*/ @SideOnly(Side.CLIENT) @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { if (event.gui instanceof GuiMainMenu) { /*byte[] file = null; String dir = Minecraft.getMinecraft().mcDataDir.getAbsolutePath().toString(); String path3 = this.removeLastChar(dir) + "AltisCraft\\User"; String path = this.removeLastChar(dir) + "AltisCraft\\User\\users.txt"; Path path2 = Paths.get(path); File f = new File(path3); File f2 = new File(path); if(!f.exists()) { System.out.println("Creating.."); f.mkdirs(); } if(!f2.exists()) { try { System.out.println("Creating.."); f2.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } try { byte[] fileArray = Files.readAllBytes(path2); file = fileArray; } catch (IOException e) { e.printStackTrace(); } if(file == null || file.length == 0) { event.gui = new GuiRegister(); } else { event.gui = new GuiCustomMainMenu(); }*/ if(!ClientProxy.isLogged()) { event.gui = new GuiMainMenu(); } else { if(ClientProxy.isAdmin()) { event.gui = new GuiMainMenu(); } else { event.gui = new GuiCustomMainMenu(); } } } else if(event.gui instanceof GuiOptions) { //System.out.println(Minecraft.getMinecraft().getSession()); } } public String removeLastChar(String str) { return str.substring(0,str.length()-1); } @SubscribeEvent public void onBlockDestroyedByPlayer(BreakEvent e) { /* * e.getPlayer().inventory.addItemStackToInventory(new * ItemStack(Items.apple, 1)); e.world.setBlock(e.x, e.y, e.z, * ModAltisCraft.MineraisCuivre, 0, 2); } */ } @SubscribeEvent public void onEntityInteract(PlayerInteractEvent event) { EntityPlayer player = event.entityPlayer; EEPRestrained props = EEPRestrained.get(player); if (player != null && props != null) { if (props.isRestrained()) { event.setCanceled(true); } } } public Random rand = new Random(); @SubscribeEvent public void onBlockDestroyedPomme(BreakEvent event) { if (event.block == ModAltisCraft.blockPomme) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(Items.apple, 1 + rand.nextInt(4))); } } @SubscribeEvent public void onBlockDestroyedPeche(BreakEvent event) { if (event.block == ModAltisCraft.blockPeche) { event.getPlayer().inventory .addItemStackToInventory(new ItemStack(ModAltisCraft.itemPeche, 1 + rand.nextInt(5))); } } @SubscribeEvent public void onBlockDestroyedCoco(BreakEvent event) { if (event.block == ModAltisCraft.BlocCoco) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(ModAltisCraft.Coco, 1 + rand.nextInt(3))); } } @SubscribeEvent public void onBlockDestroyedCocaine(BreakEvent event) { if (event.block == ModAltisCraft.CocainePlante) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(ModAltisCraft.itemCokaine0, 1)); } } @SubscribeEvent public void onBlockDestroyedCannabis(BreakEvent event) { if (event.block == ModAltisCraft.CannabisPlante) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(ModAltisCraft.itemCannabis, 1)); } } @SubscribeEvent public void onBlockDestroyedCuivre(BreakEvent event) { if (event.block == ModAltisCraft.MineraisCuivre) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(ModAltisCraft.itemCuivre, 1)); } } @SubscribeEvent public void onBlockDestroyedDiamant(BreakEvent event) { if (event.block == ModAltisCraft.MineraisDiamant) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(ModAltisCraft.itemDiamant, 1)); } } @SubscribeEvent public void onBlockDestroyedMeth(BreakEvent event) { if (event.block == ModAltisCraft.MineraisMeth) { event.getPlayer().inventory.addItemStackToInventory(new ItemStack(ModAltisCraft.itemMeth, 1)); } } }
-
@SideOnly(Side.SERVER)
Euh juste pourquoi ?!! (Au-dessus de ton event LivingDeathEvent) -
Essaie de séparer par une entrée avant chaque point et renvoi les crash report avec la classe
-
System.out.println(playerSource.getDisplayName() + " tue " + playerKilled.getDisplayName() + " avec " + playerSource.inventory.getCurrentItem() != null ? playerSource.inventory.getCurrentItem().getDisplayName() : "rien " );
Met cette ligne sur plusieurs lignes pour trouver quel objet est null.
En passant, ceci est inutile :if(event.source.getEntity() != null) { if(event.source.getEntity() instanceof EntityPlayer) {
null instanceof EntityPlayer retourne false. Donc pas besoin de null check avant le instanceof
-
@‘Julot10085’:
@SideOnly(Side.SERVER)
Euh juste pourquoi ?!! (Au-dessus de ton event LivingDeathEvent)Pour que le message soit que dans la console du serveur.
-
@‘SCAREX’:
Essaie de séparer par une entrée avant chaque point et renvoi les crash report avec la classe
Je ne comprends pas ce que tu veux dire par “[font=Ubuntu, sans-serifséparer par une entrée avant chaque point” :/]
-
@‘robin4002’:
System.out.println(playerSource.getDisplayName() + " tue " + playerKilled.getDisplayName() + " avec " + playerSource.inventory.getCurrentItem() != null ? playerSource.inventory.getCurrentItem().getDisplayName() : "rien " );
Met cette ligne sur plusieurs lignes pour trouver quel objet est null.
En passant, ceci est inutile :if(event.source.getEntity() != null) { if(event.source.getEntity() instanceof EntityPlayer) {
null instanceof EntityPlayer retourne false. Donc pas besoin de null check avant le instanceof
Voilà mon nouveau code :
@SideOnly(Side.SERVER) @SubscribeEvent public void onPlayerKill(LivingDeathEvent event) { if (event.entity instanceof EntityPlayer) { if (event.source.getEntity() instanceof EntityPlayer) { EntityPlayer playerSource = (EntityPlayer) event.source.getEntity(); EntityPlayer playerKilled = (EntityPlayer) event.entity; if (playerSource != null) { if (playerKilled != null) { System.out.println(playerSource.getDisplayName() + " tue " + playerKilled.getDisplayName() + " avec " + playerSource.inventory.getCurrentItem() != null ? playerSource.inventory.getCurrentItem().getDisplayName() : "rien "); } } } } }
-
Enlève le @SideOnly(Side.SERVER)
Le System.out.println(msg) affiche le message dans la console et non pas dans le chat du client, le joueur ne le recevra pas dans son chat même si l’annotation @SideOnly n’est pas là -
Son problème ce n’est pas le message mais le npe …
Ce que SCAREX t’as dit de faire (et moi aussi d’ailleurs) c’est ça :System.out.println(playerSource. getDisplayName() + " tue " + playerKilled .getDisplayName() + " avec " + playerSource .inventory .getCurrentItem() != null ? playerSource .inventory .getCurrentItem() .getDisplayName() : "rien " );
Comme ça avec le rapport de crash (avec le numéro de ligne) tu pourra trouver quel objet est null.
-
@‘bodri’:
Enlève le @SideOnly(Side.SERVER)
Le System.out.println(msg) affiche le message dans la console et non pas dans le chat du client, le joueur ne le recevra pas dans son chat même si l’annotation @SideOnly n’est pas làOui mais est-ce que ça le marquera dans la console des joueurs ?
-
@‘robin4002’:
Son problème ce n’est pas le message mais le npe …
Ce que SCAREX t’as dit de faire (et moi aussi d’ailleurs) c’est ça :System.out.println(playerSource. getDisplayName() + " tue " + playerKilled .getDisplayName() + " avec " + playerSource .inventory .getCurrentItem() != null ? playerSource .inventory .getCurrentItem() .getDisplayName() : "rien " );
Comme ça avec le rapport de crash (avec le numéro de ligne) tu pourra trouver quel objet est null.
Ah ok je comprenais pas merci beaucoup je vais voir avec ça !
EDIT:
Voici les nouveaux crashs
-
Des null checks et les problèmes se résoudent tout seul !