Search in sources :

Example 56 with EnumFacing

use of net.minecraft.util.EnumFacing in project SecurityCraft by Geforce132.

the class BlockPanicButton method updateBlockBounds.

private void updateBlockBounds(IBlockState state) {
    EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
    boolean flag = ((Boolean) state.getValue(POWERED)).booleanValue();
    float f2 = (flag ? 1 : 2) / 16.0F;
    switch(BlockPanicButton.SwitchEnumFacing.FACING_LOOKUP[enumfacing.ordinal()]) {
        case 1:
            setBlockBounds(0.0F, 0.30F, 0.18F, f2, 0.70F, 0.82F);
            break;
        case 2:
            setBlockBounds(1.0F - f2, 0.30F, 0.18F, 1.0F, 0.70F, 0.82F);
            break;
        case 3:
            setBlockBounds(0.1800F, 0.300F, 0.0F, 0.8150F, 0.700F, f2);
            break;
        case 4:
            setBlockBounds(0.1800F, 0.300F, 1.0F - f2, 0.8150F, 0.700F, 1.0F);
            break;
        case 5:
            setBlockBounds(0.175F, 0.0F, 0.300F, 0.825F, 0.0F + f2, 0.700F);
            break;
        case 6:
            setBlockBounds(0.175F, 1.0F - f2, 0.300F, 0.8225F, 1.0F, 0.700F);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing)

Example 57 with EnumFacing

use of net.minecraft.util.EnumFacing in project SecurityCraft by Geforce132.

the class BlockRetinalScanner method onBlockPlacedBy.

/**
 * Called when the block is placed in the world.
 */
@Override
public void onBlockPlacedBy(World par1World, BlockPos pos, IBlockState state, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
    Block block = par1World.getBlockState(pos.north()).getBlock();
    Block block1 = par1World.getBlockState(pos.south()).getBlock();
    Block block2 = par1World.getBlockState(pos.west()).getBlock();
    Block block3 = par1World.getBlockState(pos.east()).getBlock();
    EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
    if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock())
        enumfacing = EnumFacing.SOUTH;
    else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock())
        enumfacing = EnumFacing.NORTH;
    else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock())
        enumfacing = EnumFacing.EAST;
    else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock())
        enumfacing = EnumFacing.WEST;
    par1World.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) Block(net.minecraft.block.Block)

Example 58 with EnumFacing

use of net.minecraft.util.EnumFacing in project SecurityCraft by Geforce132.

the class TileEntitySecurityCameraRenderer method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileEntity par1TileEntity, double x, double y, double z, float par5, int par6) {
    float rotation = 0F;
    if (par1TileEntity.hasWorldObj()) {
        Tessellator tessellator = Tessellator.getInstance();
        float f = par1TileEntity.getWorld().getLightBrightness(par1TileEntity.getPos());
        int l = par1TileEntity.getWorld().getCombinedLight(par1TileEntity.getPos(), 0);
        int l1 = l % 65536;
        int l2 = l / 65536;
        tessellator.getWorldRenderer().setColorOpaque_F(f, f, f);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
    }
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    Minecraft.getMinecraft().renderEngine.bindTexture(cameraTexture);
    GL11.glPushMatrix();
    if (par1TileEntity.hasWorldObj() && BlockUtils.getBlock(par1TileEntity.getWorld(), par1TileEntity.getPos()) == SCContent.securityCamera) {
        EnumFacing side = BlockUtils.getBlockPropertyAsEnum(getWorld(), par1TileEntity.getPos(), BlockSecurityCamera.FACING);
        if (side == EnumFacing.EAST)
            rotation = -1F;
        else if (side == EnumFacing.SOUTH)
            rotation = -10000F;
        else if (side == EnumFacing.WEST)
            rotation = 1F;
        else if (side == EnumFacing.NORTH)
            rotation = 0F;
    } else
        rotation = -10000F;
    GL11.glRotatef(180F, rotation, 0.0F, 1.0F);
    modelSecurityCamera.cameraRotationPoint.rotateAngleY = ((TileEntitySecurityCamera) par1TileEntity).cameraRotation;
    modelSecurityCamera.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) EnumFacing(net.minecraft.util.EnumFacing)

Example 59 with EnumFacing

use of net.minecraft.util.EnumFacing in project RecurrentComplex by Ivorforce.

the class TableDataSourceMazePath method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    if (segment == 1) {
        TableCellEnum.Option<EnumFacing>[] optionList = TableDirections.getDirectionOptions(EnumFacing.VALUES);
        TableCellEnum<EnumFacing> cell = new TableCellEnum<>("side", directionFromPath(mazePath), optionList);
        cell.addPropertyConsumer(val -> {
            SavedMazePathConnection path = pathFromDirection(val, mazePath.sourceRoom.getCoordinates());
            mazePath.pathDimension = path.path.pathDimension;
            mazePath.pathGoesUp = path.path.pathGoesUp;
            tableDelegate.reloadData();
        });
        return new TitledCell(IvTranslations.get("reccomplex.generationInfo.mazeComponent.path.side"), cell);
    } else if (segment == 2) {
        invertableButton = new TableCellButton("actions", "inverse", IvTranslations.get("reccomplex.generationInfo.mazeComponent.path.invert"), isInvertable());
        invertableButton.addAction(() -> {
            mazePath.set(mazePath.inverse());
            source.room = mazePath.sourceRoom;
            tableDelegate.reloadData();
        });
        return new TitledCell(invertableButton);
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) EnumFacing(net.minecraft.util.EnumFacing) SavedMazePathConnection(ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection) TableCellEnum(ivorius.reccomplex.gui.table.cell.TableCellEnum) TableCellButton(ivorius.reccomplex.gui.table.cell.TableCellButton)

