Java 类net.minecraft.entity.player.PlayerCapabilities 实例源码

项目:DecompiledMinecraft    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities capabilities)
{
    if (this == CREATIVE)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = true;
        capabilities.disableDamage = true;
    }
    else if (this == SPECTATOR)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = true;
        capabilities.isFlying = true;
    }
    else
    {
        capabilities.allowFlying = false;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = false;
        capabilities.isFlying = false;
    }

    capabilities.allowEdit = !this.isAdventure();
}
项目:DecompiledMinecraft    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities capabilities)
{
    if (this == CREATIVE)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = true;
        capabilities.disableDamage = true;
    }
    else if (this == SPECTATOR)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = true;
        capabilities.isFlying = true;
    }
    else
    {
        capabilities.allowFlying = false;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = false;
        capabilities.isFlying = false;
    }

    capabilities.allowEdit = !this.isAdventure();
}
项目:BaseClient    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities capabilities)
{
    if (this == CREATIVE)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = true;
        capabilities.disableDamage = true;
    }
    else if (this == SPECTATOR)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = true;
        capabilities.isFlying = true;
    }
    else
    {
        capabilities.allowFlying = false;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = false;
        capabilities.isFlying = false;
    }

    capabilities.allowEdit = !this.isAdventure();
}
项目:BaseClient    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities capabilities)
{
    if (this == CREATIVE)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = true;
        capabilities.disableDamage = true;
    }
    else if (this == SPECTATOR)
    {
        capabilities.allowFlying = true;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = true;
        capabilities.isFlying = true;
    }
    else
    {
        capabilities.allowFlying = false;
        capabilities.isCreativeMode = false;
        capabilities.disableDamage = false;
        capabilities.isFlying = false;
    }

    capabilities.allowEdit = !this.isAdventure();
}
项目:Resilience-Client-Source    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities par1PlayerCapabilities)
{
    if (this == CREATIVE)
    {
        par1PlayerCapabilities.allowFlying = true;
        par1PlayerCapabilities.isCreativeMode = true;
        par1PlayerCapabilities.disableDamage = true;
    }
    else
    {
        par1PlayerCapabilities.allowFlying = false;
        par1PlayerCapabilities.isCreativeMode = false;
        par1PlayerCapabilities.disableDamage = false;
        par1PlayerCapabilities.isFlying = false;
    }

    par1PlayerCapabilities.allowEdit = !this.isAdventure();
}
项目:Cauldron    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities p_77147_1_)
{
    if (this == CREATIVE)
    {
        p_77147_1_.allowFlying = true;
        p_77147_1_.isCreativeMode = true;
        p_77147_1_.disableDamage = true;
    }
    else
    {
        p_77147_1_.allowFlying = false;
        p_77147_1_.isCreativeMode = false;
        p_77147_1_.disableDamage = false;
        p_77147_1_.isFlying = false;
    }

    p_77147_1_.allowEdit = !this.isAdventure();
}
项目:Cauldron    文件:WorldSettings.java   
public void configurePlayerCapabilities(PlayerCapabilities p_77147_1_)
{
    if (this == CREATIVE)
    {
        p_77147_1_.allowFlying = true;
        p_77147_1_.isCreativeMode = true;
        p_77147_1_.disableDamage = true;
    }
    else
    {
        p_77147_1_.allowFlying = false;
        p_77147_1_.isCreativeMode = false;
        p_77147_1_.disableDamage = false;
        p_77147_1_.isFlying = false;
    }

    p_77147_1_.allowEdit = !this.isAdventure();
}
项目:DecompiledMinecraft    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:DecompiledMinecraft    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:DecompiledMinecraft    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:DecompiledMinecraft    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:BaseClient    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:BaseClient    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:BaseClient    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:BaseClient    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:Backmemed    文件:CPacketPlayerAbilities.java   
public CPacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:Backmemed    文件:SPacketPlayerAbilities.java   
public SPacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:CustomWorldGen    文件:CPacketPlayerAbilities.java   
public CPacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:CustomWorldGen    文件:SPacketPlayerAbilities.java   
public SPacketPlayerAbilities(PlayerCapabilities capabilities)
{
    this.setInvulnerable(capabilities.disableDamage);
    this.setFlying(capabilities.isFlying);
    this.setAllowFlying(capabilities.allowFlying);
    this.setCreativeMode(capabilities.isCreativeMode);
    this.setFlySpeed(capabilities.getFlySpeed());
    this.setWalkSpeed(capabilities.getWalkSpeed());
}
项目:Resilience-Client-Source    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities p_i45257_1_)
{
    this.func_149490_a(p_i45257_1_.disableDamage);
    this.func_149483_b(p_i45257_1_.isFlying);
    this.func_149491_c(p_i45257_1_.allowFlying);
    this.func_149493_d(p_i45257_1_.isCreativeMode);
    this.func_149485_a(p_i45257_1_.getFlySpeed());
    this.func_149492_b(p_i45257_1_.getWalkSpeed());
}
项目:Resilience-Client-Source    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities p_i45208_1_)
{
    this.func_149108_a(p_i45208_1_.disableDamage);
    this.func_149102_b(p_i45208_1_.isFlying);
    this.func_149109_c(p_i45208_1_.allowFlying);
    this.func_149111_d(p_i45208_1_.isCreativeMode);
    this.func_149104_a(p_i45208_1_.getFlySpeed());
    this.func_149110_b(p_i45208_1_.getWalkSpeed());
}
项目:NightfallMod    文件:CreativeAmulet.java   
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
    PlayerCapabilities cap = ((EntityPlayer)player).capabilities;
           cap.allowFlying = true;
           cap.isCreativeMode = true;
           cap.disableDamage = true;
           cap.allowEdit = true;  

}
项目:McMod-CheatStar    文件:EventItemSuperStar.java   
@SubscribeEvent
public void entityUpdate(LivingEvent.LivingUpdateEvent event)
{
    if(!isPlayer(event.entityLiving))
    {
        return;
    }

    EntityPlayer player = (EntityPlayer)event.entityLiving;
    PlayerCapabilities capabilities = player.capabilities; 

    IAttributeInstance movementSpeed = player.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

    if(!checkEquips(player))
    {
        event.entityLiving.stepHeight = 0.5F;
        capabilities.allowFlying = player.capabilities.isCreativeMode;

        if(!ModConfig.useSpeedPotion)
        {
            movementSpeed.setBaseValue(0.1);
        }

        FoodStats fs = player.getFoodStats();
        if(fs != null)
        {
            fs.addStats(20, 5);
        }

        return;
    }

    player.stepHeight = 1;

    capabilities.allowFlying = true;
    if(!ModConfig.useSpeedPotion)
    {
        movementSpeed.setBaseValue(ModConfig.speedMultiplicator);
    }
}
项目:Cauldron    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities p_i45257_1_)
{
    this.func_149490_a(p_i45257_1_.disableDamage);
    this.func_149483_b(p_i45257_1_.isFlying);
    this.func_149491_c(p_i45257_1_.allowFlying);
    this.func_149493_d(p_i45257_1_.isCreativeMode);
    this.func_149485_a(p_i45257_1_.getFlySpeed());
    this.func_149492_b(p_i45257_1_.getWalkSpeed());
}
项目:Cauldron    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities p_i45208_1_)
{
    this.func_149108_a(p_i45208_1_.disableDamage);
    this.func_149102_b(p_i45208_1_.isFlying);
    this.func_149109_c(p_i45208_1_.allowFlying);
    this.func_149111_d(p_i45208_1_.isCreativeMode);
    this.func_149104_a(p_i45208_1_.getFlySpeed());
    this.func_149110_b(p_i45208_1_.getWalkSpeed());
}
项目:Cauldron    文件:C13PacketPlayerAbilities.java   
public C13PacketPlayerAbilities(PlayerCapabilities p_i45257_1_)
{
    this.func_149490_a(p_i45257_1_.disableDamage);
    this.func_149483_b(p_i45257_1_.isFlying);
    this.func_149491_c(p_i45257_1_.allowFlying);
    this.func_149493_d(p_i45257_1_.isCreativeMode);
    this.func_149485_a(p_i45257_1_.getFlySpeed());
    this.func_149492_b(p_i45257_1_.getWalkSpeed());
}
项目:Cauldron    文件:S39PacketPlayerAbilities.java   
public S39PacketPlayerAbilities(PlayerCapabilities p_i45208_1_)
{
    this.func_149108_a(p_i45208_1_.disableDamage);
    this.func_149102_b(p_i45208_1_.isFlying);
    this.func_149109_c(p_i45208_1_.allowFlying);
    this.func_149111_d(p_i45208_1_.isCreativeMode);
    this.func_149104_a(p_i45208_1_.getFlySpeed());
    this.func_149110_b(p_i45208_1_.getWalkSpeed());
}
项目:Draconix-ThePowerOfUseres    文件:Utils.java   
public static void setPlayerWalkSpeed(EntityPlayer player, float value)
{
    Class c = PlayerCapabilities.class;
    Field field = c.getDeclaredFields()[6];
    field.setAccessible(true);

    try 
    {
        field.setFloat(player.capabilities, value);
    }
    catch (Exception e) 
    {
        e.printStackTrace();
    }
}
项目:GaiaMod    文件:GaiaModEventHandler.java   
private static void setPlayerFlySpeed(PlayerCapabilities capabilities,
        float flySpeed) {
    if (flySpeedField == null) {
        flySpeedField = ReflectionHelper.findField(
                PlayerCapabilities.class, "flySpeed", "field_75096_f");
        flySpeedField.setAccessible(true);
    }

    try {
        flySpeedField.set(capabilities, flySpeed);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}
项目:RuneCraftery    文件:Packet202PlayerAbilities.java   
public Packet202PlayerAbilities(PlayerCapabilities p_i1449_1_) {
   this.func_73353_a(p_i1449_1_.field_75102_a);
   this.func_73349_b(p_i1449_1_.field_75100_b);
   this.func_73354_c(p_i1449_1_.field_75101_c);
   this.func_73356_d(p_i1449_1_.field_75098_d);
   this.func_73351_a(p_i1449_1_.func_75093_a());
   this.func_73355_b(p_i1449_1_.func_75094_b());
}
项目:RuneCraftery    文件:Packet202PlayerAbilities.java   
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());
}
项目:BetterNutritionMod    文件:Packet202PlayerAbilities.java   
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());
}
项目:Wars-Mod    文件:CommonEvents.java   
@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));
    }
}
项目:SurvivalWings    文件:WingsUpdater.java   
private void setFlySpeed( PlayerCapabilities pc, float speed )
{
    ReflectionHelper.setPrivateValue( PlayerCapabilities.class, pc, speed, 5 );
}
项目:NeptuneMod    文件:MixinEntityPlayerMP.java   
@Override
public void updateCapabilities() {
    this.playerNetServerHandler.sendPacket(new S39PacketPlayerAbilities((PlayerCapabilities) this.getCapabilities()));
}