Texture Four en fonction du son status
-
Comment je peut faire alors ???
-
Il faut que tu return la texture en fonction de la metadata
-
D’accord mais le metadata je le trouve où ?
-
Il y a un argument metadat dans ta fonction getIcon
-
Oui mais la valeur du metadata je là sort d’où?
–--------------------------------------------------------------------
EDIT: Si quelqu’un sait comment resoudre ce crash
Ceci n’a strictement rien a voir avec le sujet

[22:34:13] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.world.BlockEvent$HarvestDropsEvent@40e581af: java.lang.NullPointerException at com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50) ~[BlockEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.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:140) [EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) [ForgeEventFactory.class:?] at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) [Block.class:?] at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) [Explosion.class:?] at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) [WorldServer.class:?] at net.minecraft.world.World.createExplosion(World.java:2655) [World.class:?] at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) [EntityTNTPrimed.class:?] at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) [EntityTNTPrimed.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) [World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) [WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2258) [World.class:?] at net.minecraft.world.World.updateEntities(World.java:2108) [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:?] [22:34:13] [Server thread/ERROR] [FML]: Index: 1 Listeners: [22:34:13] [Server thread/ERROR] [FML]: 0: NORMAL [22:34:13] [Server thread/ERROR] [FML]: 1: ASM: com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler@5bb1b018 onDrops(Lnet/minecraftforge/event/world/BlockEvent$HarvestDropsEvent;)V [22:34:13] [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 com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50) ~[BlockEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.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:140) ~[EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) ~[ForgeEventFactory.class:?] at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) ~[Block.class:?] at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) ~[Explosion.class:?] at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) ~[WorldServer.class:?] at net.minecraft.world.World.createExplosion(World.java:2655) ~[World.class:?] at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) ~[EntityTNTPrimed.class:?] at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) ~[EntityTNTPrimed.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) ~[WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2258) ~[World.class:?] at net.minecraft.world.World.updateEntities(World.java:2108) ~[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 [22:34:13] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Family\Desktop\Java Modding\NewMechanicalCraft\eclipse\.\crash-reports\crash-2016-03-02_22.34.13-server.txt [22:34:13] [Server thread/INFO]: Stopping server [22:34:13] [Server thread/INFO]: Saving players [22:34:13] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ---- // This doesn't make any sense! Time: 02/03/16 22:34 Description: Ticking entity java.lang.NullPointerException: Ticking entity at com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) at net.minecraft.world.World.createExplosion(World.java:2655) at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) 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.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 com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) at net.minecraft.world.World.createExplosion(World.java:2655) at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) 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: PrimedTnt (net.minecraft.entity.item.EntityTNTPrimed) Entity ID: 274 Entity Name: Block of TNT Entity's Exact location: 7,50, 32,49, 192,49 Entity's Block location: World: (7,32,192), Chunk: (at 7,2,0 in 0,12; contains blocks 0,0,192 to 15,255,207), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: -0,00, -0,00, 0,00 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) -- Affected level -- Details: Level name: TestGenOres All players: 1 total; [EntityPlayerMP['SpyMan'/129, l='TestGenOres', x=7,54, y=33,00, z=194,64]] Chunk stats: ServerChunkCache: 625 Drop: 0 Level seed: -7302235049456822426 Level generator: ID 00 - default, ver 1\. Features enabled: false Level generator options: Level spawn location: World: (-4,64,252), Chunk: (at 12,4,12 in -1,15; contains blocks -16,0,240 to -1,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 11121 game time, 11121 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 3184 (now: false), thunder time: 115577 (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)package com.google.SpyMan.Mechanicalcraft.common.Event; import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.event.world.BlockEvent; public class BlockEventHandler { @SubscribeEvent public void onDrops(BlockEvent.HarvestDropsEvent event) { if (event.block == Blocks.iron_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenIronOre, 2)); } if (event.block == Blocks.gold_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenGoldOre, 2)); } if (event.block == Blocks.lit_redstone_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenRedstoneOre, 2)); } if (event.block == Blocks.redstone_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenRedstoneOre, 2)); } if (event.block == Blocks.coal_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenCoalOre, 2)); } if (event.block == Blocks.diamond_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenDiamondOre, 2)); } if (event.block == Blocks.emerald_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenEmeraldOre, 2)); } if (event.block == MechanicalCraft.copperOre && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenCopperOre, 2)); } if (event.block == MechanicalCraft.tinOre && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenTinOre, 2)); } if (event.block == Blocks.lapis_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill) { event.drops.clear(); event.drops.add(new ItemStack(MechanicalCraft.brokenLapisOre, 2)); } } } -
Comment ça tu la sort d’où ? C’est le fonction getIcon qui la sort, appelée par mc (sauf erreur de ma part, ai pas codé en 1.7.10 depuis trèèès longtemps)
Et pour le crash, je peux pas bien voir sans les numéros de ligne mais vérifies bien que évent.drops soit pas null. -
Je pense que vais mettre en place une nouvelle règle.
Le prochain qui met une balise code ou une balise java à l’intérieur d’une balise spoiler va se manger un ban. Idem pour le prochain qui poste des logs sans la balise code ou du code sans la balise java.La balise code et la balise java ajoutent AUTOMATIQUEMENT un slider si le code est loin. Mettre une balise java ou code dans un spoiler aura juste pour effet d’avoir un rendu dégueulasse.
De même la balise java ajoute AUTOMATIQUEMENT les numéros de ligne et la couleur. C’était quoi ce message dégueulasse fait à base de quote de color, de b et de i ?Bref, pour le crash tu as un npe sur la ligne 50, ce qui est étrange.
Ce que je te conseil c’est de faire un bloc
if(event.harvester.getHeldItem() != null)
{
}
et de mettre toutes les conditions dedans (et du-coup retirer ce if présent à chaque condition). -
Désolé pour les balises j’avais oublier comme ça faisait longtemps que je n’avais posté de sujet

Quand j’ai dit “la valeur du metadata” je pensais a comment je la fait varié en fonction du status de mon block.
Elle va pas détecter toute seul si mon block est en marche ou pas, sachant que isBurning() ne fonctionne pas
et sinon j’ai oublier de préciser le crash des events c’est uniquement quand les blocks sont cassé avec quelque chose d’autre qu’une pioche, la main ou mon items Ce qui fait crash: un creeper casse les blocks ou la tnt ou les mobs qui le peuvent
PS: ça ce fonctionne pas, ça crash encore

-
C’est event.harvester qui est null, il faut ajouter un null check sur ce dernier.
-
Merci beaucoup !
Mes events fonctionnent enfin correctement -
Pour la metadata, il faut que tu créées une fonction qui va vérifier si le cour est allumé et si le bloc est celui du four éteint dans ce cas , il faudra ajouter 4 à le metadata (pour garder l orientation), et inversement, cette fonction sera appelée par le tileentity
-
ça ne fonctionne pas

-
Voici la fonction qui fait ça dans la version 1.7 de mon mod :
public static void updateFurnaceBlockState(boolean active, World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); TileEntity tileentity = world.getTileEntity(x, y, z); keepFurnaceInventory = true; //Fait que le block ne loot pas l'inventaire quand on le rempli (marche avec la fonction breakBlock()) if (active&& meta < 4) //Le block n'est pas actif mais devrait l'être { world.setBlock(x, y, z, TonBlock, meta + 4, 1); } else if(meta >= 4)//Le block est pas actif mais ne devait pas l'être { world.setBlock(x, y, z, TonBlock, meta - 4, 1); } keepFurnaceInventory = false; if (tileentity != null) { tileentity.validate(); world.setTileEntity(x, y, z, tileentity); } }Et vérifies bien ta fonction getIcon() (serait idiot que ça marche mais que tu puisses pas le voir
)Dans ma méthode update du tile entity :
if (flag != this.furnaceBurnTime > 0) //La boolean flag est définie au DEBUT de la fonction, elle égale à this.furnaceBurnTime > 0 ; et il faut que tu mettes cette condition à la fin de la fonction, ça détecte si le statut du four a changé { BlockFourElec.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } -
Je sais pas pourquoi mais je crois que je suis un pure noob en modding
Mon jeu crash
-
Rapport de crash ?
(Je ne compte pas télécharger à chaque fois ton code pour le tester de mon côté si ça peut être résolu facilement)
-
[20:47:12] [Server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking block 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.ExceptionInInitializerError at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203) ~[TileEntityCrusher.class:?] at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246) ~[TileEntityCrusher.class:?] at net.minecraft.world.World.updateEntities(World.java:2160) ~[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 Caused by: java.lang.NullPointerException at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<init>(CrusherRecipes.java:22) ~[CrusherRecipes.class:?] at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<clinit>(CrusherRecipes.java:16) ~[CrusherRecipes.class:?] at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203) ~[TileEntityCrusher.class:?] at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246) ~[TileEntityCrusher.class:?] at net.minecraft.world.World.updateEntities(World.java:2160) ~[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 [20:47:12] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Family\Desktop\Java Modding\NewMechanicalCraft\eclipse\.\crash-reports\crash-2016-03-03_20.47.12-server.txt [20:47:12] [Server thread/INFO]: Stopping server [20:47:12] [Server thread/INFO]: Saving players [20:47:12] [Server thread/INFO]: Saving worlds [20:47:12] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [20:47:13] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ---- // I bet Cylons wouldn't have this problem. Time: 03/03/16 20:47 Description: Ticking block entity java.lang.ExceptionInInitializerError at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203) at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246) at net.minecraft.world.World.updateEntities(World.java:2160) 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) Caused by: java.lang.NullPointerException at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<init>(CrusherRecipes.java:22) at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<clinit>(CrusherRecipes.java:16) ... 9 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203) at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246) ```</clinit></init></clinit></init> -
NPE -> Classe CrusherRecipes, ligne 22 & 16. On peut les voir ?
-
Y a un zip en download 2 messages plus haut sinon
Enfait le problème vien de mon block qui change de texture pas des recipesBlock Crusher
[color=#0187dfpackage ]com.google.SpyMan.Mechanicalcraft.common.BlockCrusher%(#aaa9a7)[; ] import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft%(#aaa9a7)[; ] import cpw.mods.fml.relauncher.Side%(#aaa9a7)[; ]import ***cpw.mods.fml.relauncher.SideOnly***%(#aaa9a7)[; ]import net.minecraft.block.Block%(#aaa9a7)[; ]import net.minecraft.block.BlockContainer%(#aaa9a7)[; ]import net.minecraft.block.ITileEntityProvider%(#aaa9a7)[; ]import net.minecraft.block.material.Material%(#aaa9a7)[; ]import net.minecraft.client.renderer.texture.IIconRegister%(#aaa9a7)[; ]import net.minecraft.entity.EntityLivingBase%(#aaa9a7)[; ]import net.minecraft.entity.item.EntityItem%(#aaa9a7)[; ]import net.minecraft.entity.player.EntityPlayer%(#aaa9a7)[; ]import net.minecraft.inventory.IInventory%(#aaa9a7)[; ]import net.minecraft.item.ItemStack%(#aaa9a7)[; ]import net.minecraft.nbt.NBTTagCompound%(#aaa9a7)[; ]import net.minecraft.tileentity.TileEntity%(#aaa9a7)[; ]import net.minecraft.util.IIcon%(#aaa9a7)[; ]import net.minecraft.util.MathHelper%(#aaa9a7)[; ]import net.minecraft.world.World%(#aaa9a7)[; ] public class Crusher extends BlockContainer implements %(#345f99)[ITileEntityProvider ]{ public Crusher(Material *material*) { super(*material*)%(#aaa9a7)[; ] setResistance(30.0F)%(#aaa9a7)[; ] setHardness(3)%(#aaa9a7)[; ] setHarvestLevel("pickaxe", 2)%(#aaa9a7)[; ] } private static String machineType = "crusher"%(#aaa9a7)[; ] public static String[] blockTexture = new String[] { %(#ff537a)MechanicalCraft.TEXTURE_NAME + "machine_side"%(#aaa9a7)[, ] %(#ff537a)MechanicalCraft.TEXTURE_NAME + machineType+"_front"%(#aaa9a7)[, ] %(#ff537a)MechanicalCraft.TEXTURE_NAME + machineType+"_front_on"%(#aaa9a7)[, ] %(#ff537a)MechanicalCraft.TEXTURE_NAME + "machine_bottom"%(#aaa9a7)[, ] %(#ff537a)MechanicalCraft.TEXTURE_NAME + %(#00b10f)["machine_top" ] }%(#aaa9a7)[; ] private IIcon top, bottom, side, frontOn, frontOff%(#aaa9a7)[; ] TileEntityCrusher tileEntityCrusher%(#aaa9a7)[; ] public void registerBlockIcons(IIconRegister *iiconRegister*) { this.frontOn = *iiconRegister*.registerIcon(blockTexture[2])%(#aaa9a7)[; ] this.frontOff = *iiconRegister*.registerIcon(blockTexture[1])%(#aaa9a7)[; ] this.top = *iiconRegister*.registerIcon(blockTexture[4])%(#aaa9a7)[; ] this.bottom = *iiconRegister*.registerIcon(blockTexture[3])%(#aaa9a7)[; ] this.side = *iiconRegister*.registerIcon(blockTexture[0])%(#aaa9a7)[; ] } public void onBlockPlacedBy(World *world*, int *x*, int *y*, int *z*, EntityLivingBase *living*, ItemStack *stack*) { int direction = MathHelper.floor_double((double) (*living*.rotationYaw %(#aaa9a7)* 4.0F / 360.0F) + 2.5D) & 3%(#aaa9a7)[; ] *world*.setBlockMetadataWithNotify(*x*, *y*, *z*, direction, 2)%(#aaa9a7)[; ] } ***@SideOnly***(Side.CLIENT) public IIcon getIcon(int *side*, int *metadata*) { if (*side *== 0) return this.bottom%(#aaa9a7)[; ] else if (*side *== 1) return this.top%(#aaa9a7)[; ] if ((*side *== 3 && *metadata *== 0) || (*side *== 4 && *metadata *== 1) || (*side *== 2 && *metadata *== 2) || (*side *== 5 && *metadata *== 3)) { return this.frontOff%(#aaa9a7)[; ] } else if ((*side *== 3 && *metadata *== 4) || (*side *== 4 && *metadata *== 5) || (*side *== 2 && *metadata *== 6) || (*side *== 5 && *metadata *== 7)) { return this.frontOn%(#aaa9a7)[; ] } return this.side%(#aaa9a7)[; ] } private static boolean keepFurnaceInventory = false%(#aaa9a7)[; ] // METHOD: update the block front texture public static void updateMachineTexture(boolean *active*, World *world*, int *x*, int *y*, int *z*) { Block block = *world*.getBlock(*x*, *y*, *z*)%(#aaa9a7)[; ] int meta = *world*.getBlockMetadata(*x*, *y*, *z*)%(#aaa9a7)[; ] TileEntity tileentity = *world*.getTileEntity(*x*, *y*, *z*)%(#aaa9a7)[; ] keepFurnaceInventory = true%(#aaa9a7)[; ] if (*active *&& meta < 4) { *world*.setBlock(*x*, *y*, *z*, MechanicalCraft.crusher, meta + 4, 1)%(#aaa9a7)[; ] } else if(meta >= 4) { *world*.setBlock(*x*, *y*, *z*, MechanicalCraft.crusher, meta - 4, 1)%(#aaa9a7)[; ] } keepFurnaceInventory = false%(#aaa9a7)[; ] if (tileentity != null) { tileentity.validate()%(#aaa9a7)[; ] *world*.setTileEntity(*x*, *y*, *z*, tileentity)%(#aaa9a7)[; ] } } %(#278c3c)[***@Override ***] public TileEntity createNewTileEntity(World *world*, int *metadata*) { return new TileEntityCrusher()%(#aaa9a7)[; ] } %(#278c3c)[***@Override ***] public boolean hasTileEntity(int *metadata*) { return true%(#aaa9a7)[; ] } public void breakBlock(World *world*, int *x*, int *y*, int *z*, Block *block*, int *metadata*) { TileEntity tileentity = *world*.getTileEntity(*x*, *y*, *z*)%(#aaa9a7)[; ] if (tileentity instanceof IInventory) { if (keepFurnaceInventory = true) {} %(#0187df)[else ] { IInventory inv = (IInventory)tileentity%(#aaa9a7)[; ] for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1) { ItemStack itemstack = inv.getStackInSlot(i1)%(#aaa9a7)[; ] if (itemstack != null) { float f = *world*.rand.nextFloat() %(#aaa9a7)* 0.8F + 0.1F%(#aaa9a7)[; ] float f1 = *world*.rand.nextFloat() %(#aaa9a7)* 0.8F + 0.1F%(#aaa9a7)[; ] EntityItem entityitem%(#aaa9a7)[; ] for (float f2 = *world*.rand.nextFloat() %(#aaa9a7)* 0.8F + 0.1F; itemstack.stackSize > 0; *world*.spawnEntityInWorld(entityitem)) { int j1 = *world*.rand.nextInt(21) + 10%(#aaa9a7)[; ] if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize%(#aaa9a7)[; ] } itemstack.stackSize -= j1%(#aaa9a7)[; ] entityitem = new EntityItem(*world*, (double) ((float) *x *+ f), (double) ((float) *y *+ f1), (double) ((float) *z *+ f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()))%(#aaa9a7)[; ] float f3 = 0.05F%(#aaa9a7)[; ] entityitem.motionX = (double) ((float) *world*.rand.nextGaussian() %(#aaa9a7)* f3)%(#aaa9a7)[; ] entityitem.motionY = (double) ((float) *world*.rand.nextGaussian() %(#aaa9a7)* f3 + 0.2F)%(#aaa9a7)[; ] entityitem.motionZ = (double) ((float) *world*.rand.nextGaussian() %(#aaa9a7)* f3)%(#aaa9a7)[; ] if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy())%(#aaa9a7)[; ] } } } } } *world*.func_147453_f(*x*, *y*, *z*, *block*)%(#aaa9a7)[; ] } super.breakBlock(*world*, *x*, *y*, *z*, *block*, *metadata*)%(#aaa9a7)[; ] } public boolean onBlockActivated(World *world*, int *x*, int *y*, int *z*, EntityPlayer *player*, int *side*, float *hitx*, float *hity*, float *hitz*) { if (*world*.isRemote) { return true%(#aaa9a7)[; ] } %(#0187df)[else ] { *player*.openGui(MechanicalCraft.instance, 3, *world*, *x*, *y*, *z*)%(#aaa9a7)[; ] return true%(#aaa9a7)[; ] } } } ``` TileEntityCrusher ```java [color=#0187dfpackage ]com.google.SpyMan.Mechanicalcraft.common.BlockCrusher%(#aaa9a7)[; ] import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft%(#aaa9a7)[; ]import cpw.mods.fml.relauncher.Side%(#aaa9a7)[; ]import ***cpw.mods.fml.relauncher.SideOnly***%(#aaa9a7)[; ]import net.minecraft.entity.player.EntityPlayer%(#aaa9a7)[; ]import net.minecraft.init.Blocks%(#aaa9a7)[; ]import net.minecraft.init.Items%(#aaa9a7)[; ]import net.minecraft.inventory.IInventory%(#aaa9a7)[; ]import net.minecraft.item.ItemStack%(#aaa9a7)[; ]import net.minecraft.nbt.NBTTagCompound%(#aaa9a7)[; ]import net.minecraft.nbt.NBTTagList%(#aaa9a7)[; ]import net.minecraft.network.NetworkManager%(#aaa9a7)[; ]import net.minecraft.network.Packet%(#aaa9a7)[; ]import net.minecraft.network.play.server.S35PacketUpdateTileEntity%(#aaa9a7)[; ]import net.minecraft.tileentity.TileEntity%(#aaa9a7)[; ]import net.minecraft.tileentity.TileEntityFurnace%(#aaa9a7)[; ] public class TileEntityCrusher extends TileEntity implements IInventory { private byte direction%(#aaa9a7)[; ] private ItemStack[] contents = new ItemStack[4]%(#aaa9a7)[; ] protected int workingTime = 0%(#aaa9a7)[; ] protected int workingTimeNeeded = 200%(#aaa9a7)[; ] protected int burnTime = 0%(#aaa9a7)[; ] protected int burnTimeTotal = 0%(#aaa9a7)[; ] %(#278c3c)[***@Override ***] public void readFromNBT(NBTTagCompound *compound*) { super.readFromNBT(*compound*)%(#aaa9a7)[; ] this.direction = *compound*.getByte("Direction")%(#aaa9a7)[; ] NBTTagList nbttaglist = *compound*.getTagList("Items", 10)%(#aaa9a7)[; ] this.contents = new ItemStack[this.getSizeInventory()]%(#aaa9a7)[; ] for(int %(#666965)_= 0; %(#666965)_< nbttaglist.tagCount(); ++%(#666965)*) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[; ] int j = nbttagcompound1.getByte("Slot") & 255%(#aaa9a7)[; ] if(j >= 0 && j < this.contents.length) { this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1)%(#aaa9a7)[; ] } } this.workingTime = *compound*.getShort("workingTime")%(#aaa9a7)[; ] this.workingTimeNeeded = *compound*.getShort("workingTimeNeeded")%(#aaa9a7)[; ] } %(#278c3c)[***@Override ***] public void writeToNBT(NBTTagCompound *compound*) { super.writeToNBT(*compound*)%(#aaa9a7)[; ] NBTTagList nbttaglist = new NBTTagList()%(#aaa9a7)[; ] *compound*.setByte("Direction", this.direction)%(#aaa9a7)[; ] for(int %(#666965)_= 0; %(#666965)_< this.contents.length; ++%(#666965)*) { if(this.contents[%(#666965)*] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound()%(#aaa9a7)[; ] nbttagcompound1.setByte("Slot", (byte)%(#666965)*)%(#aaa9a7)[; ] this.contents[%(#666965)*].writeToNBT(nbttagcompound1)%(#aaa9a7)[; ] nbttaglist.appendTag(nbttagcompound1)%(#aaa9a7)[; ] } } *compound*.setTag("Items", nbttaglist)%(#aaa9a7)[; ] *compound*.setShort("workingTime", (short)this.workingTime)%(#aaa9a7)[; ] *compound*.setShort("workingTimeNeeded", (short)this.workingTimeNeeded)%(#aaa9a7)[; ] } public byte getDirection() { return direction%(#aaa9a7)[; ] } public void setDirection(byte *direction*) { this.direction = *direction*%(#aaa9a7)[; ] this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[; ] } public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound()%(#aaa9a7)[; ] this.writeToNBT(nbttagcompound)%(#aaa9a7)[; ] return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound)%(#aaa9a7)[; ] } public void onDataPacket(NetworkManager *net*, S35PacketUpdateTileEntity *pkt*) { this.readFromNBT(*pkt*.func_148857_g())%(#aaa9a7)[; ] } public int getSizeInventory() { return this.contents.length%(#aaa9a7)[; ] } public void openInventory() {} public void closeInventory() {} public String getInventoryName() { return MechanicalCraft.crusher.getLocalizedName()%(#aaa9a7)[; ] } public boolean hasCustomInventoryName() { return false%(#aaa9a7)[; ] } public int getInventoryStackLimit() { return 64%(#aaa9a7)[; ] } public boolean isUseableByPlayer(EntityPlayer *player*) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : *player*.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D%(#aaa9a7)[; ] } public ItemStack getStackInSlot(int *slotIndex*) { return this.contents[*slotIndex*]%(#aaa9a7)[; ] } public ItemStack decrStackSize(int *slotIndex*, int *amount*) { if(this.contents[*slotIndex*] != null) { ItemStack itemstack%(#aaa9a7)[; ] if(this.contents[*slotIndex*].stackSize <= *amount*) { itemstack = this.contents[*slotIndex*]%(#aaa9a7)[; ] this.contents[*slotIndex*] = null%(#aaa9a7)[; ] this.markDirty()%(#aaa9a7)[; ] return itemstack%(#aaa9a7)[; ] } %(#0187df)[else ] { itemstack = this.contents[*slotIndex*].splitStack(*amount*)%(#aaa9a7)[; ] if(this.contents[*slotIndex*].stackSize == 0) { this.contents[*slotIndex*] = null%(#aaa9a7)[; ] } this.markDirty()%(#aaa9a7)[; ] return itemstack%(#aaa9a7)[; ] } } %(#0187df)[else ] { return null%(#aaa9a7)[; ] } } public ItemStack getStackInSlotOnClosing(int *slotIndex*) { if(this.contents[*slotIndex*] != null) { ItemStack itemstack = this.contents[*slotIndex*]%(#aaa9a7)[; ] this.contents[*slotIndex*] = null%(#aaa9a7)[; ] return itemstack%(#aaa9a7)[; ] } %(#0187df)[else ] { return null%(#aaa9a7)[; ] } } public void setInventorySlotContents(int *slotIndex*, ItemStack *stack*) { this.contents[*slotIndex*] = *stack*%(#aaa9a7)[; ] if(*stack *!= null && *stack*.stackSize > this.getInventoryStackLimit()) { *stack*.stackSize = this.getInventoryStackLimit()%(#aaa9a7)[; ] } this.markDirty()%(#aaa9a7)[; ] } public boolean isItemValidForSlot(int *slot*, ItemStack *stack*) { return *slot *== 2 ? false : true%(#aaa9a7)[; ] } public boolean isBurning() { return this.workingTime > 0%(#aaa9a7)[; ] } protected boolean canSmelt() { if(this.contents[0] == null) { return false%(#aaa9a7)[; ] } %(#0187df)[else ] { ItemStack itemstack = CrusherRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0]})%(#aaa9a7)[; ] if(itemstack == null) return false%(#aaa9a7)[; ] if(this.contents[2] == null) return true%(#aaa9a7)[; ] if(!this.contents[2].isItemEqual(itemstack)) return false%(#aaa9a7)[; ] int result = contents[2].stackSize + itemstack.stackSize%(#aaa9a7)[; ] return result <= getInventoryStackLimit() && result <= this.contents[2].getMaxStackSize()%(#aaa9a7)[; ] } } public void smeltItem() { if(this.canSmelt()) { ItemStack itemstack = CrusherRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0]})%(#aaa9a7)[; ] if(this.contents[2] == null) { this.contents[2] = itemstack.copy()%(#aaa9a7)[; ] } else if(this.contents[2].getItem() == itemstack.getItem()) { this.contents[2].stackSize += itemstack.stackSize%(#aaa9a7)[; ] } this.decrStackSize(0, 1)%(#aaa9a7)[; ] } } boolean flag%(#aaa9a7)[; ] public void updateEntity() { %(#ff9205)[//System.out.println(burnTime + "/" + burnTimeTotal); ] if(this.burnTime > 0) { burnTime%(#aaa9a7)[–; ] flag = true%(#aaa9a7)[; ] } %(#0187df)[else ] { flag = false%(#aaa9a7)[; ] } if(this.canSmelt()) { if(this.burnTime <= 0) { int %(#666965)____ -
Normal que ça marche pas…
package com.google.SpyMan.Mechanicalcraft.common.BlockCrusher; import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class CrusherRecipes { private static final CrusherRecipes smeltingBase = new CrusherRecipes(); private Map <itemstack[], itemstack="">smeltingList = new HashMap<itemstack[], itemstack="">(); private MechanicalCraft m; // ici la variable n'est jamais initialisée public CrusherRecipes() { this.m.crusherRecipes(); // Et ici tu appelles la variable } }L’instance ne va pas se créer toute seule.
PS : pense vraiment à respecter la convention java</itemstack[],></itemstack[],>
-
9a ne change pas grand chose ça crash toujours

Pour la code convention alors y’a 24 pages et je ne suis qu’à la 13ème pages