Résolu Pas codé depuis 1mois = perdu
-
Voilla donc j’ai mon gui handler mes je sait pas ce que j’ai fait fin si de la mer…
donc je suis perdu merci de m’aider a remettre bien mon code
package com.adamitemod.mod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityMachine) { return new ContainerMachine((TileEntityMachine)tile, player.inventory); } else if(tile instanceof TileEntityMachinePulveriser) { return new ContainerMachinePulveriser((TileEntityMachinePulveriser)tile, player.inventory); } else if(ID == 0) { return new ContainerBackPack(player.inventory, new InventoryBackPack(player.getHeldItem(), 54)); } else if(tile instanceof TileEntityMachineStacker) { return new ContainerMachineStacker((TileEntityMachineStacker)tile, player.inventory); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityMachine) { return new GuiMachine((TileEntityMachine)tile, player.inventory); } else if(tile instanceof TileEntityMachinePulveriser) { return new GuiMachinePulveriser((TileEntityMachinePulveriser)tile, player.inventory); } else if(ID == 0) { return new GuiBackPack(player.inventory, new InventoryBackPack(player.getHeldItem(), 54)); } else if(tile instanceof TileEntityMachineStacker) { return new GuiMachineStacker((TileEntityMachineStacker)tile, player.inventory); } return null; } }
-
Quel est problème ?
Car je ne vois pas de soucis dans le code. -
genre je veux créer un stacker j’ai fait le block et tous je le pose je fait clique droit sans rien dans la main sa crash
je relance je fait clique droit en ayant 1stacker dans la main je ne crash pas mais sa m’ouvre le m’auvais GUI sa ouvre celui de backpack
-
Mets le :
else if(ID == 0)
{
return new ContainerBackPack(player.inventory, new InventoryBackPack(player.getHeldItem(), 54));
}
tout à la fin des conditions.
Ou alors change l’id dans la fonction openGUI de ton stacker -
sa ne le fait plus mes sa crash toujour quand j’essaye de l’ouvrir
–-- Minecraft Crash Report ---- // Why is it breaking :( Time: 18/06/16 17:43 Description: Unexpected error java.lang.IndexOutOfBoundsException: Index: 38, Size: 38 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at net.minecraft.inventory.Container.getSlot(Container.java:130) at net.minecraft.inventory.Container.putStacksInSlots(Container.java:558) at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1202) at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:70) at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:78) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1693) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) 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 java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at net.minecraft.inventory.Container.getSlot(Container.java:130) at net.minecraft.inventory.Container.putStacksInSlots(Container.java:558) at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1202) at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:70) at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:78) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player224'/176, l='MpServer', x=307,75, y=65,62, z=304,72]] Chunk stats: MultiplayerChunkCache: 25, 25 Level seed: 0 Level generator: ID 00 - default, ver 1\. Features enabled: false Level generator options: Level spawn location: World: (252,64,255), Chunk: (at 12,4,15 in 15,15; contains blocks 240,0,240 to 255,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 220580 game time, 220580 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 21 total; [EntityZombie['Zombie'/32, l='MpServer', x=292,91, y=66,00, z=317,50], EntitySquid['Squid'/512, l='MpServer', x=280,91, y=53,38, z=333,19], EntitySquid['Squid'/513, l='MpServer', x=283,50, y=52,00, z=329,50], EntitySquid['Squid'/514, l='MpServer', x=284,41, y=53,34, z=332,22], EntitySquid['Squid'/515, l='MpServer', x=273,84, y=53,25, z=328,03], EntityBat['Bat'/67, l='MpServer', x=323,81, y=15,26, z=278,58], EntitySquid['Squid'/516, l='MpServer', x=278,50, y=54,28, z=324,22], EntityBat['Bat'/69, l='MpServer', x=320,13, y=12,05, z=285,00], EntityZombie['Zombie'/70, l='MpServer', x=315,50, y=28,00, z=336,50], EntitySquid['Squid'/518, l='MpServer', x=275,91, y=53,25, z=327,06], EntitySquid['Squid'/491, l='MpServer', x=318,88, y=55,34, z=352,59], EntityClientPlayerMP['Player224'/176, l='MpServer', x=307,75, y=65,62, z=304,72], EntitySlime['Slime'/53, l='MpServer', x=295,69, y=14,00, z=301,69], EntitySheep['Sheep'/54, l='MpServer', x=296,50, y=76,00, z=290,50], EntitySheep['Sheep'/55, l='MpServer', x=296,50, y=76,00, z=290,50], EntityZombie['Zombie'/87, l='MpServer', x=326,34, y=50,00, z=272,34], EntityZombie['Zombie'/94, l='MpServer', x=337,50, y=34,00, z=276,50], EntitySquid['Squid'/510, l='MpServer', x=277,50, y=55,34, z=329,50], EntityBat['Bat'/95, l='MpServer', x=340,50, y=19,17, z=321,80], EntitySheep['Sheep'/31, l='MpServer', x=277,94, y=66,00, z=275,03], EntitySquid['Squid'/511, l='MpServer', x=282,47, y=55,34, z=326,56]] 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:991) 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 10 (x86) version 10.0 Java Version: 1.8.0_66, Oracle Corporation Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation Memory: 842963088 bytes (803 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 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.99.99 Minecraft Forge 10.13.4.1558 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.1558-1.7.10.jar) UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) UCHIJAAAA adamitemod{1.0.0} [Adamite Mod] (bin) GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.4276' Renderer: 'Intel(R) HD Graphics' Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics GL version 4.0.0 - Build 10.18.10.4276, 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)
-
Il y a un problème avec la taille de l’inventaire, tu as du mettre 38 (ou +) quelque part alors que sa taille est de 38 (38 n’est pas inclus car ça commence à 0 et non 1). Montre ton TileEntity et ton Container.
-
package com.adamitemod.mod; import com.adamitemod.mod.init.MachineRecipes; import com.adamitemod.mod.init.MachineRecipesPulveriser; import com.adamitemod.mod.init.MachineRecipesStacker; import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.Side; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityMachineStacker extends TileEntity implements IInventory { private ItemStack[] contents = new ItemStack[2]; private int workingTime = 0; private int workingTimeNeeded = 100; @SideOnly(Side.CLIENT) public int getCookProgress() { return this.workingTime * 8 / this.workingTimeNeeded; } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList nbttaglist = new NBTTagList(); for(int i = 0; i < this.contents.length; ++i) { if(this.contents* != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.contents*.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } compound.setTag("Items", nbttaglist); compound.setShort("workingTime", (short)this.workingTime); compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.contents = new ItemStack[this.getSizeInventory()]; for(int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if(j >= 0 && j < this.contents.length) { this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.workingTime = compound.getShort("workingTime"); this.workingTimeNeeded = compound.getShort("workingTimeNeeded"); } @Override public int getSizeInventory() { return this.contents.length; } @Override public ItemStack getStackInSlot(int slotIndex) { return this.contents[slotIndex]; } @Override public ItemStack decrStackSize(int slotIndex, int amount) { if(this.contents[slotIndex] != null) { ItemStack itemstack; if(this.contents[slotIndex].stackSize <= amount) { itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; this.markDirty(); return itemstack; } else { itemstack = this.contents[slotIndex].splitStack(amount); if(this.contents[slotIndex].stackSize == 0) { this.contents[slotIndex] = null; } this.markDirty(); return itemstack; } } else { return null; } } @Override public ItemStack getStackInSlotOnClosing(int slotIndex) { if(this.contents[slotIndex] != null) { ItemStack itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; return itemstack; } else { return null; } } @Override public void setInventorySlotContents(int slotIndex, ItemStack stack) { this.contents[slotIndex] = stack; if(stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } @Override public String getInventoryName() { return "tile.machineTuto"; } @Override public boolean hasCustomInventoryName() { return false; } @Override public int getInventoryStackLimit() { return 64; } @Override 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; } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return slot == 1 ? false : true; } public boolean isBurning() { return this.workingTime > 0; } private boolean canSmelt() { if(this.contents[0] == null) { return false; } else { ItemStack itemstack = MachineRecipesStacker.smelting().getSmeltingResult(this.contents[0]); if(itemstack == null) return false; if(this.contents[1] == null) return true; if(!this.contents[1].isItemEqual(itemstack)) return false; int result = contents[1].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.contents[0].getMaxStackSize(); } } public void updateEntity() { if(this.isBurning() && this.canSmelt()) { ++this.workingTime; } if(this.canSmelt() && !this.isBurning()) { this.workingTime = 1; } if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) { this.smeltItem(); this.workingTime = 0; } if(!this.canSmelt()) { this.workingTime = 0; } } public void smeltItem() { if(this.canSmelt()) { ItemStack itemstack = MachineRecipesStacker.smelting().getSmeltingResult(this.contents[0]); if(this.contents[1] == null) { this.contents[1] = itemstack.copy(); } else if(this.contents[1].getItem() == itemstack.getItem()) { this.contents[1].stackSize += itemstack.stackSize; } –this.contents[0].stackSize; if(this.contents[0].stackSize <= 0) { this.contents[0] = null; } } } }
package com.adamitemod.mod; import com.adamitemod.mod.TileEntityMachinePulveriser; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerMachineStacker extends Container { public ContainerMachineStacker(TileEntityMachineStacker tile, InventoryPlayer inventory) { this.tileMachineStacker = tile; this.addSlotToContainer(new Slot(tile, 0, 57, 121)); this.addSlotToContainer(new SlotResult(tile, 1, 124, 121)); this.bindPlayerInventory(inventory); } public boolean canInteractWith(EntityPlayer player) { return tileMachineStacker.isUseableByPlayer(player); } private void bindPlayerInventory(InventoryPlayer inventory) { for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 17 + j * 18, 171 + i * 18)); } for(int i = 0; i < 9; i++) addSlotToContainer(new Slot(inventory, i, 17 + i * 18, 229)); } public ItemStack transferStackInSlot(EntityPlayer player, int quantity) { ItemStack itemstack = null; Slot slot = (Slot)inventorySlots.get(quantity); if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if(quantity < tileMachineStacker.getSizeInventory()) { if(!mergeItemStack(itemstack1, tileMachineStacker.getSizeInventory(), inventorySlots.size(), true)) return null; } else if(!mergeItemStack(itemstack1, 0, tileMachineStacker.getSizeInventory(), false)) return null; if(itemstack1.stackSize == 0) slot.putStack((ItemStack)null); else slot.onSlotChanged(); } return itemstack; } public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); tileMachineStacker.closeInventory(); } private TileEntityMachineStacker tileMachineStacker; }
-
Il n’y pas d’erreur là dedans, dans le constructeur de ton Gui, as-tu bien “super(new ContainerBackPack(quelques choses));” ?
-
mon backpack marche ses mon stacker qui bug
-
Oui j’ai bien se que tu m’as demander dans le gui c’est :
super(new ContainerMachineStacker(tile, inventory));
-
@‘amigo127’:
mon backpack marche ses mon stacker qui bug
Ah oui autant pour moi je me suis trompé pour le nom ^^
Alors je ne vois pas d’où vient le problème.
-
bah je sait juste que que j’essaye de l’ouvrire sa crash
-
Envoi rapport de crash + container correspondant
-
OKi je fait ceci de suite___Le crash :
:::
java.lang.NullPointerException: Ticking memory connection
at com.adamitemod.mod.InventoryBackPack.<init>(InventoryBackPack.java:20)
at com.adamitemod.mod.GuiHandler.getServerGuiElement(GuiHandler.java:25)
at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:243)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at com.adamitemod.mod.MachineStacker.onBlockActivated(MachineStacker.java:86)
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
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.adamitemod.mod.InventoryBackPack.<init>(InventoryBackPack.java:20)
at com.adamitemod.mod.GuiHandler.getServerGuiElement(GuiHandler.java:25)
at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:243)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at com.adamitemod.mod.MachineStacker.onBlockActivated(MachineStacker.java:86)
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)– Ticking connection –
Details:
Connection: net.minecraft.network.NetworkManager@14a7560
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
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)– System Details –
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (x86) version 10.0
Java Version: 1.8.0_66, Oracle Corporation
Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation
Memory: 714443272 bytes (681 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 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.99.99 Minecraft Forge 10.13.4.1558 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.1558-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA adamitemod{1.0.0} [Adamite Mod] (bin)
GL info:ERRORRuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP[‘Player584’/281, l=‘New World’, x=308,30, y=66,00, z=299,57]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to ‘fml,forge’
:::ma class
package com.adamitemod.mod; import com.adamitemod.mod.TileEntityMachinePulveriser; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerMachineStacker extends Container { public ContainerMachineStacker(TileEntityMachineStacker tile, InventoryPlayer inventory) { this.tileMachineStacker = tile; this.addSlotToContainer(new Slot(tile, 0, 57, 121)); this.addSlotToContainer(new SlotResult(tile, 1, 124, 121)); this.bindPlayerInventory(inventory); } public boolean canInteractWith(EntityPlayer player) { return tileMachineStacker.isUseableByPlayer(player); } private void bindPlayerInventory(InventoryPlayer inventory) { for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 17 + j * 18, 171 + i * 18)); } for(int i = 0; i < 9; i++) addSlotToContainer(new Slot(inventory, i, 17 + i * 18, 229)); } public ItemStack transferStackInSlot(EntityPlayer player, int quantity) { ItemStack itemstack = null; Slot slot = (Slot)inventorySlots.get(quantity); if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if(quantity < tileMachineStacker.getSizeInventory()) { if(!mergeItemStack(itemstack1, tileMachineStacker.getSizeInventory(), inventorySlots.size(), true)) return null; } else if(!mergeItemStack(itemstack1, 0, tileMachineStacker.getSizeInventory(), false)) return null; if(itemstack1.stackSize == 0) slot.putStack((ItemStack)null); else slot.onSlotChanged(); } return itemstack; } public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); tileMachineStacker.closeInventory(); } private TileEntityMachineStacker tileMachineStacker; } ```</init></init>
-
Renvoies le code du gui handler.
Il n’est toujours pas bon, il essaie d’ouvrir le container du BackPack au lieu de celui du bloc. -
Ses ce que je me disait mais j’ai pas trouvé tien cadeau du pas bohneur
package com.adamitemod.mod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityMachine) { return new ContainerMachine((TileEntityMachine)tile, player.inventory); } else if(tile instanceof TileEntityMachinePulveriser) { return new ContainerMachinePulveriser((TileEntityMachinePulveriser)tile, player.inventory); } else if(ID == 0) { return new ContainerBackPack(player.inventory, new InventoryBackPack(player.getHeldItem(), 54)); } else if(tile instanceof TileEntityMachineStacker) { return new ContainerMachineStacker((TileEntityMachineStacker)tile, player.inventory); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityMachine) { return new GuiMachine((TileEntityMachine)tile, player.inventory); } else if(tile instanceof TileEntityMachinePulveriser) { return new GuiMachinePulveriser((TileEntityMachinePulveriser)tile, player.inventory); } else if(tile instanceof TileEntityMachineStacker) { return new GuiMachineStacker((TileEntityMachineStacker)tile, player.inventory); } else if(ID == 0) { return new GuiBackPack(player.inventory, new InventoryBackPack(player.getHeldItem(), 54)); } return null; } }
-
else if(ID == 0)
{
return new ContainerBackPack(player.inventory, new InventoryBackPack(player.getHeldItem(), 54));
}
-> pareil à mettre à la fin de la fonction. -
Ou change l’ID en le passant à 1 car si tu utilises la méthode de Robin ton ID est toujours à 0
-
Merci pour vos réponce je test sa :)___Merci a vous sa marche nnikell