Ayant décidé de me lancer dans un énième projet, je décide de créer une machine avec un GUI. La machine marche, les crafts fonctionnent ... Mais on ne peut pas en dire autant du GUI. Regardez donc :
J'ai suivi ce tuto : http://www.minecraftforgefrance.fr/showthread.php?tid=2017
Voici ma classe GUI :
Code (Java):
package rwby.GUI ;
import net.minecraft.client.gui.inventory.GuiContainer ;
import net.minecraft.client.resources.I18n ;
import net.minecraft.entity.player.InventoryPlayer ;
import net.minecraft.inventory.IInventory ;
import net.minecraft.util.ResourceLocation ;
import org.lwjgl.opengl.GL11 ;
import rwby.Blocks.TileEntity_Dust_Energizer ;
import rwby.Handlers.B_Dust_Energizer_Container ;
public class GUI_Dust_Energizer extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation( "rwby:textures/GUI/energizer_load.png" ) ;
private TileEntity_Dust_Energizer TileEntity_Dust_Energizer;
private IInventory playerInv;
public GUI_Dust_Energizer( TileEntity_Dust_Energizer tile, InventoryPlayer inventory)
{
super ( new B_Dust_Energizer_Container( tile, inventory) ) ;
this .TileEntity_Dust_Energizer = tile;
this .playerInv = inventory;
this .allowUserInput = false ;
this .ySize = 256 ;
this .xSize = 195 ;
}
@Override
protected void drawGuiContainerBackgroundLayer( float partialRenderTick, int x, int y)
{
GL11.glColor4f ( 1.0F, 1.0F, 1.0F, 1.0F) ;
this .mc .getTextureManager ( ) .bindTexture ( texture) ;
int k = ( this .width - this .xSize ) / 2 ;
int l = ( this .height - this .ySize ) / 2 ;
this .drawTexturedModalRect ( k, l, 0 , 46 , this .xSize , this .ySize - 49 ) ; //Cette ligne a changé
if ( this .TileEntity_Dust_Energizer .isBurning ( ) )
{
int i = this .TileEntity_Dust_Energizer .getCookProgress ( ) ; //Nous créerons cette fonction après
this .drawTexturedModalRect ( x, y, 0 , 0 , width, height) ;
}
}
protected void drawGuiContainerForegroundLayer( int x, int y)
{
this .fontRendererObj .drawString ( this .playerInv .hasCustomInventoryName ( ) ? this .playerInv .getInventoryName ( ) : I18n.format ( this .playerInv .getInventoryName ( ) ) , 10 , this .ySize - 98 , 4210752 ) ;
}
}
Le problème n'est pas la position des cases, mais bien le GUI qui apparait a la position de ma souris pendant la "fonte" au lieu d'apparaitre a la position nécessaire.