java类net.minecraft.entity.player.PlayerCapabilities的实例源码

Packet202PlayerAbilities.java 文件源码 项目:RuneCraftery 阅读 27 收藏 0 点赞 0 评论 0
public Packet202PlayerAbilities(PlayerCapabilities par1PlayerCapabilities)
{
    this.setDisableDamage(par1PlayerCapabilities.disableDamage);
    this.setFlying(par1PlayerCapabilities.isFlying);
    this.setAllowFlying(par1PlayerCapabilities.allowFlying);
    this.setCreativeMode(par1PlayerCapabilities.isCreativeMode);
    this.setFlySpeed(par1PlayerCapabilities.getFlySpeed());
    this.setWalkSpeed(par1PlayerCapabilities.getWalkSpeed());
}
Packet202PlayerAbilities.java 文件源码 项目:BetterNutritionMod 阅读 24 收藏 0 点赞 0 评论 0
public Packet202PlayerAbilities(PlayerCapabilities par1PlayerCapabilities)
{
    this.setDisableDamage(par1PlayerCapabilities.disableDamage);
    this.setFlying(par1PlayerCapabilities.isFlying);
    this.setAllowFlying(par1PlayerCapabilities.allowFlying);
    this.setCreativeMode(par1PlayerCapabilities.isCreativeMode);
    this.setFlySpeed(par1PlayerCapabilities.getFlySpeed());
    this.setWalkSpeed(par1PlayerCapabilities.getWalkSpeed());
}
CommonEvents.java 文件源码 项目:Wars-Mod 阅读 29 收藏 0 点赞 0 评论 0
@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));
    }
}
WingsUpdater.java 文件源码 项目:SurvivalWings 阅读 21 收藏 0 点赞 0 评论 0
private void setFlySpeed( PlayerCapabilities pc, float speed )
{
    ReflectionHelper.setPrivateValue( PlayerCapabilities.class, pc, speed, 5 );
}
MixinEntityPlayerMP.java 文件源码 项目:NeptuneMod 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void updateCapabilities() {
    this.playerNetServerHandler.sendPacket(new S39PacketPlayerAbilities((PlayerCapabilities) this.getCapabilities()));
}


问题


面经


文章

微信
公众号

扫码关注公众号