Jump to content

WorldType GuiTroubles


Niightlord491

Recommended Posts

Hey everybody I got a simple problem I think... But anyways the problem is that I made a new WorldType and I wish for when the player first spawns in this worldtype my GUI screen will appear. Now I've heard that forge has an amazing method just for this purpose called onGuiWorldPress and I'm looking forward to using it but I just don't know where to inject it into my code. Heres the code please help!

package net.minecraft.src;

public class SinCityWorldType extends WorldType {
public SinCityWorldType() {
        super(2, "Sin City");
        // The first parameter is the id number of the WorldType,
        // vanilla Minecraft uses 0, 1, and 8 already. The max that can be used is 15,
        // The second parameter is our textname for our WorldType, the case needs to
        // match the "generator.void" localization in the "mod_" file.
}

public WorldChunkManager getChunkManager(World world) {
        return new SinCityChunkManager(world);
        // This is our ChunkManager class, it controls rain, temp, biomes, and spawn location
}


public boolean hasVoidParticles(boolean flag) {
        return false; // Used to determine if there is a sky
}

public int getSeaLevel(World world) {
        return 0; // Sets the Sea Level, be careful with this one, it controls the Y value of your spawn point.
}

public double voidFadeMagnitude() {
        return 0.0D; // Sets the void fade, play with it to see which values work for you.
}
public IChunkProvider getChunkGenerator(World world)
{
return new ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled());
// Change the provider on the line above to the Chunk Provider of choice.
}
}

 

Also here's the GUI if you need it.

 

package net.minecraft.src;

import java.awt.image.BufferedImage;
import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import org.lwjgl.input.Mouse;

public class GuiSinCity extends GuiScreen
{
private BufferedImage img;
private int imgID = 1000;


public GuiSinCity(EntityPlayer entityplayer)
{

}

public void initGui() 
{
 controlList.clear();
     controlList.add(new GuiButton(1, width / 2 + 10, height / 2 + 150, 98, 20, "Police"));
     controlList.add(new GuiButton(2, width / 2 - 110, height / 2 + 150, 98, 20, "Criminal"));
}
protected void actionPerformed(GuiButton guibutton){
    if(guibutton.id == 1)
    {
    	mc.displayGuiScreen(new GuiSCIntro1(mc.thePlayer));       
    }
    if(guibutton.id == 2)
    {
        mc.displayGuiScreen(new GuiSCIntro2(mc.thePlayer));
    }
}
public void drawLargeStringWithShadow(String text, int x, int y, int color)
{
    GL11.glScalef(2F, 2F, 2F);
    fontRenderer.drawStringWithShadow(text, x / 2, y / 2, color);
    GL11.glScalef(0.5F, 0.5F, 0.5F);
}
public void drawBorderedRect(int x, int y, int x1, int y1, int size, int borderC, int insideC) 
{
    drawRect(x, y, x1, y1, borderC);
    drawRect(x + size, y + size, x1 - size, y1 - size, insideC);
}


public void drawScreen(int i, int j, float f)
{               
	drawDefaultBackground();
	drawBorderedRect(235, 50, 448, 280, 1, 0xFF3c3c3c, 0xFF5c5c5c);
	drawLargeStringWithShadow("Introduction.", mc.displayWidth / 5 , (mc.displayHeight / 2) - 340, 0x44ff11);
        drawCenteredString(fontRenderer,"Sup Homie, Welcome to SinCity.", width / 2, 60, 0x44ff11);
        drawCenteredString(fontRenderer,"This world isn't like anything", width / 2, 70, 0x44ff11);
        drawCenteredString(fontRenderer,"you've ever experienced", width / 2, 80, 0x44ff11);
        drawCenteredString(fontRenderer,"so get yo ass ready and lets go" , width / 2, 90, 0x44ff11);	
        drawCenteredString(fontRenderer,"You can either pick from 2 classes", width / 2, 100, 0x44ff11);
        drawCenteredString(fontRenderer, "which is either Criminal or Police.", width / 2, 110, 0x44ff11);
        drawCenteredString(fontRenderer,"Criminals love to cause trouble in SinCity", width / 2, 120, 0x44ff11);
        drawCenteredString(fontRenderer,"and do things from robbing banks", width / 2, 130, 0x44ff11);
        drawCenteredString(fontRenderer,"to shooting at the cops", width / 2, 140, 0x44ff11);
        drawCenteredString(fontRenderer,"if you think you got the balls go for it.", width / 2, 150, 0x44ff11);
        drawCenteredString(fontRenderer,"On the other hand you have Police,", width / 2, 160, 0x44ff11);
        drawCenteredString(fontRenderer,"Not many people appreciate the five-o", width / 2, 170, 0x44ff11);
        drawCenteredString(fontRenderer,"but if you wanna play Mr.GoodyTwoShoes", width / 2, 180, 0x44ff11);
        drawCenteredString(fontRenderer,"this is the choice for you.", width / 2, 190, 0x44ff11);
        drawCenteredString(fontRenderer, "The Police class enables you to do things", width / 2, 200, 0x44ff11);
        drawCenteredString(fontRenderer,"from patrolling the streets", width / 2, 210, 0x44ff11);
        drawCenteredString(fontRenderer,"to arresting bank robbers.", width / 2, 220, 0x44ff11);
        drawCenteredString(fontRenderer,"Alright now you got the", width / 2, 230, 0x44ff11);
        drawCenteredString(fontRenderer, "rundown of both classes," , width / 2, 240, 0x44ff11);
        drawCenteredString(fontRenderer,"Click either Criminal or Police below", width / 2, 250, 0x44ff11);
        drawCenteredString(fontRenderer, "and get ready to enter SinCity!", width / 2, 260, 0x44ff11);
        
        
        
        super.drawScreen(i, j, f);
        //drawCenteredString(fontRenderer,, width / 2, 60, 0x44ff11);
}



public boolean doesGuiPauseGame()
{
         return false;
}
}

Thanks!

Link to comment
Share on other sites

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.