Jump to content

hydroflame

Members
  • Posts

    1511
  • Joined

  • Last visited

Posts posted by hydroflame

  1. *sight*

     

    we have forge.... we have user interfaces...... we should be able to make mods that are 100% command free, its way more interactive and fun to interact with beautiful menu then to type

     

    "/hur dur create area protected set group=admin 51, 51, 51, 100, 100, 100"

     

    i know you're just using whats already there. but i think I'm getting cancer from these.

     

    honestly I'm really excited to release my mod because we can finally start getting rid of those sign shop ....

  2.  

     

     

     

    import java.util.HashMap;

     

    import org.lwjgl.opengl.GL11;

     

    import net.minecraft.client.Minecraft;

    import net.minecraft.client.renderer.Tessellator;

     

    public class NewFontRenderer{

    public static NewFontRenderer instance = new NewFontRenderer ();

     

    private HashMap<Character, float[]> map = new HashMap<Character, float[]>();

    public NewFontRenderer (){

    int i = 0;

    map.put('a', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('b', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('c', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('d', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('e', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('f', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('g', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('h', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('i', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('j', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('k', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('l', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('m', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('n', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('o', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('p', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('q', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('r', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('s', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('t', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('u', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('v', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('w', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('x', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('y', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('z', new float[]{(i++*34)/3196f, (i*34)/3196f});

     

    map.put('A', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('B', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('C', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('D', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('E', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('F', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('G', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('H', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('I', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('J', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('K', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('L', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('M', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('N', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('O', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('P', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('Q', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('R', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('S', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('T', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('U', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('V', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('W', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('X', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('Y', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('Z', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('1', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('2', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('3', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('4', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('5', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('6', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('7', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('8', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('9', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('0', new float[]{(i++*34)/3196f, (i*34)/3196f});

     

    map.put('-', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('=', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('`', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('!', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('@', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('#', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('$', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('%', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('^', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('&', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('*', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('(', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put(')', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('_', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('+', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('~', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put(',', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('.', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('/', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put(';', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('\'', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('[', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put(']', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('\\', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('<', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('>', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('?', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put(':', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('"', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('{', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('}', new float[]{(i++*34)/3196f, (i*34)/3196f});

    map.put('|', new float[]{(i++*34)/3196f, (i*34)/3196f});

    }

     

    public void drawString(String s,int x, int y, int height, boolean is3D, float r, float g, float b){

    if(!is3D){

    int originX = x;

    Tessellator tess = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine.bindTexture("sf.png");

    tess.startDrawingQuads();

    tess.setColorOpaque_F(r, g, b);

    for(int i =0; i < s.length(); i++){

    char c = s.charAt(i);

    if(c == '\n'){

    y += height;

    x = originX;

    continue;

    }

    if(c == ' '){

    x += height*3/4;

    continue;

    }

    float[] coord = map.get©;

     

    tess.addVertexWithUV(x, y, 0, coord[0], 0);

    tess.addVertexWithUV(x, y+height, 0, coord[0], 1);

    tess.addVertexWithUV(x+height*(1+coord[1]-coord[0]), y+height, 0, coord[1], 1f);

    tess.addVertexWithUV(x+height*(1+coord[1]-coord[0]), y, 0, coord[1], 0);

    x += height*(1+coord[1]-coord[0]);

    }

    tess.draw();

    }else{

    int originX = x;

    Tessellator tess = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine.bindTexture(ForgeRevCommonProxy.sf);

    tess.startDrawingQuads();

    tess.setColorOpaque(0, 0, 255);

    for(int i =0; i < s.length(); i++){

    char c = s.charAt(i);

    if(c == '\n'){

    y += height;

    x = originX;

    continue;

    }

    if(c == ' '){

    x += height*3/4;

    continue;

    }

    float[] coord = map.get©;

     

    tess.addVertexWithUV(x, y, 0, coord[1], 1);

    tess.addVertexWithUV(x, y+height, 0, coord[1], 0);

    tess.addVertexWithUV(x+height*(1+coord[1]-coord[0]), y+height, 0, coord[0], 0);

    tess.addVertexWithUV(x+height*(1+coord[1]-coord[0]), y, 0, coord[0], 1);

    x -= height*(1+coord[1]-coord[0]);

    }

    tess.draw();

    }

    }

    }

     

     

     

     

    basicly this, make sure you have the file "sf.png"  at the root of miencraft.jar (if you're in eclipse its the root of "moddirectory/jars/bin/minecraft.jar"  )

    and to make a draw call (most likely from a TileEntitySpecialRenderer)

     

    FontRendererFR.instance.drawString(message, startX, startY, heightOfTheLetter, isItFor3DOr2D, red, green, blue);

     

     

     

    the image is here

    http://imagebin.org/index.php?mode=image&id=262660

    http://imagebin.org/262660

     

     

    is looks all white, but thats becasue the site doesnt accept alpha, if you zoom in enough youll see that theres is actually an alphabet there, and if you save the image itll be transparent

  3. yeah ok it makes a lot of sens.

     

    getSide shouldnt be static, as static means its the same for everyone.

     

    what you want is a way to access a world variable and call

    world.getBlockMetadata(x, y, z);

    thsi will return what "getSide" is, but the specific value for every different block, if you want more help,

     

     

     

    put in spoiler every class you think could help, i dont have access to a minecraft build at the moment so i cant search by myself

     

     

  4. I have no idea personall i do it with blocks because i want the mayor of the town to be able to change the width/height/length of a plot (plots are "protected area") 

     

    i didnt know ForgeEssential was only for 147, mines 152 ready ;)

     

    technicly they're not mobs, they are entities, like a higher level in hierarchy. their only point as entities is ... to exists i guess. i do knwo they is a tutorial or 2 on the wiki about this. maybe you could try spawning a custom mob and then removing the "mob" part of the mob

  5. either get it from someone who already done this, copy over what vanilla minecraft is using or make a fontRenderer yourself from scratch.

     

    i suggest you do not make 1 from scratch becuase its a pain to implements. though if you want i can share mine.

     

    you will also need a TileEntitySpecialRenderer

  6. as a opengl expert

    //The PushMatrix tells the renderer to "start" doing something.

    this is hilarious and also giving me cancer but dont worry I'm super anal about CG code

     

    i know that its because of "MachinePoweredMelter.getSide" can you show me how this variable is set, it should be different for every block and it behing the same is the cause for the same orientation everywhere

     

  7. nono, if you do that youll literally create a new player

     

    okay you know in the function "handle(INetworkManager manager, Packet250CustomPayload packet, Player player)"

    cast the Player reference to a EntityPlayerMP and its THIS reference to write stuff to the nbt

  8. javadoc says the method "getEntityData()" return a nbt that will be written to disk

     

    im guessing just call the same thign... server side...

     

    im doing something similar but im using mysql instead of the nbt. so I'm not sure but it looks pretty straightfoward

  9. use something liek thsi

     

     

     

    package nicba1010.chemistryzation.common;

     

     

     

    import net.minecraft.client.Minecraft;

     

    import net.minecraft.client.gui.FontRenderer;

     

    import net.minecraft.client.gui.Gui;

     

    import net.minecraft.entity.player.EntityPlayer;

     

    import net.minecraft.nbt.NBTTagCompound;

     

    import net.minecraftforge.client.event.RenderGameOverlayEvent;

     

    import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;

     

    import net.minecraftforge.event.EventPriority;

     

    import net.minecraftforge.event.ForgeSubscribe;

     

     

     

    //

     

    // GuiBuffBar implements a simple status bar at the top of the screen which

     

    // shows the current buffs/debuffs applied to the character.

     

    //

     

    public class GuiChemistryLevel extends Gui {

     

            private Minecraft mc;

     

            FontRenderer fontrenderer;

     

            EntityPlayer p;

     

            NBTTagCompound nbt;

     

     

     

            public GuiChemistryLevel(Minecraft mc) {

     

                    super();

     

                    fontrenderer = mc.fontRenderer;

     

                    // We need this to invoke the render engine.

     

                    this.mc = mc;

     

            }

     

     

     

            @ForgeSubscribe(priority = EventPriority.NORMAL)

     

            public void onRenderExperienceBar(RenderGameOverlayEvent event) {

                 

     

                  p = mc.thePlayer;

                  nbt = p.getEntityData();

     

                     

                    if (event.isCancelable() || event.type != ElementType.EXPERIENCE) {

     

                            return;

     

                    }

     

                    int level;

     

                    level = nbt.getInteger("level");

     

                    if (level == 0) {

     

                            nbt.setInteger("level", 1);

     

                            level = nbt.getInteger("level");

     

                            fontrenderer.drawString("Level " + level, 1, 1, 0xffffffff);

     

                    } else {

     

                            fontrenderer.drawString("Level " + level, 1, 1, 0xffffffff);

     

                    }

     

     

     

                    this.mc.renderEngine.bindTexture("/gui/inventory.png");

     

            }

     

    }

     

  10. 1 please use spoilers,

     

    2 ..................

     

     

     

     

    what you are saying to the mod right now is

    "oh you're initializing the server? OPEN A GUI NOW NOW NOW" which cant happen server side

     

    1 make a class that implements IGuiHandler

    2 register this class like this

    NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler());

    3 make GuiChemistryLevel  extends GuiScreen instead

    4 call the gui from any method (either right click a block or bind it to a key)

    5 look at the wiki and tutorials.

     

     

     

  11. can we see the class "Chemistryzation". why are you calling a gui from there ? Even worst, why is it from a method called postInit ?

     

     

    at nicba1010.chemistryzation.common.GuiChemistryLevel.<init>(GuiChemistryLevel.java:49)

    at nicba1010.chemistryzation.common.Chemistryzation.postInit(Chemistryzation.java:76)

     

     

  12. heuf .... here we go

     

     

     

     

    //you class my block wtv thigny should be like this

    public class someBlock extends Block{

    //some code here like constructors n shit

    public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID) {

    TileEntity tileEntity = world.getBlockTileEntity(x, y, z);//this will return the tile entity at this location

      if(tileEntity != null){//safety check

      if(tileEntity instanceof TileEntityYourBlock){//safety check

        TileEntityYourBlock tileEntityYourBlock = (TileEntityYourBlock) tileEntity;//cast into the right kind

        tileEntityYourBlock.updateEntity();//call the update function on the tile entity

      }

      }

     

    }

    //some more code about wtv

    }

     

     

     

    as for the other thing about orientation, search the forge wiki for "metadata"

×
×
  • Create New...

Important Information

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