use of net.minecraft.util.math.Vec3i in project MinecraftForge by MinecraftForge.
the class TRSRTransformation method rotate.
public static EnumFacing rotate(Matrix4f matrix, EnumFacing facing) {
Vec3i dir = facing.getDirectionVec();
Vector4f vec = new Vector4f(dir.getX(), dir.getY(), dir.getZ(), 0);
matrix.transform(vec);
return EnumFacing.getFacingFromVector(vec.x, vec.y, vec.z);
}
use of net.minecraft.util.math.Vec3i in project Overloaded by CJ-MC-Mods.
the class ModelUtils method renderQuadsRGB.
public static void renderQuadsRGB(List<BakedQuad> listQuads, float r, float g, float b) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
int i = 0;
for (int j = listQuads.size(); i < j; ++i) {
BakedQuad bakedquad = (BakedQuad) listQuads.get(i);
vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
vertexbuffer.addVertexData(bakedquad.getVertexData());
vertexbuffer.putColorRGB_F4(r, g, b);
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 malmo by Microsoft.
the class BuildBattleDecoratorImplementation method parseParameters.
/**
* Attempt to parse the given object as a set of parameters for this handler.
*
* @param params the parameter block to parse
* @return true if the object made sense for this handler; false otherwise.
*/
@Override
public boolean parseParameters(Object params) {
if (params == null || !(params instanceof BuildBattleDecorator))
return false;
this.params = (BuildBattleDecorator) params;
this.sourceBounds = this.params.getGoalStructureBounds();
this.destBounds = this.params.getPlayerStructureBounds();
this.delta = new Vec3i(destBounds.getMin().getX() - sourceBounds.getMin().getX(), destBounds.getMin().getY() - sourceBounds.getMin().getY(), destBounds.getMin().getZ() - sourceBounds.getMin().getZ());
this.structureVolume = volumeOfBounds(this.sourceBounds);
assert (this.structureVolume == volumeOfBounds(this.destBounds));
this.dest = new ArrayList<IBlockState>(Collections.nCopies(this.structureVolume, (IBlockState) null));
this.source = new ArrayList<IBlockState>(Collections.nCopies(this.structureVolume, (IBlockState) null));
DrawBlockBasedObjectType tickBlock = this.params.getBlockTypeOnCorrectPlacement();
DrawBlockBasedObjectType crossBlock = this.params.getBlockTypeOnIncorrectPlacement();
this.blockTypeOnCorrectPlacement = (tickBlock != null) ? new XMLBlockState(tickBlock.getType(), tickBlock.getColour(), tickBlock.getFace(), tickBlock.getVariant()) : null;
this.blockTypeOnIncorrectPlacement = (crossBlock != null) ? new XMLBlockState(crossBlock.getType(), crossBlock.getColour(), crossBlock.getFace(), crossBlock.getVariant()) : null;
return true;
}
use of net.minecraft.util.math.Vec3i in project MorePlanets by SteveKunG.
the class ClientRendererUtil method renderModelBrightnessColorQuads.
private static void renderModelBrightnessColorQuads(float brightness, float red, float green, float blue, List<BakedQuad> listQuads) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder vertexbuffer = tessellator.getBuffer();
int i = 0;
for (int j = listQuads.size(); i < j; ++i) {
BakedQuad bakedquad = listQuads.get(i);
vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
vertexbuffer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex()) {
ClientRendererUtil.putColorRGB_F4(vertexbuffer, red * brightness, green * brightness, blue * brightness);
} else {
ClientRendererUtil.putColorRGB_F4(vertexbuffer, brightness, brightness, brightness);
}
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
vertexbuffer.putNormal(vec3i.getX(), vec3i.getY(), vec3i.getZ());
tessellator.draw();
}
}
use of net.minecraft.util.math.Vec3i in project ForestryMC by ForestryMC.
the class WorldGenHelper method generateSphere.
public static void generateSphere(World world, BlockPos center, int radius, ITreeBlockType block, EnumReplaceMode replace) {
Vec3i start = new Vec3i(center.getX() - radius, center.getY() - radius, center.getZ() - radius);
Vec3i area = new Vec3i(radius * 2 + 1, radius * 2 + 1, radius * 2 + 1);
for (int x = start.getX(); x < start.getX() + area.getX(); x++) {
for (int y = start.getY() + area.getY() - 1; y >= start.getY(); y--) {
// generating top-down is faster for lighting calculations
for (int z = start.getZ(); z < start.getZ() + area.getZ(); z++) {
if (center.getDistance(x, y, z) <= radius + 0.01) {
addBlock(world, new BlockPos(x, y, z), block, replace);
}
}
}
}
}
Aggregations