Java 类net.minecraft.world.gen.feature.WorldGenEndPodium 实例源码

项目:Backmemed    文件:DragonFightManager.java   
public void processDragonDeath(EntityDragon dragon)
{
    if (dragon.getUniqueID().equals(this.dragonUniqueId))
    {
        this.bossInfo.setPercent(0.0F);
        this.bossInfo.setVisible(false);
        this.generatePortal(true);
        this.spawnNewGateway();

        if (!this.previouslyKilled)
        {
            this.world.setBlockState(this.world.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.getDefaultState());
        }

        this.previouslyKilled = true;
        this.dragonKilled = true;
    }
}
项目:Backmemed    文件:PhaseDying.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    ++this.time;

    if (this.targetLocation == null)
    {
        BlockPos blockpos = this.dragon.world.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION);
        this.targetLocation = new Vec3d((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
    }

    double d0 = this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ);

    if (d0 >= 100.0D && d0 <= 22500.0D && !this.dragon.isCollidedHorizontally && !this.dragon.isCollidedVertically)
    {
        this.dragon.setHealth(1.0F);
    }
    else
    {
        this.dragon.setHealth(0.0F);
    }
}
项目:Backmemed    文件:PhaseTakeoff.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    if (!this.firstTick && this.currentPath != null)
    {
        BlockPos blockpos = this.dragon.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        double d0 = this.dragon.getDistanceSqToCenter(blockpos);

        if (d0 > 100.0D)
        {
            this.dragon.getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN);
        }
    }
    else
    {
        this.firstTick = false;
        this.findNewTarget();
    }
}
项目:CustomWorldGen    文件:DragonFightManager.java   
public void processDragonDeath(EntityDragon dragon)
{
    if (dragon.getUniqueID().equals(this.dragonUniqueId))
    {
        this.bossInfo.setPercent(0.0F);
        this.bossInfo.setVisible(false);
        this.generatePortal(true);
        this.spawnNewGateway();

        if (!this.previouslyKilled)
        {
            this.world.setBlockState(this.world.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.getDefaultState());
        }

        this.previouslyKilled = true;
        this.dragonKilled = true;
    }
}
项目:CustomWorldGen    文件:PhaseDying.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    ++this.time;

    if (this.targetLocation == null)
    {
        BlockPos blockpos = this.dragon.worldObj.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION);
        this.targetLocation = new Vec3d((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
    }

    double d0 = this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ);

    if (d0 >= 100.0D && d0 <= 22500.0D && !this.dragon.isCollidedHorizontally && !this.dragon.isCollidedVertically)
    {
        this.dragon.setHealth(1.0F);
    }
    else
    {
        this.dragon.setHealth(0.0F);
    }
}
项目:CustomWorldGen    文件:PhaseTakeoff.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    if (this.firstTick)
    {
        this.firstTick = false;
        this.findNewTarget();
    }
    else
    {
        BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        double d0 = this.dragon.getDistanceSqToCenter(blockpos);

        if (d0 > 100.0D)
        {
            this.dragon.getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN);
        }
    }
}
项目:ExpandedRailsMod    文件:PhaseDying.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    ++this.time;

    if (this.targetLocation == null)
    {
        BlockPos blockpos = this.dragon.worldObj.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION);
        this.targetLocation = new Vec3d((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
    }

    double d0 = this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ);

    if (d0 >= 100.0D && d0 <= 22500.0D && !this.dragon.isCollidedHorizontally && !this.dragon.isCollidedVertically)
    {
        this.dragon.setHealth(1.0F);
    }
    else
    {
        this.dragon.setHealth(0.0F);
    }
}
项目:ExpandedRailsMod    文件:PhaseTakeoff.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    if (this.firstTick)
    {
        this.firstTick = false;
        this.findNewTarget();
    }
    else
    {
        BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        double d0 = this.dragon.getDistanceSqToCenter(blockpos);

        if (d0 > 100.0D)
        {
            this.dragon.getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN);
        }
    }
}
项目:Backmemed    文件:DragonFightManager.java   
private void generatePortal(boolean active)
{
    WorldGenEndPodium worldgenendpodium = new WorldGenEndPodium(active);

    if (this.exitPortalLocation == null)
    {
        for (this.exitPortalLocation = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION).down(); this.world.getBlockState(this.exitPortalLocation).getBlock() == Blocks.BEDROCK && this.exitPortalLocation.getY() > this.world.getSeaLevel(); this.exitPortalLocation = this.exitPortalLocation.down())
        {
            ;
        }
    }

    worldgenendpodium.generate(this.world, new Random(), this.exitPortalLocation);
}
项目:Backmemed    文件:PhaseLandingApproach.java   
private void findNewTarget()
{
    if (this.currentPath == null || this.currentPath.isFinished())
    {
        int i = this.dragon.initPathPoints();
        BlockPos blockpos = this.dragon.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        EntityPlayer entityplayer = this.dragon.world.getNearestAttackablePlayer(blockpos, 128.0D, 128.0D);
        int j;

        if (entityplayer != null)
        {
            Vec3d vec3d = (new Vec3d(entityplayer.posX, 0.0D, entityplayer.posZ)).normalize();
            j = this.dragon.getNearestPpIdx(-vec3d.xCoord * 40.0D, 105.0D, -vec3d.zCoord * 40.0D);
        }
        else
        {
            j = this.dragon.getNearestPpIdx(40.0D, (double)blockpos.getY(), 0.0D);
        }

        PathPoint pathpoint = new PathPoint(blockpos.getX(), blockpos.getY(), blockpos.getZ());
        this.currentPath = this.dragon.findPath(i, j, pathpoint);

        if (this.currentPath != null)
        {
            this.currentPath.incrementPathIndex();
        }
    }

    this.navigateToNextPathNode();

    if (this.currentPath != null && this.currentPath.isFinished())
    {
        this.dragon.getPhaseManager().setPhase(PhaseList.LANDING);
    }
}
项目:Backmemed    文件:PhaseLanding.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    if (this.targetLocation == null)
    {
        this.targetLocation = new Vec3d(this.dragon.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION));
    }

    if (this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ) < 1.0D)
    {
        ((PhaseSittingFlaming)this.dragon.getPhaseManager().getPhase(PhaseList.SITTING_FLAMING)).resetFlameCount();
        this.dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING);
    }
}
项目:Backmemed    文件:EntityDragon.java   
public float getHeadPartYOffset(int p_184667_1_, double[] p_184667_2_, double[] p_184667_3_)
{
    IPhase iphase = this.phaseManager.getCurrentPhase();
    PhaseList <? extends IPhase > phaselist = iphase.getPhaseList();
    double d0;

    if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF)
    {
        if (iphase.getIsStationary())
        {
            d0 = (double)p_184667_1_;
        }
        else if (p_184667_1_ == 6)
        {
            d0 = 0.0D;
        }
        else
        {
            d0 = p_184667_3_[1] - p_184667_2_[1];
        }
    }
    else
    {
        BlockPos blockpos = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        float f = Math.max(MathHelper.sqrt(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F);
        d0 = (double)((float)p_184667_1_ / f);
    }

    return (float)d0;
}
项目:Backmemed    文件:EntityDragon.java   
public Vec3d getHeadLookVec(float p_184665_1_)
{
    IPhase iphase = this.phaseManager.getCurrentPhase();
    PhaseList <? extends IPhase > phaselist = iphase.getPhaseList();
    Vec3d vec3d;

    if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF)
    {
        if (iphase.getIsStationary())
        {
            float f4 = this.rotationPitch;
            float f5 = 1.5F;
            this.rotationPitch = -45.0F;
            vec3d = this.getLook(p_184665_1_);
            this.rotationPitch = f4;
        }
        else
        {
            vec3d = this.getLook(p_184665_1_);
        }
    }
    else
    {
        BlockPos blockpos = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        float f = Math.max(MathHelper.sqrt(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F);
        float f1 = 6.0F / f;
        float f2 = this.rotationPitch;
        float f3 = 1.5F;
        this.rotationPitch = -f1 * 1.5F * 5.0F;
        vec3d = this.getLook(p_184665_1_);
        this.rotationPitch = f2;
    }

    return vec3d;
}
项目:CustomWorldGen    文件:DragonFightManager.java   
private void generatePortal(boolean active)
{
    WorldGenEndPodium worldgenendpodium = new WorldGenEndPodium(active);

    if (this.exitPortalLocation == null)
    {
        for (this.exitPortalLocation = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION).down(); this.world.getBlockState(this.exitPortalLocation).getBlock() == Blocks.BEDROCK && this.exitPortalLocation.getY() > this.world.getSeaLevel(); this.exitPortalLocation = this.exitPortalLocation.down())
        {
            ;
        }
    }

    worldgenendpodium.generate(this.world, new Random(), this.exitPortalLocation);
}
项目:CustomWorldGen    文件:PhaseLandingApproach.java   
private void findNewTarget()
{
    if (this.currentPath == null || this.currentPath.isFinished())
    {
        int i = this.dragon.initPathPoints();
        BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        EntityPlayer entityplayer = this.dragon.worldObj.getNearestAttackablePlayer(blockpos, 128.0D, 128.0D);
        int j;

        if (entityplayer != null)
        {
            Vec3d vec3d = (new Vec3d(entityplayer.posX, 0.0D, entityplayer.posZ)).normalize();
            j = this.dragon.getNearestPpIdx(-vec3d.xCoord * 40.0D, 105.0D, -vec3d.zCoord * 40.0D);
        }
        else
        {
            j = this.dragon.getNearestPpIdx(40.0D, (double)blockpos.getY(), 0.0D);
        }

        PathPoint pathpoint = new PathPoint(blockpos.getX(), blockpos.getY(), blockpos.getZ());
        this.currentPath = this.dragon.findPath(i, j, pathpoint);

        if (this.currentPath != null)
        {
            this.currentPath.incrementPathIndex();
        }
    }

    this.navigateToNextPathNode();

    if (this.currentPath != null && this.currentPath.isFinished())
    {
        this.dragon.getPhaseManager().setPhase(PhaseList.LANDING);
    }
}
项目:CustomWorldGen    文件:PhaseLanding.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    if (this.targetLocation == null)
    {
        this.targetLocation = new Vec3d(this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION));
    }

    if (this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ) < 1.0D)
    {
        ((PhaseSittingFlaming)this.dragon.getPhaseManager().getPhase(PhaseList.SITTING_FLAMING)).resetFlameCount();
        this.dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING);
    }
}
项目:CustomWorldGen    文件:EntityDragon.java   
@SideOnly(Side.CLIENT)
public float getHeadPartYOffset(int p_184667_1_, double[] p_184667_2_, double[] p_184667_3_)
{
    IPhase iphase = this.phaseManager.getCurrentPhase();
    PhaseList <? extends IPhase > phaselist = iphase.getPhaseList();
    double d0;

    if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF)
    {
        if (iphase.getIsStationary())
        {
            d0 = (double)p_184667_1_;
        }
        else if (p_184667_1_ == 6)
        {
            d0 = 0.0D;
        }
        else
        {
            d0 = p_184667_3_[1] - p_184667_2_[1];
        }
    }
    else
    {
        BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        float f = Math.max(MathHelper.sqrt_double(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F);
        d0 = (double)((float)p_184667_1_ / f);
    }

    return (float)d0;
}
项目:CustomWorldGen    文件:EntityDragon.java   
public Vec3d getHeadLookVec(float p_184665_1_)
{
    IPhase iphase = this.phaseManager.getCurrentPhase();
    PhaseList <? extends IPhase > phaselist = iphase.getPhaseList();
    Vec3d vec3d;

    if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF)
    {
        if (iphase.getIsStationary())
        {
            float f4 = this.rotationPitch;
            float f5 = 1.5F;
            this.rotationPitch = -45.0F;
            vec3d = this.getLook(p_184665_1_);
            this.rotationPitch = f4;
        }
        else
        {
            vec3d = this.getLook(p_184665_1_);
        }
    }
    else
    {
        BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        float f = Math.max(MathHelper.sqrt_double(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F);
        float f1 = 6.0F / f;
        float f2 = this.rotationPitch;
        float f3 = 1.5F;
        this.rotationPitch = -f1 * 1.5F * 5.0F;
        vec3d = this.getLook(p_184665_1_);
        this.rotationPitch = f2;
    }

    return vec3d;
}
项目:morecommands    文件:CommandSpawnportal.java   
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
    Entity entity = getSenderAsEntity(sender.getMinecraftISender(), Entity.class);

    if (params.length > 0) {
        if (params[0].equalsIgnoreCase("end"))
            new WorldGenEndPodium(true).generate(sender.getWorld(), new Random(), new BlockPos(entity));
        else if (params[0].equalsIgnoreCase("nether"))
            new Teleporter((WorldServer) entity.world).makePortal(entity);
        else throw new CommandException("command.spawnportal.unknownPortal", sender);
    }
    else throw new CommandException("command.spawnportal.noArgs", sender);

    return null;
}
项目:ExpandedRailsMod    文件:PhaseLandingApproach.java   
private void findNewTarget()
{
    if (this.currentPath == null || this.currentPath.isFinished())
    {
        int i = this.dragon.initPathPoints();
        BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        EntityPlayer entityplayer = this.dragon.worldObj.getNearestAttackablePlayer(blockpos, 128.0D, 128.0D);
        int j;

        if (entityplayer != null)
        {
            Vec3d vec3d = (new Vec3d(entityplayer.posX, 0.0D, entityplayer.posZ)).normalize();
            j = this.dragon.getNearestPpIdx(-vec3d.xCoord * 40.0D, 105.0D, -vec3d.zCoord * 40.0D);
        }
        else
        {
            j = this.dragon.getNearestPpIdx(40.0D, (double)blockpos.getY(), 0.0D);
        }

        PathPoint pathpoint = new PathPoint(blockpos.getX(), blockpos.getY(), blockpos.getZ());
        this.currentPath = this.dragon.findPath(i, j, pathpoint);

        if (this.currentPath != null)
        {
            this.currentPath.incrementPathIndex();
        }
    }

    this.navigateToNextPathNode();

    if (this.currentPath != null && this.currentPath.isFinished())
    {
        this.dragon.getPhaseManager().setPhase(PhaseList.LANDING);
    }
}
项目:ExpandedRailsMod    文件:PhaseLanding.java   
/**
 * Gives the phase a chance to update its status.
 * Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
 */
