Jump to content

Recommended Posts

Posted

Hey guys. I was wondering on how to add my own pictures in minecraft. All of the tutorials i saw shows only how to replace already existed pics, but i want to make a new one. So basicly add my own new custom picture to minecraft, not replacing any existing one. Have u got any ideas on how to do so?

Posted

You will need to make your own EntityPainting.

 

There suppose to be more of painting files. Like Model or something, cuz i havent seen any String on taking texture.

 

EntityPainting uses an ENUM to describe paintings.  The texture path is handled by the renderer, but the ENUM describes the painting name ("skull") as well as its UV position in the texture and width and height (UVWH are all full-block values, eg. 0,0 with width/height 1,1 would be a 1x1 painting located in the upper left of the texture, which at the default resolution would be 16x16 pixels).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You will need to make your own EntityPainting.

 

There suppose to be more of painting files. Like Model or something, cuz i havent seen any String on taking texture.

 

EntityPainting uses an ENUM to describe paintings.  The texture path is handled by the renderer, but the ENUM describes the painting name ("skull") as well as its UV position in the texture and width and height (UVWH are all full-block values, eg. 0,0 with width/height 1,1 would be a 1x1 painting located in the upper left of the texture, which at the default resolution would be 16x16 pixels).

 

Yes, i've seen that. Thanks, i'll try to do something with it.

Posted

You will need to make your own EntityPainting.

 

There suppose to be more of painting files. Like Model or something, cuz i havent seen any String on taking texture.

 

EntityPainting uses an ENUM to describe paintings.  The texture path is handled by the renderer, but the ENUM describes the painting name ("skull") as well as its UV position in the texture and width and height (UVWH are all full-block values, eg. 0,0 with width/height 1,1 would be a 1x1 painting located in the upper left of the texture, which at the default resolution would be 16x16 pixels).

 

So, i've done everything and my paintings are not working. I've made textures, render class, entity class ,enum class. Copied stuff, changed names and nothing. When i try to place a picture with my item, it just not placing.  I missed something? Check out my files, i dont understand what i could miss.

 

Entity file

 

 

package doorcloser.modding;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import java.util.ArrayList;

import net.minecraft.entity.EntityHanging;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.EnumArt;

import net.minecraft.world.World;

 

public class EntityHLPainting extends EntityHanging

{

    public EnumHLArt art;

 

    public EntityHLPainting(World par1World)

    {

        super(par1World);

    }

 

    public EntityHLPainting(World par1World, int par2, int par3, int par4, int par5)

    {

        super(par1World, par2, par3, par4, par5);

        ArrayList arraylist = new ArrayList();

        EnumHLArt[] aenumart = EnumHLArt.values();

        int i1 = aenumart.length;

 

        for (int j1 = 0; j1 < i1; ++j1)

        {

            EnumHLArt enumart = aenumart[j1];

            this.art = enumart;

            this.setDirection(par5);

 

            if (this.onValidSurface())

            {

                arraylist.add(enumart);

            }

        }

 

        if (!arraylist.isEmpty())

        {

            this.art = (EnumHLArt)arraylist.get(this.rand.nextInt(arraylist.size()));

        }

 

        this.setDirection(par5);

    }

 

    @SideOnly(Side.CLIENT)

    public EntityHLPainting(World par1World, int par2, int par3, int par4, int par5, String par6Str)

    {

        this(par1World, par2, par3, par4, par5);

        EnumHLArt[] aenumart = EnumHLArt.values();

        int i1 = aenumart.length;

 

        for (int j1 = 0; j1 < i1; ++j1)

        {

            EnumHLArt enumart = aenumart[j1];

 

            if (enumart.title.equals(par6Str))

            {

                this.art = enumart;

                break;

            }

        }

 

        this.setDirection(par5);

    }

 

   

   

    public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

    {

        par1NBTTagCompound.setString("Motive", this.art.title);

        super.writeEntityToNBT(par1NBTTagCompound);

    }

 

   

   

    public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

    {

        String s = par1NBTTagCompound.getString("Motive");

        EnumHLArt[] aenumart = EnumHLArt.values();

        int i = aenumart.length;

 

        for (int j = 0; j < i; ++j)

        {

            EnumHLArt enumart = aenumart[j];

 

            if (enumart.title.equals(s))

            {

                this.art = enumart;

            }

        }

 

        if (this.art == null)

        {

            this.art = EnumHLArt.Kebab;

        }

 

        super.readEntityFromNBT(par1NBTTagCompound);

    }

 

