本文整理汇总了Java中net.minecraft.util.EnumFacing.getHorizontal方法的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.getHorizontal方法的具体用法?Java EnumFacing.getHorizontal怎么用?Java EnumFacing.getHorizontal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.EnumFacing
的用法示例。
在下文中一共展示了EnumFacing.getHorizontal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readEntityFromNBT
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.hangingPosition = new BlockPos(tagCompund.getInteger("TileX"), tagCompund.getInteger("TileY"), tagCompund.getInteger("TileZ"));
EnumFacing enumfacing;
if (tagCompund.hasKey("Direction", 99))
{
enumfacing = EnumFacing.getHorizontal(tagCompund.getByte("Direction"));
this.hangingPosition = this.hangingPosition.offset(enumfacing);
}
else if (tagCompund.hasKey("Facing", 99))
{
enumfacing = EnumFacing.getHorizontal(tagCompund.getByte("Facing"));
}
else
{
enumfacing = EnumFacing.getHorizontal(tagCompund.getByte("Dir"));
}
this.updateFacingWithBoundingBox(enumfacing);
}
示例2: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing = EnumFacing.NORTH;
boolean stick = true;
boolean base = true;
if(meta == 0) {
stick = false;
} else if(meta == EnumFacing.HORIZONTALS.length + 1) {
base = false;
} else {
facing = EnumFacing.getHorizontal(meta - 1);
}
return getDefaultState().withProperty(FACING, facing)
.withProperty(STICK, stick)
.withProperty(BASE, base);
}
示例3: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing = EnumFacing.getHorizontal(meta & 3);
Boolean ishead = Boolean.valueOf((meta & 4) != 0);
// return this.getDefaultState().withProperty(FACING,
// facing).withProperty(ISHEAD, ishead);
return this.getDefaultState().withProperty(FACING, facing);
}
示例4: readStructureFromNBT
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* (abstract) Helper method to read subclass data from NBT
*/
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.isMultipleFloors = tagCompound.getBoolean("tf");
this.corridorDirection = EnumFacing.getHorizontal(tagCompound.getInteger("D"));
}
示例5: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta)
{
EnumFacing enumfacing = EnumFacing.getHorizontal(meta & 3);
if (enumfacing.getAxis() == EnumFacing.Axis.Y)
{
enumfacing = EnumFacing.NORTH;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(FULL, (meta & 4) > 0);
}
示例6: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta)
{
EnumFacing enumfacing = EnumFacing.getHorizontal(meta & 3); //untill third bit ? so facing only
if (enumfacing.getAxis() == EnumFacing.Axis.Y)
{
enumfacing = EnumFacing.NORTH;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ENDBLOCK, (meta & 4) > 0); //facing + (saved data after facing = &4
}
示例7: readPacketData
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityID = buf.readVarIntFromBuffer();
this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A);
this.position = buf.readBlockPos();
this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
示例8: readPacketData
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityID = buf.readVarIntFromBuffer();
this.uniqueId = buf.readUuid();
this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.MAX_NAME_LENGTH);
this.position = buf.readBlockPos();
this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
示例9: fixTagCompound
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = compound.getString("id");
boolean flag = "Painting".equals(s);
boolean flag1 = "ItemFrame".equals(s);
if ((flag || flag1) && !compound.hasKey("Facing", 99))
{
EnumFacing enumfacing;
if (compound.hasKey("Direction", 99))
{
enumfacing = EnumFacing.getHorizontal(compound.getByte("Direction"));
compound.setInteger("TileX", compound.getInteger("TileX") + enumfacing.getFrontOffsetX());
compound.setInteger("TileY", compound.getInteger("TileY") + enumfacing.getFrontOffsetY());
compound.setInteger("TileZ", compound.getInteger("TileZ") + enumfacing.getFrontOffsetZ());
compound.removeTag("Direction");
if (flag1 && compound.hasKey("ItemRotation", 99))
{
compound.setByte("ItemRotation", (byte)(compound.getByte("ItemRotation") * 2));
}
}
else
{
enumfacing = EnumFacing.getHorizontal(compound.getByte("Dir"));
compound.removeTag("Dir");
}
compound.setByte("Facing", (byte)enumfacing.getHorizontalIndex());
}
return compound;
}
示例10: readStructureBaseNBT
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Reads and sets structure base data (boundingbox, {@link
* net.minecraft.world.gen.structure.StructureComponent#coordBaseMode coordBase} and {@link
* net.minecraft.world.gen.structure.StructureComponent#componentType componentType})
*/
public void readStructureBaseNBT(World worldIn, NBTTagCompound tagCompound)
{
if (tagCompound.hasKey("BB"))
{
this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB"));
}
int i = tagCompound.getInteger("O");
this.coordBaseMode = i == -1 ? null : EnumFacing.getHorizontal(i);
this.componentType = tagCompound.getInteger("GD");
this.readStructureFromNBT(tagCompound);
}
示例11: getHorizontalFacing
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public EnumFacing getHorizontalFacing()
{
return EnumFacing.getHorizontal(MathHelper.floor_double((double)(this.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3);
}
示例12: onItemUse
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else if (side != EnumFacing.UP)
{
return false;
}
else
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
boolean flag = block.isReplaceable(worldIn, pos);
if (!flag)
{
pos = pos.up();
}
int i = MathHelper.floor_double((double)(playerIn.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
EnumFacing enumfacing = EnumFacing.getHorizontal(i);
BlockPos blockpos = pos.offset(enumfacing);
if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack))
{
boolean flag1 = worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
boolean flag2 = flag || worldIn.isAirBlock(pos);
boolean flag3 = flag1 || worldIn.isAirBlock(blockpos);
if (flag2 && flag3 && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos.down()))
{
IBlockState iblockstate1 = Blocks.bed.getDefaultState().withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)).withProperty(BlockBed.FACING, enumfacing).withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
if (worldIn.setBlockState(pos, iblockstate1, 3))
{
IBlockState iblockstate2 = iblockstate1.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD);
worldIn.setBlockState(blockpos, iblockstate2, 3);
}
--stack.stackSize;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
}
示例13: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
EnumFacing enumfacing = EnumFacing.getHorizontal(meta);
return (meta & 8) > 0 ? this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.HEAD).withProperty(FACING, enumfacing).withProperty(OCCUPIED, Boolean.valueOf((meta & 4) > 0)) : this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.FOOT).withProperty(FACING, enumfacing);
}
示例14: readStructureFromNBT
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
this.isMultipleFloors = tagCompound.getBoolean("tf");
this.corridorDirection = EnumFacing.getHorizontal(tagCompound.getInteger("D"));
}
示例15: getHorizontalFacing
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
* Gets the horizontal facing direction of this Entity.
*/
public EnumFacing getHorizontalFacing()
{
return EnumFacing.getHorizontal(MathHelper.floor_double((double)(this.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3);
}