public void doLocalUpdate()
{
    if (this.targetLocation == null)
    {
        this.targetLocation = new Vec3d(this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION));
    }

    if (this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ) < 1.0D)
    {
        ((PhaseSittingFlaming)this.dragon.getPhaseManager().getPhase(PhaseList.SITTING_FLAMING)).resetFlameCount();
        this.dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING);
    }
}
项目:ExpandedRailsMod    文件:EntityDragon.java   
@SideOnly(Side.CLIENT)
public float getHeadPartYOffset(int p_184667_1_, double[] p_184667_2_, double[] p_184667_3_)
{
    IPhase iphase = this.phaseManager.getCurrentPhase();
    PhaseList <? extends IPhase > phaselist = iphase.getPhaseList();
    double d0;

    if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF)
    {
        if (iphase.getIsStationary())
        {
            d0 = (double)p_184667_1_;
        }
        else if (p_184667_1_ == 6)
        {
            d0 = 0.0D;
        }
        else
        {
            d0 = p_184667_3_[1] - p_184667_2_[1];
        }
    }
    else
    {
        BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        float f = Math.max(MathHelper.sqrt_double(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F);
        d0 = (double)((float)p_184667_1_ / f);
    }

    return (float)d0;
}
项目:ExpandedRailsMod    文件:EntityDragon.java   
public Vec3d getHeadLookVec(float p_184665_1_)
{
    IPhase iphase = this.phaseManager.getCurrentPhase();
    PhaseList <? extends IPhase > phaselist = iphase.getPhaseList();
    Vec3d vec3d;

    if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF)
    {
        if (iphase.getIsStationary())
        {
            float f4 = this.rotationPitch;
            float f5 = 1.5F;
            this.rotationPitch = -45.0F;
            vec3d = this.getLook(p_184665_1_);
            this.rotationPitch = f4;
        }
        else
        {
            vec3d = this.getLook(p_184665_1_);
        }
    }
    else
    {
        BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION);
        float f = Math.max(MathHelper.sqrt_double(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F);
        float f1 = 6.0F / f;
        float f2 = this.rotationPitch;
        float f3 = 1.5F;
        this.rotationPitch = -f1 * 1.5F * 5.0F;
        vec3d = this.getLook(p_184665_1_);
        this.rotationPitch = f2;
    }

    return vec3d;
}
项目:Backmemed    文件:DragonFightManager.java   
@Nullable
private BlockPattern.PatternHelper findExitPortal()
{
    for (int i = -8; i <= 8; ++i)
    {
        for (int j = -8; j <= 8; ++j)
        {
            Chunk chunk = this.world.getChunkFromChunkCoords(i, j);

            for (TileEntity tileentity : chunk.getTileEntityMap().values())
            {
                if (tileentity instanceof TileEntityEndPortal)
                {
                    BlockPattern.PatternHelper blockpattern$patternhelper = this.portalPattern.match(this.world, tileentity.getPos());

                    if (blockpattern$patternhelper != null)
                    {
                        BlockPos blockpos = blockpattern$patternhelper.translateOffset(3, 3, 3).getPos();

                        if (this.exitPortalLocation == null && blockpos.getX() == 0 && blockpos.getZ() == 0)
                        {
                            this.exitPortalLocation = blockpos;
                        }

                        return blockpattern$patternhelper;
                    }
                }
            }
        }
    }

    int k = this.world.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION).getY();

    for (int l = k; l >= 0; --l)
    {
        BlockPattern.PatternHelper blockpattern$patternhelper1 = this.portalPattern.match(this.world, new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION.getX(), l, WorldGenEndPodium.END_PODIUM_LOCATION.getZ()));

        if (blockpattern$patternhelper1 != null)
        {
            if (this.exitPortalLocation == null)
            {
                this.exitPortalLocation = blockpattern$patternhelper1.translateOffset(3, 3, 3).getPos();
            }

            return blockpattern$patternhelper1;
        }
    }

    return null;
}
项目:Backmemed    文件:PhaseHoldingPattern.java   
private void findNewTarget()
{
    if (this.currentPath != null && this.currentPath.isFinished())
    {
        BlockPos blockpos = this.dragon.world.getTopSolidOrLiquidBlock(new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION));
        int i = this.dragon.getFightManager() == null ? 0 : this.dragon.getFightManager().getNumAliveCrystals();

        if (this.dragon.getRNG().nextInt(i + 3) == 0)
        {
            this.dragon.getPhaseManager().setPhase(PhaseList.LANDING_APPROACH);
            return;
        }

        double d0 = 64.0D;
        EntityPlayer entityplayer = this.dragon.world.getNearestAttackablePlayer(blockpos, d0, d0);

        if (entityplayer != null)
        {
            d0 = entityplayer.getDistanceSqToCenter(blockpos) / 512.0D;
        }

        if (entityplayer != null && (this.dragon.getRNG().nextInt(MathHelper.abs((int)d0) + 2) == 0 || this.dragon.getRNG().nextInt(i + 2) == 0))
        {
            this.strafePlayer(entityplayer);
            return;
        }
    }

    if (this.currentPath == null || this.currentPath.isFinished())
    {
        int j = this.dragon.initPathPoints();
        int k = j;

        if (this.dragon.getRNG().nextInt(8) == 0)
        {
            this.clockwise = !this.clockwise;
            k = j + 6;
        }

        if (this.clockwise)
        {
            ++k;
        }
        else
        {
            --k;
        }

        if (this.dragon.getFightManager() != null && this.dragon.getFightManager().getNumAliveCrystals() >= 0)
        {
            k = k % 12;

            if (k < 0)
            {
                k += 12;
            }
        }
        else
        {
            k = k - 12;
            k = k & 7;
            k = k + 12;
        }

        this.currentPath = this.dragon.findPath(j, k, (PathPoint)null);

        if (this.currentPath != null)
        {
            this.currentPath.incrementPathIndex();
        }
    }

    this.navigateToNextPathNode();
}
项目:CustomWorldGen    文件:DragonFightManager.java   
@Nullable
private BlockPattern.PatternHelper findExitPortal()
{
    for (int i = -8; i <= 8; ++i)
    {
        for (int j = -8; j <= 8; ++j)
        {
            Chunk chunk = this.world.getChunkFromChunkCoords(i, j);

            for (TileEntity tileentity : chunk.getTileEntityMap().values())
            {
                if (tileentity instanceof TileEntityEndPortal)
                {
                    BlockPattern.PatternHelper blockpattern$patternhelper = this.portalPattern.match(this.world, tileentity.getPos());

                    if (blockpattern$patternhelper != null)
                    {
                        BlockPos blockpos = blockpattern$patternhelper.translateOffset(3, 3, 3).getPos();

                        if (this.exitPortalLocation == null && blockpos.getX() == 0 && blockpos.getZ() == 0)
                        {
                            this.exitPortalLocation = blockpos;
                        }

                        return blockpattern$patternhelper;
                    }
                }
            }
        }
    }

    int k = this.world.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION).getY();

    for (int l = k; l >= 0; --l)
    {
        BlockPattern.PatternHelper blockpattern$patternhelper1 = this.portalPattern.match(this.world, new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION.getX(), l, WorldGenEndPodium.END_PODIUM_LOCATION.getZ()));

        if (blockpattern$patternhelper1 != null)
        {
            if (this.exitPortalLocation == null)
            {
                this.exitPortalLocation = blockpattern$patternhelper1.translateOffset(3, 3, 3).getPos();
            }

            return blockpattern$patternhelper1;
        }
    }

    return null;
}
项目:CustomWorldGen    文件:PhaseHoldingPattern.java   
private void findNewTarget()
{
    if (this.currentPath != null && this.currentPath.isFinished())
    {
        BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION));
        int i = this.dragon.getFightManager() == null ? 0 : this.dragon.getFightManager().getNumAliveCrystals();

        if (this.dragon.getRNG().nextInt(i + 3) == 0)
        {
            this.dragon.getPhaseManager().setPhase(PhaseList.LANDING_APPROACH);
            return;
        }

        double d0 = 64.0D;
        EntityPlayer entityplayer = this.dragon.worldObj.getNearestAttackablePlayer(blockpos, d0, d0);

        if (entityplayer != null)
        {
            d0 = entityplayer.getDistanceSqToCenter(blockpos) / 512.0D;
        }

        if (entityplayer != null && (this.dragon.getRNG().nextInt(MathHelper.abs_int((int)d0) + 2) == 0 || this.dragon.getRNG().nextInt(i + 2) == 0))
        {
            this.strafePlayer(entityplayer);
            return;
        }
    }

    if (this.currentPath == null || this.currentPath.isFinished())
    {
        int j = this.dragon.initPathPoints();
        int k = j;

        if (this.dragon.getRNG().nextInt(8) == 0)
        {
            this.clockwise = !this.clockwise;
            k = j + 6;
        }

        if (this.clockwise)
        {
            ++k;
        }
        else
        {
            --k;
        }

        if (this.dragon.getFightManager() != null && this.dragon.getFightManager().getNumAliveCrystals() >= 0)
        {
            k = k % 12;

            if (k < 0)
            {
                k += 12;
            }
        }
        else
        {
            k = k - 12;
            k = k & 7;
            k = k + 12;
        }

        this.currentPath = this.dragon.findPath(j, k, (PathPoint)null);

        if (this.currentPath != null)
        {
            this.currentPath.incrementPathIndex();
        }
    }

    this.navigateToNextPathNode();
}
项目:ExpandedRailsMod    文件:PhaseHoldingPattern.java   
private void findNewTarget()
{
    if (this.currentPath != null && this.currentPath.isFinished())
    {
        BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION));
        int i = this.dragon.getFightManager() == null ? 0 : this.dragon.getFightManager().getNumAliveCrystals();

        if (this.dragon.getRNG().nextInt(i + 3) == 0)
        {
            this.dragon.getPhaseManager().setPhase(PhaseList.LANDING_APPROACH);
            return;
        }

        double d0 = 64.0D;
        EntityPlayer entityplayer = this.dragon.worldObj.getNearestAttackablePlayer(blockpos, d0, d0);

        if (entityplayer != null)
        {
            d0 = entityplayer.getDistanceSqToCenter(blockpos) / 512.0D;
        }

        if (entityplayer != null && (this.dragon.getRNG().nextInt(MathHelper.abs_int((int)d0) + 2) == 0 || this.dragon.getRNG().nextInt(i + 2) == 0))
        {
            this.strafePlayer(entityplayer);
            return;
        }
    }

    if (this.currentPath == null || this.currentPath.isFinished())
    {
        int j = this.dragon.initPathPoints();
        int k = j;

        if (this.dragon.getRNG().nextInt(8) == 0)
        {
            this.clockwise = !this.clockwise;
            k = j + 6;
        }

        if (this.clockwise)
        {
            ++k;
        }
        else
        {
            --k;
        }

        if (this.dragon.getFightManager() != null && this.dragon.getFightManager().getNumAliveCrystals() >= 0)
        {
            k = k % 12;

            if (k < 0)
            {
                k += 12;
            }
        }
        else
        {
            k = k - 12;
            k = k & 7;
            k = k + 12;
        }

        this.currentPath = this.dragon.findPath(j, k, (PathPoint)null);

        if (this.currentPath != null)
        {
            this.currentPath.incrementPathIndex();
        }
    }

    this.navigateToNextPathNode();
}