use of net.minecraft.util.Vec3 in project Hyperium by HyperiumClient.
the class ReachDisplay method onAttack.
@InvokeEvent
public void onAttack(PlayerAttackEntityEvent event) {
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mc.objectMouseOver.entityHit.getEntityId() == event.getEntity().getEntityId()) {
Vec3 vec = mc.getRenderViewEntity().getPositionEyes(1.0f);
double range = mc.objectMouseOver.hitVec.distanceTo(vec);
rangeText = new DecimalFormat(".##").format(range) + " blocks";
} else {
rangeText = "Not on target?";
}
lastAttack = System.currentTimeMillis();
}
use of net.minecraft.util.Vec3 in project Hyperium by HyperiumClient.
the class ParticleAuraHandler method renderPlayer.
@InvokeEvent
public void renderPlayer(RenderPlayerEvent event) {
if (Minecraft.getMinecraft().isGamePaused())
return;
if (event.getEntity().isInvisible())
return;
if (Minecraft.getMinecraft().currentScreen instanceof GuiHyperiumScreenIngameMenu)
return;
if (Minecraft.getMinecraft().theWorld == null || Minecraft.getMinecraft().thePlayer == null)
return;
if (!Settings.SHOW_PARTICLES)
return;
AbstractClientPlayer entity = event.getEntity();
if (!entity.equals(Minecraft.getMinecraft().thePlayer) && (entity.posX != entity.prevPosZ || entity.posY != entity.prevPosY || entity.posZ != entity.prevPosZ)) {
return;
}
ParticleAura particleAura = auras.get(entity.getUniqueID());
if (particleAura != null && !entity.isInvisible()) {
double x = entity.prevPosX + (entity.posX - entity.prevPosX) * event.getPartialTicks();
double y = entity.posY + (entity.posY - entity.prevPosY) * event.getPartialTicks();
double z = entity.posZ + (entity.posZ - entity.prevPosZ) * event.getPartialTicks();
List<Vec3> render = particleAura.render(entity, x, y, z);
render.forEach(vec3 -> {
IParticle type = particleAura.getType();
if (type != null) {
EntityFX entityFX = type.spawn(entity.worldObj, vec3.xCoord, vec3.yCoord, vec3.zCoord);
int particleMaxAge = particleAura.getParticleMaxAge();
IMixinEntityFX e = (IMixinEntityFX) entityFX;
if (particleAura.isChroma()) {
int i = Color.HSBtoRGB(System.currentTimeMillis() % 1000L / 1000.0f, 0.8f, 0.8f);
Color color = new Color(i);
entityFX.setRBGColorF(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
} else if (particleAura.isRgb()) {
entityFX.setRBGColorF(particleAura.getRed() / 255F, particleAura.getBlue() / 255F, particleAura.getBlue() / 255F);
}
e.setParticleGravity(10);
e.setParticleMaxAge(particleMaxAge);
Minecraft.getMinecraft().effectRenderer.addEffect(entityFX);
}
});
}
}
use of net.minecraft.util.Vec3 in project Hyperium by HyperiumClient.
the class DoubleTwirlAnimation method render.
@Override
public List<Vec3> render(EntityPlayer player, double x, double y, double z) {
double l = (System.currentTimeMillis() % 1000) / 1000D;
l *= Math.PI;
List<Vec3> list = new ArrayList<>();
y += 1.5;
Vec3 vec3 = new Vec3(x, y, z);
list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
l += Math.PI;
list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
return list;
}
use of net.minecraft.util.Vec3 in project Hyperium by HyperiumClient.
the class QuadTwirlAnimation method render.
@Override
public List<Vec3> render(EntityPlayer player, double x, double y, double z) {
double l = (System.currentTimeMillis() % 1000) / 1000D;
l *= Math.PI / 2;
List<Vec3> list = new ArrayList<>();
y += 1.8;
Vec3 vec3 = new Vec3(x, y, z);
list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
l += Math.PI / 2;
list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
l += Math.PI / 2;
list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
l += Math.PI / 2;
list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
return list;
}
use of net.minecraft.util.Vec3 in project Hyperium by HyperiumClient.
the class TornadoAnimation method render.
@Override
public List<Vec3> render(EntityPlayer player, double x, double y, double z) {
ArrayList<Vec3> vec3s = new ArrayList<>();
Vec3 base = new Vec3(x, y + .2, z);
double z1 = .2;
for (int i = 0; i < 20; i++) {
if (i % 2 == 0)
continue;
double v = Math.pow(10, z1 + (i / 10D) - 1) / 5 + .3;
double period = 5000 * v;
double v2 = (System.currentTimeMillis() % period) / period;
v2 *= Math.PI * 2;
for (int j = 0; j < i; j++) {
double v1 = Math.PI * 2D * j / ((double) i) + v2;
vec3s.add(base.addVector(v * MathHelper.sin((float) v1), i / 10D, v * MathHelper.cos((float) v1)));
}
}
return vec3s;
}
Aggregations