Java 类net.minecraft.client.renderer.texture.AbstractTexture 实例源码

项目:BaseClient    文件:ShadersTex.java   
public static MultiTexID getMultiTexID(AbstractTexture tex)
{
    MultiTexID multitexid = tex.multiTex;

    if (multitexid == null)
    {
        int i = tex.getGlTextureId();
        multitexid = (MultiTexID)multiTexMap.get(Integer.valueOf(i));

        if (multitexid == null)
        {
            multitexid = new MultiTexID(i, GL11.glGenTextures(), GL11.glGenTextures());
            multiTexMap.put(Integer.valueOf(i), multitexid);
        }

        tex.multiTex = multitexid;
    }

    return multitexid;
}
项目:BaseClient    文件:ShadersTex.java   
public static void deleteTextures(AbstractTexture atex, int texid)
{
    MultiTexID multitexid = atex.multiTex;

    if (multitexid != null)
    {
        atex.multiTex = null;
        multiTexMap.remove(Integer.valueOf(multitexid.base));
        GlStateManager.deleteTexture(multitexid.norm);
        GlStateManager.deleteTexture(multitexid.spec);

        if (multitexid.base != texid)
        {
            SMCLog.warning("Error : MultiTexID.base mismatch: " + multitexid.base + ", texid: " + texid);
            GlStateManager.deleteTexture(multitexid.base);
        }
    }
}
项目:Backmemed    文件:ShadersTex.java   
public static MultiTexID getMultiTexID(AbstractTexture tex)
{
    MultiTexID multitexid = tex.multiTex;

    if (multitexid == null)
    {
        int i = tex.getGlTextureId();
        multitexid = (MultiTexID)multiTexMap.get(Integer.valueOf(i));

        if (multitexid == null)
        {
            multitexid = new MultiTexID(i, GL11.glGenTextures(), GL11.glGenTextures());
            multiTexMap.put(Integer.valueOf(i), multitexid);
        }

        tex.multiTex = multitexid;
    }

    return multitexid;
}
项目:Backmemed    文件:ShadersTex.java   
public static void deleteTextures(AbstractTexture atex, int texid)
{
    MultiTexID multitexid = atex.multiTex;

    if (multitexid != null)
    {
        atex.multiTex = null;
        multiTexMap.remove(Integer.valueOf(multitexid.base));
        GlStateManager.deleteTexture(multitexid.norm);
        GlStateManager.deleteTexture(multitexid.spec);

        if (multitexid.base != texid)
        {
            SMCLog.warning("Error : MultiTexID.base mismatch: " + multitexid.base + ", texid: " + texid);
            GlStateManager.deleteTexture(multitexid.base);
        }
    }
}
项目:Statues    文件:GeneralStatueClient.java   
public static void spawnPaintEffect(World world,int x, int y, int z) {
    TileEntity te = world.getTileEntity(x, y, z);
    if (! (te instanceof TileEntityStatue))
        return;
    TileEntityStatue statue=(TileEntityStatue) te;
    EntityStatuePlayer player=statue.getStatue();

    AbstractTexture tex=player.getTextureSkin();

    for(int side=2;side<6;side++){
        for(int i=0;i<80;i++){
            EntityTextureFX p=addTextureEffects(world,x,y+i%2,z,tex,side,0.05f,0.1f);
            if(p!=null) world.spawnEntityInWorld(p);
        }
    }

}
项目:Statues    文件:EntityTextureFX.java   
public EntityTextureFX(World world, double x, double y, double z, double vx, double vy, double vz,AbstractTexture tex,float particleScaleU,float particleScaleV) {
    super(world);

    setPosition(x,y,z);
    setSize(0.2f,0.2f);

    prevPosX = posX;
    prevPosY = posY;
    prevPosZ = posZ;

       motionX = vx;
       motionY = vy;
       motionZ = vz;

       texture=tex; 

       particleAge=0;
       particleMaxAge=2+rand.nextInt(12);
       scaleU=particleScaleU;
       scaleV=particleScaleV;

       pu=rand.nextFloat()*(1.0f-scaleU);
       pv=rand.nextFloat()*(1.0f-scaleV);
}
项目:Statues    文件:EntityStatuePlayer.java   
public void applySkin(String name, Block block, int side, int meta) {
    if(block==null) block=Blocks.stone;

    ResourceLocation steveSkin = new ResourceLocation("statues:textures/steve.png|B" + Block.getIdFromBlock(block) + "," + side + "," + meta);
    AbstractTexture steveDataSkin = getDataForSteve(steveSkin, new ResourceLocation("statues:textures/steve.png"), block, side, meta);

    if (name != null && !name.isEmpty()) {
        skin = new ResourceLocation("skins/" + StringUtils.stripControlCodes(name) + "|B" + Block.getIdFromBlock(block) + "," + side + "," + meta);
        dataSkin = getTextureForSkin(skin, steveDataSkin, name, block, side, meta);
    } else {
        skin = steveSkin;
        dataSkin = steveDataSkin;
    }
}
项目:Statues    文件:EntityStatuePlayer.java   
public AbstractTexture getTextureForSkin(ResourceLocation skin, AbstractTexture fallbackSkin, String name, Block block, int side, int meta) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    AbstractTexture tex = (AbstractTexture) texturemanager.getTexture(skin);

    if (tex == null) {
        tex = new StatueTextureDownloaded(skin, Statues.skinServerLocation + name + ".png", fallbackSkin, new ImageStatueBufferDownload(this, block, side, meta, name+"."+Block.getIdFromBlock(block)+"."+meta));
        texturemanager.loadTexture(skin, tex);
    }

    return tex;
}
项目:Statues    文件:EntityStatuePlayer.java   
public AbstractTexture getDataForSteve(ResourceLocation skin, ResourceLocation base, Block block, int side, int meta) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    AbstractTexture tex = (AbstractTexture) texturemanager.getTexture(skin);

    if (tex == null) {
        tex = new StatueTextureStatic(base, new ImageStatueBufferDownload(this, block, side, meta,"steve."+Block.getIdFromBlock(block)+"."+meta));
        texturemanager.loadTexture(skin, tex);
    }

    return tex;
}
项目:OpenBlocks    文件:TileEntityTrophyRenderer.java   
private AbstractTexture getBlockTexture() {
    final TextureManager texturemanager = rendererDispatcher.renderEngine;
    if (texturemanager != null) {
        final ITextureObject texture = texturemanager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        if (texture instanceof AbstractTexture)
            return (AbstractTexture)texture;
    }

    return null;
}
项目:Statues    文件:GeneralStatueClient.java   
public static EntityTextureFX addTextureEffects(World world, int x, int y, int z, AbstractTexture texture, int side,float u,float v) {
    Block block = world.getBlock(x, y, z);
    if(block==null) return null;

    double w = block.getBlockBoundsMaxX() - block.getBlockBoundsMinX();
    double h = block.getBlockBoundsMaxY() - block.getBlockBoundsMinY();
    double l = block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ();
    double px = rand.nextDouble() * w;
    double py = rand.nextDouble() * h;
    double pz = rand.nextDouble() * l;

    float f = 0.25F;
    double d0 = x + block.getBlockBoundsMinX() + px;
    double d1 = y + block.getBlockBoundsMinY() + py;
    double d2 = z + block.getBlockBoundsMinZ() + pz;

    switch (side) {
    case 0:
        d1 = y + block.getBlockBoundsMinY() - f;
        break;
    case 1:
        d1 = y + block.getBlockBoundsMaxY() + f;
        break;
    case 2:
        d2 = z + block.getBlockBoundsMinZ() - f;
        break;
    case 3:
        d2 = z + block.getBlockBoundsMaxZ() + f;
        break;
    case 4:
        d0 = x + block.getBlockBoundsMinX() - f;
        break;
    case 5:
        d0 = x + block.getBlockBoundsMaxX() + f;
        break;
    }

    double motion=0.5;
    EntityTextureFX res = new EntityTextureFX(world, d0, d1, d2, motion*(px/w-0.5), motion*(py/h-0.5), motion*(pz/l-0.5), texture, u, v);

    return res;
}
项目:Statues    文件:EntityStatuePlayer.java   
public AbstractTexture getTextureSkin() {
    return dataSkin;
}
项目:OpenBlocks    文件:TileEntityTrophyRenderer.java   
private void renderTrophy(Trophy type, double x, double y, double z, float angle) {
    Entity entity = type.getEntity();
    if (entity != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(x, y + type.getVerticalOffset() + 0.2, z);
        GL11.glRotatef(angle, 0, 1, 0);

        final double ratio = type.getScale();
        GL11.glScaled(ratio, ratio, ratio);
        World renderWorld = RenderUtils.getRenderWorld();
        if (renderWorld != null) {
            Render<Entity> renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity);
            // yeah we don't care about fonts, but we do care that the
            // renderManager is available
            if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {

                final boolean blurLast;
                final boolean mipmapLast;
                final AbstractTexture blocksTexture = getBlockTexture();
                if (blocksTexture != null) {
                    blurLast = blocksTexture.blurLast;
                    mipmapLast = blocksTexture.mipmapLast;
                } else {
                    blurLast = false;
                    mipmapLast = false;
                }

                GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
                final boolean lightmapEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
                GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

                synchronized (entity) {
                    entity.world = renderWorld;
                    renderer.doRender(entity, 0, 0, 0, 0, 0);
                    entity.world = null;
                }

                GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
                if (lightmapEnabled) GlStateManager.enableTexture2D();
                else GlStateManager.disableTexture2D();
                GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

                if (blocksTexture != null) {
                    blocksTexture.mipmapLast = mipmapLast;
                    blocksTexture.blurLast = blurLast;
                }
            }
        }
        GL11.glPopMatrix();

    }
}