Java Code Examples for net.minecraft.world.World.getSpawnPoint()

The following are Jave code examples for showing how to use getSpawnPoint() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Loot-Slash-Conquer   File: CapabilityChunkLevel.java   Source Code and License Vote up 5 votes
private static int getAreaLevel(World world, ChunkPos pos)
{	
	ChunkPos spawnChunk = new ChunkPos(world.getSpawnPoint());
	
	double distance = Math.sqrt(Math.pow(pos.x - spawnChunk.x, 2) + Math.pow(pos.z - spawnChunk.z, 2));
	return (int) (distance / 10 + 1);
}
 
Example 2
Project: DecompiledMinecraft   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.entityUniqueID = getUUID(gameProfileIn);
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
}
 
Example 3
Project: DecompiledMinecraft   File: DedicatedServer.java   Source Code and License Vote up 5 votes
public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn)
{
    if (worldIn.provider.getDimensionId() != 0)
    {
        return false;
    }
    else if (this.getConfigurationManager().getOppedPlayers().isEmpty())
    {
        return false;
    }
    else if (this.getConfigurationManager().canSendCommands(playerIn.getGameProfile()))
    {
        return false;
    }
    else if (this.getSpawnProtectionSize() <= 0)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = worldIn.getSpawnPoint();
        int i = MathHelper.abs_int(pos.getX() - blockpos.getX());
        int j = MathHelper.abs_int(pos.getZ() - blockpos.getZ());
        int k = Math.max(i, j);
        return k <= this.getSpawnProtectionSize();
    }
}
 
Example 4
Project: DecompiledMinecraft   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.entityUniqueID = getUUID(gameProfileIn);
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
}
 
Example 5
Project: BaseClient   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.entityUniqueID = getUUID(gameProfileIn);
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
}
 
Example 6
Project: BaseClient   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.entityUniqueID = getUUID(gameProfileIn);
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
}
 
Example 7
Project: Zombe-Modpack   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.setUniqueId(getUUID(gameProfileIn));
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.unused180 = 180.0F;
}
 
Example 8
Project: Backmemed   File: BiomeVoidDecorator.java   Source Code and License Vote up 5 votes
public void decorate(World worldIn, Random random, Biome biome, BlockPos pos)
{
    BlockPos blockpos = worldIn.getSpawnPoint();
    int i = 16;
    double d0 = blockpos.distanceSq(pos.add(8, blockpos.getY(), 8));

    if (d0 <= 1024.0D)
    {
        BlockPos blockpos1 = new BlockPos(blockpos.getX() - 16, blockpos.getY() - 1, blockpos.getZ() - 16);
        BlockPos blockpos2 = new BlockPos(blockpos.getX() + 16, blockpos.getY() - 1, blockpos.getZ() + 16);
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(blockpos1);

        for (int j = pos.getZ(); j < pos.getZ() + 16; ++j)
        {
            for (int k = pos.getX(); k < pos.getX() + 16; ++k)
            {
                if (j >= blockpos1.getZ() && j <= blockpos2.getZ() && k >= blockpos1.getX() && k <= blockpos2.getX())
                {
                    blockpos$mutableblockpos.setPos(k, blockpos$mutableblockpos.getY(), j);

                    if (blockpos.getX() == k && blockpos.getZ() == j)
                    {
                        worldIn.setBlockState(blockpos$mutableblockpos, Blocks.COBBLESTONE.getDefaultState(), 2);
                    }
                    else
                    {
                        worldIn.setBlockState(blockpos$mutableblockpos, Blocks.STONE.getDefaultState(), 2);
                    }
                }
            }
        }
    }
}
 
Example 9
Project: Backmemed   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.setUniqueId(getUUID(gameProfileIn));
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.unused180 = 180.0F;
}
 
