Алло, здравствуйте. Я ведь написал, капался в ванильных гуишках, и не понял ничего.MaximPixel написал(а):GuiTextField в net.minecraft.client.gui.GuiCommandBlock.class
GuiSlider'ы в net.minecraft.client.gui.GuiOptions.class
там мало кода
Да как это все дело вызывать я знаю. С GuiTextField вроде разобрался. А вот как работать с гуиСлайдер ,не понимаю.Agravaine написал(а):В initGui создаешь объект своего элемента, аля кнопка.
А потом у него вызываешь drawScreen, updateScreen и т.д методы в соответствующих в гуи.
Вот что можно высунуть из GuiCommandBlock:wgalexru написал(а):Алло, здравствуйте. Я ведь написал, капался в ванильных гуишках, и не понял ничего.MaximPixel написал(а):GuiTextField в net.minecraft.client.gui.GuiCommandBlock.class
GuiSlider'ы в net.minecraft.client.gui.GuiOptions.class
там мало кода
private GuiTextField commandTextField;
public void updateScreen()
{
this.commandTextField.updateCursorCounter();
}
public void initGui() {
this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
this.commandTextField.setMaxStringLength(32500);
this.commandTextField.setFocused(true);
}
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
this.commandTextField.textboxKeyTyped(typedChar, keyCode);
}
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
this.commandTextField.mouseClicked(mouseX, mouseY, mouseButton);
}
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
this.drawDefaultBackground();
this.commandTextField.drawTextBox();
super.drawScreen(mouseX, mouseY, partialTicks);
}
MaximPixel написал(а):Вот что можно высунуть из GuiCommandBlock:wgalexru написал(а):Алло, здравствуйте. Я ведь написал, капался в ванильных гуишках, и не понял ничего.MaximPixel написал(а):GuiTextField в net.minecraft.client.gui.GuiCommandBlock.class
GuiSlider'ы в net.minecraft.client.gui.GuiOptions.class
там мало кода
Код:private GuiTextField commandTextField; public void updateScreen() { this.commandTextField.updateCursorCounter(); } public void initGui() { this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20); this.commandTextField.setMaxStringLength(32500); this.commandTextField.setFocused(true); } protected void keyTyped(char typedChar, int keyCode) throws IOException { this.commandTextField.textboxKeyTyped(typedChar, keyCode); } protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); this.commandTextField.mouseClicked(mouseX, mouseY, mouseButton); } public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.commandTextField.drawTextBox(); super.drawScreen(mouseX, mouseY, partialTicks); }