Résolu Poubelle Portatif
-
Bonjour,
J’ai ajouté une poubelle portatif dans mon mods. Elle marche super bien sur eclipse. Mais le probleme c’est quand je la mais en multi ou solo il fait crash le joueur quand il fait clik droit que en solo sa marche super bien.
Voilà le code:
package fr.darkvince.ultra; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import scala.reflect.internal.Trees.This; public class itemPoubelle extends Item{ public itemPoubelle() { this.maxStackSize = 1; } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (!world.isRemote) { player.openGui(Main.instance, 6, world, (int) player.posX, (int) player.posY, (int) player.posZ); } return stack; } }
package fr.darkvince.ultra; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; public class SlotLocked extends Slot { public SlotLocked(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } public boolean canTakeStack(EntityPlayer par1EntityPlayer) { return false; } }
package fr.darkvince.ultra; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class SlotVoid extends Slot { public SlotVoid(int x, int y) { super(null, 0, x, y); } public void putStack(ItemStack par1ItemStack) { onSlotChanged(); } public ItemStack getStack() { return null; } public void onSlotChanged() {} public int getSlotStackLimit() { return 64; } }
package fr.darkvince.ultra; import fr.darkvince.ultra.containerPoubelle; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class GuiPoubelle extends GuiContainer { private static final ResourceLocation background = new ResourceLocation("ultra:textures/gui/container/poubelle.png"); public GuiPoubelle(InventoryPlayer playerInventory) { super(new containerPoubelle(playerInventory)); } protected void func_146979_b(int par1, int par2) { this.fontRendererObj.drawString(I18n.format("item.poubelle.name", new Object[0]), 8, 6, 12500670); } protected void func_146976_a(float var1, int var2, int var3) { this.buttonList.add(this.background); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int x = (this.width - this.height ) / 2; int y = (this.width - this.height ) / 2; drawTexturedModalRect(x, y, 0, 0, this.height, this.width); } @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // on colorise this.mc.getTextureManager().bindTexture(background); // affiche la texture int k = (this.width - this.xSize) / 2; // on calcul la coordonnée x du point en haut à gauche int l = (this.height - this.ySize) / 2; // on calcul la coordonnée y du point en haut à gauche this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); // on desine la texture, la fonction à pour argument point x de départ, point y de départ, vecteur u, vecteur v, largeur, hauteur) } }
package fr.darkvince.ultra; import java.util.List; import fr.darkvince.ultra.SlotLocked; import fr.darkvince.ultra.SlotVoid; 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 containerPoubelle extends Container { public containerPoubelle(InventoryPlayer playerInventory) { addSlotToContainer(new SlotVoid(80, 18)); bindPlayerInventory(playerInventory); } public boolean canInteractWith(EntityPlayer var1) { return true; } public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null) { slot.putStack(null); } return null; } protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 51 + i * 18)); } } for (int i = 0; i < 9; i++) { if (inventoryPlayer.getStackInSlot(i) == inventoryPlayer.player.getCurrentEquippedItem()) { addSlotToContainer(new SlotLocked(inventoryPlayer, i, 8 + i * 18, 109)); } else { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 109)); } } } }
package fr.darkvince.ultra.coffre; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; import fr.darkvince.ultra.GuiPoubelle; import fr.darkvince.ultra.containerPoubelle; 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 TileEntityCoffre){ return new ContainerCupboard((TileEntityCoffre)tile, player.inventory); } else if(ID == 6){ return new containerPoubelle(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 TileEntityCoffre) { return new GuiCupboard((TileEntityCoffre)tile, player.inventory); } else if (ID == 6) { return new GuiPoubelle(player.inventory); } return null; } }
-
Le crash report ?
-
@‘AymericRed’:
Le crash report ?
Y’en a pas
-
logs dans ce cas.
-
@‘robin4002’:
logs dans ce cas.
Voilà la ligne
[04:15:47] [Server thread/INFO]: darkvince_ lost connection: TextComponent{text=‘Disconnected’, siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}
Sa viendrai de sa ?
1. **protected** **void** func_146976_a(**float** var1, **int** var2, **int** var3) 2. { 3. **this**.buttonList.add(**this**.background); 4. 5. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 6. **int** x = (**this**.width - **this**.height ) / 2; 7. **int** y = (**this**.width - **this**.height ) / 2; 8. drawTexturedModalRect(x, y, 0, 0, **this**.height, **this**.width); 9. } 10. @Override 11. **protected** **void** drawGuiContainerBackgroundLayer(**float** p_146976_1_, **int** p_146976_2_, **int** p_146976_3_) { 12. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // on colorise 13. **this**.mc.getTextureManager().bindTexture(background); // affiche la texture 14. **int** k = (**this**.width - **this**.xSize) / 2; // on calcul la coordonnée x du point en haut à gauche 15. **int** l = (**this**.height - **this**.ySize) / 2; // on calcul la coordonnée y du point en haut à gauche 16. **this**.drawTexturedModalRect(k, l, 0, 0, **this**.xSize, **this**.ySize); // on desine la texture, la fonction à pour argument point x de départ, point y de départ, vecteur u, vecteur v, largeur, hauteur) 17. }
Oups je les mis 2 fois sa doit venir de la
-
Les logs complet du client. Cette ligne dit juste que tu as été déconnecté, elle n’aide pas.
-
@‘robin4002’:
Les logs complet du client. Cette ligne dit juste que tu as été déconnecté, elle n’aide pas.
[12:00:12] [main/INFO]: Setting user: darkvince_ [12:00:15] [Client thread/INFO]: LWJGL Version: 2.9.0 [12:00:25] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Not Enough Items, FMLFileResourcePack:Better Furnaces, FMLFileResourcePack:bspkrsCore, FMLFileResourcePack:StatusEffectHUD, FMLFileResourcePack:Iron Chest, FMLFileResourcePack:ArmorStatusHUD, FMLFileResourcePack:CraftGuide, FMLFileResourcePack:StarMod, FMLFileResourcePack:Dual Hotbar, FMLFileResourcePack:Enchanting Plus, FMLFileResourcePack:Mo' Bends, FMLFileResourcePack:ModCustomMenu, FMLFileResourcePack:TeeLuk's SpecialArmor, FMLFileResourcePack:ultra, FMLFileResourcePack:UltraDeco, Pack [UltraFT] PvP [12:00:28] [Sound Library Loader/INFO]: Sound engine started [12:00:31] [Client thread/INFO]: textures/blocks: dropping miplevel from 4 to 3, because of minTexel: 14 [12:00:31] [Client thread/INFO]: Created: 1024x512 textures/blocks-atlas [12:00:31] [Client thread/ERROR]: Using missing texture, unable to load ultradeco:textures/items/itemiridium.png, java.io.FileNotFoundException [12:00:31] [Client thread/ERROR]: Using missing texture, unable to load ultra:textures/items/itemPoubelle.png, java.io.FileNotFoundException [12:00:32] [Client thread/ERROR]: Using missing texture, unable to load ultra:textures/items/bucketfluidUltraWater.png, java.io.FileNotFoundException [12:00:32] [Client thread/INFO]: Created: 512x512 textures/items-atlas [12:00:35] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Not Enough Items, FMLFileResourcePack:Better Furnaces, FMLFileResourcePack:bspkrsCore, FMLFileResourcePack:StatusEffectHUD, FMLFileResourcePack:Iron Chest, FMLFileResourcePack:ArmorStatusHUD, FMLFileResourcePack:CraftGuide, FMLFileResourcePack:StarMod, FMLFileResourcePack:Dual Hotbar, FMLFileResourcePack:Enchanting Plus, FMLFileResourcePack:Mo' Bends, FMLFileResourcePack:ModCustomMenu, FMLFileResourcePack:TeeLuk's SpecialArmor, FMLFileResourcePack:ultra, FMLFileResourcePack:UltraDeco, Pack [UltraFT] PvP [12:00:36] [Client thread/INFO]: Created: 1024x512 textures/blocks-atlas [12:00:36] [Client thread/ERROR]: Using missing texture, unable to load ultradeco:textures/items/itemiridium.png, java.io.FileNotFoundException [12:00:36] [Client thread/ERROR]: Using missing texture, unable to load ultra:textures/items/itemPoubelle.png, java.io.FileNotFoundException [12:00:36] [Client thread/ERROR]: Using missing texture, unable to load ultra:textures/items/bucketfluidUltraWater.png, java.io.FileNotFoundException [12:00:36] [Client thread/INFO]: Created: 512x512 textures/items-atlas [12:00:37] [Sound Library Loader/INFO]: Sound engine started [12:00:38] [MCO Availability Checker #1/ERROR]: Couldn't connect to Realms [12:14:22] [Client thread/INFO]: Connecting to srv56.minecraft-mania.fr, 25919 [12:14:24] [Client thread/INFO]: [CHAT] [SimpleAutoMessage] Your config.yml is outdated. You should probably create a new one. [12:14:24] [Client thread/INFO]: [CHAT] [HolographicDisplays] Found an update: v2.1.12\. Download: [12:14:24] [Client thread/INFO]: [CHAT] >> http://dev.bukkit.org/bukkit-plugins/holographic-displays [12:14:24] [Client thread/INFO]: [CHAT] [Market] You have new mail! [12:14:24] [Client thread/INFO]: [CHAT] 15.6 is out! You are running 12.31 [12:14:24] [Client thread/INFO]: [CHAT] Update Vault at: http://dev.bukkit.org/server-mods/vault [12:14:24] [Client thread/INFO]: [CHAT] Please login with "/login password" [12:14:24] [Client thread/INFO]: [CHAT] darkvince_ vien de se connecté sur UltraFight [12:14:24] [Client thread/INFO]: [CHAT] Welcome, [Fondateur] darkvince_! [12:14:24] [Client thread/INFO]: [CHAT] Type /help for a list of commands. [12:14:24] [Client thread/INFO]: [CHAT] Type /list to see who else is online. [12:14:24] [Client thread/INFO]: [CHAT] Players online: 6 - World time: 12:57 PM [12:14:24] [Client thread/INFO]: [CHAT] Vous n'avez pas de courrier. [12:14:24] [Client thread/INFO]: [CHAT] A new §eOptiFine§f version is available: §eHD Ultra E1§f [12:14:28] [Client thread/INFO]: [CHAT] Please login with "/login password" [12:14:33] [Client thread/INFO]: [CHAT] Please login with "/login password" [12:14:33] [Client thread/INFO]: [CHAT] Successful login! [12:14:33] [Client thread/INFO]: [CHAT] Welcome darkvince_ on Ultrafight server [12:14:33] [Client thread/INFO]: [CHAT] This server use AuthMe protection! [12:14:36] [Client thread/INFO]: [CHAT] [ClearLag] Removed 23 Entities! [12:14:40] [Client thread/INFO]: [CHAT] [Lvl 0] <**UltraFight [Fondateur] darkvince_> yop [12:14:59] [Client thread/INFO]: [CHAT] darckesia was slain by kellylagitane [12:15:13] [Client thread/INFO]: [CHAT] [Lvl 0] <**XxDiabloxX [Chevalier] kellylagitane> je te le rend au spawn [12:15:29] [Client thread/INFO]: [CHAT] [Lvl 0] <**TeamBG [Garde] darckesia> nn on vas me le piker [12:15:31] [Client thread/INFO]: [CHAT] [Message] Boutique : Nekiorr vient d'acheter Kit Enchantement | A vie. [12:15:39] [Client thread/INFO]: [CHAT] [Lvl 0] <**XxDiabloxX [Chevalier] kellylagitane> suis moi [12:15:45] [Client thread/INFO]: [CHAT] amtho13 has just earned the achievement [Hot Topic] [12:15:51] [Client thread/INFO]: [CHAT] amtho13 a quitté UltraFight [12:16:06] [Client thread/INFO]: [CHAT] [Lvl 0] <**XxDiabloxX [Chevalier] kellylagitane> tp toi darckesia [12:16:07] [Client thread/INFO]: [CHAT] XiNaToR21 vien de se connecté sur UltraFight [12:16:35] [Client thread/INFO]: [CHAT] amtho13 vien de se connecté sur UltraFight [12:16:39] [Client thread/INFO]: [CHAT] [Lvl 0] <*PONEYCLUB [Garde] Warship> Comment on a des bottles d'xp x5 ? [12:16:55] [Client thread/INFO]: [CHAT] [Lvl 0] <*PONEYCLUB [Garde] Warship> bottle [12:17:18] [Client thread/INFO]: [CHAT] [Lvl 0] <**TeamBG [Garde] darckesia> kellylagitane tp toi [12:17:19] [Client thread/INFO]: [CHAT] [Lvl 6] <*Horizon [Conseillé] XiNaToR21> fais clique gauche sur une bouteille vide [12:17:26] [Client thread/INFO]: [CHAT] [Lvl 0] <*PONEYCLUB [Garde] Warship> Dacc [12:18:00] [Client thread/INFO]: [CHAT] darckesia was slain by kellylagitane [12:18:38] [Client thread/INFO]: [CHAT] ant610 vien de se connecté sur UltraFight [12:19:07] [Client thread/INFO]: [CHAT] [Lvl 0] <**XxDiabloxX [Chevalier] kellylagitane> go [12:19:25] [Client thread/INFO]: [CHAT] It's Night! PvP is Enabled! [12:19:48] [Client thread/INFO]: [CHAT] [Lvl 0] <**TeamBG [Garde] darckesia> stop [12:19:49] [Client thread/INFO]: [CHAT] [Fondateur] darkvince_ est désormais AFK. [12:20:03] [Client thread/INFO]: [CHAT] [Lvl 0] <**TeamBG [Garde] darckesia> je revien [12:20:10] [Client thread/INFO]: [CHAT] [Lvl 0] <**XxDiabloxX [Chevalier] kellylagitane> ok [12:20:17] [Client thread/INFO]: [CHAT] [Info] Voter pour le serveur 1000 PB a gagne que la chance soit avec vous [12:21:17] [Client thread/INFO]: [CHAT] [ClearLag] Warning Ground items will be removed in 60 seconds! [12:21:44] [Client thread/INFO]: [CHAT] [Lvl 0] <**XxDiabloxX [Chevalier] kellylagitane> darckesia je suis dans ma basse [12:21:57] [Client thread/INFO]: [CHAT] [ClearLag] Warning Ground items will be removed in 20 seconds! [12:22:01] [Client thread/INFO]: [CHAT] [Lvl 0] <**TeamBG [Garde] darckesia> je vais pas te pille [12:22:45] [Server thread/INFO]: Starting integrated minecraft server version 1.7.2 [12:22:45] [Server thread/INFO]: Generating keypair [12:22:45] [Server thread/INFO]: Preparing start region for level 0 [12:22:46] [Server thread/INFO]: Preparing spawn area: 55% [12:22:47] [Server thread/INFO]: darkvince_[local:E:e820a468] logged in with entity id 327933 at (258.3507603761474, 65.99657404410092, 250.88018165824877) [12:22:47] [Server thread/INFO]: darkvince_ joined the game [12:22:49] [Server thread/INFO]: darkvince_ lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}} [12:22:49] [Server thread/INFO]: darkvince_ left the game [12:22:49] [Server thread/INFO]: Stopping singleplayer server as player logged out [12:22:49] [Server thread/INFO]: Stopping server [12:22:49] [Server thread/INFO]: Saving players [12:22:49] [Server thread/INFO]: Saving worlds [12:22:49] [Server thread/INFO]: Saving chunks for level 'Nouveau monde'/Overworld [12:22:50] [Server thread/INFO]: Saving chunks for level 'Nouveau monde'/Nether [12:22:50] [Server thread/INFO]: Saving chunks for level 'Nouveau monde'/The End
-
Tu peux faire une vidéo du problème ?
Car visiblement il n’y a rien dans les logs, et sans information supplémentaire difficile de trouver la source. -
@‘robin4002’:
Tu peux faire une vidéo du problème ?
Car visiblement il n’y a rien dans les logs, et sans information supplémentaire difficile de trouver la source.Quand je fait clique droit sa marque sa
-
Ca dit juste q’une erreur est survenue mais pas laquelle, ça aide pas, essaye des mettre des System.out.println(“…”); dans ton onItemRightClick, dans ton GuiHandler et dans les contructeurs de ton gui et de ton container, pour voir où ça se bloque.
-
@‘AymericRed’:
Ca dit juste q’une erreur est survenue mais pas laquelle, ça aide pas, essaye des mettre des System.out.println(“…”); dans ton onItemRightClick, dans ton GuiHandler et dans les contructeurs de ton gui et de ton container, pour voir où ça se bloque.
Alors j’ai déja essayé mais le truc c’est pareil sa marche bien mais que sur eclipse
-
Ah oui comme tu testes que sur eclipse… Ben t’es obligé de compiler ton mod en laissant les System.out.println() et tu lance minecraft en laissant le launcher tu visible pour voir le log.
-
Je c’est pas comment j’ai fait j’ai juste supprimé une ligne est sa remarche merci a vous pour votre aide
-
Ok ben c’est cool ^^ Balise résolu ?