    public int func_82329_d()

    {

        return this.art.sizeX;

    }

 

    public int func_82330_g()

    {

        return this.art.sizeY;

    }

 

@Override

public void dropItemStack() {

this.entityDropItem(new ItemStack(mod_HalflifeMod.hlpainting), 0.0F);

 

}

 

}

 

 

 

Render file

 

 

package doorcloser.modding;

 

import net.minecraft.client.renderer.OpenGlHelper;

import net.minecraft.client.renderer.Tessellator;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.entity.Entity;

import net.minecraft.util.EnumArt;

import net.minecraft.util.MathHelper;

 

import org.lwjgl.opengl.GL11;

import org.lwjgl.opengl.GL12;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@SideOnly(Side.CLIENT)

public class RenderHLPainting extends Render

{

    public void renderThePainting(EntityHLPainting par1Entity, double par2, double par4, double par6, float par8, float par9)

    {

        GL11.glPushMatrix();

        GL11.glTranslatef((float)par2, (float)par4, (float)par6);

        GL11.glRotatef(par8, 0.0F, 1.0F, 0.0F);

        GL11.glEnable(GL12.GL_RESCALE_NORMAL);

        this.loadTexture("/art/hlkz.png");

        EnumHLArt enumart = par1Entity.art;

        float f2 = 0.0625F;

        GL11.glScalef(f2, f2, f2);

        this.func_77010_a(par1Entity, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);

        GL11.glDisable(GL12.GL_RESCALE_NORMAL);

        GL11.glPopMatrix();

    }

 

    private void func_77010_a(EntityHLPainting par1Entity, int par2, int par3, int par4, int par5)

    {

        float f = (float)(-par2) / 2.0F;

        float f1 = (float)(-par3) / 2.0F;

        float f2 = 0.5F;

        float f3 = 0.75F;

        float f4 = 0.8125F;

        float f5 = 0.0F;

        float f6 = 0.0625F;

        float f7 = 0.75F;

        float f8 = 0.8125F;

        float f9 = 0.001953125F;

        float f10 = 0.001953125F;

        float f11 = 0.7519531F;

        float f12 = 0.7519531F;

        float f13 = 0.0F;

        float f14 = 0.0625F;

 

        for (int i1 = 0; i1 < par2 / 16; ++i1)

        {

            for (int j1 = 0; j1 < par3 / 16; ++j1)

            {

                float f15 = f + (float)((i1 + 1) * 16);

                float f16 = f + (float)(i1 * 16);

                float f17 = f1 + (float)((j1 + 1) * 16);

                float f18 = f1 + (float)(j1 * 16);

                this.func_77008_a(par1Entity, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);

                float f19 = (float)(par4 + par2 - i1 * 16) / 256.0F;

                float f20 = (float)(par4 + par2 - (i1 + 1) * 16) / 256.0F;

                float f21 = (float)(par5 + par3 - j1 * 16) / 256.0F;

                float f22 = (float)(par5 + par3 - (j1 + 1) * 16) / 256.0F;

                Tessellator tessellator = Tessellator.instance;

                tessellator.startDrawingQuads();

                tessellator.setNormal(0.0F, 0.0F, -1.0F);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22);

                tessellator.setNormal(0.0F, 0.0F, 1.0F);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);

                tessellator.setNormal(0.0F, 1.0F, 0.0F);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);

