use of net.minecraft.util.math.Vec3i in project Overloaded by CJ-MC-Mods.
the class ModelUtils method renderQuads.
public static void renderQuads(List<BakedQuad> listQuads) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
int i = 0;
vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
for (int j = listQuads.size(); i < j; ++i) {
BakedQuad bakedquad = listQuads.get(i);
vertexbuffer.addVertexData(bakedquad.getVertexData());
vertexbuffer.putColorRGB_F4(1, 1, 1);
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
vertexbuffer.putNormal((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ());
}
tessellator.draw();
}
use of net.minecraft.util.math.Vec3i in project RecurrentComplex by Ivorforce.
the class CommandNaturalSpace method placeNaturalAir.
public static void placeNaturalAir(MockWorld world, BlockArea area, int floorDistance, int maxClosedSides) {
BlockGenericSpace spaceBlock = RCBlocks.genericSpace;
BlockPos lowerPoint = area.getLowerCorner();
BlockPos higherPoint = area.getHigherCorner();
Set<BlockPos> set = new HashSet<>();
for (BlockSurfacePos surfaceCoord : BlockSurfaceArea.from(area)) {
int safePoint = lowerPoint.getY();
for (int y = higherPoint.getY(); y >= lowerPoint.getY(); y--) {
IBlockState blockState = world.getBlockState(surfaceCoord.blockPos(y));
if ((blockState.getMaterial() != Material.AIR && blockState.getBlock() != spaceBlock) || sidesClosed(world, surfaceCoord.blockPos(y), area) >= maxClosedSides) {
boolean isFloor = blockState == RCBlocks.genericSolid.getDefaultState();
safePoint = y + (isFloor ? 1 : floorDistance);
break;
}
}
for (int y = safePoint; y <= higherPoint.getY(); y++) set.add(surfaceCoord.blockPos(y));
if (safePoint > lowerPoint.getY()) {
for (int y = lowerPoint.getY(); y <= higherPoint.getY(); y++) {
IBlockState blockState = world.getBlockState(surfaceCoord.blockPos(y));
if ((blockState.getMaterial() != Material.AIR && blockState.getBlock() != spaceBlock) || sidesClosed(world, surfaceCoord.blockPos(y), area) >= maxClosedSides) {
safePoint = y - 1;
break;
}
}
}
for (int y = lowerPoint.getY(); y <= safePoint; y++) set.add(surfaceCoord.blockPos(y));
}
set.forEach(pos -> {
BlockPos down = pos.down();
BlockPos down2 = pos.down(2);
world.setBlockState(pos, pos.getY() > lowerPoint.getY() && !set.contains(down) && world.getBlockState(down).getBlock().isReplaceable(world, down) && world.getBlockState(down2).getBlock().isReplaceable(world, down2) && new BlockArea(pos.subtract(new Vec3i(2, 0, 2)), pos.add(new Vec3i(2, 0, 2))).stream().allMatch(set::contains) ? spaceBlock.getDefaultState().withProperty(BlockGenericSpace.TYPE, 1) : spaceBlock.getDefaultState());
});
}
use of net.minecraft.util.math.Vec3i in project Gaspunk by Ladysnake.
the class EntityGrenade method onImpact.
@Override
protected void onImpact(@Nonnull RayTraceResult result) {
if (result.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(result.getBlockPos()).isFullBlock() && this.ignoreTime-- <= 0) {
Vec3i hitVector = result.sideHit.getDirectionVec();
motionX *= hitVector.getX() * -0.4 + 0.2;
if (Math.abs(motionX) < 0.2)
motionX = 0;
motionY *= hitVector.getY() * -0.4 + 0.2;
if (Math.abs(motionY) < 0.3)
motionY = 0;
motionZ *= hitVector.getZ() * -0.4 + 0.2;
if (Math.abs(motionZ) < 0.2)
motionZ = 0;
this.ignoreTime = 2;
isAirBorne = true;
} else if (result.typeOfHit == RayTraceResult.Type.ENTITY) {
this.motionX *= -0.05;
this.motionY *= -0.05;
this.motionZ *= -0.05;
this.rotationYaw += 180.0F;
this.prevRotationYaw += 180.0F;
}
}
Aggregations