Java 类net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType 实例源码

项目:pnc-repressurized    文件:ModelProgrammingPuzzle.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
    TextureAtlasSprite widgetSprite = bakedTextureGetter.apply(getWidgetTexture(widget));
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    int width = widget.getWidth() + (widget.getParameters() != null && widget.getParameters().length > 0 ? 10 : 0);
    int height = widget.getHeight() + (widget.hasStepOutput() ? 5 : 0);

    Pair<Double, Double> maxUV = widget.getMaxUV();
    int textureSize = widget.getTextureSize();
    float scale = 1F / (float) Math.max(maxUV.getLeft(), maxUV.getRight());
    float transX = 0;//maxUV.getLeft().floatValue();
    float transY = -1 + maxUV.getRight().floatValue();
    transform = transform.compose(new TRSRTransformation(new Vector3f(0, 0, 0), null, new Vector3f(scale, scale, 1), null));
    transform = transform.compose(new TRSRTransformation(new Vector3f(transX, transY, 0), null, new Vector3f(1, 1, 1), null));

    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), NORTH_Z_BASE, widgetSprite, EnumFacing.NORTH, 0xffffffff));
    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), SOUTH_Z_BASE, widgetSprite, EnumFacing.SOUTH, 0xffffffff));

    return new BakedProgrammingPuzzle(this, builder.build(), widgetSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap());
}
项目:Infernum    文件:ModelSpellPage.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (baseSpellPageModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) baseSpellPageModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = baseSpellPageModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:Infernum    文件:ModelKnowledgeBook.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (baseKnowledgeBookModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) baseKnowledgeBookModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = baseKnowledgeBookModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:Infernum    文件:BakedModelKnowledgeBook.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (parentModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:Infernum    文件:BakedModelSpellPage.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (parentModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:DankNull    文件:TESRDankNullDock.java   
@Override
public void renderItem(@Nonnull ItemStack stack, TransformType transformType) {
    if (Block.getBlockFromItem(stack.getItem()) == ModBlocks.DANKNULL_DOCK) {
        GuiUtils.bindTexture(DankTextures.DOCK_TEXTURE);
        GlStateManager.enableLighting();
        GlStateManager.rotate(180, 0, 0, 180);
        GlStateManager.translate(-0.5, -1.5, 0.5);
        MODEL.render(0.0625F);
        GlStateManager.translate(0.5, 1.5, -0.5);
        GlStateManager.disableLighting();
        GlStateManager.disableDepth();
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        renderDankNull(stack);
    }
}
项目:DankNull    文件:DankNullRenderer.java   
public void renderItem(ItemStack stack, IBakedModel model) {
    if (!stack.isEmpty()) {
        if (model.isBuiltInRenderer() && !(stack.getItem() instanceof ItemDankNullHolder)) {
            Minecraft.getMinecraft().getItemRenderer().renderItem(EasyMappings.player(), stack, ItemCameraTransforms.TransformType.NONE);
        }
        else {
            RenderModel.render(model, stack);
            if (stack.hasEffect()) {
                if ((stack.getItem() instanceof ItemDankNull)) {
                    if (!Options.superShine) {
                        GlintEffectRenderer.apply(model, stack.getItemDamage());
                    }
                    else {
                        GlintEffectRenderer.apply2(model, DankNullUtils.getColor(stack.getItemDamage(), false));
                    }
                }
                else {
                    GlintEffectRenderer.apply(model, -1);
                }
            }
        }
    }
}
项目:BetterBeginningsReborn    文件:InfusionRender.java   
private void renderIngredients(TileEntityInfusionRepair te, double x, double y, double z, float partialTicks)
   {
GlStateManager.pushMatrix();
IItemHandler itemHandler = CapUtils.getItemHandler(te);
for(int slot = 0; slot < 8; slot++)
{
    ItemStack stack = itemHandler.getStackInSlot(TileEntityInfusionRepair.SLOT_ENCH_ITEM + 1 + slot);
    Vec2f ingredientPos = ingredientPositions[slot];
    if(Prep1_11.isEmpty(stack)) continue;

    GlStateManager.pushMatrix();
    GlStateManager.translate(ingredientPos.x * PIXEL_SIZE, -0.15F, ingredientPos.y * PIXEL_SIZE);
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    GlStateManager.rotate(((mc.player.ticksExisted + partialTicks) * 60.0f) / 10.0F, 0.0F, 1.0F, 0.0F);
    mc.getRenderItem().renderItem(stack, TransformType.GROUND);
    GlStateManager.scale(1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
   }
项目:BetterBeginningsReborn    文件:WickerBasketRender.java   
@Override
   public void render(TileEntityWickerBasket te, double x, double y, double z, float partialTicks,
           int destroyStage, float alpha)
   {
rand.setSeed(te.getWorld().getSeed());
IItemHandler itemHandler = CapUtils.getItemHandler(te);
for(int slot = 0; slot < itemHandler.getSlots(); slot++)
{
    GlStateManager.pushMatrix();
    //Translate into the centre of the basket, above the bottom
    GlStateManager.translate(x + 0.5F, y + 0.2F + 0.075F * slot, z + 0.5F);
    GlStateManager.translate(getRandDisplacement(rand), 0.0F, getRandDisplacement(rand));
    GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(360.0F * rand.nextFloat(), 0.0F, 0.0F, 1.0F);
    GlStateManager.scale(0.8F, 0.8F, 0.8F);
    Minecraft.getMinecraft().getRenderItem().renderItem(itemHandler.getStackInSlot(slot), TransformType.FIXED);
    GlStateManager.popMatrix();
}
   }
项目:CustomWorldGen    文件:MultiLayerModel.java   
public MultiLayerBakedModel(ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms)
{
    this.models = models;
    this.cameraTransforms = cameraTransforms;
    this.missing = missing;
    if(models.containsKey(Optional.absent()))
    {
        base = models.get(Optional.absent());
    }
    else
    {
        base = missing;
    }
    ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
    quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(models, Optional.<EnumFacing>absent()));
    for(EnumFacing side: EnumFacing.values())
    {
        quadBuilder.put(Optional.of(side), buildQuads(models, Optional.of(side)));
    }
    quads = quadBuilder.build();
}
项目:CustomWorldGen    文件:ItemLayerModel.java   
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, ItemOverrideList overrides, IBakedModel otherModel)
{
    this.quads = quads;
    this.particle = particle;
    this.transforms = transforms;
    this.overrides = overrides;
    if(otherModel != null)
    {
        this.otherModel = otherModel;
        this.isCulled = true;
    }
    else
    {
        ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
        for(BakedQuad quad : quads)
        {
            if(quad.getFace() == EnumFacing.SOUTH)
            {
                builder.add(quad);
            }
        }
        this.otherModel = new BakedItemModel(builder.build(), particle, transforms, overrides, this);
        isCulled = false;
    }
}
项目:BetterWithAddons    文件:ModelToolShardInner.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
    for(int i = 0; i < textures.size(); i++)
    {
        ResourceLocation tex = textures.get(i);
        if(tex.toString().equals("minecraft:missingno"))
            continue;
        TextureAtlasSprite sprite = bakedTextureGetter.apply(tex);

        String breakLocation = new ResourceLocation(Reference.MOD_ID,"items/breakmask").toString();
        TextureAtlasSprite breakTemplate = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(breakLocation);

        builder.addAll(getQuadsForSprite(i, breakTemplate, sprite, format, transform));
        //builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, NORTH_Z + Z_OFFSET * i, EnumFacing.NORTH, 0xffffffff));
       // builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, SOUTH_Z - Z_OFFSET * i, EnumFacing.SOUTH, 0xffffffff));
    }
    TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
    ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
    return new BakedItemModel(builder.build(), particle, map, null);
}
项目:BetterWithAddons    文件:ModelToolShardInner.java   
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, IBakedModel otherModel) {
    this.quads = quads;
    this.particle = particle;
    this.transforms = transforms;
    if(otherModel != null)
    {
        this.otherModel = otherModel;
        this.isCulled = true;
    }
    else
    {
        ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
        for(BakedQuad quad : quads)
        {
            if(quad.getFace() == EnumFacing.SOUTH)
            {
                builder.add(quad);
            }
        }
        this.otherModel = new BakedItemModel(builder.build(), particle, transforms, this);
        isCulled = false;
    }
}
项目:CrystalMod    文件:Fixed3DBlockModel.java   
/** Get the default transformations for inside inventories and third person */
    protected static ImmutableMap<TransformType, TRSRTransformation> getBlockTransforms() {
        ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();

        // Copied from ForgeBlockStateV1
        /*builder.put(TransformType.THIRD_PERSON, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, 1.5f / 16, -2.75f / 16),
                TRSRTransformation.quatFromYXZDegrees(new Vector3f(10, -45, 170)), new Vector3f(0.375f, 0.375f, 0.375f), null)));
*/
        // Gui
        {
            Matrix4f rotationMatrix = new Matrix4f();
            rotationMatrix.setIdentity();
            rotationMatrix = rotateTowardsFace(EnumFacing.SOUTH, EnumFacing.EAST);

            Matrix4f result = new Matrix4f();
            result.setIdentity();
            // Multiply by the last matrix transformation FIRST
            result.mul(rotationMatrix);

            TRSRTransformation trsr = new TRSRTransformation(result);

            builder.put(TransformType.GUI, trsr);
        }

        return builder.build();
    }
