本文整理匯總了Java中net.minecraft.entity.item.EntityBoat.setBoatType方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityBoat.setBoatType方法的具體用法?Java EntityBoat.setBoatType怎麽用?Java EntityBoat.setBoatType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.item.EntityBoat
的用法示例。
在下文中一共展示了EntityBoat.setBoatType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dispenseStack
import net.minecraft.entity.item.EntityBoat; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
World world = source.getWorld();
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
Material material = world.getBlockState(blockpos).getMaterial();
double d3;
if (Material.WATER.equals(material))
{
d3 = 1.0D;
}
else
{
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
{
return this.dispenseBehavior.dispense(source, stack);
}
d3 = 0.0D;
}
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
entityboat.setBoatType(this.boatType);
entityboat.rotationYaw = enumfacing.getHorizontalAngle();
world.spawnEntityInWorld(entityboat);
stack.func_190918_g(1);
return stack;
}
示例2: dispenseStack
import net.minecraft.entity.item.EntityBoat; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
World world = source.getWorld();
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
Material material = world.getBlockState(blockpos).getMaterial();
double d3;
if (Material.WATER.equals(material))
{
d3 = 1.0D;
}
else
{
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
{
return this.dispenseBehavior.dispense(source, stack);
}
d3 = 0.0D;
}
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
entityboat.setBoatType(this.boatType);
entityboat.rotationYaw = enumfacing.getOpposite().getHorizontalAngle();
world.spawnEntityInWorld(entityboat);
stack.splitStack(1);
return stack;
}
示例3: dispenseStack
import net.minecraft.entity.item.EntityBoat; //導入方法依賴的package包/類
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
EnumFacing enumfacing = (EnumFacing)source.func_189992_e().getValue(BlockDispenser.FACING);
World world = source.getWorld();
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
Material material = world.getBlockState(blockpos).getMaterial();
double d3;
if (Material.WATER.equals(material))
{
d3 = 1.0D;
}
else
{
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
{
return this.dispenseBehavior.dispense(source, stack);
}
d3 = 0.0D;
}
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
entityboat.setBoatType(this.boatType);
entityboat.rotationYaw = enumfacing.getOpposite().getHorizontalAngle();
world.spawnEntityInWorld(entityboat);
stack.splitStack(1);
return stack;
}