use of net.minecraft.util.math.Vec3f in project wildmod by Osmiooo.
the class LightmapTextureManagerMixin method update.
@Inject(at = @At("HEAD"), method = "update")
public void update(float delta, CallbackInfo ci) {
assert this.client.player != null;
if (this.client.player.hasStatusEffect(RegisterStatusEffects.DARKNESS)) {
int lightvalue;
double dark;
assert this.client.player != null;
if (this.client.player.hasStatusEffect(RegisterStatusEffects.DARKNESS)) {
dark = MathAddon.cutCos(time, 0, true) * 1.6;
} else {
dark = 0;
}
if (this.dirty) {
this.dirty = false;
this.client.getProfiler().push("lightTex");
ClientWorld clientWorld = this.client.world;
if (clientWorld != null) {
float f = clientWorld.getStarBrightness(1.0F);
float h;
if (clientWorld.getLightningTicksLeft() > 0) {
h = 1.0F;
} else {
h = f * 0.95F + 0.05F;
}
float i = this.client.player.getUnderwaterVisibility();
float l;
if (this.client.player.hasStatusEffect(StatusEffects.NIGHT_VISION)) {
l = GameRenderer.getNightVisionStrength(this.client.player, delta);
} else if (i > 0.0F && this.client.player.hasStatusEffect(StatusEffects.CONDUIT_POWER)) {
l = i;
} else {
l = 0.0F;
}
Vec3f vec3f = new Vec3f(f, f, 1.0F);
vec3f.lerp(new Vec3f(1.0F, 1.0F, 1.0F), 0.35F);
float m = this.flickerIntensity + 1.5F;
Vec3f vec3f2 = new Vec3f();
for (int n = 0; n < 16; ++n) {
for (int o = 0; o < 16; ++o) {
float p = this.getBrightness(clientWorld, n) * h;
float q = this.getBrightness(clientWorld, o) * m;
float s = q * ((q * 0.6F + 0.4F) * 0.6F + 0.4F);
float t = q * (q * q * 0.6F + 0.4F);
vec3f2.set(q, s, t);
float w;
Vec3f vec3f5;
if (clientWorld.getDimensionEffects().shouldBrightenLighting()) {
vec3f2.lerp(new Vec3f(0.99F, 1.12F, 1.0F), 0.25F);
} else {
Vec3f vec3f3 = vec3f.copy();
vec3f3.scale(p);
vec3f2.add(vec3f3);
vec3f2.lerp(new Vec3f(0.75F, 0.75F, 0.75F), 0.04F);
if (this.renderer.getSkyDarkness(delta) > 0.0F) {
w = this.renderer.getSkyDarkness(delta);
vec3f5 = vec3f2.copy();
vec3f5.multiplyComponentwise(0.7F, 0.6F, 0.6F);
vec3f2.lerp(vec3f5, w);
}
}
vec3f2.clamp(0.0F, 1.0F);
float v;
if (l > 0.0F) {
v = Math.max(vec3f2.getX(), Math.max(vec3f2.getY(), vec3f2.getZ()));
if (v < 1.0F) {
w = 1.0F / v;
vec3f5 = vec3f2.copy();
vec3f5.scale(w);
vec3f2.lerp(vec3f5, l);
}
}
v = (float) this.client.options.gamma;
Vec3f vec3f6 = vec3f2.copy();
vec3f6.modify(this::easeOutQuart);
vec3f2.lerp(vec3f6, v - (float) dark);
vec3f2.lerp(new Vec3f(0.75F, 0.75F, 0.75F), 0.04F);
vec3f2.clamp(0.0F, 1.0F);
vec3f2.scale(255.0F);
int z = (int) vec3f2.getX();
int aa = (int) vec3f2.getY();
int ab = (int) vec3f2.getZ();
lightvalue = -16777216 | ab << 16 | aa << 8 | z;
this.image.setColor(o, n, lightvalue);
}
}
}
}
this.texture.upload();
}
}
use of net.minecraft.util.math.Vec3f in project wildmod by Osmiooo.
the class ShriekParticle method buildGeometry.
@Override
public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float f) {
Vec3d vec3d = camera.getPos();
float g = (float) (MathHelper.lerp((double) f, this.prevPosX, this.x) - vec3d.getX());
float h = (float) (MathHelper.lerp((double) f, this.prevPosY, this.y) - vec3d.getY());
float i = (float) (MathHelper.lerp((double) f, this.prevPosZ, this.z) - vec3d.getZ());
Quaternion quaternion;
quaternion = new Quaternion(-1, 0, 0, -0.6F);
Vec3f j = new Vec3f(-1.0F, -1.0F, 0.0F);
j.rotate(quaternion);
Vec3f[] vec3fs = new Vec3f[] { new Vec3f(-1.0F, -1.0F, 0.0F), new Vec3f(-1.0F, 1.0F, 0.0F), new Vec3f(1.0F, 1.0F, 0.0F), new Vec3f(1.0F, -1.0F, 0.0F) };
float k = this.getSize(f);
for (int l = 0; l < 4; ++l) {
Vec3f vec3f = vec3fs[l];
vec3f.rotate(quaternion);
vec3f.scale((float) (((this.age) / (9.8)) / 7));
vec3f.add(g, h, i);
this.setAlpha((float) (this.age - this.maxAge) * 6);
}
float l = this.getMinU();
float vec3f = this.getMaxU();
float m = this.getMinV();
float n = this.getMaxV();
int o = this.getBrightness(f);
vertexConsumer.vertex((double) vec3fs[0].getX(), (double) vec3fs[0].getY(), (double) vec3fs[0].getZ()).texture(vec3f, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[1].getX(), (double) vec3fs[1].getY(), (double) vec3fs[1].getZ()).texture(vec3f, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[2].getX(), (double) vec3fs[2].getY(), (double) vec3fs[2].getZ()).texture(l, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[3].getX(), (double) vec3fs[3].getY(), (double) vec3fs[3].getZ()).texture(l, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
}
use of net.minecraft.util.math.Vec3f in project wildmod by Osmiooo.
the class ShriekParticle2PosZ method buildGeometry.
@Override
public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float f) {
Vec3d vec3d = camera.getPos();
float g = (float) (MathHelper.lerp((double) f, this.prevPosX, this.x) - vec3d.getX());
float h = (float) (MathHelper.lerp((double) f, this.prevPosY, this.y) - vec3d.getY());
float i = (float) (MathHelper.lerp((double) f, this.prevPosZ, this.z) - vec3d.getZ());
Quaternion quaternion;
quaternion = new Quaternion(-1, 0, 0, 0.6F);
Vec3f j = new Vec3f(-1.0F, -1.0F, 0.0F);
j.rotate(quaternion);
Vec3f[] vec3fs = new Vec3f[] { new Vec3f(-1.0F, -1.0F, 0.0F), new Vec3f(-1.0F, 1.0F, 0.0F), new Vec3f(1.0F, 1.0F, 0.0F), new Vec3f(1.0F, -1.0F, 0.0F) };
float k = this.getSize(f);
for (int l = 0; l < 4; ++l) {
Vec3f vec3f = vec3fs[l];
vec3f.rotate(quaternion);
vec3f.scale((float) (((this.age) / (9.8)) / 7));
vec3f.add(g, h, i);
this.setAlpha((float) (this.age - this.maxAge) * 6);
}
float l = this.getMinU();
float vec3f = this.getMaxU();
float m = this.getMinV();
float n = this.getMaxV();
int o = this.getBrightness(f);
vertexConsumer.vertex((double) vec3fs[0].getX(), (double) vec3fs[0].getY(), (double) vec3fs[0].getZ()).texture(vec3f, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[1].getX(), (double) vec3fs[1].getY(), (double) vec3fs[1].getZ()).texture(vec3f, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[2].getX(), (double) vec3fs[2].getY(), (double) vec3fs[2].getZ()).texture(l, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[3].getX(), (double) vec3fs[3].getY(), (double) vec3fs[3].getZ()).texture(l, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
}
use of net.minecraft.util.math.Vec3f in project wildmod by Osmiooo.
the class ShriekParticle2 method buildGeometry.
@Override
public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float f) {
Vec3d vec3d = camera.getPos();
float g = (float) (MathHelper.lerp((double) f, this.prevPosX, this.x) - vec3d.getX());
float h = (float) (MathHelper.lerp((double) f, this.prevPosY, this.y) - vec3d.getY());
float i = (float) (MathHelper.lerp((double) f, this.prevPosZ, this.z) - vec3d.getZ());
Quaternion quaternion;
quaternion = new Quaternion(-0.6F, 0, 0, 1);
Vec3f j = new Vec3f(-1.0F, -1.0F, 0.0F);
j.rotate(quaternion);
Vec3f[] vec3fs = new Vec3f[] { new Vec3f(-1.0F, -1.0F, 0.0F), new Vec3f(-1.0F, 1.0F, 0.0F), new Vec3f(1.0F, 1.0F, 0.0F), new Vec3f(1.0F, -1.0F, 0.0F) };
float k = this.getSize(f);
for (int l = 0; l < 4; ++l) {
Vec3f vec3f = vec3fs[l];
vec3f.rotate(quaternion);
vec3f.scale((float) (((this.age) / (9.8)) / 7));
vec3f.add(g, h, i);
this.setAlpha((float) (this.age - this.maxAge) * 6);
}
float l = this.getMinU();
float vec3f = this.getMaxU();
float m = this.getMinV();
float n = this.getMaxV();
int o = this.getBrightness(f);
vertexConsumer.vertex((double) vec3fs[0].getX(), (double) vec3fs[0].getY(), (double) vec3fs[0].getZ()).texture(vec3f, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[1].getX(), (double) vec3fs[1].getY(), (double) vec3fs[1].getZ()).texture(vec3f, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[2].getX(), (double) vec3fs[2].getY(), (double) vec3fs[2].getZ()).texture(l, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[3].getX(), (double) vec3fs[3].getY(), (double) vec3fs[3].getZ()).texture(l, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
}
use of net.minecraft.util.math.Vec3f in project wildmod by Osmiooo.
the class ShriekParticlePosZ method buildGeometry.
@Override
public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float f) {
Vec3d vec3d = camera.getPos();
float g = (float) (MathHelper.lerp((double) f, this.prevPosX, this.x) - vec3d.getX());
float h = (float) (MathHelper.lerp((double) f, this.prevPosY, this.y) - vec3d.getY());
float i = (float) (MathHelper.lerp((double) f, this.prevPosZ, this.z) - vec3d.getZ());
Quaternion quaternion;
quaternion = new Quaternion(-0.6F, 0, 0, -1);
Vec3f j = new Vec3f(-1.0F, -1.0F, 0.0F);
j.rotate(quaternion);
Vec3f[] vec3fs = new Vec3f[] { new Vec3f(-1.0F, -1.0F, 0.0F), new Vec3f(-1.0F, 1.0F, 0.0F), new Vec3f(1.0F, 1.0F, 0.0F), new Vec3f(1.0F, -1.0F, 0.0F) };
float k = this.getSize(f);
for (int l = 0; l < 4; ++l) {
Vec3f vec3f = vec3fs[l];
vec3f.rotate(quaternion);
vec3f.scale((float) (((this.age) / (9.8)) / 7));
vec3f.add(g, h, i);
this.setAlpha((float) (this.age - this.maxAge) * 6);
}
float l = this.getMinU();
float vec3f = this.getMaxU();
float m = this.getMinV();
float n = this.getMaxV();
int o = this.getBrightness(f);
vertexConsumer.vertex((double) vec3fs[0].getX(), (double) vec3fs[0].getY(), (double) vec3fs[0].getZ()).texture(vec3f, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[1].getX(), (double) vec3fs[1].getY(), (double) vec3fs[1].getZ()).texture(vec3f, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[2].getX(), (double) vec3fs[2].getY(), (double) vec3fs[2].getZ()).texture(l, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[3].getX(), (double) vec3fs[3].getY(), (double) vec3fs[3].getZ()).texture(l, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
}
Aggregations