java类net.minecraft.world.EnumDifficulty的实例源码

EntityPigZombieMage.java 文件源码 项目:Infernum 阅读 26 收藏 0 点赞 0 评论 0
public void setCombatTask() {
    if (this.world != null && !this.world.isRemote) {
        this.tasks.removeTask(this.aiAttackOnCollide);
        this.tasks.removeTask(this.aiSpellAttack);
        ItemStack itemstack = this.getHeldItemMainhand();

        if (itemstack.getItem() == InfernumItems.SPELL_PAGE
                && ItemSpellPage.getSpell(itemstack).equals(InfernumSpells.WITHERING_BOLT)) {
            int i = 30;

            if (this.world.getDifficulty() != EnumDifficulty.HARD) {
                i = 50;
            }

            this.aiSpellAttack.setAttackCooldown(i);
            this.tasks.addTask(4, this.aiSpellAttack);
        } else {
            this.tasks.addTask(4, this.aiAttackOnCollide);
        }
    }
}
GameSettings.java 文件源码 项目:BaseClient 阅读 22 收藏 0 点赞 0 评论 0
public GameSettings(Minecraft mcIn, File p_i46326_2_)
{
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar));
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
    this.mc = mcIn;
    this.optionsFile = new File(p_i46326_2_, "options.txt");
    this.optionsFileOF = new File(p_i46326_2_, "optionsof.txt");
    this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
    this.ofKeyBindZoom = new KeyBinding("Zoom", 46, "key.categories.misc");
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.add(this.keyBindings, this.ofKeyBindZoom));
    GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    this.renderDistanceChunks = 8;
    this.loadOptions();
    Config.initGameSettings(this);
}
EntityAIBreakDoor.java 文件源码 项目:DecompiledMinecraft 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Updates the task
 */