                tessellator.setNormal(0.0F, -1.0F, 0.0F);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);

                tessellator.setNormal(-1.0F, 0.0F, 0.0F);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);

                tessellator.setNormal(1.0F, 0.0F, 0.0F);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);

                tessellator.draw();

            }

        }

    }

 

    private void func_77008_a(EntityHLPainting par1EntityPainting, float par2, float par3)

    {

        int i = MathHelper.floor_double(par1EntityPainting.posX);

        int j = MathHelper.floor_double(par1EntityPainting.posY + (double)(par3 / 16.0F));

        int k = MathHelper.floor_double(par1EntityPainting.posZ);

 

        if (par1EntityPainting.hangingDirection == 2)

        {

            i = MathHelper.floor_double(par1EntityPainting.posX + (double)(par2 / 16.0F));

        }

 

        if (par1EntityPainting.hangingDirection == 1)

        {

            k = MathHelper.floor_double(par1EntityPainting.posZ - (double)(par2 / 16.0F));

        }

 

        if (par1EntityPainting.hangingDirection == 0)

        {

            i = MathHelper.floor_double(par1EntityPainting.posX - (double)(par2 / 16.0F));

        }

 

        if (par1EntityPainting.hangingDirection == 3)

        {

            k = MathHelper.floor_double(par1EntityPainting.posZ + (double)(par2 / 16.0F));

        }

 

        int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);

        int i1 = l % 65536;

        int j1 = l / 65536;

        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);

        GL11.glColor3f(1.0F, 1.0F, 1.0F);

    }

 

   

    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)

    {

        this.renderThePainting((EntityHLPainting)par1Entity, par2, par4, par6, par8, par9);

    }

}

 

 

 

Enum file

 

 

package doorcloser.modding;

 

 

public enum EnumHLArt

{

    Kebab("Kebab", 16, 16, 0, 0),

    Aztec("Aztec", 16, 16, 16, 0),

    Alban("Alban", 16, 16, 32, 0),

    Aztec2("Aztec2", 16, 16, 48, 0),

    Bomb("Bomb", 16, 16, 64, 0),

    Plant("Plant", 16, 16, 80, 0),

    Wasteland("Wasteland", 16, 16, 96, 0),

    Pool("Pool", 32, 16, 0, 32),

    Courbet("Courbet", 32, 16, 32, 32),

    Sea("Sea", 32, 16, 64, 32),

    Sunset("Sunset", 32, 16, 96, 32),

    Creebet("Creebet", 32, 16, 128, 32),

    Wanderer("Wanderer", 16, 32, 0, 64),

    Graham("Graham", 16, 32, 16, 64),

    Match("Match", 32, 32, 0, 128),

    Bust("Bust", 32, 32, 32, 128),

    Stage("Stage", 32, 32, 64, 128),

    Void("Void", 32, 32, 96, 128),

    SkullAndRoses("SkullAndRoses", 32, 32, 128, 128),

    Wither("Wither", 32, 32, 160, 128),

    BMScreen("BMScreen", 64, 32, 0, 96),

    Pointer("Pointer", 64, 64, 0, 192),

    Pigscene("Pigscene", 64, 64, 64, 192),

    BurningSkull("BurningSkull", 64, 64, 128, 192),

    Skeleton("Skeleton", 64, 48, 192, 64),

    DonkeyKong("DonkeyKong", 64, 48, 192, 112);

 

    /** Holds the maximum length of paintings art title. */

    public static final int maxArtTitleLength = "SkullAndRoses".length();

 

    /** Painting Title. */

    public final String title;

    public final int sizeX;

    public final int sizeY;

    public final int offsetX;

    public final int offsetY;

 

    private EnumHLArt(String par3Str, int par4, int par5, int par6, int par7)

    {

        this.title = par3Str;

        this.sizeX = par4;

        this.sizeY = par5;

        this.offsetX = par6;

        this.offsetY = par7;

    }

}

 

 

 

The texture actually in minecraft.jar. Idk...

Posted

Did you register your entity?

 

Did you create an item?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Did you register your entity?

 

Did you create an item?

 

This file creates item itself? No? Because my item is displaying in tab and i can take it. And yes, i have EntityMyPainting, RenderMyPainting, EnumMyArt.

Posted

Render file

 

 

        this.loadTexture("/art/hlkz.png");

 

 

 

The texture actually in minecraft.jar. Idk...

You should really consider changing this.

 

With changing, or without my item does the same - nothing. Ofcourse i put the texture in .jar file and named it the same. So there is another problem, entity, something with it.

Posted

Have you considered this?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

With changing, or without my item does the same - nothing. Ofcourse i put the texture in .jar file and named it the same. So there is another problem, entity, something with it.

Did you check that your item set your paintings entity ?

Did you check that your paintings entity contains one of the paintings value ?

Did you check that your paintings entity is being rendered with your renderer ?

 

I shouldn't have to ask those questions only to get a useful error report.

Posted

With changing, or without my item does the same - nothing. Ofcourse i put the texture in .jar file and named it the same. So there is another problem, entity, something with it.

