本文整理匯總了Java中net.minecraft.util.EnumFacing.getDirectionFromEntityLiving方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumFacing.getDirectionFromEntityLiving方法的具體用法?Java EnumFacing.getDirectionFromEntityLiving怎麽用?Java EnumFacing.getDirectionFromEntityLiving使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.EnumFacing
的用法示例。
在下文中一共展示了EnumFacing.getDirectionFromEntityLiving方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: placeBlockAt
import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState)
{
boolean flag = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
TileEntity te = world.getTileEntity(pos);
if(te instanceof TileEntityGlassMaster)
{
((TileEntityGlassMaster)te).placingFace = EnumFacing.getDirectionFromEntityLiving(pos, player);
}
return flag;
}
示例2: onBlockPlacedBy
import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote)
{
TileEntity te = worldIn.getTileEntity(pos);
if(te instanceof TileEntityGlassTerminal)
{
TileEntityGlassTerminal terminal = (TileEntityGlassTerminal)te;
terminal.facing = EnumFacing.getDirectionFromEntityLiving(pos, placer);
terminal.markDirty();
}
}
}
示例3: getDirectionalFacingForPlacement
import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
protected final EnumFacing getDirectionalFacingForPlacement(BlockPos pos, EnumFacing facing, int meta, EntityLivingBase placer)
{
if (content.faceBySide.get(meta).orElse(false))
return facing;
else
return EnumFacing.getDirectionFromEntityLiving(pos, placer);
}
示例4: getPlacementState
import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
@Override
public IBlockState getPlacementState(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
EnumFacing facing = EnumFacing.getDirectionFromEntityLiving(pos, placer);
/*EnumFacing facing = EnumFacing.UP;
Vec2f rot = placer.getPitchYaw();
if (rot.x > 45) {
facing = EnumFacing.DOWN;
} else if (rot.x > -45) {
facing = placer.getAdjustedHorizontalFacing();
}*/
return state.withProperty(BlockDirectional.FACING, facing);
}