public void updateTask()
{
    super.updateTask();

    if (this.theEntity.getRNG().nextInt(20) == 0)
    {
        this.theEntity.worldObj.playAuxSFX(1010, this.doorPosition, 0);
    }

    ++this.breakingTime;
    int i = (int)((float)this.breakingTime / 240.0F * 10.0F);

    if (i != this.previousBreakProgress)
    {
        this.theEntity.worldObj.sendBlockBreakProgress(this.theEntity.getEntityId(), this.doorPosition, i);
        this.previousBreakProgress = i;
    }

    if (this.breakingTime == 240 && this.theEntity.worldObj.getDifficulty() == EnumDifficulty.HARD)
    {
        this.theEntity.worldObj.setBlockToAir(this.doorPosition);
        this.theEntity.worldObj.playAuxSFX(1012, this.doorPosition, 0);
        this.theEntity.worldObj.playAuxSFX(2001, this.doorPosition, Block.getIdFromBlock(this.doorBlock));
    }
}
MinecraftServer.java 文件源码 项目:CustomWorldGen 阅读 21 收藏 0 点赞 0 评论 0
public void setDifficultyForAllWorlds(EnumDifficulty difficulty)
{
    for (WorldServer worldserver : this.worldServers)
    {
        if (worldserver != null)
        {
            if (worldserver.getWorldInfo().isHardcoreModeEnabled())
            {
                worldserver.getWorldInfo().setDifficulty(EnumDifficulty.HARD);
                worldserver.setAllowedSpawnTypes(true, true);
            }
            else if (this.isSinglePlayer())
            {
                worldserver.getWorldInfo().setDifficulty(difficulty);
                worldserver.setAllowedSpawnTypes(worldserver.getDifficulty() != EnumDifficulty.PEACEFUL, true);
            }
            else
            {
                worldserver.getWorldInfo().setDifficulty(difficulty);
                worldserver.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals);
            }
        }
    }
}
EntityEyeOfSchrodinger.java 文件源码 项目:Solar 阅读 17 收藏 0 点赞 0 评论 0
@Override
@SuppressWarnings("ConstantConditions")
public void updateTask() {
    EntityLivingBase target = eye.getAttackTarget();

    if(!eye.canEntityBeSeen(target)) {
        eye.setAttackTarget(null);
    } else if(tickCounter++ >= 10) {
        float f = 1.0F;

        if(eye.world.getDifficulty() == EnumDifficulty.HARD) {
            f += 2.0F;
        }

        target.attackEntityFrom(DamageSource.causeIndirectMagicDamage(eye, eye), f);
        target.attackEntityFrom(DamageSource.causeMobDamage(eye), (float) eye.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue());
        eye.setAttackTarget(null);
    }
    eye.getLookHelper().setLookPosition(target.posX, target.posY + (double) target.getEyeHeight(), target.posZ, (float) eye.getHorizontalFaceSpeed(), (float) eye.getVerticalFaceSpeed());
}
EntityZombie.java 文件源码 项目:DecompiledMinecraft 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Gives armor or weapon for entity based on given DifficultyInstance
 */
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    super.setEquipmentBasedOnDifficulty(difficulty);

    if (this.rand.nextFloat() < (this.worldObj.getDifficulty() == EnumDifficulty.HARD ? 0.05F : 0.01F))
    {
        int i = this.rand.nextInt(3);

        if (i == 0)
        {
            this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword));
        }
        else
        {
            this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_shovel));
        }
    }
}
EntityZombie.java 文件源码 项目:BaseClient 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Gives armor or weapon for entity based on given DifficultyInstance
 */
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    super.setEquipmentBasedOnDifficulty(difficulty);

    if (this.rand.nextFloat() < (this.worldObj.getDifficulty() == EnumDifficulty.HARD ? 0.05F : 0.01F))
    {
        int i = this.rand.nextInt(3);

        if (i == 0)
        {
            this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword));
        }
        else
        {
            this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_shovel));
        }
    }
}
S01PacketJoinGame.java 文件源码 项目:DecompiledMinecraft 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityId = buf.readInt();
    int i = buf.readUnsignedByte();
    this.hardcoreMode = (i & 8) == 8;
    i = i & -9;
    this.gameType = WorldSettings.GameType.getByID(i);
    this.dimension = buf.readByte();
    this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte());
    this.maxPlayers = buf.readUnsignedByte();
    this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16));

    if (this.worldType == null)
    {
        this.worldType = WorldType.DEFAULT;
    }

    this.reducedDebugInfo = buf.readBoolean();
}
EntityAIBreakDoor.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Updates the task
 */
