Résolu Mêttre des effets sur un Kit
-
Rahh ça marche toujours pas
-
Quelqu’un serait comment faire ? car le message s’affiche en illimité
-
Envoie toute ta fonction onArmorTick.
-
ItemStack boots = player.getEquipmentInSlot(1); ItemStack leggings = player.getEquipmentInSlot(2); ItemStack chestPlate = player.getEquipmentInSlot(3); ItemStack helmet = player.getEquipmentInSlot(4); boolean asApple = playerAsItem(player, Items.apple, 0); if(boots != null && boots.getItem() == ModTutoriel.bootsTuto && leggings != null && leggings.getItem() == ModTutoriel.leggingsTuto && chestPlate != null && chestPlate.getItem() == ModTutoriel.chestPlateTuto && helmet != null && helmet.getItem() == ModTutoriel.helmetTuto) { player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 10, 10)); player.addChatComponentMessage(new ChatComponentTranslation("tile.testTonMessage.kitVitesseDetectee", new Object[0])); }
Voilà
-
@‘H33nok’:
ItemStack boots = player.getEquipmentInSlot(1); ItemStack leggings = player.getEquipmentInSlot(2); ItemStack chestPlate = player.getEquipmentInSlot(3); ItemStack helmet = player.getEquipmentInSlot(4); boolean asApple = playerAsItem(player, Items.apple, 0); if(boots != null && boots.getItem() == ModTutoriel.bootsTuto && leggings != null && leggings.getItem() == ModTutoriel.leggingsTuto && chestPlate != null && chestPlate.getItem() == ModTutoriel.chestPlateTuto && helmet != null && helmet.getItem() == ModTutoriel.helmetTuto) { player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 10, 10)); player.addChatComponentMessage(new ChatComponentTranslation("tile.testTonMessage.kitVitesseDetectee", new Object[0])); }
Voilà
n’oublie pas de boolean et la boucle for
[size=x-small if(boots != null && boots.getItem() == ModTutoriel.bootsTuto && leggings != null && leggings.getItem() == ModTutoriel.leggingsTuto && chestPlate != null && chestPlate.getItem() == ModTutoriel.chestPlateTuto && helmet != null && helmet.getItem() == ModTutoriel.helmetTuto && asApple)] [size=x-small {] [size=x-small player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 10, 10));] [size=x-smallfor (int i = 0; i<1; i++) {] [size=x-smallif (!World.worldObj.isRemote){] [size=x-small player.addChatComponentMessage(new ChatComponentTranslation("tile.testTonMessage.kitVitesseDetectee", new Object[0]));] [size=x-small}}] [size=x-small }]
-
Fait comme ça :
ItemStack boots = player.getEquipmentInSlot(1); ItemStack leggings = player.getEquipmentInSlot(2); ItemStack chestPlate = player.getEquipmentInSlot(3); ItemStack helmet = player.getEquipmentInSlot(4); boolean asApple = playerAsItem(player, Items.apple, 0); if(boots != null && boots.getItem() == ModTutoriel.bootsTuto && leggings != null && leggings.getItem() == ModTutoriel.leggingsTuto && chestPlate != null && chestPlate.getItem() == ModTutoriel.chestPlateTuto && helmet != null && helmet.getItem() == ModTutoriel.helmetTuto) { player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 10, 10)); if(!player.getEntityData().getBoolean("kitVitesse") { player.addChatComponentMessage(new ChatComponentTranslation("tile.testTonMessage.kitVitesseDetectee")); player.getEntityData().setBoolean("kitVitesse", true); } }
-
ça marche mais sa ne l’affiche qu’une fois ^^ Genre y’aurai pas un moyen de l’afficher quand il met le Kit , genre le joueur met le Kit sa lui affiche un message dans le chat , après il enlève le kit , il le remet , et sa lui réaffiche un message
-
if(!player.isPotionActive(Potion.moveSpeed.getId())) { player.getEntityData().setBoolean("kitVitesse", false); }
Mets ça avant
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 10, 10));