Résolu Remplacer l'inventaire survie vanilla
-
Bonjour,
je voudrais remplacer l’inventaire vanilla survie du joueur.
J’arrive a remplacer l’image du gui mais pas le container,
est ce que vous pourriez m’aider car
Je débute dans le modding -
Bonsoir,
Vu que
inventoryContainer
est en public et qu’il est uniquement initialisé dans le constructeur du joueur, je pense que la meilleure approche et de le réinitialiser sur une nouvelle instance de ton propre container lors de l’initialisation du joueur.Tu peux faire ça dans l’event
EntityConstructing
-
mais qu’est ce que je met la ? :
@SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if(event.getEntity() instanceof EntityPlayer) { } }
je set mon container avec ?
-
EntityPlayer player = (EntityPlayer)event.getEntity(); player.inventoryContainer = new TaClasseContainerCustom(...);
-
avec un sysoutprintIn l’event est pas appellé
-
Tu as enregistré la classe d’event comment ?
-
enfait c’est bon j’avais pas mis l’event en static avec le EventSuscriber
mais maintenant j’ai ce crash :[08:07:42] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.EntityEvent$EntityConstructing@4977272f: java.lang.NullPointerException: null at net.minecraft.inventory.ContainerPlayer.<init>(ContainerPlayer.java:27) ~[ContainerPlayer.class:?] at fr.eno.pyrion.gui.container.ContainerPlayerCustom.<init>(ContainerPlayerCustom.java:28) ~[ContainerPlayerCustom.class:?] at fr.eno.pyrion.events.EventRandoms.onEntityConstructing(EventRandoms.java:26) ~[EventRandoms.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_14_EventRandoms_onEntityConstructing_EntityConstructing.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraft.entity.Entity.<init>(Entity.java:266) [Entity.class:?] at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:214) [EntityLivingBase.class:?] at net.minecraft.entity.player.EntityPlayer.<init>(EntityPlayer.java:192) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:181) [EntityPlayerMP.class:?] at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:538) [PlayerList.class:?] at net.minecraft.server.network.NetHandlerLoginServer.tryAcceptPlayer(NetHandlerLoginServer.java:139) [NetHandlerLoginServer.class:?] at net.minecraft.server.network.NetHandlerLoginServer.update(NetHandlerLoginServer.java:67) [NetHandlerLoginServer.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] [08:07:42] [Server thread/ERROR] [FML]: Index: 1 Listeners: [08:07:42] [Server thread/ERROR] [FML]: 0: NORMAL [08:07:42] [Server thread/ERROR] [FML]: 1: ASM: class fr.eno.pyrion.events.EventRandoms onEntityConstructing(Lnet/minecraftforge/event/entity/EntityEvent$EntityConstructing;)V [08:07:42] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking memory connection at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:212) ~[NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] Caused by: java.lang.NullPointerException at net.minecraft.inventory.ContainerPlayer.<init>(ContainerPlayer.java:27) ~[ContainerPlayer.class:?] at fr.eno.pyrion.gui.container.ContainerPlayerCustom.<init>(ContainerPlayerCustom.java:28) ~[ContainerPlayerCustom.class:?] at fr.eno.pyrion.events.EventRandoms.onEntityConstructing(EventRandoms.java:26) ~[EventRandoms.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_14_EventRandoms_onEntityConstructing_EntityConstructing.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?] at net.minecraft.entity.Entity.<init>(Entity.java:266) ~[Entity.class:?] at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:214) ~[EntityLivingBase.class:?] at net.minecraft.entity.player.EntityPlayer.<init>(EntityPlayer.java:192) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:181) ~[EntityPlayerMP.class:?] at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:538) ~[PlayerList.class:?] at net.minecraft.server.network.NetHandlerLoginServer.tryAcceptPlayer(NetHandlerLoginServer.java:139) ~[NetHandlerLoginServer.class:?] at net.minecraft.server.network.NetHandlerLoginServer.update(NetHandlerLoginServer.java:67) ~[NetHandlerLoginServer.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197) ~[NetworkSystem.class:?] ... 5 more [08:07:42] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\Rajo\Desktop\Eno\Dev\PyrionMod 1.12.2\run\.\crash-reports\crash-2019-09-19_08.07.42-server.txt [08:07:42] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [08:07:42] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [08:07:42] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [08:07:42] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'py-gen'/overworld [08:07:42] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 9/19/19 8:07 AM Description: Ticking memory connection java.lang.NullPointerException: Ticking memory connection at net.minecraft.inventory.ContainerPlayer.<init>(ContainerPlayer.java:27) at fr.eno.pyrion.gui.container.ContainerPlayerCustom.<init>(ContainerPlayerCustom.java:28) at fr.eno.pyrion.events.EventRandoms.onEntityConstructing(EventRandoms.java:26) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_14_EventRandoms_onEntityConstructing_EntityConstructing.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraft.entity.Entity.<init>(Entity.java:266) at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:214) at net.minecraft.entity.player.EntityPlayer.<init>(EntityPlayer.java:192) at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:181) at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:538) at net.minecraft.server.network.NetHandlerLoginServer.tryAcceptPlayer(NetHandlerLoginServer.java:139) at net.minecraft.server.network.NetHandlerLoginServer.update(NetHandlerLoginServer.java:67) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraft.inventory.ContainerPlayer.<init>(ContainerPlayer.java:27) at fr.eno.pyrion.gui.container.ContainerPlayerCustom.<init>(ContainerPlayerCustom.java:28) at fr.eno.pyrion.events.EventRandoms.onEntityConstructing(EventRandoms.java:26) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_14_EventRandoms_onEntityConstructing_EntityConstructing.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraft.entity.Entity.<init>(Entity.java:266) at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:214) at net.minecraft.entity.player.EntityPlayer.<init>(EntityPlayer.java:192) at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:181) at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:538) at net.minecraft.server.network.NetHandlerLoginServer.tryAcceptPlayer(NetHandlerLoginServer.java:139) at net.minecraft.server.network.NetHandlerLoginServer.update(NetHandlerLoginServer.java:67) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@2d1bd3f6 Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Unknown Source) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_211, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 293202768 bytes (279 MB) / 518979584 bytes (494 MB) up to 518979584 bytes (494 MB) JVM Flags: 3 total; -Xincgc -Xmx512M -Xms512M IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP 9.42 Powered by Forge 14.23.5.2768 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:--------- |:--------- |:------------ |:-------------------------------- |:--------- | | UCHIJAAAA | minecraft | 1.12.2 | minecraft.jar | None | | UCHIJAAAA | mcp | 9.42 | minecraft.jar | None | | UCHIJAAAA | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.5.2768.jar | None | | UCHIJAAAA | forge | 14.23.5.2768 | forgeSrc-1.12.2-14.23.5.2768.jar | None | | UCHIJAAAA | pyrion | 1.0.0 | bin | None | Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [08:07:42] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2019-09-19_08.07.42-server.txt [08:07:42] [main/INFO] [FML]: Waiting for the server to terminate/save. [08:07:43] [Server thread/INFO] [FML]: Unloading dimension 0 [08:07:43] [Server thread/INFO] [FML]: Applying holder lookups [08:07:43] [Server thread/INFO] [FML]: Holder lookups applied [08:07:43] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [08:07:43] [main/INFO] [FML]: Server terminated. [08:07:43] [Client Shutdown Thread/INFO] [minecraft/MinecraftServer]: Stopping server AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
mon container :
package fr.eno.pyrion.gui.container; import javax.annotation.Nullable; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ContainerPlayerCustom extends ContainerPlayer { private static ContainerPlayer containerPlayer; public ContainerPlayerCustom(InventoryPlayer playerInventory, boolean localWorld, EntityPlayer playerIn) { super(playerInventory, localWorld, playerIn); containerPlayer.inventorySlots.clear(); System.out.println("container Custom"); this.isLocalWorld = localWorld; this.player = playerIn; this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 154, 28)); this.addSlotToContainer(new Slot(playerInventory, 99, 77, 18)); for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 98 + j * 18, 18 + i * 18)); } } for (int k = 0; k < 4; ++k) { final EntityEquipmentSlot entityequipmentslot = VALID_EQUIPMENT_SLOTS[k]; this.addSlotToContainer(new Slot(playerInventory, 36 + (3 - k), 8, 8 + k * 18) { /** * Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 * in the case of armor slots) */ public int getSlotStackLimit() { return 1; } /** * Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace * fuel. */ public boolean isItemValid(ItemStack stack) { return stack.getItem().isValidArmor(stack, entityequipmentslot, player); } /** * Return whether this slot's stack can be taken from this slot. */ public boolean canTakeStack(EntityPlayer playerIn) { ItemStack itemstack = this.getStack(); return !itemstack.isEmpty() && !playerIn.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.canTakeStack(playerIn); } @Nullable @SideOnly(Side.CLIENT) public String getSlotTexture() { return ItemArmor.EMPTY_SLOT_NAMES[entityequipmentslot.getIndex()]; } }); } for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { this.addSlotToContainer(new Slot(playerInventory, j1 + (l + 1) * 9, 8 + j1 * 18, 84 + l * 18)); } } for (int i1 = 0; i1 < 9; ++i1) { this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 142)); } this.addSlotToContainer(new Slot(playerInventory, 40, 100, 62) { @Nullable @SideOnly(Side.CLIENT) public String getSlotTexture() { return "minecraft:items/empty_armor_slot_shield"; } }); } private static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; /** The crafting matrix inventory. */ public InventoryCrafting craftMatrix = new InventoryCrafting(this, 2, 2); public InventoryCraftResult craftResult = new InventoryCraftResult(); /** Determines if inventory manipulation should be handled. */ public boolean isLocalWorld; private final EntityPlayer player; /** * Callback for when the crafting matrix is changed. */ public void onCraftMatrixChanged(IInventory inventoryIn) { this.slotChangedCraftingGrid(this.player.world, this.player, this.craftMatrix, this.craftResult); } /** * Called when the container is closed. */ public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); this.craftResult.clear(); if (!playerIn.world.isRemote) { this.clearContainer(playerIn, playerIn.world, this.craftMatrix); } } /** * Determines whether supplied player can use this container */ public boolean canInteractWith(EntityPlayer playerIn) { return true; } /** * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player * inventory and the other inventory(s). */ public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack); if (index == 0) { if (!this.mergeItemStack(itemstack1, 9, 45, true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if (index >= 1 && index < 5) { if (!this.mergeItemStack(itemstack1, 9, 45, false)) { return ItemStack.EMPTY; } } else if (index >= 5 && index < 9) { if (!this.mergeItemStack(itemstack1, 9, 45, false)) { return ItemStack.EMPTY; } } else if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR && !((Slot)this.inventorySlots.get(8 - entityequipmentslot.getIndex())).getHasStack()) { int i = 8 - entityequipmentslot.getIndex(); if (!this.mergeItemStack(itemstack1, i, i + 1, false)) { return ItemStack.EMPTY; } } else if (entityequipmentslot == EntityEquipmentSlot.OFFHAND && !((Slot)this.inventorySlots.get(45)).getHasStack()) { if (!this.mergeItemStack(itemstack1, 45, 46, false)) { return ItemStack.EMPTY; } } else if (index >= 9 && index < 36) { if (!this.mergeItemStack(itemstack1, 36, 45, false)) { return ItemStack.EMPTY; } } else if (index >= 36 && index < 45) { if (!this.mergeItemStack(itemstack1, 9, 36, false)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 9, 45, false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } ItemStack itemstack2 = slot.onTake(playerIn, itemstack1); if (index == 0) { playerIn.dropItem(itemstack2, false); } } return itemstack; } /** * Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in * is null for the initial slot that was double-clicked. */ public boolean canMergeSlot(ItemStack stack, Slot slotIn) { return slotIn.inventory != this.craftResult && super.canMergeSlot(stack, slotIn); } }
-
Le problème vient plutôt des valeurs que tu as mit lors de son instanciation (donc dans la classe d’event) il y en a une qui est null.
-
tout est bien appellé :
[19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:36]: container Custom [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:50] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:31]: Inv Modifié ! [19:16:50] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2 [19:16:50] [Netty Server IO #1/INFO] [FML]: Client protocol version 2 [19:16:50] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : minecraft@1.12.2,pyrion@1.0.0,FML@8.0.99.99,forge@14.23.5.2768,mcp@9.42 [19:16:50] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [19:16:50] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [19:16:50] [Server thread/INFO] [minecraft/PlayerList]: Eno_gamer10[local:E:0c3da24b] logged in with entity id 0 at (161.87898783306562, 11.0, 12.957892389510452) [19:16:50] [Server thread/INFO] [minecraft/MinecraftServer]: Eno_gamer10 a rejoint la partie [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:36]: container Custom [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:46]: slots crafting [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:53]: slots armor [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:94]: slots inventory [19:16:51] [main/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:31]: Inv Modifié ! [19:16:52] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [19:16:52] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'py-gen'/overworld [19:16:52] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:52] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:53] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:53] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:53] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:53] [main/INFO] [minecraft/AdvancementList]: Loaded 488 advancements [19:16:54] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [19:16:54] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'py-gen'/overworld [19:16:54] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 4101ms behind, skipping 82 tick(s) [19:16:56] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:56] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing ! [19:16:56] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:35]: Entity Constructing !
mais le container du joueur n’est pas set
-
Tu peux montrer ton code ?
Car je ne vois pas trop pour quelle raison le container ne serait pas prit en compte.
-
mon container :
package fr.eno.pyrion.gui.container; import javax.annotation.Nullable; import fr.eno.pyrion.events.EventRandoms; import net.minecraft.client.Minecraft; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ContainerPlayerCustom extends Container { private static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; /** The crafting matrix inventory. */ public InventoryCrafting craftMatrix = new InventoryCrafting(this, 2, 2); public InventoryCraftResult craftResult = new InventoryCraftResult(); /** Determines if inventory manipulation should be handled. */ public boolean isLocalWorld; private final EntityPlayer player; public ContainerPlayerCustom(InventoryPlayer playerInventory, boolean localWorld, EntityPlayer player) { System.out.println("container Custom"); this.isLocalWorld = localWorld; this.player = player; this.addSlotToContainer(new SlotCrafting(player, this.craftMatrix, this.craftResult, 0, 154, 28)); for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { System.out.println("slots crafting"); this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 98 + j * 18, 18 + i * 18)); } } for (int k = 0; k < 4; ++k) { System.out.println("slots armor"); final EntityEquipmentSlot entityequipmentslot = VALID_EQUIPMENT_SLOTS[k]; this.addSlotToContainer(new Slot(playerInventory, 36 + (3 - k), 8, 8 + k * 18) { /** * Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 * in the case of armor slots) */ public int getSlotStackLimit() { return 1; } /** * Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace * fuel. */ public boolean isItemValid(ItemStack stack) { return stack.getItem().isValidArmor(stack, entityequipmentslot, player); } /** * Return whether this slot's stack can be taken from this slot. */ public boolean canTakeStack(EntityPlayer playerIn) { ItemStack itemstack = this.getStack(); return !itemstack.isEmpty() && !playerIn.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.canTakeStack(playerIn); } @Nullable @SideOnly(Side.CLIENT) public String getSlotTexture() { return ItemArmor.EMPTY_SLOT_NAMES[entityequipmentslot.getIndex()]; } }); } for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { System.out.println("slots inventory"); this.addSlotToContainer(new Slot(playerInventory, j1 + (l + 1) * 9, 8 + j1 * 18, 84 + l * 18)); } } for (int i1 = 0; i1 < 9; ++i1) { this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 142)); } this.addSlotToContainer(new Slot(playerInventory, 40, 100, 62) { @Nullable @SideOnly(Side.CLIENT) public String getSlotTexture() { //return "minecraft:items/empty_armor_slot_shield"; return "minecraft:items/apple"; } }); } /** * Callback for when the crafting matrix is changed. */ public void onCraftMatrixChanged(IInventory inventoryIn) { this.slotChangedCraftingGrid(this.player.world, this.player, this.craftMatrix, this.craftResult); } /** * Called when the container is closed. */ public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); this.craftResult.clear(); if (!playerIn.world.isRemote) { this.clearContainer(playerIn, playerIn.world, this.craftMatrix); } } /** * Determines whether supplied player can use this container */ public boolean canInteractWith(EntityPlayer playerIn) { return true; } /** * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player * inventory and the other inventory(s). */ public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack); if (index == 0) { if (!this.mergeItemStack(itemstack1, 9, 45, true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if (index >= 1 && index < 5) { if (!this.mergeItemStack(itemstack1, 9, 45, false)) { return ItemStack.EMPTY; } } else if (index >= 5 && index < 9) { if (!this.mergeItemStack(itemstack1, 9, 45, false)) { return ItemStack.EMPTY; } } else if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR && !((Slot)this.inventorySlots.get(8 - entityequipmentslot.getIndex())).getHasStack()) { int i = 8 - entityequipmentslot.getIndex(); if (!this.mergeItemStack(itemstack1, i, i + 1, false)) { return ItemStack.EMPTY; } } else if (entityequipmentslot == EntityEquipmentSlot.OFFHAND && !((Slot)this.inventorySlots.get(45)).getHasStack()) { if (!this.mergeItemStack(itemstack1, 45, 46, false)) { return ItemStack.EMPTY; } } else if (index >= 9 && index < 36) { if (!this.mergeItemStack(itemstack1, 36, 45, false)) { return ItemStack.EMPTY; } } else if (index >= 36 && index < 45) { if (!this.mergeItemStack(itemstack1, 9, 36, false)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 9, 45, false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } ItemStack itemstack2 = slot.onTake(playerIn, itemstack1); if (index == 0) { playerIn.dropItem(itemstack2, false); } } return itemstack; } /** * Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in * is null for the initial slot that was double-clicked. */ public boolean canMergeSlot(ItemStack stack, Slot slotIn) { return slotIn.inventory != this.craftResult && super.canMergeSlot(stack, slotIn); } }
j’ai pas la pomme
-
Ton gui custom s’affiche ou non ?
-
je ne set pas de gui, juste le container,
est ce que ça pose un problème ? -
Et oui, puisque le gui instancie son propre container dans le constructeur. Et que pour l’instant il utilise donc toujours le container de base de l’inventaire.
-
mais alors comment je set le gui ?
dans l’event EntityConstructing ? -
Non, avec un autre event
GuiOpenEvent
. -
draw screen n’est pas appellé dans le gui :
package fr.eno.pyrion.gui.inventory; import java.io.IOException; import fr.eno.pyrion.gui.container.ContainerPlayerCustom; import fr.eno.pyrion.utils.References; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButtonImage; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.gui.recipebook.GuiRecipeBook; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.InventoryEffectRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.ContainerPlayer; import net.minecraft.inventory.Slot; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiInventoryPlayer extends InventoryEffectRenderer { /** The location of the inventory background texture */ public static final ResourceLocation INVENTORY = new ResourceLocation(References.MOD_ID, "textures/gui/container/inventory.png"); /** The old x position of the mouse pointer */ private float oldMouseX; /** The old y position of the mouse pointer */ private float oldMouseY; private GuiButtonImage recipeButton; private boolean widthTooNarrow; private boolean buttonClicked; public GuiInventoryPlayer(EntityPlayer player) { super(player.inventoryContainer); this.allowUserInput = true; System.out.println("GuiInventoryPlayer"); } /** * Called from the main game loop to update the screen. */ public void updateScreen() { if (this.mc.playerController.isInCreativeMode()) { this.mc.displayGuiScreen(new GuiContainerCreative(this.mc.player)); } } /** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ @Override public void initGui() { System.out.println("initGui"); this.buttonList.clear(); if (this.mc.playerController.isInCreativeMode()) { this.mc.displayGuiScreen(new GuiContainerCreative(this.mc.player)); } else { super.initGui(); } this.widthTooNarrow = this.width < 379; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRenderer.drawString(I18n.format("container.crafting"), 97, 8, 4210752); } /** * Draws the screen and all the components in it. */ public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.renderHoveredToolTip(mouseX, mouseY); this.oldMouseX = (float)mouseX; this.oldMouseY = (float)mouseY; System.out.println("drawScreen"); } /** * Draws the background layer of this container (behind the items). */ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(INVENTORY); int i = this.guiLeft; int j = this.guiTop; this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); drawEntityOnScreen(i + 51, j + 75, 30, (float)(i + 51) - this.oldMouseX, (float)(j + 75 - 50) - this.oldMouseY, this.mc.player); System.out.println("draw gui container background layer"); } /** * Draws an entity on the screen looking toward the cursor. */ public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate((float)posX, (float)posY, 50.0F); GlStateManager.scale((float)(-scale), (float)scale, (float)scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = ent.renderYawOffset; float f1 = ent.rotationYaw; float f2 = ent.rotationPitch; float f3 = ent.prevRotationYawHead; float f4 = ent.rotationYawHead; GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; ent.rotationYawHead = ent.rotationYaw; ent.prevRotationYawHead = ent.rotationYaw; GlStateManager.translate(0.0F, 0.0F, 0.0F); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.renderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); ent.renderYawOffset = f; ent.rotationYaw = f1; ent.rotationPitch = f2; ent.prevRotationYawHead = f3; ent.rotationYawHead = f4; GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); } /** * Test if the 2D point is in a rectangle (relative to the GUI). Args : rectX, rectY, rectWidth, rectHeight, pointX, * pointY */ protected boolean isPointInRegion(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY) { return false; } /** * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton */ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { } /** * Called when a mouse button is released. */ protected void mouseReleased(int mouseX, int mouseY, int state) { if (this.buttonClicked) { this.buttonClicked = false; } else { super.mouseReleased(mouseX, mouseY, state); } } protected boolean hasClickedOutside(int p_193983_1_, int p_193983_2_, int p_193983_3_, int p_193983_4_) { boolean flag = p_193983_1_ < p_193983_3_ || p_193983_2_ < p_193983_4_ || p_193983_1_ >= p_193983_3_ + this.xSize || p_193983_2_ >= p_193983_4_ + this.ySize; return flag; } /** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { } /** * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) */ protected void keyTyped(char typedChar, int keyCode) throws IOException { } /** * Called when the mouse is clicked over a slot or outside the gui. */ protected void handleMouseClick(Slot slotIn, int slotId, int mouseButton, ClickType type) { super.handleMouseClick(slotIn, slotId, mouseButton, type); } /** * Called when the screen is unloaded. Used to disable keyboard repeat events */ public void onGuiClosed() { super.onGuiClosed(); } }
Event :
@SubscribeEvent public static void onEntityConstructing(EntityConstructing event) { if(event.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.getEntity(); Container containerPlayer = new ContainerPlayerCustom(player.inventory, player.world.isRemote, player); EventRandoms.containerPlayer = containerPlayer; player.openContainer = containerPlayer; player.inventoryContainer = containerPlayer; player.inventory = new InventoryPlayer(player); System.out.println("Inv Modifié !"); } else { System.out.println("Entity Constructing !"); } } @SubscribeEvent public static void onGuiOpen(GuiOpenEvent event) { EntityPlayer player = MC.player; if(event.getGui() != null && event.getGui() instanceof GuiInventory) { //event.setCanceled(true); System.out.println("gui Inv Player"); MC.displayGuiScreen(new GuiInventoryPlayer(player)); } }
Logs :
[17:20:31] [Server thread/INFO] [minecraft/IntegratedServer]: Changing view distance to 16, from 10 [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:36]: container Custom [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.gui.inventory.InventoryPlayer:<init>:56]: Inventory Player [17:20:32] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:41]: Inv Modifié ! [17:20:33] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2 [17:20:33] [Netty Server IO #1/INFO] [FML]: Client protocol version 2 [17:20:33] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : minecraft@1.12.2,pyrion@1.0.0,FML@8.0.99.99,forge@14.23.5.2768,mcp@9.42 [17:20:33] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [17:20:33] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [17:20:34] [Server thread/INFO] [minecraft/PlayerList]: Eno_gamer10[local:E:055f8c03] logged in with entity id 0 at (162.57877717409193, 11.0, 12.20632199898026) [17:20:34] [Server thread/INFO] [minecraft/MinecraftServer]: Eno_gamer10 a rejoint la partie [17:20:35] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:36]: container Custom [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:50]: slots crafting [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:57]: slots armor [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:36] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:36] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:36] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.container.ContainerPlayerCustom:<init>:98]: slots inventory [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.inventory.InventoryPlayer:<init>:56]: Inventory Player [17:20:36] [main/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:41]: Inv Modifié ! [17:20:36] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [17:20:37] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'py-gen'/overworld [17:20:37] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 2995ms behind, skipping 59 tick(s) [17:20:38] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:38] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:38] [Server thread/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onEntityConstructing:45]: Entity Constructing ! [17:20:38] [main/INFO] [minecraft/AdvancementList]: Loaded 488 advancements [17:20:40] [pool-2-thread-1/WARN] [mojang/YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@391e3e83[id=43d2a483-f574-3b67-b46e-011d0580b1d7,name=Eno_gamer10,properties={},legacy=false] com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?] at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?] at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3181) [Minecraft.class:?] at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_211] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_211] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_211] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_211] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] [17:20:43] [main/INFO] [STDOUT]: [fr.eno.pyrion.events.EventRandoms:onGuiOpen:57]: gui Inv Player [17:20:43] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.inventory.GuiInventoryPlayer:<init>:46]: GuiInventoryPlayer [17:20:43] [main/INFO] [STDOUT]: [fr.eno.pyrion.gui.inventory.GuiInventoryPlayer:initGui:67]: initGui
-
Là comme ça je ne serais pas te dire d’où vient ton problème, le mieux serait que j’ai tout le code pour regarder de mon côté sur eclipse, mais j’ai pas vraiment le temps pour ça
-
oui je comprends, merci déja de m’avoir indiquer la bonne voie