@Legrandfifou:
@Plaigon:
A la limite ne t’embête pas, avec les coordonnées, je vérifierai si elles sont vraiment importantes.
Ton premier gui d’enregistrement du mdp, doit donc avoir un référence à ta te grâce à la méthode World#getTileEntity, donc ça sous-entend bien d’avoir un blockpos dans le packet, donc précédemment dans le gui, donc précédemment dans le guihandler. Une méthode pour transférer le pos de la te jusqu’au gui, serait d’enregistrer les 3 coordonnées dans les tags du joueur, puis ensuite dans ta méthode GuiHandler#getClientGuiElement, de les ressortir pour les joindre au constructeur de ton gui, puis finalement de les retirer des tags des joueurs pour les prochaines interactions de coffres sécurisés.
En fait, au lieu de me compliquer la vie avec un mot de passe, je peut tout simplement en posant le block ajouter des data à ma tile entity avec ‘onBlockAdded’ ? Je me rend compte qu’un système de mot de passe est trop ennuyant à mettre en place, du coup je me demande si je dois quand même envoyer un packet ? Je suppose que oui ? Le server doit aussi avoir ce tag de son côté ?
Du coup j’ai fais comme j’ai dis et ca marche parfaitement, je me suis attaqué au GuiContainer mais je crash :
| |
| [21:54:10] [Server thread/FATAL]: Error executing task |
| java.util.concurrent.ExecutionException: java.lang.NullPointerException: The validated object is null |
| at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_131] |
| at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_131] |
| at net.minecraft.util.Util.runTask(Util.java:30) [Util.class:?] |
| at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:754) [MinecraftServer.class:?] |
| at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:699) [MinecraftServer.class:?] |
| at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [IntegratedServer.class:?] |
| at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?] |
| at java.lang.Thread.run(Unknown Source) [?:1.8.0_131] |
| Caused by: java.lang.NullPointerException: The validated object is null |
| at org.apache.commons.lang3.Validate.notNull(Validate.java:222) ~[commons-lang3-3.3.2.jar:3.3.2] |
| at org.apache.commons.lang3.Validate.notNull(Validate.java:203) ~[commons-lang3-3.3.2.jar:3.3.2] |
| at net.minecraft.util.NonNullList.add(NonNullList.java:57) ~[NonNullList.class:?] |
| at java.util.AbstractList.add(Unknown Source) ~[?:1.8.0_131] |
| at net.minecraft.inventory.Container.getInventory(Container.java:71) ~[Container.class:?] |
| at net.minecraft.inventory.Container.addListener(Container.java:57) ~[Container.class:?] |
| at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:102) ~[FMLNetworkHandler.class:?] |
| at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2734) ~[EntityPlayer.class:?] |
| at fr.fifou.economy.blocks.blockVault.onBlockActivated(blockVault.java:86) ~[blockVault.class:?] |
| at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:474) ~[PlayerInteractionManager.class:?] |
| at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:712) ~[NetHandlerPlayServer.class:?] |
| at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?] |
| at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?] |
| at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] |
| at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_131] |
| at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_131] |
| at net.minecraft.util.Util.runTask(Util.java:29) ~[Util.class:?] |
| … 5 more |
| [21:54:10] [Server thread/ERROR]: Encountered an unexpected exception |
| net.minecraft.util.ReportedException: Ticking player |
| at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:801) ~[MinecraftServer.class:?] |
| at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:699) ~[MinecraftServer.class:?] |
| at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[IntegratedServer.class:?] |
| at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?] |
| at java.lang.Thread.run(Unknown Source) [?:1.8.0_131] |
| Caused by: java.lang.NullPointerException |
| at net.minecraft.item.ItemStack.areItemStacksEqual(ItemStack.java:439) ~[ItemStack.class:?] |
| at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:96) ~[Container.class:?] |
| at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:322) ~[EntityPlayerMP.class:?] |
| at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2115) ~[World.class:?] |
| at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:876) ~[WorldServer.class:?] |
| at net.minecraft.world.World.updateEntity(World.java:2082) ~[World.class:?] |
| at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:677) ~[WorldServer.class:?] |
| at net.minecraft.world.World.updateEntities(World.java:1871) ~[World.class:?] |
| at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:648) ~[WorldServer.class:?] |
| at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:795) ~[MinecraftServer.class:?] |
| … 4 more |
| [21:54:10] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Florent\Desktop\EconomyMod\run\.\crash-reports\crash-2017-06-29_21.54.10-server.txt |
| [21:54:10] [Server thread/INFO]: Stopping server |
| [21:54:10] [Server thread/INFO]: Saving players |
| [21:54:10] [Server thread/INFO]: Saving worlds |
| [21:54:10] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld |
| [21:54:10] [Server thread/INFO]: Saving chunks for level 'New World'/Nether |
| [21:54:10] [Server thread/INFO]: Saving chunks for level 'New World'/The End |
| [21:54:10] [Server thread/INFO] [FML]: Unloading dimension 0 |
| [21:54:10] [Server thread/INFO] [FML]: Unloading dimension -1 |
| [21:54:10] [Server thread/INFO] [FML]: Unloading dimension 1 |
| [21:54:10] [Server thread/INFO] [FML]: Applying holder lookups |
| [21:54:10] [Server thread/INFO] [FML]: Holder lookups applied |
| [21:54:11] [Client thread/FATAL]: Reported exception thrown! |
| net.minecraft.util.ReportedException: Rendering screen |
| at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1191) ~[EntityRenderer.class:?] |
| at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) ~[Minecraft.class:?] |
| at net.minecraft.client.Minecraft.run(Minecraft.java:407) [Minecraft.class:?] |
| at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] |
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] |
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] |
| at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] |
| at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] |
| at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] |
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] |
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] |
| at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] |
| at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] |
| at GradleStart.main(GradleStart.java:26) [start/:?] |
| Caused by: java.lang.NullPointerException |
| at net.minecraft.client.gui.inventory.GuiContainer.drawSlot(GuiContainer.java:274) ~[GuiContainer.class:?] |
| at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:117) ~[GuiContainer.class:?] |
| at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:382) ~[ForgeHooksClient.class:?] |
| at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1164) ~[EntityRenderer.class:?] |
| … 15 more |
| [21:54:11] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. |
| [21:54:11] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: –-- Minecraft Crash Report ---- |
| // There are four lights! |
| |
| Time: 6/29/17 9:54 PM |
| Description: Rendering screen |
| |
| java.lang.NullPointerException: Rendering screen |
| at net.minecraft.client.gui.inventory.GuiContainer.drawSlot(GuiContainer.java:274) |
| at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:117) |
| at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:382) |
| at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1164) |
| at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) |
| at net.minecraft.client.Minecraft.run(Minecraft.java:407) |
| at net.minecraft.client.main.Main.main(Main.java:118) |
| 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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) |
| at GradleStart.main(GradleStart.java:26) |
| |
| A detailed walkthrough of the error, its code path and all known details is as follows: |
| --------------------------------------------------------------------------------------- |
| |
| -- Head -- |
| Thread: Client thread |
| Stacktrace: |
| at net.minecraft.client.gui.inventory.GuiContainer.drawSlot(GuiContainer.java:274) |
| at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:117) |
| at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:382) |
| |
| -- Screen render details -- |
| Details: |
| Screen name: fr.fifou.economy.gui.GuiVaultNew |
| Mouse location: Scaled: (480, 254). Absolute: (960, 508) |
| Screen size: Scaled: (960, 509). Absolute: (1920, 1017). Scale factor of 2 |
| |
| -- Affected level -- |
| Details: |
| Level name: MpServer |
| All players: 1 total; [EntityPlayerSP['Fifou_BE'/392, l='MpServer', x=-137.85, y=70.00, z=52.63]] |
| Chunk stats: MultiplayerChunkCache: 567, 567 |
| Level seed: 0 |
| Level generator: ID 00 - default, ver 1\. Features enabled: false |
| Level generator options: |
| Level spawn location: World: (-136,64,96), Chunk: (at 8,4,0 in -9,6; contains blocks -144,0,96 to -129,255,111), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) |
| Level time: 8311 game time, 8311 day time |
| Level dimension: 0 |
| Level storage version: 0x00000 - Unknown? |
| Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) |
| Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false |
| Forced entities: 106 total; [EntitySheep['Sheep'/267, l='MpServer', x=-106.52, y=71.00, z=-0.23], EntitySheep['Sheep'/268, l='MpServer', x=-106.52, y=70.00, z=16.11], EntitySquid['Squid'/269, l='MpServer', x=-105.48, y=60.00, z=32.40], EntityCreeper['Creeper'/270, l='MpServer', x=-97.50, y=37.00, z=51.50], EntitySquid['Squid'/271, l='MpServer', x=-101.79, y=62.11, z=54.51], EntitySquid['Squid'/272, l='MpServer', x=-97.40, y=62.10, z=57.37], EntitySquid['Squid'/273, l='MpServer', x=-112.62, y=60.85, z=92.44], EntitySheep['Sheep'/274, l='MpServer', x=-99.55, y=64.00, z=93.50], EntityCreeper['Creeper'/275, l='MpServer', x=-110.50, y=21.00, z=97.80], EntitySheep['Sheep'/276, l='MpServer', x=-101.46, y=64.00, z=101.26], EntityCreeper['Creeper'/277, l='MpServer', x=-108.80, y=15.00, z=119.46], EntityCreeper['Creeper'/282, l='MpServer', x=-89.48, y=35.00, z=-22.96], EntityCreeper['Creeper'/283, l='MpServer', x=-80.80, y=37.00, z=-12.52], EntitySheep['Sheep'/284, l='MpServer', x=-89.45, y=74.28, z=35.45], EntitySheep['Sheep'/285, l='MpServer', x=-86.61, y=72.00, z=44.81], EntitySheep['Sheep'/286, l='MpServer', x=-94.27, y=71.00, z=42.57], EntitySheep['Sheep'/287, l='MpServer', x=-91.51, y=73.00, z=36.21], EntityCreeper['Creeper'/288, l='MpServer', x=-86.50, y=20.00, z=57.50], EntityCreeper['Creeper'/289, l='MpServer', x=-89.50, y=21.00, z=66.50], EntitySheep['Sheep'/290, l='MpServer', x=-82.37, y=65.00, z=86.53], EntitySheep['Sheep'/291, l='MpServer', x=-82.51, y=66.00, z=90.27], EntityZombie['Zombie'/292, l='MpServer', x=-88.61, y=14.00, z=100.78], EntityZombie['Zombie'/293, l='MpServer', x=-91.46, y=14.00, z=97.75], EntitySheep['Sheep'/294, l='MpServer', x=-89.54, y=67.00, z=97.79], EntityPig['Pig'/295, l='MpServer', x=-84.48, y=70.00, z=104.31], EntitySkeleton['Skeleton'/296, l='MpServer', x=-88.50, y=25.00, z=128.71], EntitySlime['Slime'/299, l='MpServer', x=-73.75, y=36.00, z=-24.42], EntityBat['Bat'/300, l='MpServer', x=-64.25, y=39.10, z=-10.49], EntityBat['Bat'/301, l='MpServer', x=-73.25, y=38.10, z=-8.68], EntitySheep['Sheep'/302, l='MpServer', x=-79.70, y=74.00, z=38.50], EntitySheep['Sheep'/303, l='MpServer', x=-75.81, y=73.00, z=40.57], EntitySheep['Sheep'/304, l='MpServer', x=-72.49, y=70.00, z=60.07], EntityCreeper['Creeper'/305, l='MpServer', x=-69.21, y=12.00, z=90.49], EntityCreeper['Creeper'/306, l='MpServer', x=-65.57, y=12.00, z=91.21], EntitySheep['Sheep'/307, l='MpServer', x=-72.61, y=66.00, z=89.81], EntitySheep['Sheep'/308, l='MpServer', x=-74.24, y=70.00, z=106.67], EntityPig['Pig'/309, l='MpServer', x=-72.25, y=69.00, z=110.54], EntitySheep['Sheep'/310, l='MpServer', x=-65.18, y=69.00, z=98.73], EntityCreeper['Creeper'/313, l='MpServer', x=-58.50, y=38.00, z=-5.50], EntitySheep['Sheep'/315, l='MpServer', x=-61.45, y=67.00, z=56.80], EntitySheep['Sheep'/316, l='MpServer', x=-63.45, y=67.00, z=53.55], EntityPig['Pig'/317, l='MpServer', x=-59.48, y=66.00, z=109.20], EntityZombieVillager['Zombie Villager'/119, l='MpServer', x=-211.29, y=55.00, z=107.75], EntityPig['Pig'/120, l='MpServer', x=-216.56, y=64.00, z=109.45], EntityPig['Pig'/121, l='MpServer', x=-210.50, y=65.00, z=122.76], EntityPig['Pig'/122, l='MpServer', x=-213.03, y=64.00, z=126.06], EntityPig['Pig'/123, l='MpServer', x=-210.22, y=64.00, z=132.17], EntityPig['Pig'/126, l='MpServer', x=-197.22, y=64.00, z=4.49], EntitySkeleton['Skeleton'/127, l='MpServer', x=-207.28, y=37.00, z=105.50], EntityPig['Pig'/128, l='MpServer', x=-204.75, y=68.00, z=118.50], EntityPig['Pig'/129, l='MpServer', x=-200.75, y=65.00, z=127.50], EntityPig['Pig'/130, l='MpServer', x=-183.02, y=62.67, z=-4.83], EntityPig['Pig'/131, l='MpServer', x=-181.45, y=64.00, z=1.55], EntityPig['Pig'/132, l='MpServer', x=-181.26, y=65.00, z=3.46], EntitySkeleton['Skeleton'/133, l='MpServer', x=-183.50, y=26.00, z=104.50], EntityZombie['Zombie'/134, l='MpServer', x=-181.67, y=42.00, z=131.48], EntitySkeleton['Skeleton'/143, l='MpServer', x=-162.73, y=45.00, z=93.46], EntitySkeleton['Skeleton'/144, l='MpServer', x=-163.50, y=45.00, z=95.61], EntityZombie['Zombie'/145, l='MpServer', x=-169.23, y=29.00, z=109.45], EntityZombie['Zombie'/146, l='MpServer', x=-172.82, y=16.00, z=109.50], EntitySkeleton['Skeleton'/147, l='MpServer', x=-175.58, y=27.00, z=108.50], EntitySkeleton['Skeleton'/148, l='MpServer', x=-174.73, y=27.00, z=106.41], EntitySkeleton['Skeleton'/149, l='MpServer', x=-164.30, y=45.00, z=100.35], EntityZombie['Zombie'/150, l='MpServer', x=-160.50, y=37.00, z=103.50], EntityZombie['Zombie'/151, l='MpServer', x=-166.52, y=49.00, z=123.64], EntityCreeper['Creeper'/152, l='MpServer', x=-169.70, y=49.25, z=127.70], EntityCreeper['Creeper'/153, l='MpServer', x=-164.24, y=49.00, z=119.53], EntitySkeleton['Skeleton'/154, l='MpServer', x=-167.49, y=49.00, z=121.30], EntityBat['Bat'/155, l='MpServer', x=-165.25, y=50.10, z=114.39], EntitySkeleton['Skeleton'/156, l='MpServer', x=-169.70, y=49.43, z=126.88], EntitySkeleton['Skeleton'/157, l='MpServer', x=-170.27, y=48.00, z=125.36], EntitySkeleton['Skeleton'/158, l='MpServer', x=-168.23, y=49.00, z=121.90], EntityPig['Pig'/168, l='MpServer', x=-172.04, y=66.00, z=132.53], EntityPlayerSP['Fifou_BE'/392, l='MpServer', x=-137.85, y=70.00, z=52.63], EntityCreeper['Creeper'/201, l='MpServer', x=-154.21, y=16.00, z=13.44], EntityZombie['Zombie'/202, l='MpServer', x=-145.53, y=16.00, z=21.72], EntityZombie['Zombie'/203, l='MpServer', x=-148.46, y=23.00, z=16.75], EntitySheep['Sheep'/204, l='MpServer', x=-144.04, y=70.00, z=69.79], EntitySpider['Spider'/205, l='MpServer', x=-157.22, y=31.00, z=103.70], EntityBat['Bat'/206, l='MpServer', x=-148.70, y=32.17, z=106.50], EntityItem['item.item.seeds'/207, l='MpServer', x=-152.96, y=68.00, z=98.05], EntityZombie['Zombie'/208, l='MpServer', x=-157.56, y=16.00, z=122.19], EntityCreeper['Creeper'/209, l='MpServer', x=-159.70, y=37.31, z=126.30], EntityZombie['Zombie'/210, l='MpServer', x=-152.57, y=50.00, z=126.08], EntityCreeper['Creeper'/211, l='MpServer', x=-158.28, y=50.00, z=123.19], EntityBat['Bat'/212, l='MpServer', x=-158.40, y=54.10, z=119.61], EntityZombie['Zombie'/213, l='MpServer', x=-147.22, y=50.00, z=130.50], EntitySheep['Sheep'/222, l='MpServer', x=-129.05, y=68.00, z=42.21], EntityItem['item.item.seeds'/223, l='MpServer', x=-143.01, y=70.00, z=51.86], EntityZombie['Zombie'/224, l='MpServer', x=-139.66, y=49.00, z=124.46], EntityBat['Bat'/230, l='MpServer', x=-130.54, y=56.03, z=133.91], EntitySkeleton['Skeleton'/239, l='MpServer', x=-123.50, y=29.00, z=-20.50], EntityEnderman['Enderman'/240, l='MpServer', x=-123.51, y=20.00, z=-16.43], EntityBat['Bat'/241, l='MpServer', x=-120.32, y=22.10, z=0.50], EntitySkeleton['Skeleton'/242, l='MpServer', x=-119.79, y=23.00, z=14.50], EntityZombie['Zombie'/243, l='MpServer', x=-113.75, y=36.00, z=25.46], EntitySheep['Sheep'/244, l='MpServer', x=-112.48, y=63.00, z=25.55], EntitySheep['Sheep'/245, l='MpServer', x=-115.73, y=67.00, z=31.49], EntitySheep['Sheep'/246, l='MpServer', x=-118.47, y=64.00, z=28.00], EntitySkeleton['Skeleton'/247, l='MpServer', x=-115.50, y=36.00, z=36.50], EntityCreeper['Creeper'/248, l='MpServer', x=-124.26, y=53.00, z=106.85], EntitySquid['Squid'/249, l='MpServer', x=-113.59, y=61.13, z=101.33], EntityEnderman['Enderman'/250, l='MpServer', x=-125.50, y=17.00, z=126.57], EntityCreeper['Creeper'/251, l='MpServer', x=-117.20, y=49.00, z=123.47], EntityBat['Bat'/252, l='MpServer', x=-117.90, y=49.52, z=125.09], EntitySkeleton['Skeleton'/255, l='MpServer', x=-117.76, y=55.00, z=130.50]] |
| Retry entities: 0 total; [] |
| Server brand: fml,forge |
| Server type: Integrated singleplayer server |
| Stacktrace: |
| at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:456) |
| at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2774) |
| at net.minecraft.client.Minecraft.run(Minecraft.java:428) |
| at net.minecraft.client.main.Main.main(Main.java:118) |
| 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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) |
| at GradleStart.main(GradleStart.java:26) |
| |
| – System Details -- |
| Details: |
| Minecraft Version: 1.11.2 |
| Operating System: Windows 10 (amd64) version 10.0 |
| Java Version: 1.8.0_131, Oracle Corporation |
| Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation |
| Memory: 487702488 bytes (465 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) |
| JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M |
| IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 |
| FML: MCP 9.38 Powered by Forge 13.20.0.2228 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 |
| UCHIJAAAA minecraft{1.11.2} [Minecraft] (minecraft.jar) |
| UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) |
| UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11.2-13.20.0.2228.jar) |
| UCHIJAAAA forge{13.20.0.2228} [Minecraft Forge] (forgeSrc-1.11.2-13.20.0.2228.jar) |
| UCHIJAAAA economy{0.1} [Mod Economy] (bin) |
| Loaded coremods (and transformers): |
| GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 382.05' Renderer: 'GeForce GTX 1060 6GB/PCIe/SSE2' |
| Launched Version: 1.11.2 |
| LWJGL: 2.9.4 |
| OpenGL: GeForce GTX 1060 6GB/PCIe/SSE2 GL version 4.5.0 NVIDIA 382.05, NVIDIA Corporation |
| GL Caps: Using GL 1.3 multitexturing. |
| Using GL 1.3 texture combiners. |
| Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. |
| Shaders are available because OpenGL 2.1 is supported. |
| VBOs are available because OpenGL 1.5 is supported. |
| |
| Using VBOs: Yes |
| 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) |
| CPU: 8x Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz |
| [21:54:11] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Florent\Desktop\EconomyMod\run\.\crash-reports\crash-2017-06-29_21.54.11-client.txt |
| 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 |
| |
| |
Voici mes différentes classes ( c’est la premiere fois que j’essaye de faire un guiContainer et j’ai du me baser sur un tuto de 1.7.10 et j’ai regarder dans le code source aussi de MC…
TileEntity
| package fr.fifou.economy.blocks.tileentity; |
| |
| import java.util.UUID; |
| |
| import javax.annotation.Nullable; |
| |
| import fr.fifou.economy.blocks.blockVault; |
| |
| import net.minecraft.block.Block; |
| import net.minecraft.block.BlockChest; |
| import net.minecraft.entity.player.EntityPlayer; |
| import net.minecraft.entity.player.InventoryPlayer; |
| import net.minecraft.init.SoundEvents; |
| import net.minecraft.inventory.Container; |
| import net.minecraft.inventory.ContainerChest; |
| import net.minecraft.inventory.IInventory; |
| import net.minecraft.inventory.InventoryLargeChest; |
| import net.minecraft.inventory.ItemStackHelper; |
| import net.minecraft.item.ItemStack; |
| import net.minecraft.nbt.NBTTagCompound; |
| import net.minecraft.nbt.NBTTagList; |
| import net.minecraft.network.NetworkManager; |
| import net.minecraft.network.Packet; |
| import net.minecraft.network.play.server.SPacketUpdateTileEntity; |
| import net.minecraft.tileentity.TileEntity; |
| import net.minecraft.tileentity.TileEntityChest; |
| import net.minecraft.util.EnumFacing; |
| import net.minecraft.util.ITickable; |
| import net.minecraft.util.NonNullList; |
| import net.minecraft.util.SoundCategory; |
| import net.minecraft.util.datafix.DataFixer; |
| import net.minecraft.util.datafix.FixTypes; |
| import net.minecraft.util.datafix.walkers.ItemStackDataLists; |
| import net.minecraft.util.math.AxisAlignedBB; |
| import net.minecraft.util.math.BlockPos; |
| import net.minecraftforge.common.util.Constants; |
| |
| public class TileEntityBlockVault extends TileEntity implements IInventory |
| { |
| private ItemStack[] contents = new ItemStack[27]; |
| private String customName; |
| |
| @Override |
| public String getName() |
| { |
| return "tile.block_vault"; |
| } |
| @Override |
| public boolean hasCustomName() |
| { |
| return false; |
| } |
| |
| @Override |
| public void readFromNBT(NBTTagCompound compound) |
| { |
| super.readFromNBT(compound); |
| NBTTagList nbttl = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND); |
| this.contents = new ItemStack[this.getSizeInventory()]; |
| for(int i=0; i < nbttl.tagCount(); ++i) |
| { |
| NBTTagCompound nbttagcompound1 = nbttl.getCompoundTagAt(i); |
| int j = nbttagcompound1.getByte("Slot") & 255; |
| |
| if(j >= 0 && j < this.contents.length) |
| { |
| this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); |
| } |
| } |
| |
| } |
| |
| @Override |
| public NBTTagCompound writeToNBT(NBTTagCompound compound) |
| { |
| NBTTagList nbttaglist = new NBTTagList(); |
| for(int i = 0; i < this.contents.length; ++i) |
| { |
| if(this.contents[ i] != null) |
| { |
| NBTTagCompound nbttagcompound1 = new NBTTagCompound(); |
| nbttagcompound1.setByte("Slot", (byte)i); |
| this.contents[ i].writeToNBT(nbttagcompound1); |
| nbttaglist.appendTag(nbttagcompound1); |
| } |
| } |
| compound.setTag("Items", nbttaglist); |
| return super.writeToNBT(compound); |
| } |
| |
| @Override |
| public ItemStack getStackInSlot(int slotIndex) |
| { |
| return this.contents[slotIndex]; |
| } |
| |
| @Override |
| public int getSizeInventory() |
| { |
| return this.contents.length; |
| } |
| |
| @Override |
| public boolean isEmpty() { |
| return false; |
| } |
| @Override |
| public ItemStack decrStackSize(int slotIndex, int amount) |
| { |
| if(this.contents[slotIndex] != null) |
| { |
| ItemStack itemstack; |
| |
| if(this.contents[slotIndex].getCount() <= amount) |
| { |
| itemstack = this.contents[slotIndex]; |
| this.contents[slotIndex] = null; |
| this.markDirty(); |
| return itemstack; |
| } |
| else |
| { |
| itemstack = this.contents[slotIndex].splitStack(amount); |
| |
| if(this.contents[slotIndex].getCount() == 0) |
| { |
| this.contents[slotIndex] = null; |
| } |
| this.markDirty(); |
| return itemstack; |
| } |
| } |
| else |
| { |
| return null; |
| } |
| } |
| @Override |
| public ItemStack removeStackFromSlot(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.getCount() > this.getInventoryStackLimit()) |
| { |
| int varCount1 = stack.getCount(); |
| varCount1 = this.getInventoryStackLimit(); |
| } |
| |
| this.markDirty(); |
| |
| } |
| @Override |
| public int getInventoryStackLimit() |
| { |
| return 64; |
| } |
| @Override |
| public boolean isUsableByPlayer(EntityPlayer player) { |
| return this.world.getTileEntity(new BlockPos(this.pos.getX(), this.pos.getY(), this.pos.getZ())) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; |
| } |
| @Override |
| public void openInventory(EntityPlayer player) { |
| |
| |
| } |
| @Override |
| public void closeInventory(EntityPlayer player) { |
| |
| |
| } |
| @Override |
| public boolean isItemValidForSlot(int index, ItemStack stack) { |
| return true; |
| } |
| @Override |
| public int getField(int id) { |
| return 0; |
| } |
| @Override |
| public void setField(int id, int value) { |
| |
| } |
| @Override |
| public int getFieldCount() { |
| return 0; |
| } |
| @Override |
| public void clear() { |
| |
| } |
| } |
| |
Container
| package fr.fifou.economy.containers; |
| |
| import fr.fifou.economy.blocks.tileentity.TileEntityBlockVault; |
| import net.minecraft.entity.player.EntityPlayer; |
| import net.minecraft.entity.player.InventoryPlayer; |
| import net.minecraft.inventory.Container; |
| import net.minecraft.inventory.IInventory; |
| import net.minecraft.inventory.Slot; |
| import net.minecraft.item.ItemStack; |
| import net.minecraft.util.ResourceLocation; |
| |
| public class ContainerVault extends Container |
| { |
| private final TileEntityBlockVault tile; |
| |
| public ContainerVault(TileEntityBlockVault tile, InventoryPlayer inventory, EntityPlayer player) |
| { |
| this.tile = tile; |
| tile.openInventory(player); |
| for(int i = 0; i < 3; ++i) |
| { |
| for(int j = 0; j < 9; ++j) |
| { |
| this.addSlotToContainer(new Slot(tile, j + i * 9, 8 + j * 18, 18 + i * 18)); |
| } |
| } |
| this.bindPlayerInventory(inventory); |
| } |
| |
| @Override |
| public boolean canInteractWith(EntityPlayer playerIn) |
| { |
| return this.tile.isUsableByPlayer(playerIn); |
| } |
| |
| private void bindPlayerInventory(InventoryPlayer inventory) |
| { |
| int i; |
| for(i = 0; i < 3; ++i) |
| { |
| for(int j = 0; j < 9; ++j) |
| { |
| this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 86 + i * 18)); |
| } |
| } |
| |
| for(i = 0; i < 9; ++i) |
| { |
| this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 144)); |
| } |
| } |
| |
| public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) |
| { |
| ItemStack itemstack = null; |
| Slot slot = (Slot)this.inventorySlots.get(slotIndex); |
| |
| if(slot != null && slot.getHasStack()) |
| { |
| ItemStack itemstack1 = slot.getStack(); |
| itemstack = itemstack1.copy(); |
| |
| if(slotIndex < this.tile.getSizeInventory()) |
| { |
| if(!this.mergeItemStack(itemstack1, this.tile.getSizeInventory(), this.inventorySlots.size(), true)) |
| { |
| return null; |
| } |
| } |
| else if(!this.mergeItemStack(itemstack1, 0, this.tile.getSizeInventory(), false)) |
| { |
| return null; |
| } |
| |
| if(itemstack1.getCount() == 0) |
| { |
| slot.putStack((ItemStack)null); |
| } |
| else |
| { |
| slot.onSlotChanged(); |
| } |
| } |
| return itemstack; |
| } |
| |
| @Override |
| public void onContainerClosed(EntityPlayer playerIn) |
| { |
| super.onContainerClosed(playerIn); |
| this.tile.closeInventory(playerIn); |
| } |
| } |
| |
GuiVaultNew
| |
| package fr.fifou.economy.gui; |
| |
| import java.io.IOException; |
| |
| import org.lwjgl.input.Keyboard; |
| import org.lwjgl.opengl.GL11; |
| |
| import fr.fifou.economy.ModEconomy; |
| import fr.fifou.economy.blocks.tileentity.TileEntityBlockVault; |
| import fr.fifou.economy.containers.ContainerVault; |
| import fr.fifou.economy.packets.PacketVaultCreated; |
| import net.minecraft.client.Minecraft; |
| import net.minecraft.client.gui.GuiButton; |
| import net.minecraft.client.gui.GuiScreen; |
| import net.minecraft.client.gui.GuiTextField; |
| import net.minecraft.client.gui.inventory.GuiContainer; |
| import net.minecraft.entity.player.EntityPlayer; |
| import net.minecraft.entity.player.InventoryPlayer; |
| import net.minecraft.inventory.Container; |
| import net.minecraft.inventory.IInventory; |
| import net.minecraft.item.ItemStack; |
| import net.minecraft.tileentity.TileEntity; |
| import net.minecraft.util.ResourceLocation; |
| import net.minecraft.util.math.BlockPos; |
| import net.minecraft.util.text.TextFormatting; |
| import net.minecraft.world.World; |
| import net.minecraftforge.event.world.GetCollisionBoxesEvent; |
| import net.minecraftforge.fml.client.config.GuiButtonExt; |
| |
| public class GuiVaultNew extends GuiContainer |
| { |
| private TileEntityBlockVault tileTuto; |
| private IInventory playerInv; |
| private static final ResourceLocation background = new ResourceLocation(ModEconomy.MODID ,"textures/gui/screen/gui_item.png"); |
| protected int xSize = 256; |
| protected int ySize = 124; |
| protected int guiLeft; |
| protected int guiTop; |
| |
| public GuiVaultNew(TileEntityBlockVault tile, InventoryPlayer inventory, EntityPlayer player) |
| { |
| super(new ContainerVault(tile, inventory, player)); |
| this.tileTuto = tile; |
| this.playerInv = inventory; |
| this.allowUserInput = false; |
| this.ySize = 170; |
| } |
| |
| @Override |
| protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) |
| { |
| GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); |
| this.mc.getTextureManager().bindTexture(background); |
| int k = (this.width - this.xSize) / 2; |
| int l = (this.height - this.ySize) / 2; |
| this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); |
| } |
| } |
| |
GuiHandler
| |
| package fr.fifou.economy.gui; |
| |
| import javax.annotation.Nullable; |
| |
| import org.lwjgl.opengl.GL11; |
| |
| import fr.fifou.economy.ModEconomy; |
| import fr.fifou.economy.blocks.tileentity.TileEntityBlockVault; |
| import fr.fifou.economy.containers.ContainerVault; |
| |
| import net.minecraft.client.gui.inventory.GuiContainer; |
| import net.minecraft.client.resources.I18n; |
| import net.minecraft.entity.player.EntityPlayer; |
| import net.minecraft.entity.player.InventoryPlayer; |
| import net.minecraft.inventory.IInventory; |
| import net.minecraft.tileentity.TileEntity; |
| import net.minecraft.util.ResourceLocation; |
| import net.minecraft.util.math.BlockPos; |
| import net.minecraft.world.World; |
| import net.minecraftforge.fml.common.network.IGuiHandler; |
| import net.minecraftforge.fml.relauncher.Side; |
| import net.minecraftforge.fml.relauncher.SideOnly; |
| |
| public class GuiHandler implements IGuiHandler |
| { |
| public static final int ITEM_CARD_GUI = 0; |
| public static final int ITEM_CARD_DELETE = 1; |
| public static final int BLOCK_VAULT_NEW = 2; |
| |
| public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) |
| { |
| if(ID == BLOCK_VAULT_NEW) |
| { |
| TileEntity tile = world.getTileEntity(new BlockPos(x,y,z)); |
| if(tile instanceof TileEntityBlockVault) |
| { |
| return new ContainerVault((TileEntityBlockVault)tile, player.inventory, player); |
| } |
| } |
| |
| return null; |
| } |
| |
| public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) |
| { |
| if(ID == ITEM_CARD_GUI) |
| { |
| return new GuiItem(); |
| } |
| else if(ID == ITEM_CARD_DELETE) |
| { |
| return new GuiDelete(); |
| } |
| else if(ID == BLOCK_VAULT_NEW) |
| { |
| TileEntity tile = world.getTileEntity(new BlockPos(x,y,z)); |
| if(tile instanceof TileEntityBlockVault) |
| { |
| return new GuiVaultNew((TileEntityBlockVault)tile, player.inventory, player); |
| } |
| } |
| |
| return null; |
| } |
| |
| } |
| |
Désoler si je fais des bêtes erreurs. J’ai eu un problème avec cette ligne que j’avais mis en commentaires, pour
| if(j >= 0 && j < this.contents.length) |
| { |
| this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); |
| } |
le loadItemStackFromNBT n’existe plus et en faisant des recherches il est dit d’utiliser ItemStackHandler mais toujours rien 