本文整理匯總了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();
}