Search in sources :

Example 1 with Vec3i

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);
}
Also used : Vec3i(net.minecraft.util.math.Vec3i) Vector4f(javax.vecmath.Vector4f)

Example 2 with Vec3i

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();
    }
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Vec3i(net.minecraft.util.math.Vec3i) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

Example 3 with Vec3i

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;
}
Also used : Vec3i(net.minecraft.util.math.Vec3i) IBlockState(net.minecraft.block.state.IBlockState) DrawBlockBasedObjectType(com.microsoft.Malmo.Schemas.DrawBlockBasedObjectType) BuildBattleDecorator(com.microsoft.Malmo.Schemas.BuildBattleDecorator) XMLBlockState(com.microsoft.Malmo.Utils.BlockDrawingHelper.XMLBlockState)

Example 4 with Vec3i

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();
    }
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Vec3i(net.minecraft.util.math.Vec3i) Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 5 with Vec3i

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);
                }
            }
        }
    }
}
Also used : Vec3i(net.minecraft.util.math.Vec3i) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Vec3i (net.minecraft.util.math.Vec3i)65 BlockPos (net.minecraft.util.math.BlockPos)35 IBlockState (net.minecraft.block.state.IBlockState)15 World (net.minecraft.world.World)12 EnumFacing (net.minecraft.util.EnumFacing)7 IBeeModifier (forestry.api.apiculture.IBeeModifier)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 Tessellator (net.minecraft.client.renderer.Tessellator)4 Vec3d (net.minecraft.util.math.Vec3d)4 Random (java.util.Random)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 EnumTemperature (forestry.api.core.EnumTemperature)2 ICheckPollinatable (forestry.api.genetics.ICheckPollinatable)2 EffectLightning (hellfirepvp.fracture.client.effect.fx.EffectLightning)2 EntityFXFacingParticle (hellfirepvp.fracture.client.effect.fx.EntityFXFacingParticle)2 FissureData (hellfirepvp.fracture.common.fissure.FissureData)2 Vector3 (hellfirepvp.fracture.common.util.Vector3)2 BlockArea (ivorius.ivtoolkit.blocks.BlockArea)2 IvBlockCollection (ivorius.ivtoolkit.blocks.IvBlockCollection)2 IvWorldData (ivorius.ivtoolkit.tools.IvWorldData)2