项目:CrystalMod    文件:ItemRenderFlag.java   
@Override
public void render(ItemStack stack) {
    TransformType type = lastTransform;
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5, 0.5, 0.5);
    GlStateManager.rotate(180, 1, 0, 0);
    if(type == TransformType.GUI){
        GlStateManager.translate(-1, -0.1, 0);
        GlStateManager.scale(0.8, 0.8, 0.8);
        GlStateManager.rotate(90, 0, 1, 0);
    }else if(type == TransformType.THIRD_PERSON_RIGHT_HAND){
        GlStateManager.rotate(90, 0, 1, 0);
        GlStateManager.rotate(80, -1, 0, 0);
        GlStateManager.rotate(-50, 0, 0, 1);
        GlStateManager.translate(-0.8, 0, 0.4);
    }else if(type == TransformType.GROUND || type == TransformType.FIRST_PERSON_RIGHT_HAND){
        GlStateManager.translate(-0.5, 0, 0.5);
        GlStateManager.rotate(-45, 0, 1, 0);
    }
    GlStateManager.translate(-0.5, -0.5, -0.5);
    int color = ItemNBTHelper.getInteger(stack, "FlagColor", Color.WHITE.getRGB());
    TagManager.getInstance().renderFlag(color, 90);
    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.popMatrix();
}
项目:CrystalMod    文件:RenderTileEntityCustomSpawner.java   
public void renderSpawner(CustomSpawnerBaseLogic baseLogic, double x, double y, double z, float partialTicks) {
    Entity entity = baseLogic.getEntityForRenderer();

    if (entity != null)
    {
        EntityEssenceInstance<?> essence = ItemMobEssence.getEssence(baseLogic.getEntityNameToSpawn());
        if(essence == null){
            return;
        }
        if (baseLogic.powered) partialTicks = 0f;
        GlStateManager.pushMatrix();
        entity.setWorld(baseLogic.getSpawnerWorld());

        float f1 = 0.4375F * essence.getRenderScale(TransformType.NONE);
        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float) (baseLogic.renderRotation1 + (baseLogic.renderRotation0 - baseLogic.renderRotation1) * partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        //GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.4F, 0.0F);
        GlStateManager.scale(f1, f1, f1);
        entity.setLocationAndAngles(x, y, z, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, true);
        GlStateManager.popMatrix();
    }
}
项目:Qbar    文件:BlueprintRender.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(
        final ItemCameraTransforms.TransformType cameraTransformType)
{
    if (cameraTransformType.equals(TransformType.GUI))
    {
        return Pair.of(this,
                new TRSRTransformation(new Vector3f(0F, 0, 0F), null,
                        new Vector3f(0.625F * 1.5f, 0.625F * 1.5f, 0.625F * 1.5f),
                        TRSRTransformation.quatFromXYZ(0, (float) Math.PI, 0)).getMatrix());
    }
    return Pair.of(this,
            new TRSRTransformation(new Vector3f(0F, -.2F, 0F), null,
                    new Vector3f(0.625F / 2, 0.625F / 2, 0.625F / 2),
                    TRSRTransformation.quatFromXYZ((float) -Math.PI / 2, 0, 0)).getMatrix());
}
项目:EnderStorage    文件:EnderTankItemRender.java   
@Override
public void renderItem(ItemStack item, TransformType transformType) {
    GlStateManager.pushMatrix();
    CCRenderState ccrs = CCRenderState.instance();
    ccrs.reset();
    ccrs.pullLightmap();
    Frequency frequency = Frequency.readFromStack(item);
    FluidStack fluidStack = TankSynchroniser.getClientLiquid(frequency);
    RenderTileEnderTank.renderTank(ccrs, 2, 0F, frequency, 0, 0, 0, 0);
    if (fluidStack != null && RenderUtils.shouldRenderFluid(fluidStack)) {
        RenderTileEnderTank.renderLiquid(fluidStack, 0, 0, 0);
    }
    //Fixes issues with inventory rendering.
    //The Portal renderer modifies blend and disables it.
    //Vanillas inventory relies on the fact that items don't modify gl so it never bothers to set it again.
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.popMatrix();
}
项目:ISBRH    文件:RenderExample.java   
@Override
public void renderInventoryBlock(ItemStack itemStack,
                                 TransformType transformType, int renderId) {

    BlockExample block = (BlockExample) Block.getBlockFromItem(itemStack.getItem());

    Tessellator tessellator = Tessellator.getInstance();
    SimpleBlockRender render = new SimpleBlockRender();
    render.worldRenderer = tessellator.getWorldRenderer();
    render.setRenderBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.1F, 0.8F);
    this.renderInInventory(tessellator, render, block, transformType);

    render.setRenderBounds(0.45F, 0.1F, 0.45F, 0.55F, 0.8F, 0.55F);
    this.renderInInventory(tessellator, render, block, transformType);

    render.setRenderBounds(0.0F, 0.8F, 0.0F, 1F, 0.9F, 1F);
    this.renderInInventory(tessellator, render, block, transformType);

}
项目:ISBRH    文件:RenderExample.java   
private void renderInInventory(Tessellator tessellator,
                               SimpleBlockRender render, BlockExample block, TransformType transformType) {
    GlStateManager.translate(-0.5F, -0.5F, -0.5F);
    GlStateManager.pushMatrix();

    if (transformType.equals(TransformType.THIRD_PERSON)) {
        GlStateManager.scale(0.55F, 0.55F, 0.55F);
        GlStateManager.rotate(45, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
        GlStateManager.translate(-1.4F, -1.9F, -1F);
    }

    render.renderInventoryStandardBlock(block, block.getDefaultState(), tessellator);
    GlStateManager.popMatrix();
    GlStateManager.translate(0.5F, 0.5F, 0.5F);
}
项目:ISBRH    文件:RenderItemISBRH.java   
@Override
protected void renderItemModelTransform(ItemStack stack, IBakedModel model,
        ItemCameraTransforms.TransformType cameraTransformType)
{
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .setBlurMipmap(false, false);
    this.preTransform(stack);
    GlStateManager.enableRescaleNormal();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.pushMatrix();

    model = net.minecraftforge.client.ForgeHooksClient
            .handleCameraTransforms(model, cameraTransformType);

    renderItem(stack, model, cameraTransformType);
    GlStateManager.popMatrix();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableBlend();
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .restoreLastBlurMipmap();
}
项目:ISBRH    文件:RenderItemISBRH.java   
@Override
public void renderItemIntoGUI(ItemStack stack, int x, int y)
{
    IBakedModel ibakedmodel = this.getItemModelMesher().getItemModel(stack);
    GlStateManager.pushMatrix();
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .setBlurMipmap(false, false);
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableAlpha();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    setupGuiTransform(x, y, ibakedmodel.isGui3d());
    applyTransform(ibakedmodel.getItemCameraTransforms().gui);
    renderItem(stack, ibakedmodel, ItemCameraTransforms.TransformType.GUI);
    GlStateManager.disableAlpha();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableLighting();
    GlStateManager.popMatrix();
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .restoreLastBlurMipmap();
}
项目:Hard-Science    文件:HSOBJModelWrapper.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();

    // This is borked up for the 1st and 3rd person transforms - OBJ models not needed right now so setting aside
    // Qould normally not belong here - should register transforms at item creation time and then retrieve them here.

    builder.put(TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(  0.250f, 1.000f,  0.000f, 000, -90,  25, 0.65f));
    builder.put(TransformType.FIRST_PERSON_LEFT_HAND,  getTransform( -0.250f, 1.000f,  0.000f, 000,  90, -25, 0.65f));

    builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(  0.000f, 0.000f,  0.000f, 000, 000, 000, 1.0f));
    builder.put(TransformType.THIRD_PERSON_LEFT_HAND,  getTransform(  0.000f, 0.000f,  0.000f, 000, 000, 000, 1.0f));

    builder.put(TransformType.FIXED,                   getTransform(  0.500f, 0.500f,  0.500f, 0, 180, 0,   0.9f));
    builder.put(TransformType.GUI,                     getTransform(  0.500f, 0.500f,  0.500f, 0, 0, 45,  1.0f));
    builder.put(TransformType.GROUND,                  getTransform(  0.500f, 0.400f,  0.500f, 0, 0, 0,     0.6f));


    IModelState perspectiveState = new SimpleModelState(builder.build());

    return wrapped.bake(perspectiveState, format, bakedTextureGetter);
}
项目:MCAnm    文件:ModelDescription.java   
private ImmutableMap<TransformType, TRSRTransformation> parseViewMapping(
        JsonObject parentObject,
        JsonDeserializationContext context) {
    if (!parentObject.has("transforms")) {
        return EMPTY_MAP;
    }
    JsonElement viewElement = parentObject.get("transforms");
    if (viewElement.isJsonPrimitive() && viewElement.getAsJsonPrimitive().isString()) {
        String viewString = viewElement.getAsString();
        ResourceLocation id = new ResourceLocation(viewString);
        return PREDEFINED_TRANSFORMS.getOrDefault(id, EMPTY_MAP);
    }
    if (viewElement.isJsonObject()) {
        JsonObject viewObject = viewElement.getAsJsonObject();

        return parseTransformObject(context, viewObject);
    }
    ImmutableMap.Builder<TransformType, TRSRTransformation> result = ImmutableMap.builder();
    TRSRTransformation onlyTransformation = context.deserialize(viewElement, TRSRTransformation.class);
    for (TransformType transformType : TransformType.values()) {
        result.put(transformType, onlyTransformation);
    }
    return result.build();
}
项目:MCAnm    文件:ModelDescription.java   
private ImmutableMap<TransformType, TRSRTransformation> parseTransformObject(
        JsonDeserializationContext context,
        JsonObject viewObject) {
    ListMultimap<String, JsonElement> transformEntries = MultimapBuilder.hashKeys().arrayListValues(1).build();
    for (Map.Entry<String, JsonElement> entry : viewObject.entrySet()) {
        transformEntries.put(entry.getKey().toUpperCase(Locale.ROOT), entry.getValue());
    }

    ImmutableMap.Builder<TransformType, TRSRTransformation> result = ImmutableMap.builder();
    for (TransformType transformType : TransformType.values()) {
        String transformName = transformType.name().toUpperCase(Locale.ROOT);
        List<JsonElement> entryList = transformEntries.get(transformName);
        if (entryList.isEmpty()) {
            continue;
        }
        if (entryList.size() > 1) {
            throw new JsonParseException("Two transform entries for " + transformName);
        }
        JsonElement onlyElement = entryList.get(0);
        result.put(transformType, context.deserialize(onlyElement, TRSRTransformation.class));
    }
    return result.build();
}
项目:MCAnm    文件:ModelLoader.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    Matrix4f matr = new Matrix4f();
    matr.setIdentity();
    if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) {
        matr.setTranslation(new Vector3f(0.5f, 0.375f, 0.5f));
    }
    if (cameraTransformType == TransformType.THIRD_PERSON_LEFT_HAND) {
        matr.setTranslation(new Vector3f(-0.5f, 0.375f, 0.5f));
    }
    if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) {
        matr.setTranslation(new Vector3f(0.25f, 0, 0.5f));
    }
    if (cameraTransformType == TransformType.FIRST_PERSON_LEFT_HAND) {
        matr.setTranslation(new Vector3f(-0.75f, 0, 0.5f));
    }
    // Additional transformations
    TRSRTransformation tr = bakedState.apply(Optional.of(cameraTransformType)).orNull();
    if (tr != null && tr != TRSRTransformation.identity()) {
        matr.mul(tr.getMatrix(), matr);
    }
    return Pair.of(this, matr);
}
项目:ISBRH    文件:RenderExample.java   
@Override
public void renderInventoryBlock(ItemStack itemStack,
                                 TransformType transformType, int renderId) {

    BlockExample block = (BlockExample) Block.getBlockFromItem(itemStack.getItem());

    Tessellator tessellator = Tessellator.getInstance();
    SimpleBlockRender render = new SimpleBlockRender();
    render.worldRenderer = tessellator.getWorldRenderer();
    render.setRenderBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.1F, 0.8F);
    this.renderInInventory(tessellator, render, block, transformType);

    render.setRenderBounds(0.45F, 0.1F, 0.45F, 0.55F, 0.8F, 0.55F);
    this.renderInInventory(tessellator, render, block, transformType);

    render.setRenderBounds(0.0F, 0.8F, 0.0F, 1F, 0.9F, 1F);
    this.renderInInventory(tessellator, render, block, transformType);

}
项目:ISBRH    文件:RenderExample.java   
private void renderInInventory(Tessellator tessellator,
                               SimpleBlockRender render, BlockExample block, TransformType transformType) {
    GlStateManager.translate(-0.5F, -0.5F, -0.5F);
    GlStateManager.pushMatrix();

    if (transformType.equals(TransformType.THIRD_PERSON)) {
        GlStateManager.scale(0.55F, 0.55F, 0.55F);
        GlStateManager.rotate(45, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
        GlStateManager.translate(-1.4F, -1.9F, -1F);
    }

    render.renderInventoryStandardBlock(block, block.getDefaultState(), tessellator);
    GlStateManager.popMatrix();
    GlStateManager.translate(0.5F, 0.5F, 0.5F);
}
项目:ISBRH    文件:RenderItemISBRH.java   
@Override
protected void renderItemModelTransform(ItemStack stack, IBakedModel model,
        ItemCameraTransforms.TransformType cameraTransformType)
{
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .setBlurMipmap(false, false);
    this.preTransform(stack);
    GlStateManager.enableRescaleNormal();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.pushMatrix();

    model = net.minecraftforge.client.ForgeHooksClient
            .handleCameraTransforms(model, cameraTransformType);

    renderItem(stack, model, cameraTransformType);
    GlStateManager.popMatrix();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableBlend();
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .restoreLastBlurMipmap();
}
项目:ISBRH    文件:RenderItemISBRH.java   
@Override
public void renderItemIntoGUI(ItemStack stack, int x, int y)
{
    IBakedModel ibakedmodel = this.getItemModelMesher().getItemModel(stack);
    GlStateManager.pushMatrix();
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .setBlurMipmap(false, false);
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableAlpha();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    setupGuiTransform(x, y, ibakedmodel.isGui3d());
    applyTransform(ibakedmodel.getItemCameraTransforms().gui);
    renderItem(stack, ibakedmodel, ItemCameraTransforms.TransformType.GUI);
    GlStateManager.disableAlpha();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableLighting();
    GlStateManager.popMatrix();
    this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
    this.textureManager.getTexture(TextureMap.locationBlocksTexture)
            .restoreLastBlurMipmap();
}
项目:BetterChests    文件:ModelPortableBarrel.java   
@Override
public void render(ItemStack stack, float patrtialTicks) {
    GlStateManager.pushMatrix();
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    renderItem.renderItem(stack, parent);
    InventoryBPortableBarrel barrel = BlocksItemsBetterChests.betterportablebarrel.getInventoryFor(stack, null);
    if (barrel != null && barrel.getChestPart().isItemSet()) {
        InventoryPartBarrel part = barrel.getChestPart();
        GlStateManager.pushMatrix();
        GlStateManager.translate(0, 0, -0.05);
        GlStateManager.scale(0.8, 0.8, 0.8);

        renderItem.renderItem(part.getDummy(), TransformType.FIXED);

        GlStateManager.enableBlend();
        GlStateManager.popMatrix();
    }
    GlStateManager.popMatrix();
}
项目:BetterChests    文件:ClientEventListener.java   
@SubscribeEvent
public void renderPlayer(RenderPlayerEvent.Post event) {
    EntityPlayer player = event.getEntityPlayer();

    ItemStack bag = getBagInInv(player);

    if (!bag.isEmpty()) {
        GL11.glPushMatrix();

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef(0.0F, 17 * ONE_PIXEL, 0.0F);
        GL11.glRotatef( - player.renderYawOffset, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(0.0F, 0.0F, -4 * ONE_PIXEL);
        if (player.isSneaking()) {
            GL11.glTranslatef(0, -5 * ONE_PIXEL, 0);
            GL11.glRotatef(28.6F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0, 0, -3 * ONE_PIXEL);
        }

        Minecraft.getMinecraft().getRenderItem().renderItem(bag, TransformType.FIXED);
        GL11.glPopMatrix();
    }
}
项目:OpenBlocks    文件:DevNullItemOverride.java   
@Override
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
    final Pair<ItemStack, Integer> r = ItemDevNull.getContents(stack);
    final int depth = Math.max(1, r.getRight());

    if (depth >= ItemDevNull.STACK_LIMIT)
        return emptyFrameModels2d.get(ItemDevNull.STACK_LIMIT);

    final int modelId = depth - 1;
    final ItemStack innerStack = r.getLeft();
    if (innerStack.isEmpty())
        return emptyFrameModels2d.get(modelId);

    final IBakedModel innerModel = getItemModel(innerStack, world, entity);

    final ModelKey key = new ModelKey(innerModel, modelId, innerStack.getCount(), TransformType.NONE);
    return wrappedModelCache.getUnchecked(key).getLeft();
}
项目:OpenBlocks    文件:PathModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    final Map<TransformType, Matrix4f> transforms = extractInventoryTransforms(state, format, bakedTextureGetter);

    List<TextureAtlasSprite> textures = Lists.newArrayList();
    Optional<TextureAtlasSprite> maybeParticle = Optional.empty();

    for (Map.Entry<String, TextureAtlasSprite> e : this.textures.bakeWithKeys(bakedTextureGetter).entrySet()) {
        if (e.getKey().equals("particle")) {
            maybeParticle = Optional.of(e.getValue());
        } else {
            textures.add(e.getValue());
        }
    }

    final TextureAtlasSprite missing = bakedTextureGetter.apply(TextureMap.LOCATION_MISSING_TEXTURE);
    final TextureAtlasSprite particle = maybeParticle.orElse(missing);

    if (textures.isEmpty()) textures.add(missing);

    return new Baked(particle, textures, format, transforms);
}
项目:OpenBlocks    文件:PathModel.java   
private static Map<TransformType, Matrix4f> extractInventoryTransformsFromState(IModelState state) {
    final Map<TransformType, Matrix4f> output = Maps.newHashMap();
    for (TransformType type : TransformType.values()) {
        Matrix4f mat = null;
        final Optional<TRSRTransformation> maybeTransform = state.apply(Optional.of(type));
        if (maybeTransform.isPresent()) {
            final TRSRTransformation transform = maybeTransform.get();
            if (!transform.equals(TRSRTransformation.identity())) {
                mat = TRSRTransformation.blockCornerToCenter(transform).getMatrix();
            }
        }

        output.put(type, mat);
    }
    return output;
}
项目:OpenModsLib    文件:MultiLayerModel.java   
public MultiLayerBakedModel(Map<BlockRenderLayer, IBakedModel> models, IBakedModel base, IBakedModel missing, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms) {
    super(base, cameraTransforms);
    this.models = ImmutableMap.copyOf(models);
    this.missing = missing;

    final List<BakedQuad> quads = Lists.newArrayList();

    for (BlockRenderLayer layer : BlockRenderLayer.values()) {
        final IBakedModel model = models.get(layer);
        if (model != null) {
            buildQuadsForLayer(quads, model);
        }
    }

    this.quads = ImmutableList.copyOf(quads);
}
项目:OpenModsLib    文件:PerspectiveAwareModel.java   
@Override
public IBakedModel bake(final IModelState state, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    final Map<TransformType, IBakedModel> bakedModels = Maps.transformValues(models, location -> bakeModel(location, state, format, bakedTextureGetter));

    IModel missing = ModelLoaderRegistry.getMissingModel();
    IBakedModel bakedMissing = missing.bake(missing.getDefaultState(), format, bakedTextureGetter);

    final IBakedModel bakedBase;
    if (base.isPresent()) {
        bakedBase = bakeModel(base.get(), state, format, bakedTextureGetter);
    } else {
        bakedBase = bakedMissing;
    }

    return new PerspectiveAwareBakedModel(
            bakedModels,
            bakedBase,
            PerspectiveMapWrapper.getTransforms(state));
}
项目:EnderIO    文件:MagnetLayer.java   
@Override
public void doRenderLayer(@Nonnull RenderPlayer renderPlayer, EntityEquipmentSlot equipmentSlot, @Nonnull ItemStack piece,
    @Nonnull AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_,
    float p_177141_7_, float scale) {
  if (equipmentSlot != null) {
    return;
  }

  GlStateManager.pushMatrix();

  if (entitylivingbaseIn.isSneaking()) {
    GlStateManager.translate(0.0F, 0.2F, 0.0F);
  }

  renderPlayer.getMainModel().bipedHead.postRender(0.0625F);
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

  GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
  GlStateManager.scale(0.75f, 0.9f, 2);
  GlStateManager.translate(0.0F, 2.7f * 0.0625F, .49 * 0.0625F);

  Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, piece, TransformType.NONE);

  GlStateManager.popMatrix();
}
项目:pnc-repressurized    文件:ModelProgrammingPuzzle.java   
public BakedProgrammingPuzzle(ModelProgrammingPuzzle parent, ImmutableList<BakedQuad> quads,
                              TextureAtlasSprite particle, VertexFormat format,
                              ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
                              Map<String, IBakedModel> cache) {
    this.quads = quads;
    this.particle = particle;
    this.format = format;
    this.parent = parent;
    this.transforms = transforms;
    this.cache = cache;
    this.overridesList = new PuzzleOverrideList(Collections.emptyList(), this);
}
项目:DankNull    文件:TESRDankNullDock.java   
public static CCModelState block() {
    ImmutableMap.Builder<TransformType, TRSRTransformation> defaultBlockBuilder = ImmutableMap.builder();
    defaultBlockBuilder.put(TransformType.GUI, TransformUtils.get(0, 0, 0, 30, 225, 0, 0.625f));
    defaultBlockBuilder.put(TransformType.GROUND, TransformUtils.get(0, 3, 0, 0, 0, 0, 0.25f));
    defaultBlockBuilder.put(TransformType.FIXED, TransformUtils.get(0, 0, 5, 90, 0, 0, 0.75f));
    defaultBlockBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, TransformUtils.get(0, 2.5f, 3f, 75, 45, 0, 0.375f));
    defaultBlockBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, TransformUtils.leftify(TransformUtils.get(0, 2.5f, 3F, 75, 45, 0, 0.375f)));
    defaultBlockBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, TransformUtils.get(0, 4f, 0, 0, 45, 0, 0.4f));
    defaultBlockBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, TransformUtils.get(0, 4f, 0, 0, 225, 0, 0.4f));
    return new CCModelState(defaultBlockBuilder.build());
}