本文整理汇总了Java中net.minecraft.util.Direction.facingToDirection方法的典型用法代码示例。如果您正苦于以下问题:Java Direction.facingToDirection方法的具体用法?Java Direction.facingToDirection怎么用?Java Direction.facingToDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.Direction
的用法示例。
在下文中一共展示了Direction.facingToDirection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemUse
import net.minecraft.util.Direction; //导入方法依赖的package包/类
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if (p_77648_7_ == 0)
{
return false;
}
else if (p_77648_7_ == 1)
{
return false;
}
else
{
int i1 = Direction.facingToDirection[p_77648_7_];
EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);
if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
{
return false;
}
else
{
if (entityhanging != null && entityhanging.onValidSurface())
{
if (!p_77648_3_.isRemote)
{
p_77648_3_.spawnEntityInWorld(entityhanging);
}
--p_77648_1_.stackSize;
}
return true;
}
}
}
示例2: onItemUse
import net.minecraft.util.Direction; //导入方法依赖的package包/类
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
return false;
}
else if (par7 == 1)
{
return false;
}
else
{
int var11 = Direction.facingToDirection[par7];
EntityHanging var12 = this.createHangingEntity(par3World, par4, par5, par6, var11);
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
{
return false;
}
else
{
if (var12 != null && var12.onValidSurface())
{
if (!par3World.isClient)
{
par3World.spawnEntityInWorld(var12);
}
--par1ItemStack.stackSize;
}
return true;
}
}
}
示例3: onBlockPlaced
import net.minecraft.util.Direction; //导入方法依赖的package包/类
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
{
if (p_149660_5_ == 1 || p_149660_5_ == 0)
{
p_149660_5_ = 2;
}
return Direction.rotateOpposite[Direction.facingToDirection[p_149660_5_]];
}
示例4: onItemUse
import net.minecraft.util.Direction; //导入方法依赖的package包/类
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if (p_77648_7_ == 0)
{
return false;
}
else if (p_77648_7_ == 1)
{
return false;
}
else
{
int i1 = Direction.facingToDirection[p_77648_7_];
EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);
if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
{
return false;
}
else
{
if (entityhanging != null && entityhanging.onValidSurface())
{
if (!p_77648_3_.isRemote)
{
p_77648_3_.spawnEntityInWorld(entityhanging);
}
--p_77648_1_.stackSize;
}
return true;
}
}
}
示例5: onItemUse
import net.minecraft.util.Direction; //导入方法依赖的package包/类
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
return false;
}
else if (par7 == 1)
{
return false;
}
else
{
int i1 = Direction.facingToDirection[par7];
EntityHanging entityhanging = this.createHangingEntity(par3World, par4, par5, par6, i1);
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
{
return false;
}
else
{
if (entityhanging != null && entityhanging.onValidSurface())
{
if (!par3World.isRemote)
{
par3World.spawnEntityInWorld(entityhanging);
}
--par1ItemStack.stackSize;
}
return true;
}
}
}
示例6: onBlockPlaced
import net.minecraft.util.Direction; //导入方法依赖的package包/类
/**
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata
*/
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
{
if (par5 == 1 || par5 == 0)
{
par5 = 2;
}
return Direction.rotateOpposite[Direction.facingToDirection[par5]];
}