本文整理汇总了Java中net.minecraft.util.EnumFacing.Axis方法的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.Axis方法的具体用法?Java EnumFacing.Axis怎么用?Java EnumFacing.Axis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.EnumFacing
的用法示例。
在下文中一共展示了EnumFacing.Axis方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Y;
int i = meta & 12;
if (i == 4)
{
enumfacing$axis = EnumFacing.Axis.X;
}
else if (i == 8)
{
enumfacing$axis = EnumFacing.Axis.Z;
}
return this.getDefaultState().withProperty(AXIS, enumfacing$axis);
}
示例2: getMetaFromState
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
int i = 0;
EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);
if (enumfacing$axis == EnumFacing.Axis.X)
{
i |= 4;
}
else if (enumfacing$axis == EnumFacing.Axis.Z)
{
i |= 8;
}
return i;
}
示例3: setBlockBoundsBasedOnState
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)worldIn.getBlockState(pos).getValue(AXIS);
float f = 0.125F;
float f1 = 0.125F;
if (enumfacing$axis == EnumFacing.Axis.X)
{
f = 0.5F;
}
if (enumfacing$axis == EnumFacing.Axis.Z)
{
f1 = 0.5F;
}
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
}
示例4: parseRotation
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Nullable
private BlockPartRotation parseRotation(JsonObject object)
{
BlockPartRotation blockpartrotation = null;
if (object.has("rotation"))
{
JsonObject jsonobject = JsonUtils.getJsonObject(object, "rotation");
Vector3f vector3f = this.parsePosition(jsonobject, "origin");
vector3f.scale(0.0625F);
EnumFacing.Axis enumfacing$axis = this.parseAxis(jsonobject);
float f = this.parseAngle(jsonobject);
boolean flag = JsonUtils.getBoolean(jsonobject, "rescale", false);
blockpartrotation = new BlockPartRotation(vector3f, enumfacing$axis, f, flag);
}
return blockpartrotation;
}
示例5: onNeighborBlockChange
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Called when a neighboring block changes.
*/
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);
if (enumfacing$axis == EnumFacing.Axis.X)
{
BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.X);
if (!blockportal$size.func_150860_b() || blockportal$size.field_150864_e < blockportal$size.field_150868_h * blockportal$size.field_150862_g)
{
worldIn.setBlockState(pos, Blocks.air.getDefaultState());
}
}
else if (enumfacing$axis == EnumFacing.Axis.Z)
{
BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.Z);
if (!blockportal$size1.func_150860_b() || blockportal$size1.field_150864_e < blockportal$size1.field_150868_h * blockportal$size1.field_150862_g)
{
worldIn.setBlockState(pos, Blocks.air.getDefaultState());
}
}
}
示例6: getAxisValue
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public static int getAxisValue(EnumFacing.Axis axis, Vector3i vector) {
switch (axis) {
case X:
return vector.getX();
case Y:
return vector.getY();
case Z:
return vector.getZ();
default:
throw new AssertionError("the hell is the " + axis + " axis? I exist in the 3d plane alone!");
}
}
示例7: onNeighborChangeInternal
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
if (!this.checkForDrop(worldIn, pos, state))
{
return true;
}
else
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
EnumFacing enumfacing1 = enumfacing.getOpposite();
boolean flag = false;
if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
{
flag = true;
}
else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
{
flag = true;
}
if (flag)
{
this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);
return true;
}
else
{
return false;
}
}
}
示例8: getActualState
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
* metadata, such as fence connections.
*/
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();
if (enumfacing$axis == EnumFacing.Axis.Z && (worldIn.getBlockState(pos.west()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.east()).getBlock() == Blocks.cobblestone_wall) || enumfacing$axis == EnumFacing.Axis.X && (worldIn.getBlockState(pos.north()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.south()).getBlock() == Blocks.cobblestone_wall))
{
state = state.withProperty(IN_WALL, Boolean.valueOf(true));
}
return state;
}
示例9: setBlockBoundsBasedOnState
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
EnumFacing.Axis enumfacing$axis = ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)).getAxis();
if (enumfacing$axis == EnumFacing.Axis.Z)
{
this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
}
else
{
this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
}
}
示例10: Size
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public Size(World worldIn, BlockPos p_i45694_2_, EnumFacing.Axis p_i45694_3_)
{
this.world = worldIn;
this.axis = p_i45694_3_;
if (p_i45694_3_ == EnumFacing.Axis.X)
{
this.field_150863_d = EnumFacing.EAST;
this.field_150866_c = EnumFacing.WEST;
}
else
{
this.field_150863_d = EnumFacing.NORTH;
this.field_150866_c = EnumFacing.SOUTH;
}
for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getBlockState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
{
;
}
int i = this.func_180120_a(p_i45694_2_, this.field_150863_d) - 1;
if (i >= 0)
{
this.field_150861_f = p_i45694_2_.offset(this.field_150863_d, i);
this.field_150868_h = this.func_180120_a(this.field_150861_f, this.field_150866_c);
if (this.field_150868_h < 2 || this.field_150868_h > 21)
{
this.field_150861_f = null;
this.field_150868_h = 0;
}
}
if (this.field_150861_f != null)
{
this.field_150862_g = this.func_150858_a();
}
}
示例11: shouldSideBeRendered
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
EnumFacing.Axis enumfacing$axis = null;
IBlockState iblockstate = worldIn.getBlockState(pos);
if (worldIn.getBlockState(pos).getBlock() == this)
{
enumfacing$axis = (EnumFacing.Axis)iblockstate.getValue(AXIS);
if (enumfacing$axis == null)
{
return false;
}
if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST)
{
return false;
}
if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH)
{
return false;
}
}
boolean flag = worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.getBlockState(pos.west(2)).getBlock() != this;
boolean flag1 = worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.getBlockState(pos.east(2)).getBlock() != this;
boolean flag2 = worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.getBlockState(pos.north(2)).getBlock() != this;
boolean flag3 = worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.getBlockState(pos.south(2)).getBlock() != this;
boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X;
boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z;
return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH));
}
示例12: getMetaForAxis
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public static int getMetaForAxis(EnumFacing.Axis axis)
{
return axis == EnumFacing.Axis.X ? 1 : (axis == EnumFacing.Axis.Z ? 2 : 0);
}
示例13: func_181089_f
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public BlockPattern.PatternHelper func_181089_f(World p_181089_1_, BlockPos p_181089_2_)
{
EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
BlockPortal.Size blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.X);
LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.func_181627_a(p_181089_1_, true);
if (!blockportal$size.func_150860_b())
{
enumfacing$axis = EnumFacing.Axis.X;
blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.Z);
}
if (!blockportal$size.func_150860_b())
{
return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
}
else
{
int[] aint = new int[EnumFacing.AxisDirection.values().length];
EnumFacing enumfacing = blockportal$size.field_150866_c.rotateYCCW();
BlockPos blockpos = blockportal$size.field_150861_f.up(blockportal$size.func_181100_a() - 1);
for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
{
BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1);
for (int i = 0; i < blockportal$size.func_181101_b(); ++i)
{
for (int j = 0; j < blockportal$size.func_181100_a(); ++j)
{
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air)
{
++aint[enumfacing$axisdirection.ordinal()];
}
}
}
}
EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
{
if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
{
enumfacing$axisdirection1 = enumfacing$axisdirection2;
}
}
return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1);
}
}