Did you check that your item set your paintings entity ?

Did you check that your paintings entity contains one of the paintings value ?

Did you check that your paintings entity is being rendered with your renderer ?

 

I shouldn't have to ask those questions only to get a useful error report.

 

Ofcourse i did. How can i know where is error. Picture just not spawning, that means item doesnt make any actions. What can i change? Ofcourse my Item is set to the Entity:

hlpainting = new ItemHangingEntity(1800, EntityHLPainting.class)
	.setUnlocalizedName("hlpainting");
	LanguageRegistry.addName(hlpainting, "Hl Painting");

 

P.S> Thats the main class file( if you would ask even this )

Posted

hlpainting = new ItemHangingEntity(1800, EntityHLPainting.class)
	.setUnlocalizedName("hlpainting");
	LanguageRegistry.addName(hlpainting, "Hl Painting");

 

I know what the problem is.

 

ItemHangingEntity doesn't take arbitrary classes.  It looks like it does, but it doesn't:

 

    /**
     * Create the hanging entity associated to this item.
     */
    private EntityHanging createHangingEntity(World par1World, int par2, int par3, int par4, int par5)
    {
        return (EntityHanging)(this.hangingEntityClass == EntityPainting.class ? new EntityPainting(par1World, par2, par3, par4, par5) : (this.hangingEntityClass == EntityItemFrame.class ? new EntityItemFrame(par1World, par2, par3, par4, par5) : null));
    }

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

hlpainting = new ItemHangingEntity(1800, EntityHLPainting.class)
	.setUnlocalizedName("hlpainting");
	LanguageRegistry.addName(hlpainting, "Hl Painting");

 

I know what the problem is.

 

ItemHangingEntity doesn't take arbitrary classes.  It looks like it does, but it doesn't:

 

    /**
     * Create the hanging entity associated to this item.
     */
    private EntityHanging createHangingEntity(World par1World, int par2, int par3, int par4, int par5)
    {
        return (EntityHanging)(this.hangingEntityClass == EntityPainting.class ? new EntityPainting(par1World, par2, par3, par4, par5) : (this.hangingEntityClass == EntityItemFrame.class ? new EntityItemFrame(par1World, par2, par3, par4, par5) : null));
    }

 

What is this.hangingEntityClass? Its ItemHangingEntity class or something? Or i have to create my own hangingEntityClass?

Posted

What is this.hangingEntityClass? Its ItemHangingEntity class or something? Or i have to create my own hangingEntityClass?

 

It's the class passed to ItemHangingEntity's constructor.

 

Mojang didn't use reflection to just create a new instance of the class, which is kind of unfortunate.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

What is this.hangingEntityClass? Its ItemHangingEntity class or something? Or i have to create my own hangingEntityClass?

 

It's the class passed to ItemHangingEntity's constructor.

 

Mojang didn't use reflection to just create a new instance of the class, which is kind of unfortunate.

 

hangingEntityClass cannot be resolved or is not a type. I have to create a field or constant? Also, when i use this as a field to EntityHLPainting, it gives me an error:

- Incompatible operand types Class<EntityHLPainting> and Class<EntityItemFrame>. That means i have to create a field to both of them?

And just in case, where i have to put that code?

Posted

You're not even listening to me, are you?

 

The code I posted is from VANILLA'S ItemHangingEntity class.  I included it so you could see what the problem was.  You were not supposed to ADD IT to your code.

 

The only way to "fix" your problem is probably to duplicate the ItemHangingEntity class (and in all likelyhood, several other classes) and modify them to suit your needs.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You're not even listening to me, are you?

 

The code I posted is from VANILLA'S ItemHangingEntity class.  I included it so you could see what the problem was.  You were not supposed to ADD IT to your code.

 

The only way to "fix" your problem is probably to duplicate the ItemHangingEntity class (and in all likelyhood, several other classes) and modify them to suit your needs.

 

Ok, so i did it. And when i place a picture it doesnt show up, but when i break a block with it, it drops a picture. So basiclly that means that im putting those pictures, but they doesnt show up. So its not reading textures or idk something another?

Posted

Sounds like you have an entity, but don't have a renderer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Sounds like you have an entity, but don't have a renderer.

 

Thats all my files. Thats all what i have for my paintings:

