Texture Four en fonction du son status
-
[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
-
Si MechanicalCraft est le nom de ta classe Mod, alors ça ne sert strictement à rien de lui faire une instance puisqu’elle est censée être singleton. Tu as déjà dedans (dans ta classe MechanicalCraft) une variable instance, normalement, si tu as bien suivi le tuto. Alors tu aurais juste à faire MechanicalCraft.instance.crusherRecipes()
-
9a ?? C’est quoi ça ?
Si tu veux avoir une instance de ton mod, tu peux aussi faire “MechanicalCraft m = MechanicalCraft.INSTANCE;” ou quelque chose dans le genre, ça dépend de ce que tu as mis.
Les conventions sont assez simples :
- écriture en lowerCamelCase pour les variables et les fonctions
- écriture en UpperCamelCase pour les noms de classes
- écriture en SCREAMING_SNAKE_CASE pour les constantes
- les noms de packages doivent êtres entièrement en minuscules
-
@SCAREX
Je pense qu’il voulait dire “Ca” dans son début de réponse.
Et au passage ouais, pas besoin de te taper 30 pages de blabla, juste pour 4/5 règles grand maxi (citées au-dessus) de convention Java. Perso pour l’apprendre, je n’ai eu besoin que de 5 min ^^’ -
Ok ça marche merci

Mais comment je peut changer la texture de front de ma machine car j’ai essayé tout ce que on n’a pu me donner comme code et ça marche pas ou je ne mit prend pas correctement
-
Sinon si rien ne marche, fais deux blocs (on et off) et imite le code vanilla
-
C’est à dire ? La texture n’est pas chargée (Il faut regarder dans les logs pour savoir si la texture est trouvée) ?
-
Non le jeu crash, mais je vais essayé de faire ça dans la fonction updateEntity de mon TileEntity voir ce que cela donne
-
Envoi le crash report et les classes concernées
-
J’ai trouvé la solution mais au problèmes textures enfin !
Mais j’ai un petit soucis : Mon block ne se met pas a jour comment faire pour ?
Quand je place ma speed upgrade à l’intérieure ça fonctionne mais quand je la retire ça garde la valeur précédente de workingTimeNeeded[color=#0187df// Ceci se trouve dans la method updateEntity() de mon TileEntity] [font=Courier Newif ](contents[4] != null) { if (contents[4].getItem() == MechanicalCraft.speedUpgrade) { workingTimeNeeded = SpeedUpgrade.getSpeedUp()%(#aaa9a7)[; ] } %(#0187df)[else ] { workingTimeNeeded = workingTimeNeededDefault%(#aaa9a7)[; ] } } else {} -
C’est à dire mettre à jour ?
-
Je veut que la valeur de workingTimeNeeded change mais sans avoir besoin de mettre a jour le block manuellement ça fonctionne dans un sens mais pas dans l’autre:
Quand je la place ça marche mais quand je la retire ça ne redonne pas la valeur par default (workingTimeNeededDefault)
J’ai bien verifier si ces valeurs etaient enregistré dans les données NBT, et ce n’est pas le cas. -
Normal quand t’enlève ton upgrade, content[4] passe à nul :
if (contents[4] != null) { if (contents[4].getItem() == MechanicalCraft.speedUpgrade) { workingTimeNeeded = SpeedUpgrade.getSpeedUp(); } } else { workingTimeNeeded = workingTimeNeededDefault; } -
Merci !
