Savoir si un coffre est vide ou plein
-
rayTrace(2D, event.partialTicks);
2 c’est pas beaucoup, essaie avec quelque chose de plus grand ou rapproche toi de ton block
-
Le jeu fait juste un Ne répond pas Robin
avec ça
[21:34:10] [Server thread/INFO]: Saving and pausing game… [21:34:10] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [21:34:10] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [21:34:10] [Server thread/INFO]: Saving chunks for level 'New World'/The End [21:34:10] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@5c8342[id=858c22eb-998e-3b6e-bf5d-5bbed095e7e1,name=ZeAmateis,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:65) ~[YggdrasilAuthenticationService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:158) [YggdrasilMinecraftSessionService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:53) [YggdrasilMinecraftSessionService$1.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:50) [YggdrasilMinecraftSessionService$1.class:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?] at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:148) [YggdrasilMinecraftSessionService.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.7.0_60] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_60] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_60] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_60] at java.lang.Thread.run(Unknown Source) [?:1.7.0_60] -
Il y a une erreur avec le système d’auth de Minecraft, c’est étrange o_O
-
The client has sent too many requests within a certain amount of timeArrête pendant un petit bout de temps, mojang en a marre que tu redémarres ton jeu.
-
@‘SCAREX’:
Arrête pendant un petit bout de temps, mojang en a marre que tu redémarres ton jeu.
xD
-
Je viens de re test et j’ai juste Minecraft qui cesse de fonctionner pas de crash ni rien
-
Si c’est au démarrage, c’est normal, sinon lance bien ton mod en mode RUN (au lieu de debug), si çà ne change rien, c’est que le problème vient de ton ordi.
-
SCAREX, non mon problème persiste toujours !
Je remet mon code au cas où avec deux trois modif’s
@SideOnly(Side.CLIENT) @SubscribeEvent public void renderContainerMessage(RenderGameOverlayEvent.Text event) { MovingObjectPosition movingObjPos = this.mc.thePlayer.rayTrace(2D, event.partialTicks); int width = event.resolution.getScaledWidth(); //EntityRenderer int height = event.resolution.getScaledHeight(); EntityPlayer player = Minecraft.getMinecraft().thePlayer; World world = Minecraft.getMinecraft().theWorld; MovingObjectPosition mov = player.rayTrace(2D, event.partialTicks); if(this.mc.objectMouseOver != null && mov != null && mov.typeOfHit == MovingObjectType.BLOCK) { BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); Block block = world.getBlockState(blockpos).getBlock(); String getOpeningMessage = EnumChatFormatting.BOLD + "Right Click" + EnumChatFormatting.RESET + " to open"; String getContainerBlockName = block.getLocalizedName(); String isEmpty = "(Empty)"; String getIfIsLocked = EnumChatFormatting.DARK_RED + "Locked"; TileEntityChest tile = (TileEntityChest)this.mc.theWorld.getTileEntity(blockpos); boolean flag = true; if((block) instanceof BlockChest) { this.drawCenteredString(this.mc.fontRendererObj, getOpeningMessage, width / 2 + 30, height / 2 + 8, new Color(255,255,255).getRGB()); this.drawCenteredString(this.mc.fontRendererObj, getContainerBlockName, width / 2 + 30, height / 2 + 22, new Color(255,255,255).getRGB()); if(tile.isLocked()) { this.drawCenteredString(this.mc.fontRendererObj, getIfIsLocked, width / 2 - 20, height / 2 - 10, new Color(255,255,255).getRGB()); } for (int i = 0; i < tile.getSizeInventory(); i++) { if (tile.getStackInSlot(i) != null) { flag = false; } } if(flag) { System.out.println("container vide"); } else { System.out.println("container non-vide"); } } } } -
Essaie avec çà plutôt :
@SideOnly(Side.CLIENT) @SubscribeEvent public void renderContainerMessage(RenderGameOverlayEvent.Post event) { if (event.type == RenderGameOverlayEvent.ElementType.TEXT) { MovingObjectPosition movingObjPos = this.mc.thePlayer.rayTrace(2D, event.partialTicks); int width = event.resolution.getScaledWidth(); //EntityRenderer int height = event.resolution.getScaledHeight(); EntityPlayer player = Minecraft.getMinecraft().thePlayer; World world = Minecraft.getMinecraft().theWorld; MovingObjectPosition mov = player.rayTrace(2D, event.partialTicks); if(this.mc.objectMouseOver != null && mov != null && mov.typeOfHit == MovingObjectType.BLOCK) { BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); Block block = world.getBlockState(blockpos).getBlock(); String getOpeningMessage = EnumChatFormatting.BOLD + "Right Click" + EnumChatFormatting.RESET + " to open"; String getContainerBlockName = block.getLocalizedName(); String isEmpty = "(Empty)"; String getIfIsLocked = EnumChatFormatting.DARK_RED + "Locked"; TileEntityChest tile = (TileEntityChest)this.mc.theWorld.getTileEntity(blockpos); boolean flag = true; if((block) instanceof BlockChest) { this.drawCenteredString(this.mc.fontRendererObj, getOpeningMessage, width / 2 + 30, height / 2 + 8, new Color(255,255,255).getRGB()); this.drawCenteredString(this.mc.fontRendererObj, getContainerBlockName, width / 2 + 30, height / 2 + 22, new Color(255,255,255).getRGB()); if(tile.isLocked()) { this.drawCenteredString(this.mc.fontRendererObj, getIfIsLocked, width / 2 - 20, height / 2 - 10, new Color(255,255,255).getRGB()); } for (int i = 0; i < tile.getSizeInventory(); i++) { if (tile.getStackInSlot(i) != null) { flag = false; } } if(flag) { System.out.println("container vide"); } else { System.out.println("container non-vide"); } } } } } -
Toujours Pareil
-
@‘ZeAmateis’:
Toujours Pareil
Et si tu mets tout ce code en commentaire ?
-
ça marche normalement ^^ Normal non ? ^^’
-
Dans quelle classe se trouve cette fonction ?
Après plusieurs tests, voici mes résultats :
1-Ta fonction est dans une classe Gui (ou GuiScreen), ce qui est une mauvaise manie
2-Le container est toujours vide car tu récupère un WorldClient et non un WorldServer donc ta tileEntity est vide. Il faut faire une synchronisation client / serveur. -
une classe ou des events côté clients sont chargés
-
Petit up, une petite idée ?
Quel serait le code alors ?
@‘SCAREX’:
Dans quelle classe se trouve cette fonction ?
Après plusieurs tests, voici mes résultats :
1-Ta fonction est dans une classe Gui (ou GuiScreen), ce qui est une mauvaise manie
2-Le container est toujours vide car tu récupère un WorldClient et non un WorldServer donc ta tileEntity est vide. Il faut faire une synchronisation client / serveur. -
@‘robin4002’:
Envoie le rapport.
J’ai fait :
for (int i = 0; i < tile.getSizeInventory(); i++) { System.out.println(tile.getStackInSlot(i)); if (tile.getStackInSlot(i) != null) { flag = false; } }Le:
System.out.println(tile.getStackInSlot(i));Me donne
[18:16:59] [Client thread/INFO] [STDOUT]: [fr.zeamateis.tesm.module.client.guis.client.gui.GuiInGame:renderContainerMessage:88]: null
Pas normal ?
-
Tout le temps ? car normalement comme la boucle va de 0 à la taille de l’inventaire ça devrait afficher plusieurs null. (et au contraire un truc non null si il y a quelques choses dans le IInventory).
-
ça l’affiche tout le temps oui effectivement
-
Bon c’est ce que je craignais. Côté client getStackInSlot return toujours null, le client ne sait pas ce qu’il y a dans le coffre temps qu’il ne l’ouvre pas (c’est à ce moment que le contenu est synchronisé).
-
Problème résolu grâce à Dermensolf sur IC