Java Code Examples for net.minecraft.init.Blocks.STRUCTURE_BLOCK

The following are Jave code examples for showing how to use STRUCTURE_BLOCK of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: TileEntityStructure.java   View Source Code Vote up 6 votes
private List<TileEntityStructure> getNearbyCornerBlocks(BlockPos p_184418_1_, BlockPos p_184418_2_)
{
    List<TileEntityStructure> list = Lists.<TileEntityStructure>newArrayList();

    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(p_184418_1_, p_184418_2_))
    {
        IBlockState iblockstate = this.world.getBlockState(blockpos$mutableblockpos);

        if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
        {
            TileEntity tileentity = this.world.getTileEntity(blockpos$mutableblockpos);

            if (tileentity != null && tileentity instanceof TileEntityStructure)
            {
                list.add((TileEntityStructure)tileentity);
            }
        }
    }

    return list;
}
 
Example 2
Project: CustomWorldGen   File: TileEntityStructure.java   View Source Code Vote up 6 votes
private List<TileEntityStructure> getNearbyCornerBlocks(BlockPos p_184418_1_, BlockPos p_184418_2_)
{
    List<TileEntityStructure> list = Lists.<TileEntityStructure>newArrayList();

    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(p_184418_1_, p_184418_2_))
    {
        IBlockState iblockstate = this.worldObj.getBlockState(blockpos$mutableblockpos);

        if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
        {
            TileEntity tileentity = this.worldObj.getTileEntity(blockpos$mutableblockpos);

            if (tileentity != null && tileentity instanceof TileEntityStructure)
            {
                list.add((TileEntityStructure)tileentity);
            }
        }
    }

    return list;
}
 
Example 3
Project: Backmemed   File: Template.java   View Source Code Vote up 5 votes
public Map<BlockPos, String> getDataBlocks(BlockPos pos, PlacementSettings placementIn)
{
    Map<BlockPos, String> map = Maps.<BlockPos, String>newHashMap();
    StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();

    for (Template.BlockInfo template$blockinfo : this.blocks)
    {
        BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);

        if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos))
        {
            IBlockState iblockstate = template$blockinfo.blockState;

            if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK && template$blockinfo.tileentityData != null)
            {
                TileEntityStructure.Mode tileentitystructure$mode = TileEntityStructure.Mode.valueOf(template$blockinfo.tileentityData.getString("mode"));

                if (tileentitystructure$mode == TileEntityStructure.Mode.DATA)
                {
                    map.put(blockpos, template$blockinfo.tileentityData.getString("metadata"));
                }
            }
        }
    }

    return map;
}
 
Example 4
Project: Backmemed   File: TileEntityStructure.java   View Source Code Vote up 5 votes
private void updateBlockState()
{
    if (this.world != null)
    {
        BlockPos blockpos = this.getPos();
        IBlockState iblockstate = this.world.getBlockState(blockpos);

        if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
        {
            this.world.setBlockState(blockpos, iblockstate.withProperty(BlockStructure.MODE, this.mode), 2);
        }
    }
}
 
Example 5
Project: Backmemed   File: TileEntityStructure.java   View Source Code Vote up 5 votes
public void setMode(TileEntityStructure.Mode modeIn)
{
    this.mode = modeIn;
    IBlockState iblockstate = this.world.getBlockState(this.getPos());

    if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
    {
        this.world.setBlockState(this.getPos(), iblockstate.withProperty(BlockStructure.MODE, modeIn), 2);
    }
}
 
Example 6
Project: CustomWorldGen   File: Template.java   View Source Code Vote up 5 votes
public Map<BlockPos, String> getDataBlocks(BlockPos pos, PlacementSettings placementIn)
{
    Map<BlockPos, String> map = Maps.<BlockPos, String>newHashMap();
    StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();

    for (Template.BlockInfo template$blockinfo : this.blocks)
    {
        BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);

        if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos))
        {
            IBlockState iblockstate = template$blockinfo.blockState;

            if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK && template$blockinfo.tileentityData != null)
            {
                TileEntityStructure.Mode tileentitystructure$mode = TileEntityStructure.Mode.valueOf(template$blockinfo.tileentityData.getString("mode"));

                if (tileentitystructure$mode == TileEntityStructure.Mode.DATA)
                {
                    map.put(blockpos, template$blockinfo.tileentityData.getString("metadata"));
                }
            }
        }
    }

    return map;
}
 
Example 7
Project: CustomWorldGen   File: TileEntity.java   View Source Code Vote up 5 votes
/**
 * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity}
 * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block
 * at this location.
 *
 * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity}
 */
@SideOnly(Side.CLIENT)
public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox()
{
    net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB;
    Block type = getBlockType();
    BlockPos pos = getPos();
    if (type == Blocks.ENCHANTING_TABLE)
    {
        bb = new net.minecraft.util.math.AxisAlignedBB(pos, pos.add(1, 1, 1));
    }
    else if (type == Blocks.CHEST || type == Blocks.TRAPPED_CHEST)
    {
        bb = new net.minecraft.util.math.AxisAlignedBB(pos.add(-1, 0, -1), pos.add(2, 2, 2));
    }
    else if (type == Blocks.STRUCTURE_BLOCK)
    {
        bb = INFINITE_EXTENT_AABB;
    }
    else if (type != null && type != Blocks.BEACON)
    {
        net.minecraft.util.math.AxisAlignedBB cbb = null;
        try
        {
            cbb = worldObj.getBlockState(getPos()).getCollisionBoundingBox(worldObj, pos).addCoord(pos.getX(), pos.getY(), pos.getZ());
        }
        catch (Exception e)
        {
            // We have to capture any exceptions that may occur here because BUKKIT servers like to send
            // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does!
            // So we can not GARENTEE that the world state is the real state for the block...
            // So, once again in the long line of US having to accommodate BUKKIT breaking things,
            // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may
            // cause the TileEntity renderer to error further down the line! But alas, nothing we can do.
            cbb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1));
        }
        if (cbb != null) bb = cbb;
    }
    return bb;
}
 
Example 8
Project: CustomWorldGen   File: TileEntityStructure.java   View Source Code Vote up 5 votes
private void updateBlockState()
{
    if (this.worldObj != null)
    {
        BlockPos blockpos = this.getPos();
        IBlockState iblockstate = this.worldObj.getBlockState(blockpos);

        if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
        {
            this.worldObj.setBlockState(blockpos, iblockstate.withProperty(BlockStructure.MODE, this.mode), 2);
        }
    }
}
 
Example 9
Project: CustomWorldGen   File: TileEntityStructure.java   View Source Code Vote up 5 votes
public void setMode(TileEntityStructure.Mode modeIn)
{
    this.mode = modeIn;
    IBlockState iblockstate = this.worldObj.getBlockState(this.getPos());

    if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
    {
        this.worldObj.setBlockState(this.getPos(), iblockstate.withProperty(BlockStructure.MODE, modeIn), 2);
    }
}
 
Example 10
Project: Backmemed   File: EntityWither.java   View Source Code Vote up 4 votes
public static boolean canDestroyBlock(Block blockIn)
{
    return blockIn != Blocks.BEDROCK && blockIn != Blocks.END_PORTAL && blockIn != Blocks.END_PORTAL_FRAME && blockIn != Blocks.COMMAND_BLOCK && blockIn != Blocks.REPEATING_COMMAND_BLOCK && blockIn != Blocks.CHAIN_COMMAND_BLOCK && blockIn != Blocks.BARRIER && blockIn != Blocks.STRUCTURE_BLOCK && blockIn != Blocks.STRUCTURE_VOID;
}