use of net.minecraft.world.phys.Vec3 in project CyclopsCore by CyclopsMC.
the class DynamicBaseModel method addBakedQuadRotated.
/**
* Add a given rotated quad to a list of quads.
* @param quads The quads to append to.
* @param x1 Start X
* @param x2 End X
* @param z1 Start Z
* @param z2 End Z
* @param y Y
* @param texture The base texture
* @param side The side to add render quad at.
* @param rotation The rotation index to rotate by.
* @param isColored When set to true a colored baked quad will be made, otherwise a regular baked quad is used.
* @param shadeColor The shade color
* @param uvs A double array of 4 uv pairs
*/
protected static void addBakedQuadRotated(List<BakedQuad> quads, float x1, float x2, float z1, float z2, float y, TextureAtlasSprite texture, Direction side, int rotation, boolean isColored, int shadeColor, float[][] uvs) {
Vec3 v1 = rotate(new Vec3(x1 - .5, y - .5, z1 - .5), side).add(.5, .5, .5);
Vec3 v2 = rotate(new Vec3(x1 - .5, y - .5, z2 - .5), side).add(.5, .5, .5);
Vec3 v3 = rotate(new Vec3(x2 - .5, y - .5, z2 - .5), side).add(.5, .5, .5);
Vec3 v4 = rotate(new Vec3(x2 - .5, y - .5, z1 - .5), side).add(.5, .5, .5);
int[] data = Ints.concat(vertexToInts((float) v1.x, (float) v1.y, (float) v1.z, shadeColor, texture, uvs[(0 + rotation) % 4][0] * 16, uvs[(0 + rotation) % 4][1] * 16), vertexToInts((float) v2.x, (float) v2.y, (float) v2.z, shadeColor, texture, uvs[(1 + rotation) % 4][0] * 16, uvs[(1 + rotation) % 4][1] * 16), vertexToInts((float) v3.x, (float) v3.y, (float) v3.z, shadeColor, texture, uvs[(2 + rotation) % 4][0] * 16, uvs[(2 + rotation) % 4][1] * 16), vertexToInts((float) v4.x, (float) v4.y, (float) v4.z, shadeColor, texture, uvs[(3 + rotation) % 4][0] * 16, uvs[(3 + rotation) % 4][1] * 16));
// This fixes lighting issues when item is rendered in hand/inventory
ForgeHooksClient.fillNormal(data, side);
quads.add(new BakedQuad(data, -1, side, texture, false));
}
use of net.minecraft.world.phys.Vec3 in project SolarCraftRepository by FINDERFEED.
the class RadiantSmallTreeFoliagePlacer method isValidPos.
private boolean isValidPos(BlockPos mainpos, BlockPos posToCheck) {
Vec3 mainposvec = Helpers.getBlockCenter(mainpos);
Vec3 posToCheckVec = Helpers.getBlockCenter(posToCheck);
Vec3 horizontalVector = new Vec3(posToCheckVec.x - mainposvec.x, 0, posToCheckVec.z - mainposvec.z);
float x;
if (posToCheckVec.y < mainposvec.y) {
double razn = mainposvec.y - posToCheckVec.y;
x = (5 - (float) (razn));
if (Math.round(razn) != 1) {
x /= 1.5f;
}
} else {
x = 5 - (float) (posToCheckVec.y - mainposvec.y);
}
if (horizontalVector.length() <= Math.sqrt(2.3 * x)) {
return true;
}
return false;
}
use of net.minecraft.world.phys.Vec3 in project SolarCraftRepository by FINDERFEED.
the class CeilingDripstoneLikeCrystals method isValidPlace.
private boolean isValidPlace(WorldGenLevel world, BlockPos origin, BlockPos posToCheck, int maxheight, int maxRad) {
if (world.getBlockState(posToCheck).isAir()) {
Vec3 horizontal = new Vec3(posToCheck.getX() - origin.getX(), 0, posToCheck.getZ() - origin.getZ());
double height = Math.abs(posToCheck.getY() - origin.getY());
double logPos = maxheight - height + 1;
double radius = Math.log(logPos);
return horizontal.length() <= radius;
} else {
return false;
}
}
use of net.minecraft.world.phys.Vec3 in project SolarCraftRepository by FINDERFEED.
the class KeyDefenderTile method triggerTrap.
public void triggerTrap() {
if (!this.level.isClientSide && !activated) {
this.activated = true;
for (int i = 0; i < 20; i++) {
Zombie entity = new Zombie(EntityType.ZOMBIE, this.level);
Vec3 pos;
pos = new Vec3(this.worldPosition.getX() + level.random.nextFloat() * 8 - 4, this.worldPosition.getY() + 1, this.worldPosition.getZ() + level.random.nextFloat() * 8 - 4);
entity.setPos(pos.x, pos.y, pos.z);
this.level.addFreshEntity(entity);
}
}
}
use of net.minecraft.world.phys.Vec3 in project HexMod by gamma-delta.
the class BlockEntityConjured method landParticle.
public void landParticle(Entity entity, int number) {
if (getBlockState().getBlock() instanceof BlockConjured) {
for (int i = 0; i < number * 2; i++) {
int color = this.colorizer.getColor(entity.tickCount, entity.position().add(new Vec3(RANDOM.nextFloat(), RANDOM.nextFloat(), RANDOM.nextFloat()).scale(RANDOM.nextFloat() * 3)));
assert level != null;
level.addParticle(new ConjureParticleOptions(color, false), entity.getX() + (RANDOM.nextFloat() * 0.8D) - 0.2D, getBlockPos().getY() + (RANDOM.nextFloat() * 0.05D) + 0.95D, entity.getZ() + (RANDOM.nextFloat() * 0.8D) - 0.2D, 0.0, 0.0, 0.0);
}
}
}
Aggregations