--------------------------------------------------------------------------------------------------------------------------------------------------

My EnumArt

 

 

package doorcloser.modding;

 

 

public enum EnumHLArt

{

    Kebab("Kebab", 16, 16, 0, 0),

    Aztec("Aztec", 16, 16, 16, 0),

    Alban("Alban", 16, 16, 32, 0),

    Aztec2("Aztec2", 16, 16, 48, 0),

    Bomb("Bomb", 16, 16, 64, 0),

    Plant("Plant", 16, 16, 80, 0),

    Wasteland("Wasteland", 16, 16, 96, 0),

    Pool("Pool", 32, 16, 0, 32),

    Courbet("Courbet", 32, 16, 32, 32),

    Sea("Sea", 32, 16, 64, 32),

    Sunset("Sunset", 32, 16, 96, 32),

    Creebet("Creebet", 32, 16, 128, 32),

    Wanderer("Wanderer", 16, 32, 0, 64),

    Graham("Graham", 16, 32, 16, 64),

    Match("Match", 32, 32, 0, 128),

    Bust("Bust", 32, 32, 32, 128),

    Stage("Stage", 32, 32, 64, 128),

    Void("Void", 32, 32, 96, 128),

    SkullAndRoses("SkullAndRoses", 32, 32, 128, 128),

    Wither("Wither", 32, 32, 160, 128),

    BMScreen("BMScreen", 64, 32, 0, 96),

    Pointer("Pointer", 64, 64, 0, 192),

    Pigscene("Pigscene", 64, 64, 64, 192),

    BurningSkull("BurningSkull", 64, 64, 128, 192),

    Skeleton("Skeleton", 64, 48, 192, 64),

    DonkeyKong("DonkeyKong", 64, 48, 192, 112);

 

    /** Holds the maximum length of paintings art title. */

    public static final int maxArtTitleLength = "SkullAndRoses".length();

 

    /** Painting Title. */

    public final String title;

    public final int sizeX;

    public final int sizeY;

    public final int offsetX;

    public final int offsetY;

 

    private EnumHLArt(String par3Str, int par4, int par5, int par6, int par7)

    {

        this.title = par3Str;

        this.sizeX = par4;

        this.sizeY = par5;

        this.offsetX = par6;

        this.offsetY = par7;

    }

}

 

 

My EntityPainting

 

 

package doorcloser.modding;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import java.util.ArrayList;

import net.minecraft.entity.EntityHanging;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.EnumArt;

import net.minecraft.world.World;

 

public class EntityHLPainting extends EntityHanging

{

    public EnumHLArt hlart;

 

    public EntityHLPainting(World par1World)

    {

        super(par1World);

    }

 

    public EntityHLPainting(World par1World, int par2, int par3, int par4, int par5)

    {

        super(par1World, par2, par3, par4, par5);

        ArrayList arraylist = new ArrayList();

        EnumHLArt[] aenumart = EnumHLArt.values();

        int i1 = aenumart.length;

 

        for (int j1 = 0; j1 < i1; ++j1)

        {

            EnumHLArt enumart = aenumart[j1];

            this.hlart = enumart;

            this.setDirection(par5);

 

            if (this.onValidSurface())

            {

                arraylist.add(enumart);

            }

        }

 

        if (!arraylist.isEmpty())

        {

            this.hlart = (EnumHLArt)arraylist.get(this.rand.nextInt(arraylist.size()));

        }

 

        this.setDirection(par5);

    }

 

    @SideOnly(Side.CLIENT)

    public EntityHLPainting(World par1World, int par2, int par3, int par4, int par5, String par6Str)

    {

        this(par1World, par2, par3, par4, par5);

        EnumHLArt[] aenumart = EnumHLArt.values();

        int i1 = aenumart.length;

 

        for (int j1 = 0; j1 < i1; ++j1)

        {

            EnumHLArt enumart = aenumart[j1];

 

            if (enumart.title.equals(par6Str))

            {

                this.hlart = enumart;

                break;

            }

        }

 

        this.setDirection(par5);

    }

 

    /**

    * (abstract) Protected helper method to write subclass entity data to NBT.

    */

    public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

    {

        par1NBTTagCompound.setString("Motive", this.hlart.title);

        super.writeEntityToNBT(par1NBTTagCompound);

    }

 

