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);
}
}
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);
}
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();
}
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);
}
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);
}
Aggregations