Résolu Problème onUpdate avec mon arc.
-
Bonjour,
Je vous explique mon soucis, quand je met la fonction onUpdate dans la class de mon arc qui est extends Item mon arc bug complètement je vous met un exemple car c’est compliquer a expliqué.
vidéo:
https://www.youtube.com/watch?v=wThsb3Fi4jU&feature=youtu.beJe vous glisse ma classe juste la:
public class FlameBow extends Item { public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; @SideOnly(Side.CLIENT) private IIcon[] iconArray; public FlameBow() { this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabCombat); } /** * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount */ public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int p_77615_4_) { int j = this.getMaxItemUseDuration(stack) - p_77615_4_; ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return; } j = event.charge; boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; if (flag || player.inventory.hasItem(Items.arrow)) { float f = (float)j / 20.0F; f = (f * f + f * 2.0F) / 3.0F; if ((double)f < 0.1D) { return; } if (f > 1.0F) { f = 1.0F; } EntityArrow entityarrow = new EntityArrow(world, player, f * 2.0F); if (f == 1.0F) { entityarrow.setIsCritical(true); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); if (k > 0) { entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D); } int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); if (l > 0) { entityarrow.setKnockbackStrength(l); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) { entityarrow.setFire(100); } stack.damageItem(1, player); world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); if (flag) { entityarrow.canBePickedUp = 2; } else { player.inventory.consumeInventoryItem(Items.arrow); } if (!world.isRemote) { world.spawnEntityInWorld(entityarrow); entityarrow.setFire(1 * 10); entityarrow.setDamage(20); } } } public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) { return p_77654_1_; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack p_77626_1_) { return 72000; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack p_77661_1_) { return EnumAction.bow; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return event.result; } if (p_77659_3_.capabilities.isCreativeMode || p_77659_3_.inventory.hasItem(Items.arrow)) { p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_)); } return p_77659_1_; } /** * Return the enchantability factor of the item, most of the time is based on material. */ public int getItemEnchantability() { return 1; } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister p_94581_1_) { this.itemIcon = p_94581_1_.registerIcon(this.getIconString() + "_standby"); this.iconArray = new IIcon[bowPullIconNameArray.length]; for (int i = 0; i < this.iconArray.length; ++i) { this.iconArray* = p_94581_1_.registerIcon(this.getIconString() + "_" + bowPullIconNameArray*); } } /** * used to cycle through icons based on their used duration, i.e. for the bow */ @SideOnly(Side.CLIENT) public IIcon getItemIconForUseDuration(int p_94599_1_) { return this.iconArray[p_94599_1_]; } public void onUpdate(ItemStack item, World world, Entity player, int slotIndex, boolean inHand) { if(!item.hasTagCompound()) { item.setTagCompound(new NBTTagCompound()); } int timer = !item.getTagCompound().hasKey("timer") ? 0 : item.getTagCompound().getInteger("timer"); timer++; item.getTagCompound().setInteger("timer", timer); super.onUpdate(item, world, player, slotIndex, inHand); } }
Voilà:) merci d’avance.
PS: aussi j’ai un soucis regarder la vidéo j’ai pas de flèches qui s’affiche sur mon arc.
-
Je ne vois pas d’où peut venir le problème, pour ce qui est de la flèche qui n’est pas sur ton arc : il faut l’ajoutée sur la texture
-
@‘SCAREX’:
Je ne vois pas d’où peut venir le problème, pour ce qui est de la flèche qui n’est pas sur ton arc : il faut l’ajoutée sur la texture
Ouais c’est bizzare…
D’acc merci j’essaye :)! (pour la texture) -
Mets tout ce qui se trouve dans ta fonction onUpdate dans une condition if(!world.isRemote).
Tu modifies le tag nbt donc l’item se reset, si tu ne le fais que côté serveur ça devrait être bon; -
@‘robin4002’:
Mets tout ce qui se trouve dans ta fonction onUpdate dans une condition if(!world.isRemote).
Tu modifies le tag nbt donc l’item se reset, si tu ne le fais que côté serveur ça devrait être bon;Ouais nickel merci
Sinon j’ai toujours pas de flèches sur mon arc alors que sur la texture oui… -
As-tu pensé à refresh la workspace d’eclipse ?
-
Il te manque cette fonction :
@Override public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem != null && usingItem.getItem() == tonItem)) { int k = usingItem.getMaxItemUseDuration() - useRemaining; if(k >= 18) return iconArray[2]; if(k > 13) return iconArray[1]; if(k > 0) return iconArray[0]; } return getIconIndex(stack); }
-
@‘robin4002’:
Il te manque cette fonction :
@Override public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem != null && usingItem.getItem() == tonItem)) { int k = usingItem.getMaxItemUseDuration() - useRemaining; if(k >= 18) return iconArray[2]; if(k > 13) return iconArray[1]; if(k > 0) return iconArray[0]; } return getIconIndex(stack); }
J’ai un crash quand je met cette fonction:
[12:14:39] [main/INFO] [GradleStart]: username: floriangabet [12:14:39] [main/INFO] [GradleStart]: Extra: [] [12:14:39] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --username, floriangabet, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [12:14:39] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [12:14:39] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading [12:14:39] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre [12:14:39] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [12:14:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [12:14:39] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin [12:14:39] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [12:14:39] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [12:14:39] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [12:14:40] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [12:14:40] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [12:14:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [12:14:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [12:14:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [12:14:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker [12:14:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker [12:14:40] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [12:14:40] [main/INFO]: Setting user: floriangabet [12:14:41] [Client thread/INFO]: LWJGL Version: 2.9.1 [12:14:41] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [12:14:41] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized [12:14:41] [Client thread/INFO] [FML]: Replaced 183 ore recipies [12:14:41] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [12:14:41] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\mods for mods [12:14:41] [Client thread/INFO] [lc]: Mod lc is missing the required element 'name'. Substituting lc [12:14:43] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [12:14:43] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at CLIENT [12:14:43] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at SERVER [12:14:43] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip [12:14:43] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [12:14:43] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations [12:14:43] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [12:14:43] [Client thread/INFO] [FML]: Applying holder lookups [12:14:43] [Client thread/INFO] [FML]: Holder lookups applied [12:14:43] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [12:14:43] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [12:14:43] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [12:14:43] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [12:14:43] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [12:14:44] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [12:14:44] [Sound Library Loader/INFO]: Sound engine started [12:14:46] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas [12:14:46] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/.png java.io.FileNotFoundException: minecraft:textures/items/.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:583) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] [12:14:46] [Client thread/INFO]: Created: 512x256 textures/items-atlas [12:14:46] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [12:14:46] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip [12:14:48] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas [12:14:48] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/.png java.io.FileNotFoundException: minecraft:textures/items/.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:170) [TextureManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:643) [Minecraft.class:?] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] [12:14:48] [Client thread/INFO]: Created: 512x256 textures/items-atlas [12:14:48] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [12:14:48] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down… [12:14:48] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]: Author: Paul Lamb, www.paulscode.com [12:14:48] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [12:14:48] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [12:14:48] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [12:14:49] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [12:14:49] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [12:14:49] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [12:14:49] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [12:14:49] [Sound Library Loader/INFO]: Sound engine started [12:14:51] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10 [12:14:51] [Server thread/INFO]: Generating keypair [12:14:51] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [12:14:51] [Server thread/INFO] [FML]: Applying holder lookups [12:14:51] [Server thread/INFO] [FML]: Holder lookups applied [12:14:51] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@8982b6) [12:14:51] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@8982b6) [12:14:51] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@8982b6) [12:14:51] [Server thread/INFO]: Preparing start region for level 0 [12:14:52] [Server thread/INFO]: Changing view distance to 8, from 10 [12:14:52] [Netty Client IO #0/INFO] [FML]: Server protocol version 1 [12:14:52] [Netty IO #1/INFO] [FML]: Client protocol version 1 [12:14:52] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.85.1291,lc@1.0,Forge@10.13.2.1291,mcp@9.05 [12:14:52] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT [12:14:52] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER [12:14:52] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [12:14:52] [Server thread/INFO]: floriangabet[local:E:f92015eb] logged in with entity id 360 at (-443.43027447877336, 79.6632603931206, 969.8647109496462) [12:14:52] [Server thread/INFO]: floriangabet joined the game [12:14:52] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established [12:14:53] [Server thread/INFO]: Stopping server [12:14:53] [Server thread/INFO]: Saving players [12:14:53] [Server thread/INFO]: Saving worlds [12:14:53] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [12:14:53] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [12:14:53] [Server thread/INFO]: Saving chunks for level 'New World'/The End [12:14:53] [Server thread/INFO] [FML]: Unloading dimension 0 [12:14:53] [Server thread/INFO] [FML]: Unloading dimension -1 [12:14:53] [Server thread/INFO] [FML]: Unloading dimension 1 [12:14:53] [Server thread/INFO] [FML]: Applying holder lookups [12:14:53] [Server thread/INFO] [FML]: Holder lookups applied [12:14:53] [Client thread/FATAL]: Unreported exception thrown! java.lang.NullPointerException at net.legacymod.items.FlameBow.getIcon(FlameBow.java:271) ~[FlameBow.class:?] at net.minecraft.entity.player.EntityPlayer.getItemIcon(EntityPlayer.java:2070) ~[EntityPlayer.class:?] at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:106) ~[ItemRenderer.class:?] at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:511) ~[ItemRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:797) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1437) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] [12:14:53] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ---- // Would you like a cupcake? Time: 13/07/16 12:14 Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.legacymod.items.FlameBow.getIcon(FlameBow.java:271) at net.minecraft.entity.player.EntityPlayer.getItemIcon(EntityPlayer.java:2070) at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:106) at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:511) at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:797) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1437) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) at net.minecraft.client.Minecraft.run(Minecraft.java:951) at net.minecraft.client.main.Main.main(Main.java:164) 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:497) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.legacymod.items.FlameBow.getIcon(FlameBow.java:271) at net.minecraft.entity.player.EntityPlayer.getItemIcon(EntityPlayer.java:2070) at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:106) at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:511) at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:797) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1437) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['floriangabet'/360, l='MpServer', x=-443,43, y=81,28, z=969,86]] Chunk stats: MultiplayerChunkCache: 0, 0 Level seed: 0 Level generator: ID 00 - default, ver 1\. Features enabled: false Level generator options: Level spawn location: World: (-148,64,252), Chunk: (at 12,4,12 in -10,15; contains blocks -160,0,240 to -145,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 1703176 game time, 1200 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: 35 total; [EntityBat['Bat'/384, l='MpServer', x=-369,09, y=47,97, z=966,53], EntityChicken['Chicken'/385, l='MpServer', x=-459,53, y=64,75, z=1028,25], EntityZombie['Zombie'/386, l='MpServer', x=-418,25, y=18,64, z=910,84], EntitySlime['Slime'/387, l='MpServer', x=-424,61, y=38,64, z=909,39], EntitySlime['Slime'/388, l='MpServer', x=-421,62, y=37,37, z=898,82], EntitySkeleton['Skeleton'/389, l='MpServer', x=-430,50, y=38,64, z=907,50], EntityZombie['Zombie'/390, l='MpServer', x=-484,56, y=33,64, z=921,47], EntityBat['Bat'/398, l='MpServer', x=-435,25, y=29,10, z=892,25], EntityChicken['Chicken'/407, l='MpServer', x=-432,38, y=68,75, z=1049,59], EntityChicken['Chicken'/408, l='MpServer', x=-482,47, y=77,75, z=1046,56], EntityBat['Bat'/410, l='MpServer', x=-503,88, y=39,10, z=895,75], EntityZombie['Zombie'/413, l='MpServer', x=-490,50, y=25,64, z=910,94], EntitySheep['Sheep'/484, l='MpServer', x=-372,06, y=80,00, z=895,09], EntityPig['Pig'/423, l='MpServer', x=-365,06, y=63,64, z=1042,88], EntityClientPlayerMP['floriangabet'/360, l='MpServer', x=-443,43, y=81,28, z=969,86], EntityCreeper['Creeper'/365, l='MpServer', x=-442,94, y=49,64, z=952,50], EntityPig['Pig'/366, l='MpServer', x=-422,50, y=77,64, z=962,50], EntityChicken['Chicken'/430, l='MpServer', x=-389,41, y=69,75, z=1040,59], EntityCow['Cow'/367, l='MpServer', x=-455,53, y=67,64, z=1005,53], EntityCreeper['Creeper'/368, l='MpServer', x=-429,06, y=51,64, z=939,63], EntityPig['Pig'/369, l='MpServer', x=-415,50, y=77,64, z=958,50], EntityChicken['Chicken'/370, l='MpServer', x=-431,63, y=66,75, z=1006,38], EntityCow['Cow'/371, l='MpServer', x=-448,41, y=68,64, z=1011,22], EntityCow['Cow'/372, l='MpServer', x=-453,78, y=66,64, z=1017,19], EntityCreeper['Creeper'/373, l='MpServer', x=-484,50, y=11,64, z=947,50], EntityPig['Pig'/374, l='MpServer', x=-489,13, y=68,64, z=945,09], EntityCreeper['Creeper'/375, l='MpServer', x=-416,88, y=66,64, z=920,75], EntityCow['Cow'/376, l='MpServer', x=-494,91, y=77,64, z=1003,03], EntityPig['Pig'/377, l='MpServer', x=-493,25, y=77,64, z=1000,50], EntitySkeleton['Skeleton'/378, l='MpServer', x=-471,16, y=33,64, z=922,69], EntityCreeper['Creeper'/379, l='MpServer', x=-409,50, y=14,64, z=917,50], EntityCreeper['Creeper'/380, l='MpServer', x=-404,50, y=67,64, z=921,50], EntityChicken['Chicken'/381, l='MpServer', x=-393,47, y=69,75, z=994,53], EntitySkeleton['Skeleton'/382, l='MpServer', x=-440,50, y=14,64, z=905,13], EntitySkeleton['Skeleton'/383, l='MpServer', x=-432,50, y=38,64, z=901,97]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555) at net.minecraft.client.Minecraft.run(Minecraft.java:980) at net.minecraft.client.main.Main.main(Main.java:164) 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:497) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) – System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.8.0_45, Oracle Corporation Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation Memory: 763171048 bytes (727 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: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 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 lc{1.0} [lc] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: GeForce GTX 960/PCIe/SSE2 GL version 4.5.0 NVIDIA 368.39, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [[1.10] Firewolf v1.36.zip] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) [12:14:53] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\.\crash-reports\crash-2016-07-13_12.14.53-client.txt AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
@Override public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem != null && usingItem.getItem() == LegacyMod.FlameBow); { int k = usingItem.getMaxItemUseDuration() - useRemaining; // ligne 271 if(k >= 18) return iconArray[2]; if(k > 13) return iconArray[1]; if(k > 0) return iconArray[0]; } return getIconIndex(stack); }
-
Comment usingItem peut-être null alors qu’il y a un null check juste au dessus !?!?
Tu es sûr que c’est ça la ligne 271 ? -
@‘robin4002’:
Comment usingItem peut-être null alors qu’il y a un null check juste au dessus !?!?
Tu es sûr que c’est ça la ligne 271 ?oui quand je clique ça me met sur cette ligne.
Tu as deux ItemStack dans la fonction normal? -
Oui c’est normal.
Le npe en revanche c’est moins normal. Je ne sais pas pourquoi ça fait ça. -
@‘robin4002’:
Oui c’est normal.
Le npe en revanche c’est moins normal. Je ne sais pas pourquoi ça fait ça.Je sais pas non plus x) tu veux ma classe ?
-
Tu sais toujours pas robin ? :x
-
Non, sinon envoies un zip de ton dossier src.
-
Tien le src
-
@‘floriangabet’:
Tien le src
extends ta class a ItemBow sinon tu auras des problèmes niveaux enchantement
-
@‘Yeyvo’:
@‘floriangabet’:
Tien le src
extends ta class a ItemBow sinon tu auras des problèmes niveaux enchantement
D’acc
merci de l’info! -
Je viens de formater le code et j’ai tout de suite vu le problème :
@Override// Prob ici public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem != null && usingItem.getItem() == LegacyMod.FlameBow) ; { int k = usingItem.getMaxItemUseDuration() - useRemaining; if(k >= 18) return iconArray[2]; if(k > 13) return iconArray[1]; if(k > 0) return iconArray[0]; } return getIconIndex(stack); }
Pourquoi il y a un ; après la condition ? C’est lui qui cause problème.
-
@‘robin4002’:
Je viens de formater le code et j’ai tout de suite vu le problème :
@Override// Prob ici public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem != null && usingItem.getItem() == LegacyMod.FlameBow) ; { int k = usingItem.getMaxItemUseDuration() - useRemaining; if(k >= 18) return iconArray[2]; if(k > 13) return iconArray[1]; if(k > 0) return iconArray[0]; } return getIconIndex(stack); }
Pourquoi il y a un ; après la condition ? C’est lui qui cause problème.
Whatttt ??? x) j’avais pas vus j’ai dus le mettre sans faire exprès merci
-
Résolu ?