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


Java MathHelper.smallestEncompassingPowerOfTwo方法代码示例

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


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

示例1: doStitch

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public void doStitch()
{
    Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])((Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]));
    Arrays.sort((Object[])astitcher$holder);

    for (Stitcher.Holder stitcher$holder : astitcher$holder)
    {
        if (!this.allocateSlot(stitcher$holder))
        {
            String s = String.format("Unable to fit: %s, size: %dx%d, atlas: %dx%d, atlasMax: %dx%d - Maybe try a lower resolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight()), Integer.valueOf(this.currentWidth), Integer.valueOf(this.currentHeight), Integer.valueOf(this.maxWidth), Integer.valueOf(this.maxHeight)});
            throw new StitcherException(stitcher$holder, s);
        }
    }

    this.currentWidth = MathHelper.smallestEncompassingPowerOfTwo(this.currentWidth);
    this.currentHeight = MathHelper.smallestEncompassingPowerOfTwo(this.currentHeight);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:Stitcher.java

示例2: detectMaxMipmapLevel

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private int detectMaxMipmapLevel(Map p_detectMaxMipmapLevel_1_, IResourceManager p_detectMaxMipmapLevel_2_)
{
    int i = this.detectMinimumSpriteSize(p_detectMaxMipmapLevel_1_, p_detectMaxMipmapLevel_2_, 20);

    if (i < 16)
    {
        i = 16;
    }

    i = MathHelper.smallestEncompassingPowerOfTwo(i);

    if (i > 16)
    {
        Config.log("Sprite size: " + i);
    }

    int j = MathHelper.log2(i);

    if (j < 4)
    {
        j = 4;
    }

    return j;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:TextureMap.java

示例3: smallestEncompassingPowerOfTwo

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int smallestEncompassingPowerOfTwo(int p_smallestEncompassingPowerOfTwo_0_)
{
    return MathHelper.smallestEncompassingPowerOfTwo(p_smallestEncompassingPowerOfTwo_0_);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:RealmsMth.java

示例4: expandAndAllocateSlot

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
 * Expand stitched texture in order to make space for specified tile
 */
private boolean expandAndAllocateSlot(Stitcher.Holder p_94311_1_)
{
    int i = Math.min(p_94311_1_.getWidth(), p_94311_1_.getHeight());
    int j = Math.max(p_94311_1_.getWidth(), p_94311_1_.getHeight());
    int k = MathHelper.smallestEncompassingPowerOfTwo(this.currentWidth);
    int l = MathHelper.smallestEncompassingPowerOfTwo(this.currentHeight);
    int i1 = MathHelper.smallestEncompassingPowerOfTwo(this.currentWidth + i);
    int j1 = MathHelper.smallestEncompassingPowerOfTwo(this.currentHeight + i);
    boolean flag = i1 <= this.maxWidth;
    boolean flag1 = j1 <= this.maxHeight;

    if (!flag && !flag1)
    {
        return false;
    }
    else
    {
        int k1 = MathUtils.roundDownToPowerOfTwo(this.currentHeight);
        boolean flag2 = flag && i1 <= 2 * k1;

        if (this.currentWidth == 0 && this.currentHeight == 0)
        {
            flag2 = true;
        }

        Stitcher.Slot stitcher$slot;

        if (flag2)
        {
            if (p_94311_1_.getWidth() > p_94311_1_.getHeight())
            {
                p_94311_1_.rotate();
            }

            if (this.currentHeight == 0)
            {
                this.currentHeight = p_94311_1_.getHeight();
            }

            stitcher$slot = new Stitcher.Slot(this.currentWidth, 0, p_94311_1_.getWidth(), this.currentHeight);
            this.currentWidth += p_94311_1_.getWidth();
        }
        else
        {
            stitcher$slot = new Stitcher.Slot(0, this.currentHeight, this.currentWidth, p_94311_1_.getHeight());
            this.currentHeight += p_94311_1_.getHeight();
        }

        stitcher$slot.addSlot(p_94311_1_);
        this.stitchSlots.add(stitcher$slot);
        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:57,代码来源:Stitcher.java

示例5: isPowerOfTwo

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static boolean isPowerOfTwo(int p_isPowerOfTwo_0_)
{
    int i = MathHelper.smallestEncompassingPowerOfTwo(p_isPowerOfTwo_0_);
    return i == p_isPowerOfTwo_0_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:TextureUtils.java

示例6: scaleToPowerOfTwo

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int scaleToPowerOfTwo(int p_scaleToPowerOfTwo_0_, int p_scaleToPowerOfTwo_1_)
{
    int i = Math.max(p_scaleToPowerOfTwo_0_, p_scaleToPowerOfTwo_1_);
    i = MathHelper.smallestEncompassingPowerOfTwo(i);
    return i;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:TextureUtils.java

示例7: roundDownToPowerOfTwo

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int roundDownToPowerOfTwo(int p_roundDownToPowerOfTwo_0_)
{
    int i = MathHelper.smallestEncompassingPowerOfTwo(p_roundDownToPowerOfTwo_0_);
    return p_roundDownToPowerOfTwo_0_ == i ? i : i / 2;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:MathUtils.java


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