Créer des effets de potions
-
Et au niveau des amplifier car de 1 on ne le voit pas dans l’inventaire. Et de 2 si j’essaie de faire une condition pour get l’amplifier de ma potion je récolte un magnifique NPE
Merci d’avance -
Salut est-il possible de faire un effet de potion que quand tu tombe tu flotte comme l’entity poule

-
Dans LivingUpdateEvent tu check si le block en dessous du joueur est de l’air et si l’effet de potion est actif, alors tu modifies son motionY ou sa vélocité.
-
@‘Plaigon’:
Dans LivingUpdateEvent tu check si le block en dessous du joueur est de l’air et si l’effet de potion est actif, alors tu modifies son motionY ou sa vélocité.
Merci

-
Ce message a été supprimé ! -
bonjour, je sais j arrive un peut tard mais serait il possible de faire un effet de potion qui fait que tu ne prend pas de dégât de chute ?
EDIT:oui mais je ne sais pas comment annuler les dégats de chute
-
@Heaven Ca existe déjà, c’est la potion Slow Falling.
Sinon, tu crée ton effet de potion et dans l’évent
LivingFallEventTu annule les dégâts de chutes si la potion est active.
-
oui mais je ne sais malheureusement pas comment désactiver les dégats de chute voici mon code :
public class EventHandler { @SubscribeEvent public void LivingEvent(LivingEvent event){ if(event.entityLiving instanceof EntityPlayer) { if (event.entityLiving.isPotionActive(CustomPotion.FeatherFoaling)){ if (event.entityLiving.getActivePotionEffect(CustomPotion.FeatherFoaling).getDuration() == 0){ event.entityLiving.removePotionEffect(CustomPotion.FeatherFoaling.id); return; } if(event.entityLiving.onGround){ event.entityLiving.motionX *= 5.0F; event.entityLiving.motionZ *= 5.0F; } } } } } -
Bonjour,
Avecevent.setCancel(true);(ça fait partie des méthodes de base des event …). -
Merci de ta réponse mais ca crash dès que je la met sur mon armure :
public class EventHandler { @SubscribeEvent public void LivingEvent(LivingEvent event){ if(event.entityLiving instanceof EntityPlayer) { if (event.entityLiving.isPotionActive(CustomPotion.FeatherFoaling)){ if (event.entityLiving.getActivePotionEffect(CustomPotion.FeatherFoaling).getDuration() == 0){ event.entityLiving.removePotionEffect(CustomPotion.FeatherFoaling.id); return; } if(event.entityLiving.onGround){ event.setCanceled(true); } } } } }Class armure
public class SpaciumArmorMod extends ItemArmor { public SpaciumArmorMod(ArmorMaterial material, int metaData) { super(material, 0, metaData); } public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(stack.getItem() == SpaciumArmor.Space_Leggings) { return References.MOD_ID + ":textures/models/armor/spacium_layer_2.png"; } else if(stack.getItem() == SpaciumArmor.Space_Helmet || stack.getItem() == SpaciumArmor.Space_Chestpalte || stack.getItem() == SpaciumArmor.Space_Boots) { return References.MOD_ID + ":textures/models/armor/spacium_layer_1.png"; } return null; } public void onArmorTick(World world, EntityPlayer player , ItemStack itemStack){ if(this == SpaciumArmor.Space_Helmet){ player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 1000, 4)); player.addPotionEffect(new PotionEffect(CustomPotion.FeatherFoaling.getId(), 1000, 1)); } if(this == SpaciumArmor.Space_Boots){ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 20, 10)); } if(this == SpaciumArmor.Space_Chestpalte ){ player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 20, 5)); } if(this == SpaciumArmor.Space_Leggings){ } if (this == SpaciumArmor.Space_Leggings && this == SpaciumArmor.Space_Chestpalte && this == SpaciumArmor.Space_Boots && this == SpaciumArmor.Space_Helmet){ player.addPotionEffect(new PotionEffect(Potion.invisibility.getId(), 20, 1)); } } }