Salut,
Du coup j’ai mis différents print :
Classe GuiHandler :
public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
System.out.println(" création container chest explorer");
return new ContainerChestExplorer(world.getTileEntity(new BlockPos(x, y, z)));
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
System.out.println(" création gui chest explorer");
return new GuiChestExplorer(world.getTileEntity(new BlockPos(x, y, z)));
}
return null;
}
}
Les deux print s’affiche bien.
Classe ContainerChestExplorer :
public class ContainerChestExplorer extends Container
{
IInventory inventory;
public ContainerChestExplorer(TileEntity tile)
{
System.out.println("constructeur container");
this.inventory = ((IInventory)tile);
int i = 0;
int j = 0;
for (i = 0; i < 108; i++) {
if (i % 12 == 0)
j++;
int u = i % 12 + 1;
if (i < this.inventory.getSizeInventory()) {
addSlotToContainer(new SlotChestExplorer(this.inventory, i, u * 18 - 6, j * 18 - 10));
} else {
addSlotToContainer(new SlotChestExplorer(new InventoryDummy(), 0, u * 18 - 6, j * 18 - 10));
}
}
}
public boolean canInteractWith(EntityPlayer player) {
System.out.println("AAAAAAAAAAAAAAA" + this.inventory.isUsableByPlayer(player));
return this.inventory.isUsableByPlayer(player);
}
public ItemStack slotClick(int slotIndex, int buttonPressed, int flag, EntityPlayer player)
{
return null;
}
public ItemStack transferStackInSlot(EntityPlayer player, int quantity)
{
return null;
}
}
Le print du constructeur s’affiche bien mais celui de la méthode de canInteractWith n’apparait pas et je ne comprends pas pourquoi.
Classe GuiChestExplorer :
public class GuiChestExplorer extends GuiContainer
{
TileEntity tile;
ResourceLocation bg = new ResourceLocation("sebenforcemod:textures/gui/chestexplorer.png");
public GuiChestExplorer(TileEntity te) {
super(new ContainerChestExplorer(te));
System.out.println("constructeur gui");
this.xSize = 256;
this.ySize = 177;
}
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
this.mc.renderEngine.bindTexture(this.bg);
System.out.println("draw gui");
drawDefaultBackground();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int x = (this.width - this.xSize) / 2;
int y = (this.height - this.ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, 256, 256);
}
}
Les deux print s’affichent bien.
Est ce qu’il est possible que le gui du coffre de base s’affiche par dessus le mien ?