Собственно проблема описана в названий темы, не срабатывает GUI после использования предмета.
Коды файлов:
ClientProxy.
CommonProxy.
theBookofAllGui.
Вызов:
Делал по вот этому туториалу, понимаю он старый, но смысла искать что то другое нет, либо на официальной вики вроде как там написано тоже ещё нету нормального туториала по GUI.
Так же хотел узнать про initGUI, почему не работает controlList, чем его заменить надо.
Коды файлов:
ClientProxy.
Код:
package last2424.mods.***.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class ClientProxy extends CommonProxy
{
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null)
{
switch(ID)
{
case 0: /* your GUIs go here */
}
}
return tileEntity;
}
}
CommonProxy.
Код:
package last2424.mods.***.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class CommonProxy implements IGuiHandler
{
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
return null;
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if(tileEntity != null)
{
switch(ID)
{
case 0: /* your Containers go here*/
}
}
return tileEntity;
}
}
theBookofAllGui.
Код:
package last2424.mods.***.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class theBookofAllGui extends GuiScreen {
public final int xSizeOfTexture = 176;
public final int ySizeOfTexture = 88;
public ResourceLocation locationtexture = new ResourceLocation("/Block/changeColorGUI.png");
public theBookofAllGui(EntityPlayer player)
{
}
/*@Override
public void initGui()
{
super.initGui();
this.controlList.clear();
int posX = (this.width - xSizeOfTexture) / 2;
int posY = (this.height - ySizeOfTexture) / 2;
this.controlList.add(new GuiButton(0, posX+ 40, posY + 40, 100, 20, "no use"));
}*/
@Override
public void drawScreen(int x, int y, float f){
drawDefaultBackground();
ITextureObject var4 = this.mc.renderEngine.getTexture(locationtexture);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.getTexture((ResourceLocation) var4);
int posX = (this.width - xSizeOfTexture) / 2;
int posY = (this.height - ySizeOfTexture) / 2;
drawTexturedModalRect(posX, posY, 0, 0, xSizeOfTexture, ySizeOfTexture);
super.drawScreen(x, y, f);
}
}
Вызов:
Код:
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
{
player.openGui(mdc_main.instance, 3, world, 0, 0, 0);
return itemstack;
}
Делал по вот этому туториалу, понимаю он старый, но смысла искать что то другое нет, либо на официальной вики вроде как там написано тоже ещё нету нормального туториала по GUI.
Так же хотел узнать про initGUI, почему не работает controlList, чем его заменить надо.