jopi
Попрошайка
- 1,421
- 30
- 260
При клике на блок срабатывает код гуихандлера, игрок на мгновение останавливается и все.
Ни курсора, ни гуи, ни$&%
Код гуи:
код контейнера
Ни курсора, ни гуи, ни$&%
Код гуи:
Java:
public class GuiAnvil extends GuiContainer {
private TileAnvil tile;
private int id;
public GuiAnvil(InventoryPlayer inv, TileAnvil tile, int id) {
super(new ContainerAnvil(inv, tile, id));
this.tile = tile;
this.id = id;
this.xSize = 176;
this.ySize = 175;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
int j = (super.width - super.xSize) / 2;
int k = (super.height - super.ySize) / 2;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
super.mc.renderEngine.bindTexture(new ResourceLocation("daddon:gui.png"));
int j = (super.width - super.xSize) / 2;
int k = (super.height - super.ySize) / 2;
this.drawTexturedModalRect(j, k, 0, 0, super.xSize, super.ySize + 18);
this.drawTexturedModalRect(j + 76, k + 15, 176, 14, this.tile.time, 17);
}
}
Java:
public class ContainerAnvil extends ContainerBase {
private TileAnvil tileentity;
private int id;
private int time = 0;
private boolean isWork = false;
public ContainerAnvil(InventoryPlayer inv, TileAnvil tile, int id) {
super(inv);
this.tileentity = tile;
this.id = id;
//SlotID slot = new SlotID(tileentity, 0, 109, 16, 25);
this.addSlotToContainer(new Slot(tileentity, 0, 10, 10));
this.CalcFullInv(93);
}
@Override
public void addCraftingToCrafters(ICrafting par1ICrafting) {
super.addCraftingToCrafters(par1ICrafting);
par1ICrafting.sendProgressBarUpdate(this, 0, this.tileentity.time);
par1ICrafting.sendProgressBarUpdate(this, 1, this.tileentity.work ? 1 : 0);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < super.crafters.size(); ++i) {
ICrafting icrafting = (ICrafting) super.crafters.get(i);
if (this.time != this.tileentity.time) {
icrafting.sendProgressBarUpdate(this, 0, this.tileentity.time);
}
if (this.isWork != this.tileentity.work) {
icrafting.sendProgressBarUpdate(this, 1, this.tileentity.work ? 1 : 0);
}
}
this.time = this.tileentity.time;
this.isWork = this.tileentity.work;
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2) {
if (par1 == 0) {
this.tileentity.time = par2;
}
if (par1 == 1) {
TileAnvil tileentity = this.tileentity;
tileentity.work = par2 == 0 ? false : true;
}
}
@Override
public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
return this.tileentity.isUseableByPlayer(par1EntityPlayer);
}
@Override
public int getMergeMaxSlotIndex(int SlotIndex) {
return SlotIndex + 1;
}
}