Search in sources :

Example 51 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Charset by CharsetMC.

the class BlockScaffold method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    TileScaffold scaffold = (TileScaffold) world.getTileEntity(pos);
    IExtendedBlockState extendedBS = (IExtendedBlockState) super.getExtendedState(state, world, pos);
    if (scaffold != null) {
        return extendedBS.withProperty(TileScaffold.PROPERTY, ScaffoldCacheInfo.from(scaffold));
    } else {
        return extendedBS;
    }
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 52 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Charset by CharsetMC.

the class BlockShelf method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    TileShelf bookshelf = (TileShelf) world.getTileEntity(pos);
    IExtendedBlockState extendedBS = (IExtendedBlockState) super.getExtendedState(state, world, pos);
    if (bookshelf != null) {
        return extendedBS.withProperty(TileShelf.PROPERTY, ShelfCacheInfo.from(extendedBS, bookshelf));
    } else {
        return extendedBS;
    }
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 53 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Charset by CharsetMC.

the class BlockBarrel method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    TileEntityDayBarrel barrel = (TileEntityDayBarrel) world.getTileEntity(pos);
    IExtendedBlockState extendedBS = (IExtendedBlockState) super.getExtendedState(state, world, pos);
    if (barrel != null) {
        return extendedBS.withProperty(BARREL_INFO, BarrelCacheInfo.from(barrel));
    } else {
        return extendedBS;
    }
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 54 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Galacticraft by micdoodle8.

the class BlockFluidGC method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState oldState, IBlockAccess world, BlockPos pos) {
    IExtendedBlockState state = (IExtendedBlockState) oldState;
    state = state.withProperty(FLOW_DIRECTION, (float) getFlowDirection(world, pos));
    IBlockState[][] upBlockState = new IBlockState[3][3];
    float[][] height = new float[3][3];
    float[][] corner = new float[2][2];
    upBlockState[1][1] = world.getBlockState(pos.down(this.densityDir));
    height[1][1] = this.getFluidHeightForRender(world, pos, upBlockState[1][1]);
    if (height[1][1] == 1) {
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                corner[i][j] = 1;
            }
        }
    } else {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (i != 1 || j != 1) {
                    upBlockState[i][j] = world.getBlockState(pos.add(i - 1, 0, j - 1).down(this.densityDir));
                    height[i][j] = this.getFluidHeightForRender(world, pos.add(i - 1, 0, j - 1), upBlockState[i][j]);
                }
            }
        }
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                corner[i][j] = this.getFluidHeightAverage(height[i][j], height[i][j + 1], height[i + 1][j], height[i + 1][j + 1]);
            }
        }
        // check for downflow above corners
        boolean n = this.isFluid(upBlockState[0][1]);
        boolean s = this.isFluid(upBlockState[2][1]);
        boolean w = this.isFluid(upBlockState[1][0]);
        boolean e = this.isFluid(upBlockState[1][2]);
        boolean nw = this.isFluid(upBlockState[0][0]);
        boolean ne = this.isFluid(upBlockState[0][2]);
        boolean sw = this.isFluid(upBlockState[2][0]);
        boolean se = this.isFluid(upBlockState[2][2]);
        if (nw || n || w) {
            corner[0][0] = 1;
        }
        if (ne || n || e) {
            corner[0][1] = 1;
        }
        if (sw || s || w) {
            corner[1][0] = 1;
        }
        if (se || s || e) {
            corner[1][1] = 1;
        }
    }
    state = state.withProperty(LEVEL_CORNERS[0], corner[0][0]);
    state = state.withProperty(LEVEL_CORNERS[1], corner[0][1]);
    state = state.withProperty(LEVEL_CORNERS[2], corner[1][1]);
    state = state.withProperty(LEVEL_CORNERS[3], corner[1][0]);
    return state;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 55 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project BuildCraft by BuildCraft.

the class BlockGenericPipe method getExtendedState.

// Client side extended state rendering
@Override
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    IExtendedBlockState extended = (IExtendedBlockState) super.getActualState(state, world, pos);
    TileEntity tile = world.getTileEntity(pos);
    if (tile == null || !(tile instanceof TileGenericPipe)) {
        return extended;
    }
    TileGenericPipe pipe = (TileGenericPipe) tile;
    extended = extended.withProperty(PIPE_CORE_STATE.asUnlistedProperty(), pipe.coreState);
    extended = extended.withProperty(PIPE_RENDER_STATE.asUnlistedProperty(), pipe.renderState);
    extended = extended.withProperty(PIPE_PLUGGABLE_STATE.asUnlistedProperty(), pipe.pluggableState);
    extended = extended.withProperty(PIPE_PIPE.asUnlistedProperty(), pipe.pipe);
    return extended;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Aggregations

IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)96 IBlockState (net.minecraft.block.state.IBlockState)27 BlockPos (net.minecraft.util.math.BlockPos)24 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)17 EnumFacing (net.minecraft.util.EnumFacing)17 OBJState (net.minecraftforge.client.model.obj.OBJModel.OBJState)17 TileEntity (net.minecraft.tileentity.TileEntity)16 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)14 ArrayList (java.util.ArrayList)13 IBlockAccess (net.minecraft.world.IBlockAccess)13 UnlistedBlockPos (forestry.core.blocks.properties.UnlistedBlockPos)10 TileEntityImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable)7 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)7 Block (net.minecraft.block.Block)6 ItemStack (net.minecraft.item.ItemStack)6 Nonnull (javax.annotation.Nonnull)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 Minecraft (net.minecraft.client.Minecraft)3 Vec3d (net.minecraft.util.math.Vec3d)3