    /**

    * (abstract) Protected helper method to read subclass entity data from NBT.

    */

    public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

    {

        String s = par1NBTTagCompound.getString("Motive");

        EnumHLArt[] aenumart = EnumHLArt.values();

        int i = aenumart.length;

 

        for (int j = 0; j < i; ++j)

        {

            EnumHLArt enumart = aenumart[j];

 

            if (enumart.title.equals(s))

            {

                this.hlart = enumart;

            }

        }

 

        if (this.hlart == null)

        {

            this.hlart = EnumHLArt.Kebab;

        }

 

        super.readEntityFromNBT(par1NBTTagCompound);

    }

 

    public int func_82329_d()

    {

        return this.hlart.sizeX;

    }

 

    public int func_82330_g()

    {

        return this.hlart.sizeY;

    }

 

    /**

    * Drop the item currently on this item frame.

    */

    public void dropItemStack()

    {

        this.entityDropItem(new ItemStack(mod_HalflifeMod.hlpainting), 0.0F);

    }

}

 

 

 

My RenderPainting

 

 

package doorcloser.modding;

 

import net.minecraft.client.renderer.OpenGlHelper;

import net.minecraft.client.renderer.Tessellator;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.entity.Entity;

import net.minecraft.util.MathHelper;

 

import org.lwjgl.opengl.GL11;

import org.lwjgl.opengl.GL12;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@SideOnly(Side.CLIENT)

public class RenderHLPainting extends Render

{

    public void renderThePainting(EntityHLPainting par1Entity, double par2, double par4, double par6, float par8, float par9)

    {

        GL11.glPushMatrix();

        GL11.glTranslatef((float)par2, (float)par4, (float)par6);

        GL11.glRotatef(par8, 0.0F, 1.0F, 0.0F);

        GL11.glEnable(GL12.GL_RESCALE_NORMAL);

        this.loadTexture("/art/hlkz.png");

        EnumHLArt enumart = par1Entity.hlart;

        float f2 = 0.0625F;

        GL11.glScalef(f2, f2, f2);

        this.func_77010_a(par1Entity, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);

        GL11.glDisable(GL12.GL_RESCALE_NORMAL);

        GL11.glPopMatrix();

    }

 

    private void func_77010_a(EntityHLPainting par1Entity, int par2, int par3, int par4, int par5)

    {

        float f = (float)(-par2) / 2.0F;

        float f1 = (float)(-par3) / 2.0F;

        float f2 = 0.5F;

        float f3 = 0.75F;

        float f4 = 0.8125F;

        float f5 = 0.0F;

        float f6 = 0.0625F;

        float f7 = 0.75F;

        float f8 = 0.8125F;

        float f9 = 0.001953125F;

        float f10 = 0.001953125F;

        float f11 = 0.7519531F;

        float f12 = 0.7519531F;

        float f13 = 0.0F;

        float f14 = 0.0625F;

 

        for (int i1 = 0; i1 < par2 / 16; ++i1)

        {

            for (int j1 = 0; j1 < par3 / 16; ++j1)

            {

                float f15 = f + (float)((i1 + 1) * 16);

                float f16 = f + (float)(i1 * 16);

                float f17 = f1 + (float)((j1 + 1) * 16);

                float f18 = f1 + (float)(j1 * 16);

                this.func_77008_a(par1Entity, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);

                float f19 = (float)(par4 + par2 - i1 * 16) / 256.0F;

                float f20 = (float)(par4 + par2 - (i1 + 1) * 16) / 256.0F;

                float f21 = (float)(par5 + par3 - j1 * 16) / 256.0F;

                float f22 = (float)(par5 + par3 - (j1 + 1) * 16) / 256.0F;

                Tessellator tessellator = Tessellator.instance;

                tessellator.startDrawingQuads();

                tessellator.setNormal(0.0F, 0.0F, -1.0F);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22);

                tessellator.setNormal(0.0F, 0.0F, 1.0F);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);

                tessellator.setNormal(0.0F, 1.0F, 0.0F);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);

