Quote:
Originally Posted by Domekilla12
Ich bin wirklich Fan deiner Tutorial-Reihe geworden :)
Mich würde noch interessieren wie man erreicht dass z.b Wenn man einen knopf drückt (auf der tastatur) dass sich dann ein anderes Interface öffnet auf dem man sachen einstellen kann oder crafting rezepte nachgucken kann usw.
|
Kuck dir das mal genauer an
mod_gui
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class mod_gui extends BaseMod{
public void load()
{
ModLoader.setInGameHook(this, true, false);
ModLoader.registerKey(this, this.key_gui, false);
ModLoader.addLocalization("key.gui", "Gui Open");
}
public void keyboardEvent(KeyBinding event)
{
Minecraft minecraft = ModLoader.getMinecraftInstance();
World world = minecraft.theWorld;
if (event == this.key_gui)
{
open = !open;
}
}
public boolean onTickInGame(float f, Minecraft minecraft) {
World world = minecraft.theWorld;
EntityPlayer ep = minecraft.thePlayer;
if(open){
ModLoader.openGUI(ModLoader.getMinecraftInstance() .thePlayer, new mod_GuiExtreme());
}
return true;
}
public String getVersion() {
return "1.0.0";
}
private KeyBinding key_gui = new KeyBinding("key.gui", 48);
public static boolean open;
}
mod_guiextreme Da kommen die Funktionen rein
package net.minecraft.src;
import java.util.List;
import net.minecraft.client.Minecraft;
public class mod_GuiExtreme extends GuiScreen
{
public mod_GuiExtreme(){}
public void initGui()
{
controlList.clear();
byte byte0 = -16;
controlList.add(new GuiButton(0 /*ID*/, width / 10 /*X-Pos*/, height / 4 + 24 + byte0 /*Y-Pos*/,80 /*Breite*/ ,20 /*Höhe*/ ,"Tag"/*Text d. Buttons*/));
controlList.add(new GuiButton(1 /*ID*/, width / 10 /*X-Pos*/, height / 4 + 48 + byte0 /*Y-Pos*/,80 /*Breite*/ ,20 /*Höhe*/ ,"Mittag"/*Text d. Buttons*/));
controlList.add(new GuiButton(2 /*ID*/, width / 10 /*X-Pos*/, height / 4 + 72 + byte0 /*Y-Pos*/,80 /*Breite*/ ,20 /*Höhe*/ ,"Nacht"/*Text d. Buttons*/));
controlList.add(new GuiButton(3 /*ID*/, width / 10 /*X-Pos*/, height / 4 + 96 + byte0 /*Y-Pos*/,80 /*Breite*/ ,20 /*Höhe*/ ,"Regen"/*Text d. Buttons*/));
}
public void actionPerformed(GuiButton guibutton)
{
if(guibutton.id == 0)
{
ModLoader.getMinecraftInstance().theWorld.setWorld Time(100);
mod_gui.open = false;
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
if(guibutton.id == 1)
{
ModLoader.getMinecraftInstance().theWorld.setWorld Time(5000);
mod_gui.open = false;
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
if(guibutton.id == 2)
{
ModLoader.getMinecraftInstance().theWorld.setWorld Time(13000);
mod_gui.open = false;
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
if(guibutton.id == 3)
{
ModLoader.getMinecraftInstance().theWorld.setRainS trength(100);
mod_gui.open = false;
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
}
public void drawScreen(int i, int j, float f)
{
drawDefaultBackground();
drawCenteredString(fontRenderer, "\u00a7c Cheat Menü", width / 2, 40, 0xffffff);
super.drawScreen(i, j, f);
}
}