本文整理匯總了Java中net.minecraft.util.Vec3.rotateAroundY方法的典型用法代碼示例。如果您正苦於以下問題:Java Vec3.rotateAroundY方法的具體用法?Java Vec3.rotateAroundY怎麽用?Java Vec3.rotateAroundY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.Vec3
的用法示例。
在下文中一共展示了Vec3.rotateAroundY方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: entityHurtEvent
import net.minecraft.util.Vec3; //導入方法依賴的package包/類
@SubscribeEvent
public void entityHurtEvent(LivingHurtEvent event) {
if (!EtFuturum.enableDmgIndicator)
return;
int amount = MathHelper.floor_float(Math.min(event.entityLiving.getHealth(), event.ammount) / 2F);
if (amount <= 0)
return;
// If the attacker is a player spawn the hearts aligned and facing it
if (event.source instanceof EntityDamageSource) {
EntityDamageSource src = (EntityDamageSource) event.source;
Entity attacker = src.getSourceOfDamage();
if (attacker instanceof EntityPlayer && !(attacker instanceof FakePlayer)) {
EntityPlayer player = (EntityPlayer) attacker;
Vec3 look = player.getLookVec();
look.rotateAroundY((float) Math.PI / 2);
for (int i = 0; i < amount; i++) {
double x = event.entityLiving.posX - amount * 0.35 * look.xCoord / 2 + i * 0.35 * look.xCoord;
double y = event.entityLiving.posY + 1.5 + event.entityLiving.worldObj.rand.nextGaussian() * 0.05;
double z = event.entityLiving.posZ - amount * 0.35 * look.zCoord / 2 + i * 0.35 * look.zCoord;
EtFuturum.networkWrapper.sendToAllAround(new BlackHeartParticlesMessage(x, y, z), new TargetPoint(player.worldObj.provider.dimensionId, x, y, z, 64));
}
}
}
}