CommonEvents.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:Wars-Mod 作者:
@SubscribeEvent
public void tickEvent(TickEvent.PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (ItemArmorMod.hasFullSuit(player, WarsItems.knightArmor)) {
        player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 10, 0));
    } else if (ItemArmorMod.hasFullSuit(player, WarsItems.scoutArmor)) {
        ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, player.capabilities, 0.15F, 6);
        player.fallDistance = 0;
        player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 10, 1));
    } else if (ItemArmorMod.hasFullSuit(player, WarsItems.ninjaArmor)) {
        ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, player.capabilities, 0.18F, 6);
        player.fallDistance = 0;
        player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 10, 1));
        player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 10, 1));
        if(player.motionY < 0 && player.motionY > -0.5){
            player.motionY *= 1.5;
        }
    }

    else if (ItemArmorMod.hasFullSuit(player, WarsItems.chaosArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.enderArmor)) {

        player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 10, 0));

    }

    if (ItemArmorMod.hasFullSuit(player, WarsItems.archerArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.techArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.chaosArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.knightArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.healerArmor)
            || ItemArmorMod.hasFullSuit(player, WarsItems.guardArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.scoutArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.enderArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.ninjaArmor)) {
        ItemStack boots = player.inventory.armorItemInSlot(0);
        if (!(boots != null)) {
            Random random = new Random();
            player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 10, 10));
            player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, 10, 100));
            player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 10, 10));

            int num = random.nextInt(50);

            if (num == 1) {
                player.addChatMessage(new TextComponentTranslation("needteamboots"));
            }
        }
    }

    int killstreakBefore = player.getEntityData().getInteger("warsmod_killstreak");

    if (killstreakBefore > 1) {
        player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, 0));

    }
    if (killstreakBefore > 3) {
        player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 10, 0));

    }
    if (killstreakBefore > 7) {
        player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 20 * 15, 0));

    }
    if (killstreakBefore > 11) {
        player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 10, 0));

    }
    if (killstreakBefore > 19) {
        player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, 1));

    }
    if (killstreakBefore > 29) {
        player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 10, 1));

    }
    if (killstreakBefore > 2) {
        player.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 10, 0));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号