本文整理了Java中net.minecraft.entity.Entity.getLook()
方法的一些代码示例,展示了Entity.getLook()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getLook()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getLook
暂无
代码示例来源:origin: Vazkii/Psi
@Override
public Object execute(SpellContext context) throws SpellRuntimeException {
Entity e = this.getParamValue(context, target);
if(e == null)
throw new SpellRuntimeException(SpellRuntimeException.NULL_TARGET);
return new Vector3(e.getLook(1F));
}
代码示例来源:origin: TehNut/HWYLA
public RayTraceResult rayTrace(Entity entity, double playerReach, float partialTicks) {
Vec3d eyePosition = entity.getPositionEyes(partialTicks);
Vec3d lookVector = entity.getLook(partialTicks);
Vec3d traceEnd = eyePosition.addVector(lookVector.x * playerReach, lookVector.y * playerReach, lookVector.z * playerReach);
return entity.getEntityWorld().rayTraceBlocks(eyePosition, traceEnd, ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, true));
}
代码示例来源:origin: Lunatrius/Schematica
private RayTraceResult rayTrace(final SchematicWorld schematic, final float partialTicks) {
final Entity renderViewEntity = this.minecraft.getRenderViewEntity();
if (renderViewEntity == null) {
return null;
}
final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance();
final double posX = renderViewEntity.posX;
final double posY = renderViewEntity.posY;
final double posZ = renderViewEntity.posZ;
renderViewEntity.posX -= schematic.position.x;
renderViewEntity.posY -= schematic.position.y;
renderViewEntity.posZ -= schematic.position.z;
final Vec3d vecPosition = renderViewEntity.getPositionEyes(partialTicks);
final Vec3d vecLook = renderViewEntity.getLook(partialTicks);
final Vec3d vecExtendedLook = vecPosition.addVector(vecLook.x * blockReachDistance, vecLook.y * blockReachDistance, vecLook.z * blockReachDistance);
renderViewEntity.posX = posX;
renderViewEntity.posY = posY;
renderViewEntity.posZ = posZ;
return schematic.rayTraceBlocks(vecPosition, vecExtendedLook, false, false, true);
}
}
代码示例来源:origin: Vazkii/Psi
@Override
public Object execute(SpellContext context) throws SpellRuntimeException {
Entity e = this.getParamValue(context, target);
if(e == null)
throw new SpellRuntimeException(SpellRuntimeException.NULL_TARGET);
Vec3d look = e.getLook(1F);
EnumFacing facing = EnumFacing.getFacingFromVector((float) look.x, (float) look.y, (float) look.z);
return new Vector3(facing.getFrontOffsetX(), facing.getFrontOffsetY(), facing.getFrontOffsetZ());
}
代码示例来源:origin: TehNut/HWYLA
public static RayTraceResult rayTraceServer(Entity entity, double distance) {
double eyeHeight = entity.posY + entity.getEyeHeight();
Vec3d headVec = new Vec3d(entity.posX, eyeHeight, entity.posZ);
Vec3d start = new Vec3d(headVec.x, headVec.y, headVec.z);
Vec3d lookVec = entity.getLook(1.0F);
headVec.add(new Vec3d(lookVec.x * distance, lookVec.y * distance, lookVec.z * distance));
return entity.getEntityWorld().rayTraceBlocks(start, headVec, ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, true));
}
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@SideOnly(Side.CLIENT)
private Optional<RayTraceResult> getMouseOverExtended(float reach) {
RayTraceResult ret = null;
Minecraft mc = Minecraft.getMinecraft();
Entity renderViewEntity = mc.getRenderViewEntity();
if (renderViewEntity != null && mc.world != null) {
mc.mcProfiler.startSection("pick");
double d0 = reach;
ret = renderViewEntity.rayTrace(d0, 0);
Vec3d positionEyes = renderViewEntity.getPositionEyes(0);
double calcDist = d0;
if (ret != null) {
calcDist = ret.hitVec.distanceTo(positionEyes);
}
Vec3d vec3d1 = renderViewEntity.getLook(1.0F);
Vec3d vec3d2 = positionEyes.addVector(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0);
List<Entity> list = mc.world.getEntitiesInAABBexcluding(renderViewEntity,
renderViewEntity.getEntityBoundingBox().expand(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0).grow(1.0D, 1.0D, 1.0D),
Predicates.and(EntitySelectors.NOT_SPECTATING, e -> e != null && e.canBeCollidedWith()));
ret = getEntityHit(ret, renderViewEntity, positionEyes, calcDist, vec3d2, list);
}
return Optional.ofNullable(ret);
}
代码示例来源:origin: TeamWizardry/Wizardry
public void processEntity(@Nonnull Entity entity, boolean asCaster) {
if (asCaster) {
addData(DefaultKeys.ORIGIN, entity.getPositionVector().add(0, entity.getEyeHeight(), 0));
addData(DefaultKeys.CASTER, entity);
addData(DefaultKeys.YAW, entity.rotationYaw);
addData(DefaultKeys.PITCH, entity.rotationPitch);
addData(DefaultKeys.LOOK, entity.getLook(0));
addData(DefaultKeys.CAPABILITY, WizardryCapabilityProvider.getCap(entity));
} else {
addData(DefaultKeys.TARGET_HIT, entity.getPositionVector().add(0, entity.height / 2.0, 0));
addData(DefaultKeys.BLOCK_HIT, entity.getPosition());
addData(DefaultKeys.ENTITY_HIT, entity);
}
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
@Deprecated
public static void applyTransform(double[] wholeTransform, double[] rotationTransform, Entity ent) {
Vector entityPos = new Vector(ent.posX, ent.posY, ent.posZ);
Vector entityLook = new Vector(ent.getLook(1.0F));
Vector entityMotion = new Vector(ent.motionX, ent.motionY, ent.motionZ);
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
entity.prevRotationPitch = prevPitch;
Vector oldLookingPos = new Vector(entity.getLook(1.0F));
RotationMatrices.applyTransform(coordTransform.prevWToLRotation, oldLookingPos);
RotationMatrices.applyTransform(coordTransform.lToWRotation, oldLookingPos);
代码示例来源:origin: SquidDev-CC/plethora
Vec3d look = player.getLook(partialTicks);
double reach = 5;
if (player instanceof EntityPlayerMP) {
代码示例来源:origin: Mine-and-blade-admin/Battlegear2
Vec3d vec31 = mc.getRenderViewEntity().getLook(tickPart);
Vec3d vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
Vec3d vec33 = null;
代码示例来源:origin: jabelar/ExampleMod-1.12
Vec3d lookvec = theRenderViewEntity.getLook(0);
Vec3d var8 = pos.addVector(lookvec.x * var2, lookvec.y * var2, lookvec.z * var2);
Entity pointedEntity = null;
内容来源于网络,如有侵权,请联系作者删除!