本文整理汇总了Java中org.spongepowered.api.data.property.entity.EyeHeightProperty类的典型用法代码示例。如果您正苦于以下问题:Java EyeHeightProperty类的具体用法?Java EyeHeightProperty怎么用?Java EyeHeightProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EyeHeightProperty类属于org.spongepowered.api.data.property.entity包,在下文中一共展示了EyeHeightProperty类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: throwItem
import org.spongepowered.api.data.property.entity.EyeHeightProperty; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void throwItem()
{
Vector3d rotation = player.getTransform().getRotationAsQuaternion().getDirection().normalize();
Location location = this.player.getLocation()
.add(0, player.getProperty(EyeHeightProperty.class).get().getValue(), 0)
.add(rotation.mul(2));
Entity entity;
if (Projectile.class.isAssignableFrom(this.type.getEntityClass()))
{
entity = this.player.launchProjectile((Class<? extends Projectile>)this.type.getEntityClass()).get();
}
else
{
entity = player.getWorld().createEntity(type, location.getPosition());
Sponge.getCauseStackManager().pushCause(player);
player.getWorld().spawnEntity(entity);
entity.setVelocity(rotation.mul(8));
if (entity instanceof ExperienceOrb)
{
entity.offer(Keys.CONTAINED_EXPERIENCE, 0);
}
}
if (this.preventDamage && !this.save)
{
throwListener.add(entity);
}
}
示例2: getEyeHeight
import org.spongepowered.api.data.property.entity.EyeHeightProperty; //导入依赖的package包/类
@Override
public double getEyeHeight() {
return getHandle().getProperty(EyeHeightProperty.class).get().getValue();
}