Example 10
Project: CustomWorldGen   File: BiomeVoidDecorator.java   Source Code and License Vote up 5 votes
public void decorate(World worldIn, Random random, Biome biome, BlockPos pos)
{
    BlockPos blockpos = worldIn.getSpawnPoint();
    int i = 16;
    double d0 = blockpos.distanceSq(pos.add(8, blockpos.getY(), 8));

    if (d0 <= 1024.0D)
    {
        BlockPos blockpos1 = new BlockPos(blockpos.getX() - 16, blockpos.getY() - 1, blockpos.getZ() - 16);
        BlockPos blockpos2 = new BlockPos(blockpos.getX() + 16, blockpos.getY() - 1, blockpos.getZ() + 16);
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(blockpos1);

        for (int j = pos.getZ(); j < pos.getZ() + 16; ++j)
        {
            for (int k = pos.getX(); k < pos.getX() + 16; ++k)
            {
                if (j >= blockpos1.getZ() && j <= blockpos2.getZ() && k >= blockpos1.getX() && k <= blockpos2.getX())
                {
                    blockpos$mutableblockpos.setPos(k, blockpos$mutableblockpos.getY(), j);

                    if (blockpos.getX() == k && blockpos.getZ() == j)
                    {
                        worldIn.setBlockState(blockpos$mutableblockpos, Blocks.COBBLESTONE.getDefaultState(), 2);
                    }
                    else
                    {
                        worldIn.setBlockState(blockpos$mutableblockpos, Blocks.STONE.getDefaultState(), 2);
                    }
                }
            }
        }
    }
}
 
Example 11
Project: CustomWorldGen   File: EntityPlayer.java   Source Code and License Vote up 5 votes
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.setUniqueId(getUUID(gameProfileIn));
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.unused180 = 180.0F;
    this.fireResistance = 20;
}
 
Example 12
Project: CustomWorldGen   File: DedicatedServer.java   Source Code and License Vote up 5 votes
public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn)
{
    if (worldIn.provider.getDimension() != 0)
    {
        return false;
    }
    else if (this.getPlayerList().getOppedPlayers().isEmpty())
    {
        return false;
    }
    else if (this.getPlayerList().canSendCommands(playerIn.getGameProfile()))
    {
        return false;
    }
    else if (this.getSpawnProtectionSize() <= 0)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = worldIn.getSpawnPoint();
        int i = MathHelper.abs_int(pos.getX() - blockpos.getX());
        int j = MathHelper.abs_int(pos.getZ() - blockpos.getZ());
        int k = Math.max(i, j);
        return k <= this.getSpawnProtectionSize();
    }
}
 
Example 13
Project: DecompiledMinecraft   File: TextureCompass.java   Source Code and License Vote up 4 votes
/**
 * Updates the compass based on the given x,z coords and camera direction
 */
public void updateCompass(World worldIn, double p_94241_2_, double p_94241_4_, double p_94241_6_, boolean p_94241_8_, boolean p_94241_9_)
{
    if (!this.framesTextureData.isEmpty())
    {
        double d0 = 0.0D;

        if (worldIn != null && !p_94241_8_)
        {
            BlockPos blockpos = worldIn.getSpawnPoint();
            double d1 = (double)blockpos.getX() - p_94241_2_;
            double d2 = (double)blockpos.getZ() - p_94241_4_;
            p_94241_6_ = p_94241_6_ % 360.0D;
            d0 = -((p_94241_6_ - 90.0D) * Math.PI / 180.0D - Math.atan2(d2, d1));

            if (!worldIn.provider.isSurfaceWorld())
            {
                d0 = Math.random() * Math.PI * 2.0D;
            }
        }

        if (p_94241_9_)
        {
            this.currentAngle = d0;
        }
        else
        {
            double d3;

            for (d3 = d0 - this.currentAngle; d3 < -Math.PI; d3 += (Math.PI * 2D))
            {
                ;
            }

            while (d3 >= Math.PI)
            {
                d3 -= (Math.PI * 2D);
            }

            d3 = MathHelper.clamp_double(d3, -1.0D, 1.0D);
            this.angleDelta += d3 * 0.1D;
            this.angleDelta *= 0.8D;
            this.currentAngle += this.angleDelta;
        }

        int i;

        for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double)this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size())
        {
            ;
        }

        if (i != this.frameCounter)
        {
            this.frameCounter = i;
            TextureUtil.uploadTextureMipmap((int[][])this.framesTextureData.get(this.frameCounter), this.width, this.height, this.originX, this.originY, false, false);
        }
    }
}
 