                tessellator.setNormal(0.0F, -1.0F, 0.0F);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);

                tessellator.setNormal(-1.0F, 0.0F, 0.0F);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);

                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);

                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);

                tessellator.setNormal(1.0F, 0.0F, 0.0F);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);

                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);

                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);

                tessellator.draw();

            }

        }

    }

 

    private void func_77008_a(EntityHLPainting par1EntityPainting, float par2, float par3)

    {

        int i = MathHelper.floor_double(par1EntityPainting.posX);

        int j = MathHelper.floor_double(par1EntityPainting.posY + (double)(par3 / 16.0F));

        int k = MathHelper.floor_double(par1EntityPainting.posZ);

 

        if (par1EntityPainting.hangingDirection == 2)

        {

            i = MathHelper.floor_double(par1EntityPainting.posX + (double)(par2 / 16.0F));

        }

 

        if (par1EntityPainting.hangingDirection == 1)

        {

            k = MathHelper.floor_double(par1EntityPainting.posZ - (double)(par2 / 16.0F));

        }

 

        if (par1EntityPainting.hangingDirection == 0)

        {

            i = MathHelper.floor_double(par1EntityPainting.posX - (double)(par2 / 16.0F));

        }

 

        if (par1EntityPainting.hangingDirection == 3)

        {

            k = MathHelper.floor_double(par1EntityPainting.posZ + (double)(par2 / 16.0F));

        }

 

        int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);

        int i1 = l % 65536;

        int j1 = l / 65536;

        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);

        GL11.glColor3f(1.0F, 1.0F, 1.0F);

    }

 

   

    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)

    {

        this.renderThePainting((EntityHLPainting)par1Entity, par2, par4, par6, par8, par9);

    }

}

 

 

My ItemHangingENtity

 

 

package doorcloser.modding;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityHanging;

import net.minecraft.entity.item.EntityItemFrame;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.Direction;

import net.minecraft.world.World;

 

public class ItemHLHangingEntity extends Item

{

    private final Class hangingEntityClass;

 

    public ItemHLHangingEntity(int par1, Class par2Class)

    {

        super(par1);

        this.hangingEntityClass = par2Class;

        this.setCreativeTab(CreativeTabs.tabDecorations);

    }

 

    /**

    * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return

    * True if something happen and false if it don't. This is for ITEMS, not BLOCKS

    */

    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)

    {

        if (par7 == 0)

        {

            return false;

        }

        else if (par7 == 1)

        {

            return false;

        }

        else

        {

            int i1 = Direction.facingToDirection[par7];

            EntityHanging entityhanging = this.createHangingEntity(par3World, par4, par5, par6, i1);

 

            if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))

            {

                return false;

            }

            else

            {

                if (entityhanging != null && entityhanging.onValidSurface())

                {

                    if (!par3World.isRemote)

                    {

                        par3World.spawnEntityInWorld(entityhanging);

                    }

 

                    --par1ItemStack.stackSize;

                }

 

                return true;

            }

        }

    }

 

    /**

    * Create the hanging entity associated to this item.

    */

    private EntityHanging createHangingEntity(World par1World, int par2, int par3, int par4, int par5)

    {

        return (EntityHanging)(this.hangingEntityClass == EntityHLPainting.class ? new EntityHLPainting(par1World, par2, par3, par4, par5) : (this.hangingEntityClass == EntityItemFrame.class ? new EntityItemFrame(par1World, par2, par3, par4, par5) : null));

    }

}

 

 

 

I have Renderer here, how you can see. What else i need?

 

I also turned out, that i can put infinite number of pictures on one block, and if i broke it, alot of pictures is dropping. Thats not Rendering problem i think.

Posted

And client proxy?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

And client proxy?

 

You mean this?

hlpainting = new ItemHLHangingEntity(1800, EntityHLPainting.class)
	.setUnlocalizedName("hlpainting");
	LanguageRegistry.addName(hlpainting, "Hl Painting");

 

Im using one mod class file instead of client proxy and common proxy

Posted

No, where you Register your Renderers.

 

With the RenderingRegistry.

 

And you're going to need a common and client proxy at some point, or your mod won't work on servers.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

No, where you Register your Renderers.

 

With the RenderingRegistry.

 

And you're going to need a common and client proxy at some point, or your mod won't work on servers.

You mean this?

RenderingRegistry.registerEntityRenderingHandler(EntityHLPainting.class, new RenderHLPainting());

 

I tried that out, thats not works. Paintings is not placing. Maybe i did it not correct?

P.S: Dont Worry about Client and Common proxy stuff. I'll change it later

Posted

At this point I don't know.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.