public void updateTask()
{
    super.updateTask();

    if (this.theEntity.getRNG().nextInt(20) == 0)
    {
        this.theEntity.worldObj.playAuxSFX(1010, this.doorPosition, 0);
    }

    ++this.breakingTime;
    int i = (int)((float)this.breakingTime / 240.0F * 10.0F);

    if (i != this.previousBreakProgress)
    {
        this.theEntity.worldObj.sendBlockBreakProgress(this.theEntity.getEntityId(), this.doorPosition, i);
        this.previousBreakProgress = i;
    }

    if (this.breakingTime == 240 && this.theEntity.worldObj.getDifficulty() == EnumDifficulty.HARD)
    {
        this.theEntity.worldObj.setBlockToAir(this.doorPosition);
        this.theEntity.worldObj.playAuxSFX(1012, this.doorPosition, 0);
        this.theEntity.worldObj.playAuxSFX(2001, this.doorPosition, Block.getIdFromBlock(this.doorBlock));
    }
}
MinecraftServer.java 文件源码 项目:Backmemed 阅读 25 收藏 0 点赞 0 评论 0
public void setDifficultyForAllWorlds(EnumDifficulty difficulty)
{
    for (WorldServer worldserver : this.worldServers)
    {
        if (worldserver != null)
        {
            if (worldserver.getWorldInfo().isHardcoreModeEnabled())
            {
                worldserver.getWorldInfo().setDifficulty(EnumDifficulty.HARD);
                worldserver.setAllowedSpawnTypes(true, true);
            }
            else if (this.isSinglePlayer())
            {
                worldserver.getWorldInfo().setDifficulty(difficulty);
                worldserver.setAllowedSpawnTypes(worldserver.getDifficulty() != EnumDifficulty.PEACEFUL, true);
            }
            else
            {
                worldserver.getWorldInfo().setDifficulty(difficulty);
                worldserver.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals);
            }
        }
    }
}
EntityZombie.java 文件源码 项目:Backmemed 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Gives armor or weapon for entity based on given DifficultyInstance
 */
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    super.setEquipmentBasedOnDifficulty(difficulty);

    if (this.rand.nextFloat() < (this.world.getDifficulty() == EnumDifficulty.HARD ? 0.05F : 0.01F))
    {
        int i = this.rand.nextInt(3);

        if (i == 0)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
        }
        else
        {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SHOVEL));
        }
    }
}
S01PacketJoinGame.java 文件源码 项目:DecompiledMinecraft 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityId = buf.readInt();
    int i = buf.readUnsignedByte();
    this.hardcoreMode = (i & 8) == 8;
    i = i & -9;
    this.gameType = WorldSettings.GameType.getByID(i);
    this.dimension = buf.readByte();
    this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte());
    this.maxPlayers = buf.readUnsignedByte();
    this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16));

    if (this.worldType == null)
    {
        this.worldType = WorldType.DEFAULT;
    }

    this.reducedDebugInfo = buf.readBoolean();
}
GameSettings.java 文件源码 项目:BaseClient 阅读 26 收藏 0 点赞 0 评论 0
public GameSettings(Minecraft mcIn, File p_i46326_2_)
{
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar));
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
    this.mc = mcIn;
    this.optionsFile = new File(p_i46326_2_, "options.txt");
    this.optionsFileOF = new File(p_i46326_2_, "optionsof.txt");
    this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
    this.ofKeyBindZoom = new KeyBinding("of.key.zoom", 46, "key.categories.misc");
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.add(this.keyBindings, this.ofKeyBindZoom));
    GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    this.renderDistanceChunks = 8;
    this.loadOptions();
    Config.initGameSettings(this);
}
GameSettings.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
public GameSettings(Minecraft mcIn, File p_i46326_2_)
{
    this.keyBindings = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar);
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
    this.mc = mcIn;
    this.optionsFile = new File(p_i46326_2_, "options.txt");

    if (mcIn.isJava64bit() && Runtime.getRuntime().maxMemory() >= 1000000000L)
    {
        GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    }
    else
    {
        GameSettings.Options.RENDER_DISTANCE.setValueMax(16.0F);
    }

    this.renderDistanceChunks = mcIn.isJava64bit() ? 12 : 8;
    this.loadOptions();
}
SPacketJoinGame.java 文件源码 项目:Backmemed 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.playerId = buf.readInt();
    int i = buf.readUnsignedByte();
    this.hardcoreMode = (i & 8) == 8;
    i = i & -9;
    this.gameType = GameType.getByID(i);
    this.dimension = buf.readInt();
    this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte());
    this.maxPlayers = buf.readUnsignedByte();
    this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16));

    if (this.worldType == null)
    {
        this.worldType = WorldType.DEFAULT;
    }

    this.reducedDebugInfo = buf.readBoolean();
}
MinecraftServer.java 文件源码 项目:BaseClient 阅读 21 收藏 0 点赞 0 评论 0
public void setDifficultyForAllWorlds(EnumDifficulty difficulty)
{
    for (int i = 0; i < this.worldServers.length; ++i)
    {
        World world = this.worldServers[i];

        if (world != null)
        {
            if (world.getWorldInfo().isHardcoreModeEnabled())
            {
                world.getWorldInfo().setDifficulty(EnumDifficulty.HARD);
                world.setAllowedSpawnTypes(true, true);
            }
            else if (this.isSinglePlayer())
            {
                world.getWorldInfo().setDifficulty(difficulty);
                world.setAllowedSpawnTypes(world.getDifficulty() != EnumDifficulty.PEACEFUL, true);
            }
            else
            {
                world.getWorldInfo().setDifficulty(difficulty);
                world.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals);
            }
        }
    }
}
MinecraftServer.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
public void setDifficultyForAllWorlds(EnumDifficulty difficulty)
{
    for (int i = 0; i < this.worldServers.length; ++i)
    {
        World world = this.worldServers[i];

        if (world != null)
        {
            if (world.getWorldInfo().isHardcoreModeEnabled())
            {
                world.getWorldInfo().setDifficulty(EnumDifficulty.HARD);
                world.setAllowedSpawnTypes(true, true);
            }
            else if (this.isSinglePlayer())
            {
                world.getWorldInfo().setDifficulty(difficulty);
                world.setAllowedSpawnTypes(world.getDifficulty() != EnumDifficulty.PEACEFUL, true);
            }
            else
            {
                world.getWorldInfo().setDifficulty(difficulty);
                world.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals);
            }
        }
    }
}
EntityZombie.java 文件源码 项目:BaseClient 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Gives armor or weapon for entity based on given DifficultyInstance
 */
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    super.setEquipmentBasedOnDifficulty(difficulty);

    if (this.rand.nextFloat() < (this.worldObj.getDifficulty() == EnumDifficulty.HARD ? 0.05F : 0.01F))
    {
        int i = this.rand.nextInt(3);

        if (i == 0)
        {
            this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword));
        }
        else
        {
            this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_shovel));
        }
    }
}
EntityDummy.java 文件源码 项目:HeroUtils 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
    {
        this.setDead();
    }
}
EntitySpider.java 文件源码 项目:BaseClient 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.rand.nextInt(100) == 0)
    {
        EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj);
        entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
        entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null);
        this.worldObj.spawnEntityInWorld(entityskeleton);
        entityskeleton.mountEntity(this);
    }

    if (livingdata == null)
    {
        livingdata = new EntitySpider.GroupData();

        if (this.worldObj.getDifficulty() == EnumDifficulty.HARD && this.worldObj.rand.nextFloat() < 0.1F * difficulty.getClampedAdditionalDifficulty())
        {
            ((EntitySpider.GroupData)livingdata).func_111104_a(this.worldObj.rand);
        }
    }

    if (livingdata instanceof EntitySpider.GroupData)
    {
        int i = ((EntitySpider.GroupData)livingdata).potionEffectId;

        if (i > 0 && Potion.potionTypes[i] != null)
        {
            this.addPotionEffect(new PotionEffect(i, Integer.MAX_VALUE));
        }
    }

    return livingdata;
}
EntityMob.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
    {
        this.setDead();
    }
}
EntityLightningBolt.java 文件源码 项目:CustomWorldGen 阅读 17 收藏 0 点赞 0 评论 0
public EntityLightningBolt(World worldIn, double x, double y, double z, boolean effectOnlyIn)
{
    super(worldIn);
    this.setLocationAndAngles(x, y, z, 0.0F, 0.0F);
    this.lightningState = 2;
    this.boltVertex = this.rand.nextLong();
    this.boltLivingTime = this.rand.nextInt(3) + 1;
    this.effectOnly = effectOnlyIn;
    BlockPos blockpos = new BlockPos(this);

    if (!effectOnlyIn && !worldIn.isRemote && worldIn.getGameRules().getBoolean("doFireTick") && (worldIn.getDifficulty() == EnumDifficulty.NORMAL || worldIn.getDifficulty() == EnumDifficulty.HARD) && worldIn.isAreaLoaded(blockpos, 10))
    {
        if (worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && Blocks.FIRE.canPlaceBlockAt(worldIn, blockpos))
        {
            worldIn.setBlockState(blockpos, Blocks.FIRE.getDefaultState());
        }

        for (int i = 0; i < 4; ++i)
        {
            BlockPos blockpos1 = blockpos.add(this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1);

            if (worldIn.getBlockState(blockpos1).getMaterial() == Material.AIR && Blocks.FIRE.canPlaceBlockAt(worldIn, blockpos1))
            {
                worldIn.setBlockState(blockpos1, Blocks.FIRE.getDefaultState());
            }
        }
    }
}
TF2Util.java 文件源码 项目:Mods 阅读 31 收藏 0 点赞 0 评论 0
public static void attractMobs(EntityLivingBase living, World world) {
    if (!world.isRemote && TF2ConfigVars.shootAttract && world.getDifficulty().getDifficultyId()>1) {

        int range=world.getDifficulty()==EnumDifficulty.HARD?60:38;
        for (EntityCreature mob : world.getEntitiesWithinAABB(EntityCreature.class,
                living.getEntityBoundingBox().grow(range, range, range), new Predicate<EntityCreature>() {

                    @Override
                    public boolean apply(EntityCreature input) {
                        // TODO Auto-generated method stub
                        return input.getAttackTarget() == null && (input instanceof IMob) && input.isNonBoss();
                    }

                })) {
            mob.getLookHelper().setLookPositionWithEntity(mob, 60, 30);
            if (!TF2Util.isOnSameTeam(living, mob)) {
                if (mob.getEntitySenses().canSee(living) || mob.getDistanceSqToEntity(living)<150){
                    mob.setAttackTarget(living);
                    if(mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getModifier(FOLLOW_MODIFIER)==null)
                        mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
                    .applyModifier(new AttributeModifier(FOLLOW_MODIFIER, "Follow Check", 65-mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue(), 0));
                    //mob.getNavigator().tryMoveToEntityLiving(living, 1.1f);

                    mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).removeModifier(FOLLOW_MODIFIER);
                }

                // CoroUtilPath.tryMoveToEntityLivingLongDist((EntityCreature)mob,
                // living, 1.1D);
                ;
            }

        }
    }
}
EntityMob.java 文件源码 项目:DecompiledMinecraft 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
    {
        this.setDead();
    }
}
EntityGhast.java 文件源码 项目:DecompiledMinecraft 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
    {
        this.setDead();
    }
}
S07PacketRespawn.java 文件源码 项目:BaseClient 阅读 19 收藏 0 点赞 0 评论 0
public S07PacketRespawn(int dimensionIDIn, EnumDifficulty difficultyIn, WorldType worldTypeIn, WorldSettings.GameType gameTypeIn)
{
    this.dimensionID = dimensionIDIn;
    this.difficulty = difficultyIn;
    this.gameType = gameTypeIn;
    this.worldType = worldTypeIn;
}
EntityMob.java 文件源码 项目:CustomWorldGen 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
    {
        this.setDead();
    }
}
EntitySpider.java 文件源码 项目:DecompiledMinecraft 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.rand.nextInt(100) == 0)
    {
        EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj);
        entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
        entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null);
        this.worldObj.spawnEntityInWorld(entityskeleton);
        entityskeleton.mountEntity(this);
    }

    if (livingdata == null)
    {
        livingdata = new EntitySpider.GroupData();

        if (this.worldObj.getDifficulty() == EnumDifficulty.HARD && this.worldObj.rand.nextFloat() < 0.1F * difficulty.getClampedAdditionalDifficulty())
        {
            ((EntitySpider.GroupData)livingdata).func_111104_a(this.worldObj.rand);
        }
    }

    if (livingdata instanceof EntitySpider.GroupData)
    {
        int i = ((EntitySpider.GroupData)livingdata).potionEffectId;

        if (i > 0 && Potion.potionTypes[i] != null)
        {
            this.addPotionEffect(new PotionEffect(i, Integer.MAX_VALUE));
        }
    }

    return livingdata;
}
EntityGhast.java 文件源码 项目:Backmemed 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.world.isRemote && this.world.getDifficulty() == EnumDifficulty.PEACEFUL)
    {
        this.setDead();
    }
}
IntegratedServer.java 文件源码 项目:Backmemed 阅读 26 收藏 0 点赞 0 评论 0
public void setDifficultyForAllWorlds(EnumDifficulty difficulty)
{
    super.setDifficultyForAllWorlds(difficulty);

    if (this.mc.world != null)
    {
        this.mc.world.getWorldInfo().setDifficulty(difficulty);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号