Non résolu Problème avec le TileEntity de mon chest [1.7.10]
-
Bonjour, je rencontre un problème que je n’arrive pas à résoudre. Après multiple recherches je n’arrive pas à le résoudre donc je viens vers vous pour demander de l’aide.
Voici le problème, je viens juste de créer un coffre pour mon mod, sauf que quand je souhaite ouvrir mon coffre, mon jeu se met à crash. Voici la crash-report ainsi que la classe en rapport.
Crash-Report :
// Ooh. Shiny. Time: 22/11/19 11:12 Description: Rendering screen java.lang.ArrayIndexOutOfBoundsException: 54 at fr.zeltaria.zeltamod.tiles.TileEntityArdaiteChest.getStackInSlot(TileEntityArdaiteChest.java:29) at net.minecraft.inventory.Slot.getStack(Slot.java:88) at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:219) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) at net.minecraft.client.Minecraft.run(Minecraft.java:962) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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 fr.zeltaria.zeltamod.tiles.TileEntityArdaiteChest.getStackInSlot(TileEntityArdaiteChest.java:29) at net.minecraft.inventory.Slot.getStack(Slot.java:88) at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:219) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114) -- Screen render details -- Details: Screen name: fr.zeltaria.zeltamod.gui.GuiArdaiteChest Mouse location: Scaled: (213, 119). Absolute: (427, 240) Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2 -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player282'/133, l='MpServer', x=96,57, y=5,62, z=-102,30]] Chunk stats: MultiplayerChunkCache: 120, 120 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (-1859,4,45), Chunk: (at 13,0,13 in -117,2; contains blocks -1872,0,32 to -1857,255,47), Region: (-4,0; contains chunks -128,0 to -97,31, blocks -2048,0,0 to -1537,255,511) Level time: 101440 game time, 101440 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: 1 total; [EntityClientPlayerMP['Player282'/133, l='MpServer', x=96,57, y=5,62, z=-102,30]] 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:2566) at net.minecraft.client.Minecraft.run(Minecraft.java:984) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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 8.1 (amd64) version 6.3 Java Version: 1.8.0_231, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 767804288 bytes (732 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 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] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJAAAA zeltamod{0.1} [ZeltaMod] (bin) GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 10.18.14.4264' Renderer: 'Intel(R) HD Graphics 4600' Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 4600 GL version 4.3.0 - Build 10.18.14.4264, Intel 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: [] 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)
Classe du TileEntity :
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityArdaiteChest extends TileEntity implements IInventory, ISidedInventory { public ItemStack[] content = new ItemStack[54]; public boolean openning = false; public boolean closing = false; public float prevLid; public float lid; public int getSizeInventory() { return this.content.length; } public ItemStack getStackInSlot(int slot) { return this.content[slot]; } public ItemStack decrStackSize(int slotIndex, int amount) { if (this.content[slotIndex] != null) { if ((this.content[slotIndex]).stackSize <= amount) { ItemStack itemstack = this.content[slotIndex]; this.content[slotIndex] = null; markDirty(); return itemstack; } ItemStack itemstack = this.content[slotIndex].splitStack(amount); if ((this.content[slotIndex]).stackSize == 0) { this.content[slotIndex] = null; } markDirty(); return itemstack; } return null; } private void chestDisplay() { if (this.openning) { if (this.lid >= 1.0F || this.closing == true) { this.openning = false; } else { this.lid += 0.1F; } } if (this.closing) { if (this.lid <= 0.0F || this.openning == true) { this.closing = false; } else { this.lid -= 0.1F; } } } public ItemStack getStackInSlotOnClosing(int slotIndex) { if (this.content[slotIndex] != null) { ItemStack itemstack = this.content[slotIndex]; this.content[slotIndex] = null; return itemstack; } return null; } public void setInventorySlotcontents(int slotIndex, ItemStack stack) { this.content[slotIndex] = stack; if (stack != null && stack.stackSize > getInventoryStackLimit()) { stack.stackSize = getInventoryStackLimit(); } markDirty(); } public String getInventoryName() { return "TileEntity.ArdaiteChest"; } public boolean hasCustomInventoryName() { return false; } public int getInventoryStackLimit() { return 64; } public boolean isUseableByPlayer(EntityPlayer player) { return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) ? false : ( (player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D)); } public void openInventory() { this.openning = true; } public void closeInventory() { this.closing = true; } public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.content.length; i++) { if (this.content[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.content[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } compound.setTag("Items", nbttaglist); } public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.content = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xFF; if (j >= 0 && j < this.content.length) { this.content[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } } public int[] getAccessibleSlotsFromSide(int side) { int[] slots = new int[54]; for (int i = 0; i < 54; i++) { slots[i] = i; } return slots; } public boolean canInsertItem(int side, ItemStack stack, int slot) { if (slot < 54) return true; return false; } public boolean canExtractItem(int side, ItemStack stack, int slot) { if (slot < 54) return true; return false; } public boolean isItemValidForSlot(int slot, ItemStack item) { if (slot < 54) return true; return false; } @Override public void setInventorySlotContents(int i, ItemStack itemstack) { content[i] = itemstack; if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize = getInventoryStackLimit(); } markDirty(); } }
Je vous remercie par avance.