当前位置: 首页>>代码示例>>Java>>正文


Java MathHelper.getPositionRandom方法代码示例

本文整理汇总了Java中net.minecraft.util.math.MathHelper.getPositionRandom方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.getPositionRandom方法的具体用法?Java MathHelper.getPositionRandom怎么用?Java MathHelper.getPositionRandom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.math.MathHelper的用法示例。


在下文中一共展示了MathHelper.getPositionRandom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Builder

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public Builder(IBlockState state, IBakedModel model, TextureAtlasSprite texture, BlockPos pos)
{
    this(model.isAmbientOcclusion(), model.isGui3d(), model.getItemCameraTransforms(), model.getOverrides());
    this.builderTexture = model.getParticleTexture();
    long i = MathHelper.getPositionRandom(pos);

    for (EnumFacing enumfacing : EnumFacing.values())
    {
        this.addFaceQuads(state, model, texture, enumfacing, i);
    }

    this.addGeneralQuads(state, model, texture, i);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:SimpleBakedModel.java

示例2: render

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
@Override
public void render(TileCodeStorage te, double x, double y, double z, float partialTicks, int destroyStage, float partial, BufferBuilder buffer, Tessellator tessellator)
{
    IBlockState st = te.getWorld().getBlockState(te.getPos());
    if(st.getBlock() != BlockRegistry.code_storage)
        return;

    GlStateManager.pushMatrix();
    resetTrans(te);
    GlStateManager.translate(0.5f, 0, 0.5f);
    GlStateManager.rotate(PXLMC.getHorizontalRotation(st.getValue(HorizontalFacingController.FACING_H)), 0, 1, 0);
    GlStateManager.translate(-0.5f, 0, -0.5f);
    setTrans(te);

    long rnd = MathHelper.getPositionRandom(te.getPos());

    //body
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    PXLModelRenderer.renderModelTESR(te.getWorld(), BODY.get(), st, te.getPos(), buffer, false, rnd);
    tessellator.draw();

    //top
    GlStateManager.pushMatrix();
    String state = te.anim.getState();
    if(!state.equals("closed"))
    {
        resetTrans(te);
        GlStateManager.translate(0.5f, 0, 0.5f);
        GlStateManager.translate(0, 0.703f, 0.4457f);

        if(state.equals("opened"))
            GlStateManager.rotate(90, 1, 0, 0);
        if(state.equals("opening") || state.equals("closing"))
        {
            if(!te.anim_data.startedOpeningAnim)
            {
                te.anim_data.animStartTime = System.currentTimeMillis();
                te.anim_data.startedOpeningAnim = true;
            }
            int degrees = (int)((System.currentTimeMillis() - te.anim_data.animStartTime) / 5);
            if(degrees >= 90)
            {
                degrees = 90;
                te.anim.changeState(state.equals("opening") ? "opened" : "closed");
                te.anim_data.startedOpeningAnim = false;
            }
            GlStateManager.rotate(state.equals("opening") ? degrees : 90 - degrees, 1, 0, 0);
        }

        GlStateManager.translate(0, -0.703f, -0.4457f);
        GlStateManager.translate(-0.5f, 0, -0.5f);
        setTrans(te);
    }
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    PXLModelRenderer.renderModelTESR(te.getWorld(), TOP.get(), st.getBlock().getExtendedState(st, te.getWorld(), te.getPos()), te.getPos(), buffer, false, rnd);
    tessellator.draw();
    GlStateManager.popMatrix();

    GlStateManager.popMatrix();
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:61,代码来源:TESRCodeStorage.java

示例3: renderQuadsSmooth

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private void renderQuadsSmooth(IBlockAccess blockAccessIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, List<BakedQuad> list, float[] quadBounds, BitSet bitSet, BlockModelRenderer.AmbientOcclusionFace aoFace)
{
    double d0 = (double)posIn.getX();
    double d1 = (double)posIn.getY();
    double d2 = (double)posIn.getZ();
    Block block = stateIn.getBlock();
    Block.EnumOffsetType block$enumoffsettype = block.getOffsetType();

    if (block$enumoffsettype != Block.EnumOffsetType.NONE)
    {
        long i = MathHelper.getPositionRandom(posIn);
        d0 += ((double)((float)(i >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
        d2 += ((double)((float)(i >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;

        if (block$enumoffsettype == Block.EnumOffsetType.XYZ)
        {
            d1 += ((double)((float)(i >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
        }
    }

    int l = 0;

    for (int j = list.size(); l < j; ++l)
    {
        BakedQuad bakedquad = (BakedQuad)list.get(l);
        this.fillQuadBounds(stateIn, bakedquad.getVertexData(), bakedquad.getFace(), quadBounds, bitSet);
        aoFace.updateVertexBrightness(blockAccessIn, stateIn, posIn, bakedquad.getFace(), quadBounds, bitSet);
        buffer.addVertexData(bakedquad.getVertexData());
        buffer.putBrightness4(aoFace.vertexBrightness[0], aoFace.vertexBrightness[1], aoFace.vertexBrightness[2], aoFace.vertexBrightness[3]);
        if(bakedquad.shouldApplyDiffuseLighting())
        {
            float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.getFace());
            aoFace.vertexColorMultiplier[0] *= diffuse;
            aoFace.vertexColorMultiplier[1] *= diffuse;
            aoFace.vertexColorMultiplier[2] *= diffuse;
            aoFace.vertexColorMultiplier[3] *= diffuse;
        }
        if (bakedquad.hasTintIndex())
        {
            int k = this.blockColors.colorMultiplier(stateIn, blockAccessIn, posIn, bakedquad.getTintIndex());

            if (EntityRenderer.anaglyphEnable)
            {
                k = TextureUtil.anaglyphColor(k);
            }

            float f = (float)(k >> 16 & 255) / 255.0F;
            float f1 = (float)(k >> 8 & 255) / 255.0F;
            float f2 = (float)(k & 255) / 255.0F;
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[0] * f, aoFace.vertexColorMultiplier[0] * f1, aoFace.vertexColorMultiplier[0] * f2, 4);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[1] * f, aoFace.vertexColorMultiplier[1] * f1, aoFace.vertexColorMultiplier[1] * f2, 3);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[2] * f, aoFace.vertexColorMultiplier[2] * f1, aoFace.vertexColorMultiplier[2] * f2, 2);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[3] * f, aoFace.vertexColorMultiplier[3] * f1, aoFace.vertexColorMultiplier[3] * f2, 1);
        }
        else
        {
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[0], aoFace.vertexColorMultiplier[0], aoFace.vertexColorMultiplier[0], 4);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[1], aoFace.vertexColorMultiplier[1], aoFace.vertexColorMultiplier[1], 3);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[2], aoFace.vertexColorMultiplier[2], aoFace.vertexColorMultiplier[2], 2);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[3], aoFace.vertexColorMultiplier[3], aoFace.vertexColorMultiplier[3], 1);
        }

        buffer.putPosition(d0, d1, d2);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:66,代码来源:BlockModelRenderer.java


注:本文中的net.minecraft.util.math.MathHelper.getPositionRandom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。