Example 60 with EnumFacing

use of net.minecraft.util.EnumFacing in project RecurrentComplex by Ivorforce.

the class TableDataSourceVanillaStructureGeneration method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    switch(segment) {
        case 1:
            {
                TableCellEnum<String> cell = new TableCellEnum<>("type", "village", new TableCellEnum.Option<String>("village", IvTranslations.get("reccomplex.generationInfo.vanilla.type.village")));
                return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.type"), cell);
            }
        case 2:
            {
                switch(index) {
                    case 0:
                        return RCGuiTables.defaultWeightElement(val -> generationInfo.generationWeight = TableCells.toDouble(val), generationInfo.generationWeight);
                    case 1:
                        {
                            TableCellEnum<EnumFacing> cell = new TableCellEnum<>("front", generationInfo.front, TableDirections.getDirectionOptions(Directions.HORIZONTAL));
                            cell.addPropertyConsumer(val -> generationInfo.front = val);
                            return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.front"), cell);
                        }
                }
            }
        case 3:
            switch(index) {
                case 0:
                    {
                        TableCellFloatRange cell = new TableCellFloatRange("baseLimit", new FloatRange((float) generationInfo.minBaseLimit, (float) generationInfo.maxBaseLimit), 0, 1000, "%.2f");
                        cell.setScale(Scales.pow(5));
                        cell.addPropertyConsumer(val -> {
                            generationInfo.minBaseLimit = val.getMin();
                            generationInfo.maxBaseLimit = val.getMax();
                        });
                        return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.amount.pervillage"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.vanilla.amount.pervillage.tooltip"));
                    }
                case 1:
                    {
                        TableCellFloatRange cell = new TableCellFloatRange("scaledLimit", new FloatRange((float) generationInfo.minScaledLimit, (float) generationInfo.maxScaledLimit), 0, 1000, "%.2f");
                        cell.setScale(Scales.pow(5));
                        cell.addPropertyConsumer(val -> {
                            generationInfo.minScaledLimit = val.getMin();
                            generationInfo.maxScaledLimit = val.getMax();
                        });
                        return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.amount.scaled"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.vanilla.amount.scaled.tooltip"));
                    }
            }
            break;
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) FloatRange(ivorius.ivtoolkit.gui.FloatRange) ivorius.reccomplex.gui.table(ivorius.reccomplex.gui.table) TableCell(ivorius.reccomplex.gui.table.cell.TableCell) TableCellFloatRange(ivorius.reccomplex.gui.table.cell.TableCellFloatRange) TableDataSourceSegmented(ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented) Directions(ivorius.ivtoolkit.blocks.Directions) EnumFacing(net.minecraft.util.EnumFacing) TableDataSourceBlockPos(ivorius.reccomplex.gui.TableDataSourceBlockPos) TableCellEnum(ivorius.reccomplex.gui.table.cell.TableCellEnum) TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) VanillaGeneration(ivorius.reccomplex.world.gen.feature.structure.generic.generation.VanillaGeneration) Scales(ivorius.reccomplex.utils.scale.Scales) RCGuiTables(ivorius.reccomplex.gui.RCGuiTables) TableDirections(ivorius.reccomplex.gui.TableDirections) TableDataSourceExpression(ivorius.reccomplex.gui.TableDataSourceExpression) TableCellFloatRange(ivorius.reccomplex.gui.table.cell.TableCellFloatRange) EnumFacing(net.minecraft.util.EnumFacing) FloatRange(ivorius.ivtoolkit.gui.FloatRange) TableCellFloatRange(ivorius.reccomplex.gui.table.cell.TableCellFloatRange) TableCellEnum(ivorius.reccomplex.gui.table.cell.TableCellEnum)

Aggregations

EnumFacing (net.minecraft.util.EnumFacing)1673 BlockPos (net.minecraft.util.math.BlockPos)491 IBlockState (net.minecraft.block.state.IBlockState)403 TileEntity (net.minecraft.tileentity.TileEntity)392 ItemStack (net.minecraft.item.ItemStack)192 Block (net.minecraft.block.Block)158 ArrayList (java.util.ArrayList)121 World (net.minecraft.world.World)114 Vec3d (net.minecraft.util.math.Vec3d)104 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)98 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)88 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)73 EntityPlayer (net.minecraft.entity.player.EntityPlayer)65 FluidStack (net.minecraftforge.fluids.FluidStack)65 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)63 Nullable (javax.annotation.Nullable)51 List (java.util.List)48 Nonnull (javax.annotation.Nonnull)47 HashSet (java.util.HashSet)43 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)43