Résolu Augmeter ses stats de déplacment dans l'eau + Touche personalisée
-
Comme dit dans un précédent tppic, je vais.m’attaquer à openclasseoom pendant mon trajet en avion, et sur mn lieu de vacance
Envoyé de mon SM-G357FZ en utilisant Tapatalk
-
Le plus important à apprendre c’est la programmation orientée objet, c’est ce dont tu auras le plus besoin.
-
Je pense que mon débug a ‘bug’ (lauwl)
Aud ébut, j’ai mis la méthode motionY en pensant que s’était X
je l’ai enlevé, sans reboot mon debug, et il y a eu un petit problème, qui fait que sa n’a pas pris en compte mes modifications
Mais je ne vais pas plus vite dans l’eau, et surtout , je suis toujours ralenti dans les courants
Quelques questions :
- Est-il possible d’avoir un objet enchanté, mais on ne peut lire l’enchantement, et l’item ne brille pas
- Est-il possible de désactiver le blur de l’eau ( Le fait que l’on voit trouble sous l’eau)
Comment savoir si le joueur appuie sur la touche saut ? Si possible durant une durée déterminée ?
Pour ne plus avoir les problèmes sur le pantalons, j’ai décidé de creer une touche, présée, elle activera les air bags des pantalons, qui aura comme effet de nous faire remonter très vite
Or, je crash. J’ai pas encore trop travailler sur la toucheClientProxy
package eryah.usefulthings.proxy; import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBoat; import net.minecraft.client.model.ModelChicken; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.Item; import net.minecraft.util.ChatComponentText; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; import net.minecraftforge.fml.common.registry.EntityRegistry; import org.lwjgl.input.Keyboard; import eryah.usefulthings.Reference; import eryah.usefulthings.blocks.Clinker; import eryah.usefulthings.blocks.Crusher; import eryah.usefulthings.blocks.DragonScaleOre; import eryah.usefulthings.blocks.Limestone; import eryah.usefulthings.blocks.LitCrusher; import eryah.usefulthings.blocks.MarkedRoadBlock; import eryah.usefulthings.blocks.PlateCrafter; import eryah.usefulthings.blocks.ResinLeaves; import eryah.usefulthings.blocks.ResinTree; import eryah.usefulthings.blocks.RoadBlock; import eryah.usefulthings.blocks.Scaffolding; import eryah.usefulthings.blocks.SteelBlock; import eryah.usefulthings.client.TileEntityCrusherSpecialRenderer; import eryah.usefulthings.client.TileEntityPlateCrafterSpecialRenderer; import eryah.usefulthings.client.render.RenderGoldenEggChicken; import eryah.usefulthings.client.render.RenderMotoBoat; import eryah.usefulthings.entity.item.ELavaBottle; import eryah.usefulthings.entity.item.MotorizedBoat; import eryah.usefulthings.entity.passive.GoldenEggChicken; import eryah.usefulthings.init.AirBottle; import eryah.usefulthings.init.BladedBowDiamond; import eryah.usefulthings.init.BladedBowGold; import eryah.usefulthings.init.BladedBowIron; import eryah.usefulthings.init.BladedBowStone; import eryah.usefulthings.init.BladedBowWood; import eryah.usefulthings.init.BottleHerm; import eryah.usefulthings.init.BucketHerm; import eryah.usefulthings.init.Chainsaw; import eryah.usefulthings.init.CoalPowder; import eryah.usefulthings.init.DragonAxe; import eryah.usefulthings.init.DragonGem; import eryah.usefulthings.init.DragonHoe; import eryah.usefulthings.init.DragonPickaxe; import eryah.usefulthings.init.DragonScale; import eryah.usefulthings.init.DragonShovel; import eryah.usefulthings.init.DragonSword; import eryah.usefulthings.init.EnderGem; import eryah.usefulthings.init.EnderSoul; import eryah.usefulthings.init.Engine; import eryah.usefulthings.init.EpicAdminChestplate; import eryah.usefulthings.init.GoldenEgg; import eryah.usefulthings.init.LapisAxe; import eryah.usefulthings.init.LapisBoots; import eryah.usefulthings.init.LapisChestplate; import eryah.usefulthings.init.LapisHelmet; import eryah.usefulthings.init.LapisLeggings; import eryah.usefulthings.init.LapisPickaxe; import eryah.usefulthings.init.LapisShovel; import eryah.usefulthings.init.LapisSword; import eryah.usefulthings.init.LavaBottle; import eryah.usefulthings.init.PolishedLapis; import eryah.usefulthings.init.Propeller; import eryah.usefulthings.init.RedstoneIgniter; import eryah.usefulthings.init.Resin; import eryah.usefulthings.init.ScaphBoots; import eryah.usefulthings.init.ScaphChestplate; import eryah.usefulthings.init.ScaphHelmet; import eryah.usefulthings.init.ScaphLeggings; import eryah.usefulthings.init.SteelAxe; import eryah.usefulthings.init.SteelBoots; import eryah.usefulthings.init.SteelChestplate; import eryah.usefulthings.init.SteelHelmet; import eryah.usefulthings.init.SteelIngot; import eryah.usefulthings.init.SteelLeggings; import eryah.usefulthings.init.SteelPickaxe; import eryah.usefulthings.init.SteelShovel; import eryah.usefulthings.init.SteelSword; import eryah.usefulthings.init.SuperBadassAdminTool; import eryah.usefulthings.init.VegeStick; import eryah.usefulthings.init.WeedKiller; import eryah.usefulthings.tileentity.TileEntityCrusher; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class ClientProxy extends CommonProxy { private static KeyBinding keyAirBag; final boolean hasBeenPressed = keyAirBag.isPressed(); public ClientProxy() { FMLCommonHandler.instance().bus().register(this); keyAirBag = new KeyBinding("ut.keyDesAirbag", Keyboard.KEY_LMENU, "key.categories.movement"); ClientRegistry.registerKeyBinding(keyAirBag); } @Override public void registerRenders() { } private void registerItem(Item diamond_bladed_bow, int i, String identifier) { ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); mesher.register(diamond_bladed_bow, i, new ModelResourceLocation(identifier, "inventory")); } @SubscribeEvent public void onEvent(KeyInputEvent event) { // Si vous remplacez isPressed() par getIsKeyPressed() // Le chat sera inondé à chaque fois que vous presserez la touche if(keyAirBag.isPressed()) { keyTestTyped(); // Traitement de la touche } } private void keyTestTyped() { // La touche vient d'être appuyé !! Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText("lol, it works")); } }
Rapport de crash
–-- Minecraft Crash Report ---- // But it works on my machine. Time: 03/07/15 23:03 Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.NullPointerException at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:77) at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:517) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:505) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:211) at net.minecraft.client.Minecraft.startGame(Minecraft.java:446) at net.minecraft.client.Minecraft.run(Minecraft.java:356) at net.minecraft.client.main.Main.main(Main.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) Caused by: java.lang.NullPointerException at eryah.usefulthings.proxy.ClientProxy.<init>(ClientProxy.java:102) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:60) ... 35 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_45, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 870444088 bytes (830 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.99.8.1412 Minecraft Forge 11.14.1.1412 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed FML{8.99.8.1412} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed Forge{11.14.1.1412} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed ut{Beta 1.0} [Useful Things] (bin) Unloaded->Errored Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.2.12420 Compatibility Profile Context 13.151.0.0' Renderer: 'AMD Radeon HD 8240'
Je pense juste que le tuto que j’ai utilisé ( http://www.minecraftforgefrance.fr/showthread.php?tid=581) est outdated</init>
-
Pour ta question a propos du blur, peut être que cela est géré via une texture alors voit pour la modifier.
-
Les touches n’ont pas changé en 1.8 le tutoriel est toujours valide, envoies ton client proxy tu as un NPE dans ton code.
-
Je l’ai envoyé dans mon message précédent
Envoyé de mon SM-G357FZ en utilisant Tapatalk
-
La classe du Proxy avec la fonction de la touche ( Corrigez moi si la fonction n’est pas valide (j’ai suprimé les lignes inutiles pour ce topic ))
package eryah.usefulthings.proxy; import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBoat; import net.minecraft.client.model.ModelChicken; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; import net.minecraftforge.fml.common.registry.EntityRegistry; import org.lwjgl.input.Keyboard; import eryah.usefulthings.Reference; import eryah.usefulthings.blocks.Clinker; import eryah.usefulthings.blocks.Crusher; import eryah.usefulthings.blocks.DragonScaleOre; import eryah.usefulthings.blocks.Limestone; import eryah.usefulthings.blocks.LitCrusher; import eryah.usefulthings.blocks.MarkedRoadBlock; import eryah.usefulthings.blocks.PlateCrafter; import eryah.usefulthings.blocks.ResinLeaves; import eryah.usefulthings.blocks.ResinTree; import eryah.usefulthings.blocks.RoadBlock; import eryah.usefulthings.blocks.Scaffolding; import eryah.usefulthings.blocks.SteelBlock; import eryah.usefulthings.client.TileEntityCrusherSpecialRenderer; import eryah.usefulthings.client.TileEntityPlateCrafterSpecialRenderer; import eryah.usefulthings.client.render.RenderGoldenEggChicken; import eryah.usefulthings.client.render.RenderMotoBoat; import eryah.usefulthings.entity.item.ELavaBottle; import eryah.usefulthings.entity.item.MotorizedBoat; import eryah.usefulthings.entity.passive.GoldenEggChicken; import eryah.usefulthings.init.AirBottle; import eryah.usefulthings.init.BladedBowDiamond; import eryah.usefulthings.init.BladedBowGold; import eryah.usefulthings.init.BladedBowIron; import eryah.usefulthings.init.BladedBowStone; import eryah.usefulthings.init.BladedBowWood; import eryah.usefulthings.init.BottleHerm; import eryah.usefulthings.init.BucketHerm; import eryah.usefulthings.init.Chainsaw; import eryah.usefulthings.init.CoalPowder; import eryah.usefulthings.init.DragonAxe; import eryah.usefulthings.init.DragonGem; import eryah.usefulthings.init.DragonHoe; import eryah.usefulthings.init.DragonPickaxe; import eryah.usefulthings.init.DragonScale; import eryah.usefulthings.init.DragonShovel; import eryah.usefulthings.init.DragonSword; import eryah.usefulthings.init.EnderGem; import eryah.usefulthings.init.EnderSoul; import eryah.usefulthings.init.Engine; import eryah.usefulthings.init.EpicAdminChestplate; import eryah.usefulthings.init.GoldenEgg; import eryah.usefulthings.init.LapisAxe; import eryah.usefulthings.init.LapisBoots; import eryah.usefulthings.init.LapisChestplate; import eryah.usefulthings.init.LapisHelmet; import eryah.usefulthings.init.LapisLeggings; import eryah.usefulthings.init.LapisPickaxe; import eryah.usefulthings.init.LapisShovel; import eryah.usefulthings.init.LapisSword; import eryah.usefulthings.init.LavaBottle; import eryah.usefulthings.init.PolishedLapis; import eryah.usefulthings.init.Propeller; import eryah.usefulthings.init.RedstoneIgniter; import eryah.usefulthings.init.Resin; import eryah.usefulthings.init.ScaphBoots; import eryah.usefulthings.init.ScaphChestplate; import eryah.usefulthings.init.ScaphHelmet; import eryah.usefulthings.init.ScaphLeggings; import eryah.usefulthings.init.SteelAxe; import eryah.usefulthings.init.SteelBoots; import eryah.usefulthings.init.SteelChestplate; import eryah.usefulthings.init.SteelHelmet; import eryah.usefulthings.init.SteelIngot; import eryah.usefulthings.init.SteelLeggings; import eryah.usefulthings.init.SteelPickaxe; import eryah.usefulthings.init.SteelShovel; import eryah.usefulthings.init.SteelSword; import eryah.usefulthings.init.SuperBadassAdminTool; import eryah.usefulthings.init.VegeStick; import eryah.usefulthings.init.WeedKiller; import eryah.usefulthings.tileentity.TileEntityCrusher; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class ClientProxy extends CommonProxy { private static KeyBinding keyAirBag; final boolean hasBeenPressed = keyAirBag.isPressed(); public ClientProxy() { FMLCommonHandler.instance().bus().register(this); keyAirBag = new KeyBinding("ut.keyDesAirbag", Keyboard.KEY_LMENU, "key.categories.movement"); ClientRegistry.registerKeyBinding(keyAirBag); } @Override public void registerRenders() { } @SubscribeEvent public void onEvent(KeyInputEvent event, EntityPlayer player) { // Si vous remplacez isPressed() par getIsKeyPressed() // Le chat sera inondé à chaque fois que vous presserez la touche if(keyAirBag.isPressed()) { keyTestTyped(player); // Traitement de la touche } } private void keyTestTyped(EntityPlayer player) { // La touche vient d'être appuyé !! if(player.inventory.armorItemInSlot(3) != null && player.inventory.armorItemInSlot(3).getItem() == ScaphLeggings.airbag_leggings); { while(player.isInWater()); { player.motionY = 1.0F; } } } }
-
Oups j’avais pas vu, j’étais sur mon téléphone c’est difficile de lire les messages.
final boolean hasBeenPressed = keyAirBag.isPressed();
Cette ligne n’a rien à faire là ou elle est. -
Je crash toujours
J’ai aussi ajouté un SuscribeEvent au dessus de al fonction de la touche–-- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 04/07/15 13:15 Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.ClassNotFoundException: eryah.usefulthings.proxy.ClientProxy at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:77) at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:517) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:505) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:211) at net.minecraft.client.Minecraft.startGame(Minecraft.java:446) at net.minecraft.client.Minecraft.run(Minecraft.java:356) at net.minecraft.client.main.Main.main(Main.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) Caused by: java.lang.ClassNotFoundException: eryah.usefulthings.proxy.ClientProxy at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at net.minecraftforge.fml.common.ModClassLoader.loadClass(ModClassLoader.java:60) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:60) ... 35 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer@6c7bc8ac from coremod FMLCorePlugin at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ... 41 more Caused by: java.lang.RuntimeException: Cannot apply @SubsribeEvent to private method eryah/usefulthings/proxy/ClientProxy/keyTestTyped(Lnet/minecraft/entity/player/EntityPlayer;)V at net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer.transform(EventSubscriberTransformer.java:39) at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ... 43 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_45, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 884268384 bytes (843 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.99.8.1412 Minecraft Forge 11.14.1.1412 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed FML{8.99.8.1412} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed Forge{11.14.1.1412} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed ut{Beta 1.0} [Useful Things] (bin) Unloaded->Errored Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.2.12420 Compatibility Profile Context 13.151.0.0' Renderer: 'AMD Radeon HD 8240'
-
@SubscribeEvent public void onEvent(KeyInputEvent event, EntityPlayer player) { // Si vous remplacez isPressed() par getIsKeyPressed() // Le chat sera inondé à chaque fois que vous presserez la touche if(keyAirBag.isPressed()) { keyTestTyped(player); // Traitement de la touche } }
->
@SubscribeEvent public void onEvent(KeyInputEvent event) { // Si vous remplacez isPressed() par getIsKeyPressed() // Le chat sera inondé à chaque fois que vous presserez la touche if(keyAirBag.isPressed()) { keyTestTyped(FMLClientHandler.instance().getClientPlayer()); // Traitement de la touche } }
Et pas de @SubscribeEvent au dessus de private void keyTestTyped(EntityPlayer player)
-
keyTestTyped(FMLClientHandler.instance().%(#ff3333)getClientPlayer); // Traitement de la touche
The method getClientPlayer() is undefined for the type FMLClientHandler
Ce n’est pas plutot getClientPlayerEntity ?
-
Oui possible j’ai taper le code à la main sans Eclipse.
-
Ca fonctionne
Mais je m’envole même si je n’ai pas les jambières, et même si je ne suis pas dans l’eauprivate void keyTestTyped(EntityPlayer player) { // La touche vient d'être appuyé !! if(player.inventory.armorItemInSlot(3) != null && player.inventory.armorItemInSlot(3).getItem() == ScaphLeggings.airbag_leggings); { while(player.isInWater()); { player.motionY = 1.0F; } } }
-
Le while c’est une mauvaise idée. Mets plutôt un if, et dans le else remet le motion sur 0F
-
ah. Mais enfaite je voudrait remonter plus vite, tant que je ne suis aps sorti de l’eau
-
Pas besoin de while …
keyTestTyped est appelé à chaque tick ou le joueur appuie donc … -
Ah ok, Mais j’ai mis la fonction isPressed et non getKeyPressed
D’après le tuto, la fonction isPressed fonctionne sous 1 ticks -
Utilise getKeyPressed dans ce cas.
-
Mais je ne veut pas qu’on puisse la spam.
Je voudrait que l’on apuie dessus une fois, et ensuite sa te remonte tous seul
( On appuie sur la touche : On fait sortir les airbags, puis l’air contenue dedans te fait remonter ) -
Rajoute un booléen dans les tags du joueur pour savoir s’il a appuyé sur la touche, mais comment tu fais ensuite pour la désactiver ?