Non résolu Auto Jump
-
Bonjour, je veux faire une armure qui, si on a tout le set, nous permet de ne pas avoir à sauter pour passer un block.
Comment faire ? Mercipublic class ArmourBase extends ItemArmor implements IHasModel { public ArmourBase(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) { super(materialIn, renderIndexIn, equipmentSlotIn); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.COMBAT); ItemInit.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRederer(this, 0); } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { if(isFullSet(player)) { player.capabilities.setPlayerWalkSpeed(0.2F); player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 5, 1, true, false)); player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 5, 0, true, false)); } else { player.capabilities.setPlayerWalkSpeed(0.1F); } } public static boolean isFullSet(EntityPlayer player) { ItemStack head = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD); ItemStack chest = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack legs = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); ItemStack feet = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); return !head.isEmpty() && head.getItem() instanceof ArmourBase && !chest.isEmpty() && chest.getItem() instanceof ArmourBase && !legs.isEmpty() && legs.getItem() instanceof ArmourBase && !feet.isEmpty() && feet.getItem() instanceof ArmourBase; } }
-
Salut, regarde comment fait le jeu avec la fonctionnalité auto jump.