Example 14
Project: BaseClient   File: TextureCompass.java   Source Code and License Vote up 4 votes
/**
 * Updates the compass based on the given x,z coords and camera direction
 */
public void updateCompass(World worldIn, double p_94241_2_, double p_94241_4_, double p_94241_6_, boolean p_94241_8_, boolean p_94241_9_)
{
    if (!this.framesTextureData.isEmpty())
    {
        double d0 = 0.0D;

        if (worldIn != null && !p_94241_8_)
        {
            BlockPos blockpos = worldIn.getSpawnPoint();
            double d1 = (double)blockpos.getX() - p_94241_2_;
            double d2 = (double)blockpos.getZ() - p_94241_4_;
            p_94241_6_ = p_94241_6_ % 360.0D;
            d0 = -((p_94241_6_ - 90.0D) * Math.PI / 180.0D - Math.atan2(d2, d1));

            if (!worldIn.provider.isSurfaceWorld())
            {
                d0 = Math.random() * Math.PI * 2.0D;
            }
        }

        if (p_94241_9_)
        {
            this.currentAngle = d0;
        }
        else
        {
            double d3;

            for (d3 = d0 - this.currentAngle; d3 < -Math.PI; d3 += (Math.PI * 2D))
            {
                ;
            }

            while (d3 >= Math.PI)
            {
                d3 -= (Math.PI * 2D);
            }

            d3 = MathHelper.clamp_double(d3, -1.0D, 1.0D);
            this.angleDelta += d3 * 0.1D;
            this.angleDelta *= 0.8D;
            this.currentAngle += this.angleDelta;
        }

        int i;

        for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double)this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size())
        {
            ;
        }

        if (i != this.frameCounter)
        {
            this.frameCounter = i;

            if (Config.isShaders())
            {
                ShadersTex.uploadTexSub((int[][])((int[][])this.framesTextureData.get(this.frameCounter)), this.width, this.height, this.originX, this.originY, false, false);
            }
            else
            {
                TextureUtil.uploadTextureMipmap((int[][])((int[][])this.framesTextureData.get(this.frameCounter)), this.width, this.height, this.originX, this.originY, false, false);
            }
        }
    }
}
 
Example 15
Project: BaseClient   File: TextureCompass.java   Source Code and License Vote up 4 votes
/**
 * Updates the compass based on the given x,z coords and camera direction
 */
public void updateCompass(World worldIn, double p_94241_2_, double p_94241_4_, double p_94241_6_, boolean p_94241_8_, boolean p_94241_9_)
{
    if (!this.framesTextureData.isEmpty())
    {
        double d0 = 0.0D;

        if (worldIn != null && !p_94241_8_)
        {
            BlockPos blockpos = worldIn.getSpawnPoint();
            double d1 = (double)blockpos.getX() - p_94241_2_;
            double d2 = (double)blockpos.getZ() - p_94241_4_;
            p_94241_6_ = p_94241_6_ % 360.0D;
            d0 = -((p_94241_6_ - 90.0D) * Math.PI / 180.0D - Math.atan2(d2, d1));

            if (!worldIn.provider.isSurfaceWorld())
            {
                d0 = Math.random() * Math.PI * 2.0D;
            }
        }

        if (p_94241_9_)
        {
            this.currentAngle = d0;
        }
        else
        {
            double d3;

            for (d3 = d0 - this.currentAngle; d3 < -Math.PI; d3 += (Math.PI * 2D))
            {
                ;
            }

            while (d3 >= Math.PI)
            {
                d3 -= (Math.PI * 2D);
            }

            d3 = MathHelper.clamp_double(d3, -1.0D, 1.0D);
            this.angleDelta += d3 * 0.1D;
            this.angleDelta *= 0.8D;
            this.currentAngle += this.angleDelta;
        }

        int i;

        for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double)this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size())
        {
            ;
        }

        if (i != this.frameCounter)
        {
            this.frameCounter = i;
            TextureUtil.uploadTextureMipmap((int[][])this.framesTextureData.get(this.frameCounter), this.width, this.height, this.originX, this.originY, false, false);
        }
    }
}