Jump to content

N1xx1

Members
  • Posts

    41
  • Joined

  • Last visited

Posts posted by N1xx1

  1. Item and Block classes aren't instantiated for every item in the game or every block in the game. That's why we have ItemStacks and chunks containg an array of block ids, and that's why we have NBTTags in ItemStacks and TileEntities.

     

    If you make a variable in your Item and do something with that, you won't be able to save it and it will conflict with all other Items of the same type.

  2. You should use a custom spawning packet.

     

    I don't know what's the proper way to do it, but take a look at:

     

    cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration

    cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration.setCustomSpawning

    cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration

  3. Thank you so much! I think I'm sort of getting it now :). However, I am somewhat confused on what I'm doing incorrect in this bit of code. I basically have an Item set up to call the rendering method when right clicked. The code is this:

    {
    GL11.glPushMatrix();
    GL11.glColor3f(0F, 1F, 0F);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x+10F, y);
    GL11.glVertex2f(x+10F, y+10F);
    GL11.glVertex2f(x, y+10F);
    GL11.glPopMatrix();
    }

    where x and y are floats preset to 10F. When run, all it appears to do is make the sky green. Am I just making a really n00bish mistake? :)

     

    The color isn't part of the Matrix so you have to reset it manually.

     

    Add a GL11.glColor3f(1F, 1F, 1F); just before (or after) that glPopMatrix.

  4. So OpenGL works with matrix. Basically you can draw stuff and transform the matrix itself. You draw stuff using GL11.glVertex#f (where f can be either f (floats), i (ints) and d (doubles) and # can be 2, 3 or 4 (representing the number of dimensions you are working on) and other methods (GL11.glBegin and GL11.glEnd) and trasform matrix with GL11.glTranslate#f, GL11.glRotatef. You can also save your matrix to the stack in order to get back after a series of matrix transformation with GL11.glPushMatrix and GL11.glPopMatrix.

     

    Example:

    GL11.glPushMatrix(); //save the current matrix

    // Your transformation here

    // Your rendering here

    GL11.glPopMatrix(); //revert everything

     

    For each PushMatrix there must be a PopMatrix or the code will break and it'll start spamming a lot of openGL errors :P

     

    About Tessellator, that's just a bridge beetwen OpenGL and your code. It has some useful code (transforming quads to triangles, for instance) and it uses VetrexBuffers instead of glVertex calls.

     

    I suggest you to take a look on some openGL guides (they are universal, don't look for java specific) and at Tessellator.java itself.

  5. You can easily do that with a new configuration.

     

    String translated = config.get("language", "myblock1", "My Block").value;

     

    So you can switch beetwen different configuration files depending on Language you choose.

     

     

    If you want to get current language:

     

    FMLClientHandler.instance().getClient().gameSettings.language

  6. You need a TileEntity to do that.

     

    Basically you have to make a simple variable like "orientation" where to store the orientation. After that you should use a ISimpleBlockRender too to change the actual block orientation depending on TileEntity data.

     

    I don't know if you can find any readytouse code, you may want to check out UE wich is public in github.

  7. You'd have to make:

     

    protected List controlList = new ArrayList();

     

    Not protected but public via Access Transformers. Then you can add everything you want to the controlList.

     

    But you can't add custom function to that.

     

    However you can do something.

     

    Make this public too:

     

    private GuiButton selectedButton = null;

     

    Start some sort of loop (I don't know what you can do. Maybe a thread?) and check the value of selectedButton. If it's different from null and the id of the button is what you're looking for then run that function. GuiMainMenu's actionPerformed will just don't care about the id of you're button and you can do whatever you want.

     

    Again, I'm not sure on how you can make that loop. TickInGui? Just look in JavaDocs or wait for someone to give a better answer.

  8. Put this in your block.java file

        public String getTextureFile()
        {
                return "/YourMod/SpriteSheet.png";
        }
    

    Also you need to set up a proxy first.

     

    Please, read the topic before say any random stuff.

     

    I'm talking about custom renders, not changing block texture.

  9. If your running it before compiling your mod and running it in a client as in you are running it in eclipse, you need to put the png in your minecraft.jar IN MCP with the specified path from your code (minecraft.jar/n1xx1/stuff/landpaint.png) After recompiling/reobf and trying to run it from the client/server make sure you have it in the mod file the same as it would be in the .jar

     

    1) I'm not using eclipse. I use NetBeans.

    2) I'm using my own builder that automatically make a zip file.

    3) I put that zip file in the mods folder.

     

    Anyway, I'll figure out alone.

  10. Do you have the png file in the right directory.

     

    This is what I have in the code and the file structure.

    %MCP%/src/common/x/y/z/textures.png

     

    public static String BLOCK_PNG = "/x/y/z/textures.png";

     

    I already said I'm sure I have the texture. Actually it's not even saying "missing texture".

×
×
  • Create New...

Important Information

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