use of com.porpit.minecamera.network.MessagePhotoProcessorStart in project MineCamera by PorPit.
the class GuiPhotoProcessor method initGui.
@Override
public void initGui() {
super.initGui();
final FontRenderer fr = this.fontRendererObj;
int offsetX = (this.width - this.xSize) / 2, offsetY = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(BUTTON_START, offsetX + 11, offsetY + 101, 25, 16, "") {
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
GlStateManager.color(1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(TEXTURE);
int x = mouseX - this.xPosition, y = mouseY - this.yPosition;
if (x >= 0 && y >= 0 && x < this.width && y < this.height) {
this.drawTexturedModalRect(this.xPosition, this.yPosition, 50, 206, this.width, this.height);
} else {
this.drawTexturedModalRect(this.xPosition, this.yPosition, 24, 206, this.width, this.height);
}
}
}
@Override
public void mouseReleased(int mouseX, int mouseY) {
infolock = true;
int lightlevel = container.getTileEntity().getWorld().getLight(container.getTileEntity().getPos());
if (!container.getSlot(0).getHasStack()) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.nonectl");
return;
} else if (!container.getSlot(1).getHasStack()) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.noneda");
return;
} else if (!container.getSlot(2).getHasStack()) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.nonefilm");
return;
} else if (!container.getSlot(3).getHasStack()) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.nonepaper");
return;
} else if (container.getSlot(4).getHasStack()) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.hasphotoout");
return;
} else if (container.getBurnTime() != container.totalBurnTime) {
return;
} else if (lightlevel > 5) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.lightleveltoohigh");
return;
}
if (container.getSlot(2).getStack().hasTagCompound() && container.getSlot(2).getStack().getTagCompound().hasKey("pid")) {
String imagename = container.getSlot(2).getStack().getTagCompound().getString("pid");
EnumFailLoadImage flag = PictureFactory.isFailedToLoad(imagename);
if (flag != null) {
info = TextFormatting.RED + I18n.format("container.photoprocessor.text.failed." + flag.toString());
return;
}
MessagePhotoProcessorStart message = new MessagePhotoProcessorStart();
NetworkLoader.instance.sendToServer(message);
}
}
});
}
Aggregations