use of binnie.core.api.gui.IPoint in project Binnie by ForestryMC.
the class ControlItemDisplay method onRenderBackground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
if (this.itemStack.isEmpty()) {
return;
}
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getTopParent().getPosition());
if (relativeToWindow.xPos() > Window.get(this).getSize().xPos() + 100 || relativeToWindow.yPos() > Window.get(this).getSize().yPos() + 100) {
return;
}
GlStateManager.enableDepth();
if (this.getSize().xPos() != 16) {
GlStateManager.pushMatrix();
final float scale = this.getSize().xPos() / 16.0f;
GlStateManager.scale(scale, scale, 1);
RenderUtil.drawItem(Point.ZERO, this.itemStack, this.rotating);
GlStateManager.popMatrix();
} else {
RenderUtil.drawItem(Point.ZERO, this.itemStack, this.rotating);
}
GlStateManager.enableAlpha();
}
use of binnie.core.api.gui.IPoint in project Binnie by ForestryMC.
the class ControlChromosome method setSystem.
public void setSystem(@Nullable IBreedingSystem breedingSystem) {
if (this.breedingSystem != breedingSystem) {
this.breedingSystem = breedingSystem;
deleteAllChildren();
if (breedingSystem != null) {
IFieldKitPlugin fieldKitPlugin = breedingSystem.getFieldKitPlugin();
fieldKitPlugin.getChromosomePickerPositions();
for (Map.Entry<IChromosomeType, IPoint> entry : fieldKitPlugin.getChromosomePickerPositions().entrySet()) {
IChromosomeType chromosomeType = entry.getKey();
IPoint position = entry.getValue();
new ControlChromoPicker(this, position.xPos(), position.yPos(), chromosomeType);
}
}
}
}
use of binnie.core.api.gui.IPoint in project Binnie by ForestryMC.
the class TextureRenderer method texture.
public void texture(@Nullable final ITexture texture, final IArea area) {
if (texture == null) {
return;
}
this.setTexture(texture);
final IArea textureArea = texture.getArea().outset(texture.getBorder());
final IArea targetArea = area.outset(texture.getBorder());
if (textureArea.width() == targetArea.width() && textureArea.height() == targetArea.height()) {
final IPoint position = targetArea.pos();
GuiUtils.drawTexturedModalRect(position.xPos(), position.yPos(), textureArea.pos().xPos(), textureArea.pos().yPos(), textureArea.size().xPos(), textureArea.size().yPos(), 0);
} else {
renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
}
}
use of binnie.core.api.gui.IPoint in project Binnie by ForestryMC.
the class ControlLumbermillProgress method onRenderForeground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
GlStateManager.disableLighting();
final int sawX = (int) (63 * this.progress);
CraftGUI.RENDER.texture(ControlLumbermillProgress.SAW, new Point(sawX, -8 + Math.round(6 * (float) Math.sin(this.animation))));
final ItemStack item = Window.get(this).getInventory().getStackInSlot(LumbermillMachine.SLOT_LOG);
if (item.isEmpty()) {
return;
}
GlStateManager.disableLighting();
Block block = null;
if (item.getItem() instanceof ItemBlock) {
block = ((ItemBlock) item.getItem()).getBlock();
}
if (block == null) {
return;
}
// TODO RENDERING
// final IIcon icon = block.getIcon(2, item.getItemDamage());
TextureAtlasSprite icon = getWoodSprite(item);
for (int i = 0; i < 4; ++i) {
// CraftGUI.Render.iconBlock(new IPoint(1 + i * 16, 1), icon);
RenderUtil.drawSprite(new Point(1 + i * 16, 1), icon);
}
final ItemStack result = LumbermillRecipeManager.getPlankProduct(item, Minecraft.getMinecraft().world);
if (result.isEmpty()) {
return;
}
Block block2 = null;
if (result.getItem() instanceof ItemBlock) {
block2 = ((ItemBlock) result.getItem()).getBlock();
}
if (block2 == null) {
return;
}
// final IIcon icon2 = block2.getIcon(2, result.getItemDamage());
TextureAtlasSprite sprite = getWoodSprite(result);
final IPoint pos = this.getAbsolutePosition();
CraftGUI.RENDER.limitArea(new Area(pos.add(Point.ZERO), new Point(Math.round(this.progress * 64) + 2, 18)), guiWidth, guiHeight);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
for (int j = 0; j < 4; ++j) {
// TODO RENDERING
RenderUtil.drawSprite(new Point(1 + j * 16, 1), sprite);
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
CraftGUI.RENDER.texture(ControlLumbermillProgress.SAW, new Point(sawX, -8 + Math.round(6 * (float) Math.sin(this.animation))));
CraftGUI.RENDER.texture(ControlLumbermillProgress.SAW_2, new Point(sawX + 2, -8 + Math.round(6 * (float) Math.sin(this.animation))));
}
use of binnie.core.api.gui.IPoint in project Binnie by ForestryMC.
the class PagePlanksOverview method onValueChanged.
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
IPoint size = getSize();
new ControlText(this, new Area(0, 0, size.xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
new ControlText(this, new Area(12, 24, size.xPos() - 24, 24), I18N.localise(DatabaseConstants.EXTRATREES_KEY + ".planks.use"), TextJustification.MIDDLE_LEFT);
final IPlankType type = WoodManager.getPlankType(species);
int x = 12;
if (type != null) {
final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
final ItemStack gate = WoodManager.getGate(type);
final ItemStack door = WoodManager.getDoor(type);
if (!fence.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(fence);
x += 22;
}
if (!gate.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(gate);
x += 22;
}
if (!door.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(door);
x += 22;
}
}
final ControlText controlDescription = new ControlText(this, new Area(8, 84, this.getSize().xPos() - 16, 0), "", TextJustification.MIDDLE_CENTER);
final ControlText controlSignature = new ControlText(this, new Area(8, 84, this.getSize().xPos() - 16, 0), "", TextJustification.BOTTOM_RIGHT);
String desc = "";
if (type != null) {
desc = type.getDescription();
}
StringBuilder descBody = new StringBuilder("§o");
String descSig = "";
if (desc == null || desc.length() == 0) {
descBody.append(I18N.localise(DatabaseConstants.KEY + ".nodescription"));
} else {
final String[] descStrings = desc.split("\\|");
descBody.append(descStrings[0]);
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody.append(' ').append(descStrings[i]);
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
}
}
controlDescription.setValue(descBody + "§r");
controlSignature.setValue(descSig + "§r");
final int descHeight = CraftGUI.RENDER.textHeight(controlDescription.getValue(), controlDescription.getSize().xPos());
controlSignature.setPosition(new Point(controlSignature.getPosition().xPos(), controlDescription.getPosition().yPos() + descHeight + 10));
}
Aggregations