use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.
the class EntityDigIconFX method addBlockHitEffects.
public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, TextureAtlasSprite icon, EffectRenderer effectRenderer) {
float border = 0.1F;
Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border);
diff.x *= world.rand.nextDouble();
diff.y *= world.rand.nextDouble();
diff.z *= world.rand.nextDouble();
Vector3 pos = diff.add(bounds.min).add(border);
if (side == 0)
diff.y = bounds.min.y - border;
if (side == 1)
diff.y = bounds.max.y + border;
if (side == 2)
diff.z = bounds.min.z - border;
if (side == 3)
diff.z = bounds.max.z + border;
if (side == 4)
diff.x = bounds.min.x - border;
if (side == 5)
diff.x = bounds.max.x + border;
effectRenderer.addEffect(new EntityDigIconFX(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.
the class EntityDigIconFX method addBlockDestroyEffects.
public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, EffectRenderer effectRenderer) {
Vector3 diff = bounds.max.copy().subtract(bounds.min);
Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5);
Vector3 density = diff.copy().multiply(4);
density.x = Math.ceil(density.x);
density.y = Math.ceil(density.y);
density.z = Math.ceil(density.z);
for (int i = 0; i < density.x; ++i) for (int j = 0; j < density.y; ++j) for (int k = 0; k < density.z; ++k) {
double x = bounds.min.x + (i + 0.5) * diff.x / density.x;
double y = bounds.min.y + (j + 0.5) * diff.y / density.y;
double z = bounds.min.z + (k + 0.5) * diff.z / density.z;
effectRenderer.addEffect(new EntityDigIconFX(world, x, y, z, x - center.x, y - center.y, z - center.z, icons[world.rand.nextInt(icons.length)]));
}
}
use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.
the class RenderUtils method renderFluidCuboid.
public static void renderFluidCuboid(Cuboid6 bound, TextureAtlasSprite tex, double res) {
renderFluidQuad(new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), tex, res);
renderFluidQuad(new Vector3(bound.min.x, bound.max.y, bound.min.z), new Vector3(bound.min.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.min.z), tex, res);
renderFluidQuad(new Vector3(bound.min.x, bound.max.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), new Vector3(bound.min.x, bound.max.y, bound.max.z), tex, res);
renderFluidQuad(new Vector3(bound.max.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.max.y, bound.min.z), tex, res);
renderFluidQuad(new Vector3(bound.max.x, bound.max.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.max.y, bound.min.z), tex, res);
renderFluidQuad(new Vector3(bound.min.x, bound.max.y, bound.max.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.max.z), tex, res);
}
use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.
the class RenderUtils method renderFluidGauge.
public static void renderFluidGauge(FluidStack stack, Rectangle4i rect, double density, double res) {
if (!shouldRenderFluid(stack))
return;
int alpha = 255;
if (stack.getFluid().isGaseous())
alpha = (int) (fluidDensityToAlpha(density) * 255);
else {
int height = (int) (rect.h * density);
rect.y += rect.h - height;
rect.h = height;
}
TextureAtlasSprite tex = prepareFluidRender(stack, alpha);
CCRenderState.startDrawing();
renderFluidQuad(new Vector3(rect.x, rect.y + rect.h, 0), new Vector3(rect.w, 0, 0), new Vector3(0, -rect.h, 0), tex, res);
CCRenderState.draw();
postFluidRender();
}
Aggregations