mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 19:59:49 +00:00
Gui rendering cleanup
This commit is contained in:
1 parent
17f036522e
commit
31a305ffc2
173 files changed
+1317
-1349
No files matched your search
@@ -12,8 +12,8 @@ import binnie.craftgui.core.Tooltip;
|
||||
public class ControlColourDisplay extends Control implements IControlValue<IFlowerColour>, ITooltip {
|
||||
IFlowerColour value;
|
||||
|
||||
public ControlColourDisplay(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
public ControlColourDisplay(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ControlColourDisplay extends Control implements IControlValue<IFlow
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.solid(this.getArea(), -1);
|
||||
CraftGUI.render.solid(this.getArea().inset(1), -16777216 + this.getValue().getColor(false));
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ControlColourMixBox extends ControlListBox<IColourMix> {
|
||||
}
|
||||
|
||||
public ControlColourMixBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
|
||||
super(parent, x, y, width, height, 12.0f);
|
||||
super(parent, x, y, width, height, 12);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ public class ControlColourMixItem extends ControlOption<IColourMix> {
|
||||
|
||||
public ControlColourMixItem(final ControlList<IColourMix> controlList, final IColourMix option, final int y) {
|
||||
super(controlList, option, y);
|
||||
this.itemWidget1 = new ControlColourDisplay(this, 4.0f, 4.0f);
|
||||
this.itemWidget2 = new ControlColourDisplay(this, 44.0f, 4.0f);
|
||||
this.itemWidget3 = new ControlColourDisplay(this, 104.0f, 4.0f);
|
||||
this.itemWidget1 = new ControlColourDisplay(this, 4, 4);
|
||||
this.itemWidget2 = new ControlColourDisplay(this, 44, 4);
|
||||
this.itemWidget3 = new ControlColourDisplay(this, 104, 4);
|
||||
this.addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||
this.arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||
final BreedingSystem system = ((WindowAbstractDatabase) this.getSuperParent()).getBreedingSystem();
|
||||
|
||||
@@ -19,8 +19,8 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
int type;
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
if (this.type == 0) {
|
||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
||||
} else {
|
||||
@@ -29,7 +29,7 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
this.value = null;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
|
||||
@@ -14,15 +14,15 @@ public class ControlColourOption extends ControlTextOption<IFlowerColour> {
|
||||
|
||||
public ControlColourOption(final ControlList<IFlowerColour> controlList, final IFlowerColour option, final int y) {
|
||||
super(controlList, option, option.getColourName(), y);
|
||||
this.setSize(new IPoint(this.getSize().x(), 20.0f));
|
||||
(this.controlBee = new ControlColourDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||
this.setSize(new IPoint(this.getSize().x(), 20));
|
||||
(this.controlBee = new ControlColourDisplay(this, 2, 2)).setValue(option);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0f, 0.0f));
|
||||
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
||||
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22, 0));
|
||||
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24, 0)));
|
||||
final int th = (int) CraftGUI.render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
|
||||
final int height = Math.max(20, th + 6);
|
||||
this.setSize(new IPoint(this.size().x(), height));
|
||||
this.textWidget.setSize(new IPoint(this.textWidget.getSize().x(), height));
|
||||
this.boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
||||
this.boxPosition = new IPoint(2, (height - 18) / 2);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class PageColourMix extends PageAbstract<IFlowerColour> {
|
||||
|
||||
public PageColourMix(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Further Mixes");
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, "Further Mixes");
|
||||
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Further);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PageColourMixResultant extends PageAbstract<IFlowerColour> {
|
||||
|
||||
public PageColourMixResultant(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Resultant Mixes");
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, "Resultant Mixes");
|
||||
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Resultant);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,32 +42,32 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
final IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||
final int w = 144;
|
||||
final int h = 176;
|
||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), "Genome", TextJustification.MiddleCenter);
|
||||
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||
final Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||
new ControlText(this, new IArea(0, 4, w, 16), "Genome", TextJustification.MiddleCenter);
|
||||
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4, 20, w - 8, h - 8 - 16, 12);
|
||||
final Control contents = new Control(scrollable, 0, 0, w - 8 - 12, h - 8 - 16);
|
||||
final int tw = w - 8 - 12;
|
||||
final int w2 = 55;
|
||||
final int w3 = tw - 50;
|
||||
int y = 0;
|
||||
final int th = 14;
|
||||
final int th2 = 18;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Temp. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), "Temp. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Moist. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), "Moist. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), Binnie.LANGUAGE.localise(treeSpecies.getMoisture()), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "pH. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), "pH. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), Binnie.LANGUAGE.localise(treeSpecies.getPH()), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Fertility : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), "Fertility : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
final float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Lifespan : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), "Lifespan : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), "" + String.format("%.2f", lifespan) + " days", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Nectar : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), "Nectar : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
int x = w2;
|
||||
@@ -86,7 +86,7 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
}
|
||||
}
|
||||
final int numOfLines = 1 + (tot - 1) / 3;
|
||||
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), "Varieties : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), "Varieties : ", TextJustification.MiddleRight);
|
||||
y += th;
|
||||
contents.setSize(new IPoint(contents.size().x(), y));
|
||||
scrollable.setScrollableContent(contents);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
ControlListBox<EnumFlowerColor> selectionBoxColors;
|
||||
|
||||
public WindowBotanistDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
super(player, side, nei, Binnie.GENETICS.flowerBreedingSystem, 130.0f);
|
||||
super(player, side, nei, Binnie.GENETICS.flowerBreedingSystem, 130);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
@@ -49,7 +49,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
this.createMode(FlowerMode.Colour, new ModeWidgets(FlowerMode.Colour, this) {
|
||||
@Override
|
||||
public void createListBox(final IArea area) {
|
||||
this.listBox = new ControlListBox<IFlowerColour>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
this.listBox = new ControlListBox<IFlowerColour>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12) {
|
||||
@Override
|
||||
public IWidget createOption(final IFlowerColour value, final int y) {
|
||||
return new ControlColourOption(this.getContent(), value, y);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package binnie.core.block;
|
||||
|
||||
import binnie.core.network.packet.PacketMetadata;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@@ -83,9 +85,11 @@ public class TileEntityMetadata extends TileEntity {
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final ItemStack item = new ItemStack(block, 1, 0);
|
||||
setItemDamage(item, damage);
|
||||
return item;
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
Preconditions.checkNotNull(item, "Could not get item for block %s", block);
|
||||
final ItemStack itemStack = new ItemStack(item, 1, 0);
|
||||
setItemDamage(itemStack, damage);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
|
||||
@@ -5,17 +5,22 @@ import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class SlotValidator extends Validator<ItemStack> {
|
||||
public static ValidatorIcon IconBee;
|
||||
public static ValidatorIcon IconFrame;
|
||||
public static ValidatorIcon IconCircuit;
|
||||
public static ValidatorIcon IconBlock;
|
||||
|
||||
@Nullable
|
||||
private ValidatorIcon icon;
|
||||
|
||||
public SlotValidator(final ValidatorIcon icon) {
|
||||
public SlotValidator(@Nullable final ValidatorIcon icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TextureAtlasSprite getIcon(final boolean input) {
|
||||
return (this.icon == null) ? null : BinnieCore.proxy.getTextureAtlasSprite(this.icon.getIcon(input).getResourceLocation());
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import binnie.craftgui.minecraft.EnumColor;
|
||||
class ControlColourSelector extends Control implements ITooltip, IControlValue<EnumColor> {
|
||||
private EnumColor value;
|
||||
|
||||
public ControlColourSelector(final IWidget parent, final float x, final float y, final float w, final float h, final EnumColor value) {
|
||||
public ControlColourSelector(final IWidget parent, final int x, final int y, final int w, final int h, final EnumColor value) {
|
||||
super(parent, x, y, w, h);
|
||||
this.setValue(value);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
@@ -35,8 +35,8 @@ class ControlColourSelector extends Control implements ITooltip, IControlValue<E
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
CraftGUI.render.gradientRect(this.getArea(), -16777216 + this.value.getColour(), -16777216 + this.value.getColour());
|
||||
}
|
||||
}
|
||||
@@ -101,9 +101,9 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
final int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24);
|
||||
final int compartmentHeight = compartmentPageHeight;
|
||||
final Control controlCompartment = new Control(this, x, y, compartmentWidth, compartmentHeight);
|
||||
final ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0.0f, 0.0f, 24.0f, compartmentPageHeight, Position.Left) {
|
||||
final ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0, 0, 24, compartmentPageHeight, Position.Left) {
|
||||
@Override
|
||||
public ControlTab<Integer> createTab(final float x, final float y, final float w, final float h, final Integer value) {
|
||||
public ControlTab<Integer> createTab(final int x, final int y, final int w, final int h, final Integer value) {
|
||||
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
@@ -142,7 +142,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
}.setOrigin(EventHandler.Origin.DirectChild, tab));
|
||||
x += 24;
|
||||
final ControlPages<Integer> compartmentPages = new ControlPages<>(controlCompartment, 24.0f, 0.0f, compartmentPageWidth, compartmentPageHeight);
|
||||
final ControlPages<Integer> compartmentPages = new ControlPages<>(controlCompartment, 24, 0, compartmentPageWidth, compartmentPageHeight);
|
||||
final ControlPage[] page = new ControlPage[inv.getTabNumber()];
|
||||
for (int p = 0; p < inv.getTabNumber(); ++p) {
|
||||
page[p] = new ControlPage(compartmentPages, p);
|
||||
@@ -151,9 +151,9 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
int i = 0;
|
||||
for (int p2 = 0; p2 < inv.getTabNumber(); ++p2) {
|
||||
final ControlPage thisPage = page[p2];
|
||||
final Panel panel = new Panel(thisPage, 0.0f, 0.0f, thisPage.w(), thisPage.h(), MinecraftGUI.PanelType.Black) {
|
||||
final Panel panel = new Panel(thisPage, 0, 0, thisPage.w(), thisPage.h(), MinecraftGUI.PanelType.Black) {
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
final Texture iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline);
|
||||
CraftGUI.render.colour(WindowCompartment.this.getTab(WindowCompartment.this.panels.get(this)).getColor().getColour());
|
||||
CraftGUI.render.texture(iTexture, this.getArea().inset(3));
|
||||
@@ -168,9 +168,9 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
x += compartmentPageWidth;
|
||||
if (tabs2.length > 0) {
|
||||
final ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0.0f, 24.0f, compartmentPageHeight, Position.Right) {
|
||||
final ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0, 24, compartmentPageHeight, Position.Right) {
|
||||
@Override
|
||||
public ControlTab<Integer> createTab(final float x, final float y, final float w, final float h, final Integer value) {
|
||||
public ControlTab<Integer> createTab(final int x, final int y, final int w, final int h, final Integer value) {
|
||||
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
@@ -212,20 +212,20 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
x += 16;
|
||||
this.setSize(new IPoint(Math.max(32 + compartmentWidth, 252), this.h()));
|
||||
controlCompartment.setPosition(new IPoint((this.w() - controlCompartment.w()) / 2.0f, controlCompartment.y()));
|
||||
controlCompartment.setPosition(new IPoint((this.w() - controlCompartment.w()) / 2, controlCompartment.y()));
|
||||
final ControlPlayerInventory invent = new ControlPlayerInventory(this, true);
|
||||
final ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.Left);
|
||||
final ControlSlide slide = new ControlSlide(this, 0, 134, 136, 92, Position.Left);
|
||||
slide.setLabel("Tab Properties");
|
||||
slide.setSlide(false);
|
||||
slide.addHelp("Tab Properties");
|
||||
slide.addHelp("The label, colour and icon of the Tab can be altered here. Clicking on the icon with a held item will change it.");
|
||||
final Panel tabPropertyPanel = new Panel(slide, 16.0f, 8.0f, 112.0f, 76.0f, MinecraftGUI.PanelType.Gray);
|
||||
final Panel tabPropertyPanel = new Panel(slide, 16, 8, 112, 76, MinecraftGUI.PanelType.Gray);
|
||||
int y2 = 4;
|
||||
new ControlText(tabPropertyPanel, new IPoint(4.0f, y2), "Tab Name:");
|
||||
new ControlText(tabPropertyPanel, new IPoint(4, y2), "Tab Name:");
|
||||
final Panel parent = tabPropertyPanel;
|
||||
final float x2 = 4.0f;
|
||||
final int x2 = 4;
|
||||
y2 += 12;
|
||||
(this.tabName = new ControlTextEdit(parent, x2, y2, 104.0f, 12.0f)).addSelfEventHandler(new EventTextEdit.Handler() {
|
||||
(this.tabName = new ControlTextEdit(parent, x2, y2, 104, 12)).addSelfEventHandler(new EventTextEdit.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventTextEdit event) {
|
||||
final CompartmentTab tab = WindowCompartment.this.getCurrentTab();
|
||||
@@ -236,8 +236,8 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
}.setOrigin(EventHandler.Origin.Self, this.tabName));
|
||||
y2 += 20;
|
||||
new ControlText(tabPropertyPanel, new IPoint(4.0f, y2), "Tab Icon: ");
|
||||
(this.tabIcon = new ControlItemDisplay(tabPropertyPanel, 58.0f, y2 - 4)).setItemStack(new ItemStack(Items.PAPER));
|
||||
new ControlText(tabPropertyPanel, new IPoint(4, y2), "Tab Icon: ");
|
||||
(this.tabIcon = new ControlItemDisplay(tabPropertyPanel, 58, y2 - 4)).setItemStack(new ItemStack(Items.PAPER));
|
||||
this.tabIcon.addAttribute(Attribute.MouseOver);
|
||||
this.tabIcon.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
@@ -254,13 +254,13 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
WindowCompartment.this.sendClientAction("comp-change-tab", nbt);
|
||||
}
|
||||
});
|
||||
this.tabColour = new ControlColourSelector(tabPropertyPanel, 82.0f, y2 - 4, 16.0f, 16.0f, EnumColor.White);
|
||||
this.tabColour = new ControlColourSelector(tabPropertyPanel, 82, y2 - 4, 16, 16, EnumColor.White);
|
||||
this.tabIcon.addHelp("Icon for Current Tab");
|
||||
this.tabIcon.addHelp("Click here with an item to change");
|
||||
y2 += 20;
|
||||
new ControlText(tabPropertyPanel, new IPoint(4.0f, y2), "Colour: ");
|
||||
new ControlText(tabPropertyPanel, new IPoint(4, y2), "Colour: ");
|
||||
final int cw = 8;
|
||||
final Panel panelColour = new Panel(tabPropertyPanel, 40.0f, y2 - 4, cw * 8 + 2, cw * 2 + 1, MinecraftGUI.PanelType.Gray);
|
||||
final Panel panelColour = new Panel(tabPropertyPanel, 40, y2 - 4, cw * 8 + 2, cw * 2 + 1, MinecraftGUI.PanelType.Gray);
|
||||
for (int cc = 0; cc < 16; ++cc) {
|
||||
final ControlColourSelector color = new ControlColourSelector(panelColour, 1 + cw * (cc % 8), 1 + cw * (cc / 8), cw, cw, EnumColor.values()[cc]);
|
||||
color.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@@ -277,16 +277,16 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
color.addHelp("Select a colour to highlight the current tab");
|
||||
}
|
||||
y2 += 20;
|
||||
final ControlButton searchButton = new ControlButton(controlCompartment, compartmentWidth - 24 - 64 - 8, compartmentPageHeight, 64.0f, 16.0f, "Search") {
|
||||
final ControlButton searchButton = new ControlButton(controlCompartment, compartmentWidth - 24 - 64 - 8, compartmentPageHeight, 64, 16, "Search") {
|
||||
@Override
|
||||
protected void onMouseClick(final EventMouse.Down event) {
|
||||
WindowCompartment.this.createSearchDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
final Object texture = this.isMouseOver() ? CraftGUITexture.TabHighlighted : CraftGUITexture.Tab;
|
||||
CraftGUI.render.texture(CraftGUI.render.getTexture(texture).crop(Position.Bottom, 8.0f), this.getArea());
|
||||
CraftGUI.render.texture(CraftGUI.render.getTexture(texture).crop(Position.Bottom, 8), this.getArea());
|
||||
}
|
||||
};
|
||||
searchButton.addHelp("Search Button");
|
||||
@@ -294,7 +294,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
|
||||
public void createSearchDialog() {
|
||||
new Dialog(this, 252.0f, 192.0f) {
|
||||
new Dialog(this, 252, 192) {
|
||||
Control slotGrid;
|
||||
String textSearch = "";
|
||||
boolean sortByName = false;
|
||||
@@ -307,16 +307,16 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
final ControlScrollableContent<IWidget> scroll = new ControlScrollableContent<IWidget>(this, 124.0f, 16.0f, 116.0f, 92.0f, 6.0f) {
|
||||
final ControlScrollableContent<IWidget> scroll = new ControlScrollableContent<IWidget>(this, 124, 16, 116, 92, 6) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.colour(11184810);
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, this.getArea().inset(new IBorder(0.0f, 6.0f, 0.0f, 0.0f)));
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, this.getArea().inset(new IBorder(0, 6, 0, 0)));
|
||||
}
|
||||
};
|
||||
scroll.setScrollableContent(this.slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f));
|
||||
scroll.setScrollableContent(this.slotGrid = new Control(scroll, 1, 1, 108, 18));
|
||||
new ControlPlayerInventory(this, true);
|
||||
new ControlTextEdit(this, 16.0f, 16.0f, 100.0f, 14.0f).addEventHandler(new EventTextEdit.Handler() {
|
||||
new ControlTextEdit(this, 16, 16, 100, 14).addEventHandler(new EventTextEdit.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventTextEdit event) {
|
||||
textSearch = event.value;
|
||||
@@ -325,21 +325,21 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
});
|
||||
this.includeItems = true;
|
||||
this.includeBlocks = true;
|
||||
new ControlCheckbox(this, 16.0f, 40.0f, 100.0f, "Sort A-Z", this.sortByName) {
|
||||
new ControlCheckbox(this, 16, 40, 100, "Sort A-Z", this.sortByName) {
|
||||
@Override
|
||||
protected void onValueChanged(final boolean value) {
|
||||
sortByName = value;
|
||||
updateSearch();
|
||||
}
|
||||
};
|
||||
new ControlCheckbox(this, 16.0f, 64.0f, 100.0f, "Include Items", this.includeItems) {
|
||||
new ControlCheckbox(this, 16, 64, 100, "Include Items", this.includeItems) {
|
||||
@Override
|
||||
protected void onValueChanged(final boolean value) {
|
||||
includeItems = value;
|
||||
updateSearch();
|
||||
}
|
||||
};
|
||||
new ControlCheckbox(this, 16.0f, 88.0f, 100.0f, "Include Blocks", this.includeBlocks) {
|
||||
new ControlCheckbox(this, 16, 88, 100, "Include Blocks", this.includeBlocks) {
|
||||
@Override
|
||||
protected void onValueChanged(final boolean value) {
|
||||
includeBlocks = value;
|
||||
|
||||
@@ -45,10 +45,10 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class WindowFieldKit extends Window {
|
||||
private float glassOffsetX;
|
||||
private float glassOffsetY;
|
||||
private float glassVX;
|
||||
private float glassVY;
|
||||
private int glassOffsetX;
|
||||
private int glassOffsetY;
|
||||
private int glassVX;
|
||||
private int glassVY;
|
||||
private Random glassRand;
|
||||
private Control GlassControl;
|
||||
private ControlChromosome chromo;
|
||||
@@ -59,13 +59,13 @@ public class WindowFieldKit extends Window {
|
||||
private ItemStack prev;
|
||||
|
||||
public WindowFieldKit(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(280.0f, 230.0f, player, inventory, side);
|
||||
this.glassOffsetX = 0.0f;
|
||||
this.glassOffsetY = 0.0f;
|
||||
this.glassVX = 0.0f;
|
||||
this.glassVY = 0.0f;
|
||||
super(280, 230, player, inventory, side);
|
||||
this.glassOffsetX = 0;
|
||||
this.glassOffsetY = 0;
|
||||
this.glassVX = 0;
|
||||
this.glassVY = 0;
|
||||
this.glassRand = new Random();
|
||||
this.analyseProgress = 1.0f;
|
||||
this.analyseProgress = 1;
|
||||
this.isAnalysing = false;
|
||||
this.info = new HashMap<>();
|
||||
this.prev = null;
|
||||
@@ -115,13 +115,13 @@ public class WindowFieldKit extends Window {
|
||||
this.getWindowInventory().createSlot(1);
|
||||
this.setupValidators();
|
||||
new ControlPlayerInventory(this);
|
||||
final IPoint handGlass = new IPoint(16.0f, 32.0f);
|
||||
final IPoint handGlass = new IPoint(16, 32);
|
||||
this.GlassControl = new ControlImage(this, handGlass.x(), handGlass.y(), new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett));
|
||||
new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(InventoryType.Window, 0);
|
||||
new ControlSlot(this, 208.0f, 8.0f).assign(InventoryType.Window, 1);
|
||||
(this.text = new ControlText(this, new IPoint(232.0f, 13.0f), "Paper")).setColour(2236962);
|
||||
(this.text = new ControlText(this, new IArea(0.0f, 120.0f, this.w(), 24.0f), "", TextJustification.MiddleCenter)).setColour(2236962);
|
||||
this.chromo = new ControlChromosome(this, 150.0f, 24.0f);
|
||||
new ControlSlot(this, handGlass.x() + 54, handGlass.y() + 26).assign(InventoryType.Window, 0);
|
||||
new ControlSlot(this, 208, 8).assign(InventoryType.Window, 1);
|
||||
(this.text = new ControlText(this, new IPoint(232, 13), "Paper")).setColour(2236962);
|
||||
(this.text = new ControlText(this, new IArea(0, 120, this.w(), 24), "", TextJustification.MiddleCenter)).setColour(2236962);
|
||||
this.chromo = new ControlChromosome(this, 150, 24);
|
||||
this.addEventHandler(new EventValueChanged.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventValueChanged event) {
|
||||
@@ -151,9 +151,9 @@ public class WindowFieldKit extends Window {
|
||||
super.onUpdateClient();
|
||||
if (this.isAnalysing) {
|
||||
this.analyseProgress += 0.01f;
|
||||
if (this.analyseProgress >= 1.0f) {
|
||||
if (this.analyseProgress >= 1) {
|
||||
this.isAnalysing = false;
|
||||
this.analyseProgress = 1.0f;
|
||||
this.analyseProgress = 1;
|
||||
final ItemStack stack = this.getWindowInventory().getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
this.sendClientAction("analyse", new NBTTagCompound());
|
||||
@@ -164,9 +164,9 @@ public class WindowFieldKit extends Window {
|
||||
this.glassVX += this.glassRand.nextFloat() - 0.5f - this.glassOffsetX * 0.2f;
|
||||
this.glassVY += this.glassRand.nextFloat() - 0.5f - this.glassOffsetY * 0.2f;
|
||||
this.glassOffsetX += this.glassVX;
|
||||
this.glassOffsetX *= 1.0f - this.analyseProgress;
|
||||
this.glassOffsetX *= 1 - this.analyseProgress;
|
||||
this.glassOffsetY += this.glassVY;
|
||||
this.glassOffsetY *= 1.0f - this.analyseProgress;
|
||||
this.glassOffsetY *= 1 - this.analyseProgress;
|
||||
this.GlassControl.setOffset(new IPoint(this.glassOffsetX, this.glassOffsetY));
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public class WindowFieldKit extends Window {
|
||||
if (this.getWindowInventory().getStackInSlot(1) == null) {
|
||||
this.text.setValue("No Paper!");
|
||||
this.isAnalysing = false;
|
||||
this.analyseProgress = 1.0f;
|
||||
this.analyseProgress = 1;
|
||||
} else {
|
||||
this.startAnalysing();
|
||||
this.chromo.setRoot(null);
|
||||
@@ -231,14 +231,14 @@ public class WindowFieldKit extends Window {
|
||||
}
|
||||
} else if (item != null) {
|
||||
this.isAnalysing = false;
|
||||
this.analyseProgress = 1.0f;
|
||||
this.analyseProgress = 1;
|
||||
this.refreshSpecies();
|
||||
if (this.damageKit()) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.isAnalysing = false;
|
||||
this.analyseProgress = 1.0f;
|
||||
this.analyseProgress = 1;
|
||||
this.chromo.setRoot(null);
|
||||
}
|
||||
}
|
||||
@@ -249,12 +249,12 @@ public class WindowFieldKit extends Window {
|
||||
}
|
||||
|
||||
private void startAnalysing() {
|
||||
this.glassVX = 0.0f;
|
||||
this.glassVY = 0.0f;
|
||||
this.glassOffsetX = 0.0f;
|
||||
this.glassOffsetY = 0.0f;
|
||||
this.glassVX = 0;
|
||||
this.glassVY = 0;
|
||||
this.glassOffsetX = 0;
|
||||
this.glassOffsetY = 0;
|
||||
this.isAnalysing = true;
|
||||
this.analyseProgress = 0.0f;
|
||||
this.analyseProgress = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WindowGenesis extends Window {
|
||||
private Panel panelPickup;
|
||||
|
||||
public WindowGenesis(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(342.0f, 228.0f, player, inventory, side);
|
||||
super(342, 228, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,9 +64,9 @@ public class WindowGenesis extends Window {
|
||||
public void initialiseClient() {
|
||||
new ControlPlayerInventory(this);
|
||||
this.setTitle("Genesis");
|
||||
final ControlTabBar<BreedingSystem> tabSystems = new ControlTabBar<BreedingSystem>(this, 8.0f, 28.0f, 23.0f, 100.0f, Position.Left) {
|
||||
final ControlTabBar<BreedingSystem> tabSystems = new ControlTabBar<BreedingSystem>(this, 8, 28, 23, 100, Position.Left) {
|
||||
@Override
|
||||
public ControlTab<BreedingSystem> createTab(final float x, final float y, final float w, final float h, final BreedingSystem value) {
|
||||
public ControlTab<BreedingSystem> createTab(final int x, final int y, final int w, final int h, final BreedingSystem value) {
|
||||
return new ControlTabIcon<BreedingSystem>(this, x, y, w, h, value) {
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
@@ -95,17 +95,17 @@ public class WindowGenesis extends Window {
|
||||
tabSystems.setValues(Binnie.GENETICS.getActiveSystems());
|
||||
this.root = Binnie.GENETICS.getActiveSystems().iterator().next().getSpeciesRoot();
|
||||
this.template = this.root.getDefaultTemplate();
|
||||
final IArea one = new IArea(32.0f, 28.0f, 170.0f, 100.0f);
|
||||
final IArea two = new IArea(214.0f, 28.0f, 100.0f, 100.0f);
|
||||
final IArea one = new IArea(32, 28, 170, 100);
|
||||
final IArea two = new IArea(214, 28, 100, 100);
|
||||
new Panel(this, one.outset(1), MinecraftGUI.PanelType.Black);
|
||||
new Panel(this, two.outset(1), MinecraftGUI.PanelType.Black);
|
||||
this.geneList = new ControlListBox<Gene>(this, one.x(), one.y(), one.w(), one.h(), 10.0f) {
|
||||
this.geneList = new ControlListBox<Gene>(this, one.x(), one.y(), one.w(), one.h(), 10) {
|
||||
@Override
|
||||
public IWidget createOption(final Gene value, final int y) {
|
||||
return new ControlGenesisOption(this.getContent(), value, y);
|
||||
}
|
||||
};
|
||||
this.geneOptions = new ControlListBox<Gene>(this, two.x(), two.y(), two.w(), two.h(), 10.0f) {
|
||||
this.geneOptions = new ControlListBox<Gene>(this, two.x(), two.y(), two.w(), two.h(), 10) {
|
||||
@Override
|
||||
public IWidget createOption(final Gene value, final int y) {
|
||||
return new ControlTextOption<>(this.getContent(), value, y);
|
||||
@@ -146,7 +146,7 @@ public class WindowGenesis extends Window {
|
||||
WindowGenesis.this.refreshTemplate(chromo);
|
||||
}
|
||||
}.setOrigin(EventHandler.Origin.Self, this.geneOptions));
|
||||
this.panelPickup = new Panel(this, 16.0f, 140.0f, 60.0f, 42.0f, MinecraftGUI.PanelType.Black);
|
||||
this.panelPickup = new Panel(this, 16, 140, 60, 42, MinecraftGUI.PanelType.Black);
|
||||
this.refreshTemplate(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,16 +17,16 @@ public class ControlCheckbox extends Control implements IControlValue<Boolean> {
|
||||
boolean value;
|
||||
String text;
|
||||
|
||||
public ControlCheckbox(final IWidget parent, final float x, final float y, final boolean bool) {
|
||||
this(parent, x, y, 0.0f, "", bool);
|
||||
public ControlCheckbox(final IWidget parent, final int x, final int y, final boolean bool) {
|
||||
this(parent, x, y, 0, "", bool);
|
||||
}
|
||||
|
||||
public ControlCheckbox(final IWidget parent, final float x, final float y, final float w, final String text, final boolean bool) {
|
||||
super(parent, x, y, (w > 16.0f) ? w : 16.0f, 16.0f);
|
||||
public ControlCheckbox(final IWidget parent, final int x, final int y, final int w, final String text, final boolean bool) {
|
||||
super(parent, x, y, (w > 16) ? w : 16, 16);
|
||||
this.text = text;
|
||||
this.value = bool;
|
||||
if (w > 16.0f) {
|
||||
new ControlText(this, new IArea(16.0f, 1.0f, w - 16.0f, 16.0f), text, TextJustification.MiddleCenter).setColour(4473924);
|
||||
if (w > 16) {
|
||||
new ControlText(this, new IArea(16, 1, w - 16, 16), text, TextJustification.MiddleCenter).setColour(4473924);
|
||||
}
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addEventHandler(new EventMouse.Down.Handler() {
|
||||
@@ -57,7 +57,7 @@ public class ControlCheckbox extends Control implements IControlValue<Boolean> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
Object texture = this.getValue() ? CraftGUITexture.CheckboxChecked : CraftGUITexture.Checkbox;
|
||||
if (this.isMouseOver()) {
|
||||
texture = (this.getValue() ? CraftGUITexture.CheckboxCheckedHighlighted : CraftGUITexture.CheckboxHighlighted);
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ControlText extends Control implements IControlValue<String> {
|
||||
private TextJustification align;
|
||||
|
||||
public ControlText(final IWidget parent, final IPoint pos, final String text) {
|
||||
this(parent, new IArea(pos, new IPoint(500.0f, 0.0f)), text, TextJustification.TopLeft);
|
||||
this(parent, new IArea(pos, new IPoint(500, 0)), text, TextJustification.TopLeft);
|
||||
}
|
||||
|
||||
public ControlText(final IWidget parent, final String text, final TextJustification align) {
|
||||
@@ -27,7 +27,7 @@ public class ControlText extends Control implements IControlValue<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.text(this.getArea(), this.align, this.text, this.getColour());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
|
||||
public class ControlTextCentered extends ControlText {
|
||||
public ControlTextCentered(final IWidget parent, final float y, final String text) {
|
||||
super(parent, new IArea(new IPoint(0.0f, y), new IPoint(parent.size().x(), 0.0f)), text, TextJustification.TopCenter);
|
||||
public ControlTextCentered(final IWidget parent, final int y, final String text) {
|
||||
super(parent, new IArea(new IPoint(0, y), new IPoint(parent.size().x(), 0)), text, TextJustification.TopCenter);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public class ControlTextEdit extends Control implements IControlValue<String> {
|
||||
GuiTextField field;
|
||||
private String cachedValue;
|
||||
|
||||
public ControlTextEdit(final IWidget parent, final float x, final float y, final float width, final float height) {
|
||||
public ControlTextEdit(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height);
|
||||
this.cachedValue = "";
|
||||
this.field = new GuiTextField(0, this.getWindow().getGui().getFontRenderer(), 0, 0, 10, 10);
|
||||
@@ -77,7 +77,7 @@ public class ControlTextEdit extends Control implements IControlValue<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(CraftGUITexture.Slot, this.getArea());
|
||||
this.renderTextField();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ControlButton extends Control {
|
||||
private ControlText textWidget;
|
||||
private String text;
|
||||
|
||||
public ControlButton(final IWidget parent, final float x, final float y, final float width, final float height) {
|
||||
public ControlButton(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addEventHandler(new EventMouse.Down.Handler() {
|
||||
@@ -30,7 +30,7 @@ public class ControlButton extends Control {
|
||||
protected void onMouseClick(final EventMouse.Down event) {
|
||||
}
|
||||
|
||||
public ControlButton(final IWidget parent, final float x, final float y, final float width, final float height, final String text) {
|
||||
public ControlButton(final IWidget parent, final int x, final int y, final int width, final int height, final String text) {
|
||||
this(parent, x, y, width, height);
|
||||
this.text = text;
|
||||
this.textWidget = new ControlText(this, this.getArea(), text, TextJustification.MiddleCenter);
|
||||
@@ -48,7 +48,7 @@ public class ControlButton extends Control {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
Object texture = CraftGUITexture.ButtonDisabled;
|
||||
if (this.isMouseOver()) {
|
||||
texture = CraftGUITexture.ButtonHighlighted;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ControlEnumButton<T> extends ControlButton implements IControlValue
|
||||
}
|
||||
}
|
||||
|
||||
public ControlEnumButton(final IWidget parent, final float x, final float y, final float width, final float height, final T[] values) {
|
||||
public ControlEnumButton(final IWidget parent, final int x, final int y, final int width, final int height, final T[] values) {
|
||||
super(parent, x, y, width, height, "");
|
||||
this.enumConstants = new ArrayList<>();
|
||||
Collections.addAll(this.enumConstants, values);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Control extends Widget implements ITooltipHelp, ITooltip {
|
||||
List<String> tooltipStrings;
|
||||
public int extraLevel;
|
||||
|
||||
public Control(final IWidget parent, final float x, final float y, final float w, final float h) {
|
||||
public Control(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent);
|
||||
this.helpStrings = new ArrayList<>();
|
||||
this.tooltipStrings = new ArrayList<>();
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ControlList<T> extends Control implements IControlValue<T> {
|
||||
boolean creating;
|
||||
IValidator<IWidget> validator;
|
||||
|
||||
protected ControlList(final ControlListBox<T> parent, final float x, final float y, final float w, final float h) {
|
||||
protected ControlList(final ControlListBox<T> parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent, x, y, w, h);
|
||||
this.value = null;
|
||||
this.allOptions = new LinkedHashMap<>();
|
||||
@@ -67,7 +67,7 @@ public class ControlList<T> extends Control implements IControlValue<T> {
|
||||
if (this.isValidOption(entry.getValue())) {
|
||||
entry.getValue().show();
|
||||
this.optionWidgets.put(entry.getKey(), entry.getValue());
|
||||
entry.getValue().setPosition(new IPoint(0.0f, height));
|
||||
entry.getValue().setPosition(new IPoint(0, height));
|
||||
height += (int) entry.getValue().getSize().y();
|
||||
} else {
|
||||
entry.getValue().hide();
|
||||
|
||||
@@ -9,13 +9,13 @@ import binnie.craftgui.events.EventKey;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ControlListBox<T> extends ControlScrollableContent<ControlList<T>> implements IControlValue<T> {
|
||||
public ControlListBox(final IWidget parent, final float x, final float y, final float w, final float h, final float scrollBarSize) {
|
||||
public ControlListBox(final IWidget parent, final int x, final int y, final int w, final int h, final int scrollBarSize) {
|
||||
super(parent, x, y, w, h, scrollBarSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
this.setScrollableContent(new ControlList<>(this, 1.0f, 1.0f, this.w() - 2.0f - this.scrollBarSize, this.h() - 2.0f));
|
||||
this.setScrollableContent(new ControlList<>(this, 1, 1, this.w() - 2 - this.scrollBarSize, this.h() - 2));
|
||||
this.addEventHandler(new EventKey.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventKey.Down event) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ControlOption<T> extends Control implements IControlValue<T> {
|
||||
}
|
||||
|
||||
public ControlOption(final ControlList<T> controlList, final T option, final int height) {
|
||||
super(controlList, 0.0f, height, controlList.getSize().x(), 20.0f);
|
||||
super(controlList, 0, height, controlList.getSize().x(), 20);
|
||||
this.value = option;
|
||||
if (this.value != null) {
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
@@ -55,7 +55,7 @@ public class ControlOption<T> extends Control implements IControlValue<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
if (this.isCurrentSelection()) {
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, this.getArea());
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ public class ControlPage<T> extends Control implements IControlValue<T> {
|
||||
T value;
|
||||
|
||||
public ControlPage(final IWidget parent, final T value) {
|
||||
this(parent, 0.0f, 0.0f, parent.w(), parent.h(), value);
|
||||
this(parent, 0, 0, parent.w(), parent.h(), value);
|
||||
}
|
||||
|
||||
public ControlPage(final IWidget parent, final float x, final float y, final float w, final float h, final T value) {
|
||||
public ControlPage(final IWidget parent, final int x, final int y, final int w, final int h, final T value) {
|
||||
super(parent, x, y, w, h);
|
||||
this.setValue(value);
|
||||
if (parent instanceof IControlValue && ((IControlValue) parent).getValue() == null) {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ControlPages<T> extends Control implements IControlValues<T>, ICont
|
||||
return child != null && this.value == ((IControlValue) child).getValue();
|
||||
}
|
||||
|
||||
public ControlPages(final IWidget parent, final float x, final float y, final float w, final float h) {
|
||||
public ControlPages(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent, x, y, w, h);
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import binnie.craftgui.core.IWidget;
|
||||
public class ControlScroll extends Control {
|
||||
private IControlScrollable scrollWidget;
|
||||
|
||||
public ControlScroll(final IWidget parent, final float x, final float y, final float width, final float height, final IControlScrollable scrollWidget) {
|
||||
public ControlScroll(final IWidget parent, final int x, final int y, final int width, final int height, final IControlScrollable scrollWidget) {
|
||||
super(parent, x, y, width, height);
|
||||
this.scrollWidget = scrollWidget;
|
||||
new ControlScrollBar(this);
|
||||
|
||||
@@ -12,10 +12,10 @@ public class ControlScrollBar extends Control {
|
||||
protected final IControlScrollable scrollable;
|
||||
|
||||
public ControlScrollBar(final ControlScroll parent) {
|
||||
this(parent, 0.0f, 0.0f, parent.getSize().x(), parent.getSize().y(), parent.getScrollableWidget());
|
||||
this(parent, 0, 0, parent.getSize().x(), parent.getSize().y(), parent.getScrollableWidget());
|
||||
}
|
||||
|
||||
public ControlScrollBar(final IWidget parent, final float x, final float y, final float w, final float h, final IControlScrollable scrollable2) {
|
||||
public ControlScrollBar(final IWidget parent, final int x, final int y, final int w, final int h, final IControlScrollable scrollable2) {
|
||||
super(parent, x, y, w, h);
|
||||
this.scrollable = scrollable2;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
@@ -53,21 +53,21 @@ public class ControlScrollBar extends Control {
|
||||
return this.scrollable.getPercentageShown() < 0.99f;
|
||||
}
|
||||
|
||||
public float getBarHeight() {
|
||||
return this.h() * this.scrollable.getPercentageShown();
|
||||
public int getBarHeight() {
|
||||
return Math.round(this.h() * this.scrollable.getPercentageShown());
|
||||
}
|
||||
|
||||
protected IArea getRenderArea() {
|
||||
float height = this.getBarHeight();
|
||||
if (height < 6.0f) {
|
||||
height = 6.0f;
|
||||
int height = this.getBarHeight();
|
||||
if (height < 6) {
|
||||
height = 6;
|
||||
}
|
||||
final float yOffset = ((int) this.h() - (int) this.getBarHeight()) * this.scrollable.getPercentageIndex();
|
||||
return new IArea(0.0f, yOffset, this.getSize().x(), height);
|
||||
final int yOffset = Math.round((this.h() - this.getBarHeight()) * this.scrollable.getPercentageIndex());
|
||||
return new IArea(0, yOffset, this.getSize().x(), height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
final IArea renderArea = this.getRenderArea();
|
||||
Object texture = CraftGUITexture.ScrollDisabled;
|
||||
if (this.isMouseOver()) {
|
||||
|
||||
@@ -9,20 +9,20 @@ import binnie.craftgui.events.EventWidget;
|
||||
|
||||
public class ControlScrollableContent<T extends IWidget> extends Control implements IControlScrollable {
|
||||
protected T controlChild;
|
||||
protected float scrollBarSize;
|
||||
protected int scrollBarSize;
|
||||
float percentageIndex;
|
||||
|
||||
public ControlScrollableContent(final IWidget parent, final float x, final float y, final float w, final float h, final float scrollBarSize) {
|
||||
public ControlScrollableContent(final IWidget parent, final int x, final int y, final int w, final int h, final int scrollBarSize) {
|
||||
super(parent, x, y, w, h);
|
||||
this.percentageIndex = 0.0f;
|
||||
if (scrollBarSize != 0.0f) {
|
||||
new ControlScroll(this, this.getSize().x() - scrollBarSize, 0.0f, scrollBarSize, this.getSize().y(), this);
|
||||
this.percentageIndex = 0;
|
||||
if (scrollBarSize != 0) {
|
||||
new ControlScroll(this, this.getSize().x() - scrollBarSize, 0, scrollBarSize, this.getSize().y(), this);
|
||||
}
|
||||
this.addEventHandler(new EventMouse.Wheel.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Wheel event) {
|
||||
if (ControlScrollableContent.this.getRelativeMousePosition().x() > 0.0f && ControlScrollableContent.this.getRelativeMousePosition().y() > 0.0f && ControlScrollableContent.this.getRelativeMousePosition().x() < ControlScrollableContent.this.getSize().x() && ControlScrollableContent.this.getRelativeMousePosition().y() < ControlScrollableContent.this.getSize().y()) {
|
||||
if (ControlScrollableContent.this.getMovementRange() == 0.0f) {
|
||||
if (ControlScrollableContent.this.getRelativeMousePosition().x() > 0 && ControlScrollableContent.this.getRelativeMousePosition().y() > 0 && ControlScrollableContent.this.getRelativeMousePosition().x() < ControlScrollableContent.this.getSize().x() && ControlScrollableContent.this.getRelativeMousePosition().y() < ControlScrollableContent.this.getSize().y()) {
|
||||
if (ControlScrollableContent.this.getMovementRange() == 0) {
|
||||
return;
|
||||
}
|
||||
final float percentageMove = 0.8f / ControlScrollableContent.this.getMovementRange();
|
||||
@@ -39,14 +39,14 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
return;
|
||||
}
|
||||
|
||||
child.setCroppedZone(this, new IArea(1.0F, 1.0F, getSize().x() - 2.0F - this.scrollBarSize, getSize().y() - 2.0F));
|
||||
child.setCroppedZone(this, new IArea(1, 1, getSize().x() - 2 - this.scrollBarSize, getSize().y() - 2));
|
||||
|
||||
child.addSelfEventHandler(new EventWidget.ChangeSize.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventWidget.ChangeSize event) {
|
||||
ControlScrollableContent.this.controlChild.setOffset(new IPoint(0.0f, -ControlScrollableContent.this.percentageIndex * ControlScrollableContent.this.getMovementRange()));
|
||||
if (ControlScrollableContent.this.getMovementRange() == 0.0f) {
|
||||
ControlScrollableContent.this.percentageIndex = 0.0f;
|
||||
ControlScrollableContent.this.controlChild.setOffset(new IPoint(0, Math.round(-ControlScrollableContent.this.percentageIndex * ControlScrollableContent.this.getMovementRange())));
|
||||
if (ControlScrollableContent.this.getMovementRange() == 0) {
|
||||
ControlScrollableContent.this.percentageIndex = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -58,11 +58,11 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
|
||||
@Override
|
||||
public float getPercentageShown() {
|
||||
if (this.controlChild == null || this.controlChild.getSize().y() == 0.0f) {
|
||||
return 1.0f;
|
||||
if (this.controlChild == null || this.controlChild.getSize().y() == 0) {
|
||||
return 1;
|
||||
}
|
||||
final float shown = this.getSize().y() / this.controlChild.getSize().y();
|
||||
return Math.min(shown, 1.0f);
|
||||
return Math.min(shown, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,15 +76,15 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
return;
|
||||
}
|
||||
this.percentageIndex += percentage;
|
||||
if (this.percentageIndex > 1.0f) {
|
||||
this.percentageIndex = 1.0f;
|
||||
} else if (this.percentageIndex < 0.0f) {
|
||||
this.percentageIndex = 0.0f;
|
||||
if (this.percentageIndex > 1) {
|
||||
this.percentageIndex = 1;
|
||||
} else if (this.percentageIndex < 0) {
|
||||
this.percentageIndex = 0;
|
||||
}
|
||||
if (this.getMovementRange() == 0.0f) {
|
||||
this.percentageIndex = 0.0f;
|
||||
if (this.getMovementRange() == 0) {
|
||||
this.percentageIndex = 0;
|
||||
}
|
||||
this.controlChild.setOffset(new IPoint(0.0f, -this.percentageIndex * this.getMovementRange()));
|
||||
this.controlChild.setOffset(new IPoint(0, Math.round(-this.percentageIndex * this.getMovementRange())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,10 +95,10 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
@Override
|
||||
public float getMovementRange() {
|
||||
if (this.controlChild == null) {
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
final float range = this.controlChild.getSize().y() - this.getSize().y();
|
||||
return Math.max(range, 0.0f);
|
||||
return Math.max(range, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,13 +111,13 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
maxY /= totalY;
|
||||
final float shownPercentage = this.getPercentageShown();
|
||||
final float percentageIndex = this.getPercentageIndex();
|
||||
final float minPercent = (1.0f - shownPercentage) * percentageIndex;
|
||||
final float minPercent = (1 - shownPercentage) * percentageIndex;
|
||||
final float maxPercent = minPercent + shownPercentage;
|
||||
if (maxY > maxPercent) {
|
||||
this.setPercentageIndex((maxY - shownPercentage) / (1.0f - shownPercentage));
|
||||
this.setPercentageIndex((maxY - shownPercentage) / (1 - shownPercentage));
|
||||
}
|
||||
if (minY < minPercent) {
|
||||
this.setPercentageIndex(minY / (1.0f - shownPercentage));
|
||||
this.setPercentageIndex(minY / (1 - shownPercentage));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
private ControlTabBar<T> tabBar;
|
||||
protected T value;
|
||||
|
||||
public ControlTab(final ControlTabBar<T> parent, final float x, final float y, final float w, final float h, final T value) {
|
||||
public ControlTab(final ControlTabBar<T> parent, final int x, final int y, final int w, final int h, final T value) {
|
||||
super(parent, x, y, w, h);
|
||||
this.setValue(value);
|
||||
this.tabBar = parent;
|
||||
@@ -67,7 +67,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
Object texture = CraftGUITexture.TabDisabled;
|
||||
if (this.isMouseOver()) {
|
||||
texture = CraftGUITexture.TabHighlighted;
|
||||
@@ -76,7 +76,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
}
|
||||
final Texture lTexture = CraftGUI.render.getTexture(texture);
|
||||
final Position position = this.getTabPosition();
|
||||
Texture iTexture = lTexture.crop(position, 8.0f);
|
||||
Texture iTexture = lTexture.crop(position, 8);
|
||||
final IArea area = this.getArea();
|
||||
if (texture == CraftGUITexture.TabDisabled) {
|
||||
if (position == Position.Top || position == Position.Left) {
|
||||
@@ -97,7 +97,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
}
|
||||
if (icon.hasOutline()) {
|
||||
iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline);
|
||||
iTexture = iTexture.crop(position, 8.0f);
|
||||
iTexture = iTexture.crop(position, 8);
|
||||
CraftGUI.render.colour(icon.getOutlineColour());
|
||||
CraftGUI.render.texture(iTexture, area.inset(2));
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
|
||||
T value;
|
||||
Position position;
|
||||
|
||||
public ControlTabBar(final IWidget parent, final float x, final float y, final float width, final float height, final Position position) {
|
||||
public ControlTabBar(final IWidget parent, final int x, final int y, final int width, final int height, final Position position) {
|
||||
super(parent, x, y, width, height);
|
||||
this.position = position;
|
||||
this.addEventHandler(new EventValueChanged.Handler() {
|
||||
@@ -37,9 +37,9 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
|
||||
int j = 0;
|
||||
for (final T value : values) {
|
||||
if (this.position == Position.Top || this.position == Position.Bottom) {
|
||||
final IWidget tab = this.createTab(j * tabDimension, 0.0f, tabDimension, this.getSize().y(), value);
|
||||
final IWidget tab = this.createTab(j * tabDimension, 0, tabDimension, this.getSize().y(), value);
|
||||
} else {
|
||||
final IWidget tab = this.createTab(0.0f, j * tabDimension, this.getSize().x(), tabDimension, value);
|
||||
final IWidget tab = this.createTab(0, j * tabDimension, this.getSize().x(), tabDimension, value);
|
||||
}
|
||||
++j;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public ControlTab<T> createTab(final float x, final float y, final float w, final float h, final T value) {
|
||||
public ControlTab<T> createTab(final int x, final int y, final int w, final int h, final T value) {
|
||||
return new ControlTab<>(this, x, y, w, h, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ import binnie.craftgui.resource.minecraft.CraftGUIResourceManager;
|
||||
|
||||
public class CraftGUI {
|
||||
public static CraftGUIResourceManager resourceManager;
|
||||
public static Renderer render;
|
||||
public static final Renderer render = new Renderer();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public interface IWidget {
|
||||
|
||||
int getColour();
|
||||
|
||||
void render();
|
||||
void render(int guiWidth, int guiHeight);
|
||||
|
||||
void updateClient();
|
||||
|
||||
@@ -126,13 +126,13 @@ public interface IWidget {
|
||||
|
||||
boolean contains(final IPoint p0);
|
||||
|
||||
float x();
|
||||
int x();
|
||||
|
||||
float y();
|
||||
int y();
|
||||
|
||||
float w();
|
||||
int w();
|
||||
|
||||
float h();
|
||||
int h();
|
||||
|
||||
void onRender(final RenderStage p0);
|
||||
void onRender(final RenderStage stage, int guiWidth, int guiHeight);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
this.mousedOverWidget = null;
|
||||
this.draggedWidget = null;
|
||||
this.focusedWidget = null;
|
||||
this.mousePosition = new IPoint(0.0f, 0.0f);
|
||||
this.mousePosition = IPoint.ZERO;
|
||||
this.dragStart = IPoint.ZERO;
|
||||
this.addEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
|
||||
@@ -30,9 +30,9 @@ public class Widget implements IWidget {
|
||||
this.parent = null;
|
||||
this.subWidgets = new ArrayList<>();
|
||||
this.attributes = new ArrayList<>();
|
||||
this.position = new IPoint(0.0f, 0.0f);
|
||||
this.size = new IPoint(0.0f, 0.0f);
|
||||
this.offset = new IPoint(0.0f, 0.0f);
|
||||
this.position = IPoint.ZERO;
|
||||
this.size = IPoint.ZERO;
|
||||
this.offset = IPoint.ZERO;
|
||||
this.cropped = false;
|
||||
this.colour = 16777215;
|
||||
this.globalEventHandlers = new ArrayList<>();
|
||||
@@ -269,19 +269,19 @@ public class Widget implements IWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void render() {
|
||||
public final void render(int guiWidth, int guiHeight) {
|
||||
if (this.isVisible()) {
|
||||
CraftGUI.render.preRender(this);
|
||||
this.onRender(RenderStage.PreChildren);
|
||||
CraftGUI.render.preRender(this, guiWidth, guiHeight);
|
||||
this.onRender(RenderStage.PreChildren, guiWidth, guiHeight);
|
||||
for (final IWidget widget : this.getWidgets()) {
|
||||
widget.render();
|
||||
widget.render(guiWidth, guiHeight);
|
||||
}
|
||||
for (final IWidget widget : this.getWidgets()) {
|
||||
CraftGUI.render.preRender(widget);
|
||||
widget.onRender(RenderStage.PostSiblings);
|
||||
CraftGUI.render.preRender(widget, guiWidth, guiHeight);
|
||||
widget.onRender(RenderStage.PostSiblings, guiWidth, guiHeight);
|
||||
CraftGUI.render.postRender(widget);
|
||||
}
|
||||
this.onRender(RenderStage.PostChildren);
|
||||
this.onRender(RenderStage.PostChildren, guiWidth, guiHeight);
|
||||
CraftGUI.render.postRender(this);
|
||||
}
|
||||
}
|
||||
@@ -402,22 +402,22 @@ public class Widget implements IWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRender(final RenderStage stage) {
|
||||
public void onRender(final RenderStage stage, int guiWidth, int guiHeight) {
|
||||
if (stage == RenderStage.PreChildren) {
|
||||
this.onRenderBackground();
|
||||
this.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
if (stage == RenderStage.PostChildren) {
|
||||
this.onRenderForeground();
|
||||
this.onRenderForeground(guiWidth, guiHeight);
|
||||
}
|
||||
if (stage == RenderStage.PostSiblings) {
|
||||
this.onRenderOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
}
|
||||
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
}
|
||||
|
||||
public void onRenderOverlay() {
|
||||
@@ -480,22 +480,22 @@ public class Widget implements IWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float x() {
|
||||
public int x() {
|
||||
return this.pos().x();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float y() {
|
||||
public int y() {
|
||||
return this.pos().y();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float w() {
|
||||
public int w() {
|
||||
return this.size().x();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float h() {
|
||||
public int h() {
|
||||
return this.size().y();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,20 @@ package binnie.craftgui.core.geometry;
|
||||
import binnie.craftgui.controls.core.IControlValue;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.events.EventValueChanged;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CraftGUIUtil {
|
||||
public static void alignToWidget(final IWidget target, final IWidget relativeTo) {
|
||||
@@ -15,34 +29,34 @@ public class CraftGUIUtil {
|
||||
target.setPosition(target.getPosition().add(movement));
|
||||
}
|
||||
|
||||
public static void horizontalGrid(final float px, final float py, final IWidget... widgets) {
|
||||
horizontalGrid(px, py, TextJustification.MiddleCenter, 0.0f, widgets);
|
||||
public static void horizontalGrid(final int px, final int py, final IWidget... widgets) {
|
||||
horizontalGrid(px, py, TextJustification.MiddleCenter, 0, widgets);
|
||||
}
|
||||
|
||||
public static void horizontalGrid(final float px, final float py, final TextJustification just, final float spacing, final IWidget... widgets) {
|
||||
float x = 0.0f;
|
||||
float h = 0.0f;
|
||||
public static void horizontalGrid(final int px, final int py, final TextJustification just, final int spacing, final IWidget... widgets) {
|
||||
int x = 0;
|
||||
int h = 0;
|
||||
for (final IWidget widget : widgets) {
|
||||
h = Math.max(h, widget.getSize().y());
|
||||
}
|
||||
for (final IWidget widget : widgets) {
|
||||
widget.setPosition(new IPoint(px + x, py + (h - widget.getSize().y()) * just.yOffset));
|
||||
widget.setPosition(new IPoint(px + x, py + Math.round((h - widget.getSize().y()) * just.getYOffset())));
|
||||
x += widget.getSize().x() + spacing;
|
||||
}
|
||||
}
|
||||
|
||||
public static void verticalGrid(final float px, final float py, final IWidget... widgets) {
|
||||
horizontalGrid(px, py, TextJustification.MiddleCenter, 0.0f, widgets);
|
||||
public static void verticalGrid(final int px, final int py, final IWidget... widgets) {
|
||||
horizontalGrid(px, py, TextJustification.MiddleCenter, 0, widgets);
|
||||
}
|
||||
|
||||
public static void verticalGrid(final float px, final float py, final TextJustification just, final float spacing, final IWidget... widgets) {
|
||||
float y = 0.0f;
|
||||
float w = 0.0f;
|
||||
public static void verticalGrid(final int px, final int py, final TextJustification just, final int spacing, final IWidget... widgets) {
|
||||
int y = 0;
|
||||
int w = 0;
|
||||
for (final IWidget widget : widgets) {
|
||||
w = Math.max(w, widget.getSize().x());
|
||||
}
|
||||
for (final IWidget widget : widgets) {
|
||||
widget.setPosition(new IPoint(px + (w - widget.getSize().x()) * just.xOffset, py + y));
|
||||
widget.setPosition(new IPoint(px + Math.round((w - widget.getSize().x()) * just.getXOffset()), py + y));
|
||||
y += widget.getSize().y() + spacing;
|
||||
}
|
||||
}
|
||||
@@ -61,4 +75,131 @@ public class CraftGUIUtil {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void renderTexturePadded(final IArea area, final IArea texture, final IBorder padding) {
|
||||
int borderLeft = padding.l();
|
||||
int borderRight = padding.r();
|
||||
int borderTop = padding.t();
|
||||
int borderBottom = padding.b();
|
||||
final int posX = area.pos().x();
|
||||
final int posY = area.pos().y();
|
||||
final int width = area.size().x();
|
||||
final int height = area.size().y();
|
||||
final int textWidth = texture.w();
|
||||
final int textHeight = texture.h();
|
||||
final int u = texture.x();
|
||||
final int v = texture.y();
|
||||
if (borderTop + borderBottom > height) {
|
||||
borderTop = height / 2;
|
||||
borderBottom = height / 2;
|
||||
}
|
||||
if (borderLeft + borderRight > width) {
|
||||
borderLeft = width / 2;
|
||||
borderRight = width / 2;
|
||||
}
|
||||
final IPoint origin = area.pos();
|
||||
GuiUtils.drawTexturedModalRect(posX, posY, u, v, borderLeft, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY, u + textWidth - borderRight, v, borderRight, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + height - borderBottom, u, v + textHeight - borderBottom, borderLeft, borderBottom, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY + height - borderBottom, u + textWidth - borderRight, v + textHeight - borderBottom, borderRight, borderBottom, 0);
|
||||
int texturingWidth;
|
||||
for (int currentXPos = borderLeft; currentXPos < width - borderRight; currentXPos += texturingWidth) {
|
||||
final int distanceXRemaining = width - borderRight - currentXPos;
|
||||
texturingWidth = textWidth - borderLeft - borderRight;
|
||||
if (texturingWidth > distanceXRemaining) {
|
||||
texturingWidth = distanceXRemaining;
|
||||
}
|
||||
if (texturingWidth <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY, u + borderLeft, v, texturingWidth, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY + height - borderBottom, u + borderLeft, v + textHeight - borderBottom, texturingWidth, borderBottom, 0);
|
||||
int texturingHeight;
|
||||
for (int currentYPos = borderTop; currentYPos < height - borderBottom; currentYPos += texturingHeight) {
|
||||
final int distanceYRemaining = height - borderBottom - currentYPos;
|
||||
texturingHeight = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight > distanceYRemaining) {
|
||||
texturingHeight = distanceYRemaining;
|
||||
}
|
||||
if (texturingHeight <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY + currentYPos, u + borderLeft, v + borderTop, texturingWidth, texturingHeight, 0);
|
||||
}
|
||||
}
|
||||
int texturingHeight2;
|
||||
for (int currentYPos2 = borderTop; currentYPos2 < height - borderBottom; currentYPos2 += texturingHeight2) {
|
||||
final int distanceYRemaining2 = height - borderBottom - currentYPos2;
|
||||
texturingHeight2 = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight2 > distanceYRemaining2) {
|
||||
texturingHeight2 = distanceYRemaining2;
|
||||
}
|
||||
if (texturingHeight2 <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + currentYPos2, u, v + borderTop, borderLeft, texturingHeight2, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY + currentYPos2, u + textWidth - borderRight, v + borderTop, borderRight, texturingHeight2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawRect(float left, float top, float right, float bottom, final int color) {
|
||||
GuiUtils.drawGradientRect(0, (int) left, (int) top, (int) right, (int) bottom, color, color);
|
||||
}
|
||||
|
||||
public static void renderItem(final IPoint pos, final ItemStack itemStack) {
|
||||
renderItem(pos, itemStack, false);
|
||||
}
|
||||
|
||||
public static void renderItem(final IPoint pos, final ItemStack itemStack, final boolean rotating) {
|
||||
Preconditions.checkNotNull(itemStack);
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
FontRenderer font = getFontRenderer(minecraft, itemStack);
|
||||
|
||||
if (rotating) {
|
||||
GlStateManager.pushMatrix();
|
||||
final float phase = Minecraft.getSystemTime() / 20;
|
||||
GL11.glTranslatef(8, 8, 0);
|
||||
GL11.glRotatef(phase, 0, -0.866f, 0.5f);
|
||||
GL11.glTranslatef(-8, -8, -67.1f);
|
||||
}
|
||||
|
||||
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, pos.x(), pos.y());
|
||||
minecraft.getRenderItem().renderItemOverlayIntoGUI(font, itemStack, pos.x(), pos.y(), null);
|
||||
|
||||
if (rotating) {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static FontRenderer getFontRenderer(Minecraft minecraft, ItemStack ingredient) {
|
||||
FontRenderer fontRenderer = ingredient.getItem().getFontRenderer(ingredient);
|
||||
if (fontRenderer == null) {
|
||||
fontRenderer = minecraft.fontRendererObj;
|
||||
}
|
||||
return fontRenderer;
|
||||
}
|
||||
|
||||
public static void drawTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
||||
double uMin = textureSprite.getMinU();
|
||||
double uMax = textureSprite.getMaxU();
|
||||
double vMin = textureSprite.getMinV();
|
||||
double vMax = textureSprite.getMaxV();
|
||||
uMax = uMax - maskRight / 16.0 * (uMax - uMin);
|
||||
vMax = vMax - maskTop / 16.0 * (vMax - vMin);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
|
||||
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,19 +12,19 @@ public class IArea {
|
||||
this(pos.x(), pos.y(), size.x(), size.y());
|
||||
}
|
||||
|
||||
public IArea(final float xywh) {
|
||||
public IArea(final int xywh) {
|
||||
this(xywh, xywh, xywh, xywh);
|
||||
}
|
||||
|
||||
public IArea(final float xy, final float wh) {
|
||||
public IArea(final int xy, final int wh) {
|
||||
this(xy, xy, wh, wh);
|
||||
}
|
||||
|
||||
public IArea(final float x, final float y, final float wh) {
|
||||
public IArea(final int x, final int y, final int wh) {
|
||||
this(x, y, wh, wh);
|
||||
}
|
||||
|
||||
public IArea(final float x, final float y, final float w, final float h) {
|
||||
public IArea(final int x, final int y, final int w, final int h) {
|
||||
this.setPosition(new IPoint(x, y));
|
||||
this.setSize(new IPoint(w, h));
|
||||
}
|
||||
@@ -57,36 +57,36 @@ public class IArea {
|
||||
return position.x() >= this.pos().x() && position.y() >= this.pos.y() && position.x() <= this.pos().x() + this.size().x() && position.y() <= this.pos().y() + this.size().y();
|
||||
}
|
||||
|
||||
public float x() {
|
||||
public int x() {
|
||||
return this.pos().x();
|
||||
}
|
||||
|
||||
public float y() {
|
||||
public int y() {
|
||||
return this.pos().y();
|
||||
}
|
||||
|
||||
public float w() {
|
||||
public int w() {
|
||||
return this.size().x();
|
||||
}
|
||||
|
||||
public float h() {
|
||||
public int h() {
|
||||
return this.size().y();
|
||||
}
|
||||
|
||||
public float x(final float n) {
|
||||
return this.pos.x(n);
|
||||
public void x(final int n) {
|
||||
this.pos = new IPoint(n, this.pos.y());
|
||||
}
|
||||
|
||||
public float y(final float n) {
|
||||
return this.pos.y(n);
|
||||
public void y(final int n) {
|
||||
this.pos = new IPoint(this.pos.x(), n);
|
||||
}
|
||||
|
||||
public float w(final float n) {
|
||||
return this.size.x(n);
|
||||
public void w(final int n) {
|
||||
this.size = new IPoint(n, this.size.y());
|
||||
}
|
||||
|
||||
public float h(final float n) {
|
||||
return this.size.y(n);
|
||||
public void h(final int n) {
|
||||
this.size = new IPoint(this.size.x(), n);
|
||||
}
|
||||
|
||||
public IArea inset(final IBorder border) {
|
||||
@@ -110,7 +110,7 @@ public class IArea {
|
||||
return this.w() + "x" + this.h() + "@" + this.x() + "," + this.y();
|
||||
}
|
||||
|
||||
public IArea shift(final float dx, final float f) {
|
||||
public IArea shift(final int dx, final int f) {
|
||||
return new IArea(this.x() + dx, this.y() + f, this.w(), this.h());
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,68 @@
|
||||
package binnie.craftgui.core.geometry;
|
||||
|
||||
public class IBorder {
|
||||
public static final IBorder ZERO = new IBorder(0.0f);
|
||||
float t;
|
||||
float b;
|
||||
float l;
|
||||
float r;
|
||||
public static final IBorder ZERO = new IBorder(0);
|
||||
int t;
|
||||
int b;
|
||||
int l;
|
||||
int r;
|
||||
|
||||
public IBorder(final float pad) {
|
||||
public IBorder(final int pad) {
|
||||
this(pad, pad, pad, pad);
|
||||
}
|
||||
|
||||
public IBorder(final float tb, final float rl) {
|
||||
public IBorder(final int tb, final int rl) {
|
||||
this(tb, rl, tb, rl);
|
||||
}
|
||||
|
||||
public IBorder(final float t, final float rl, final float b) {
|
||||
public IBorder(final int t, final int rl, final int b) {
|
||||
this(t, rl, b, rl);
|
||||
}
|
||||
|
||||
public IBorder(final float t, final float r, final float b, final float l) {
|
||||
public IBorder(final int t, final int r, final int b, final int l) {
|
||||
this.t = t;
|
||||
this.b = b;
|
||||
this.l = l;
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public IBorder(final Position edge, final float n) {
|
||||
this((edge == Position.Top) ? n : 0.0f, (edge == Position.Right) ? n : 0.0f, (edge == Position.Bottom) ? n : 0.0f, (edge == Position.Left) ? n : 0.0f);
|
||||
public IBorder(final Position edge, final int n) {
|
||||
this((edge == Position.Top) ? n : 0, (edge == Position.Right) ? n : 0, (edge == Position.Bottom) ? n : 0, (edge == Position.Left) ? n : 0);
|
||||
}
|
||||
|
||||
public IBorder(final IBorder padding) {
|
||||
this(padding.t(), padding.r(), padding.b(), padding.l());
|
||||
}
|
||||
|
||||
public float t() {
|
||||
public int t() {
|
||||
return this.t;
|
||||
}
|
||||
|
||||
public float b() {
|
||||
public int b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public float l() {
|
||||
public int l() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public float r() {
|
||||
public int r() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public float t(final float n) {
|
||||
public int t(final int n) {
|
||||
return this.t = n;
|
||||
}
|
||||
|
||||
public float b(final float n) {
|
||||
public int b(final int n) {
|
||||
return this.b = n;
|
||||
}
|
||||
|
||||
public float l(final float n) {
|
||||
public int l(final int n) {
|
||||
return this.l = n;
|
||||
}
|
||||
|
||||
public float r(final float n) {
|
||||
public int r(final int n) {
|
||||
return this.r = n;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
package binnie.craftgui.core.geometry;
|
||||
|
||||
public class IPoint {
|
||||
public static final IPoint ZERO = new IPoint(0.0f, 0.0f);
|
||||
float x;
|
||||
float y;
|
||||
public static final IPoint ZERO = new IPoint(0, 0);
|
||||
private final int x;
|
||||
private final int y;
|
||||
|
||||
public IPoint(final float x, final float y) {
|
||||
this.x = 0.0f;
|
||||
this.y = 0.0f;
|
||||
public IPoint(final int x, final int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public IPoint(final IPoint o) {
|
||||
this.x = 0.0f;
|
||||
this.y = 0.0f;
|
||||
this.x = o.x();
|
||||
this.y = o.y();
|
||||
}
|
||||
@@ -35,7 +31,7 @@ public class IPoint {
|
||||
return add(this, other);
|
||||
}
|
||||
|
||||
public IPoint add(final float dx, final float dy) {
|
||||
public IPoint add(final int dx, final int dy) {
|
||||
return add(this, new IPoint(dx, dy));
|
||||
}
|
||||
|
||||
@@ -43,27 +39,14 @@ public class IPoint {
|
||||
return new IPoint(this);
|
||||
}
|
||||
|
||||
public float x() {
|
||||
public int x() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public float y() {
|
||||
public int y() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public void xy(final float x, final float y) {
|
||||
this.x(x);
|
||||
this.y(y);
|
||||
}
|
||||
|
||||
public float x(final float x) {
|
||||
return this.x = x;
|
||||
}
|
||||
|
||||
public float y(final float y) {
|
||||
return this.y = y;
|
||||
}
|
||||
|
||||
public boolean equals(final IPoint other) {
|
||||
return this.x() == other.x() && this.y() == other.y();
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ public enum TextJustification {
|
||||
BottomCenter(0.5f, 1.0f),
|
||||
BottomRight(1.0f, 1.0f);
|
||||
|
||||
float xOffset;
|
||||
float yOffset;
|
||||
private final float xOffset;
|
||||
private final float yOffset;
|
||||
|
||||
TextJustification(final float xOffset, final float yOffset) {
|
||||
this.xOffset = xOffset;
|
||||
|
||||
@@ -2,58 +2,53 @@ package binnie.craftgui.core.renderer;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.minecraft.GuiCraftGUI;
|
||||
import binnie.craftgui.resource.IStyleSheet;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Renderer {
|
||||
GuiCraftGUI gui;
|
||||
int currentColour;
|
||||
Texture currentTexture;
|
||||
IStyleSheet stylesheet;
|
||||
private IStyleSheet stylesheet;
|
||||
|
||||
public Renderer(final GuiCraftGUI gui) {
|
||||
this.currentColour = 16777215;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public final void preRender(final IWidget widget) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(widget.getPosition().x(), widget.getPosition().y(), 0.0f);
|
||||
public final void preRender(final IWidget widget, int guiWidth, int guiHeight) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(widget.getPosition().x(), widget.getPosition().y(), 0.0f);
|
||||
this.colour(widget.getColour());
|
||||
if (widget.isCroppedWidet()) {
|
||||
final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget;
|
||||
final IPoint pos = cropRelative.getAbsolutePosition();
|
||||
final IArea cropZone = widget.getCroppedZone();
|
||||
GL11.glEnable(3089);
|
||||
this.limitArea(new IArea(pos.add(cropZone.pos()), cropZone.size()));
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
this.limitArea(new IArea(pos.add(cropZone.pos()), cropZone.size()), guiWidth, guiHeight);
|
||||
|
||||
}
|
||||
GL11.glDisable(2929);
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
|
||||
public final void postRender(final IWidget widget) {
|
||||
if (widget.isCroppedWidet()) {
|
||||
GL11.glDisable(3089);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
GL11.glEnable(2929);
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public void colour(final int hex) {
|
||||
this.currentColour = hex;
|
||||
int a = (hex & 0xFF000000) >> 24;
|
||||
final int r = (hex & 0xFF0000) >> 16;
|
||||
final int g = (hex & 0xFF00) >> 8;
|
||||
@@ -62,10 +57,9 @@ public class Renderer {
|
||||
a += 256;
|
||||
}
|
||||
if (a > 0 && a != 255) {
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
GL11.glEnable(3042);
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
} else {
|
||||
GL11.glColor3f(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +71,9 @@ public class Renderer {
|
||||
}
|
||||
|
||||
public void setTexture(final Texture texture) {
|
||||
if (texture != this.currentTexture && texture != null) {
|
||||
if (texture != null) {
|
||||
BinnieCore.proxy.bindTexture(texture.getFilename());
|
||||
}
|
||||
this.colour(this.currentColour);
|
||||
}
|
||||
|
||||
public void texture(final Object texture, final IPoint position) {
|
||||
@@ -94,7 +87,7 @@ public class Renderer {
|
||||
this.setTexture(texture);
|
||||
final IPoint point = position.sub(new IPoint(texture.getBorder().l(), texture.getBorder().t()));
|
||||
final IArea textureArea = texture.getArea().outset(texture.getBorder());
|
||||
this.gui.renderTexture(point, textureArea);
|
||||
GuiUtils.drawTexturedModalRect(point.x(), point.y(), textureArea.pos().x(), textureArea.pos().y(), textureArea.size().x(), textureArea.size().y(), 0);
|
||||
}
|
||||
|
||||
public void texture(final Object window, final IArea area) {
|
||||
@@ -109,9 +102,10 @@ public class Renderer {
|
||||
final IArea textureArea = texture.getArea().outset(texture.getBorder());
|
||||
final IArea targetArea = area.outset(texture.getBorder());
|
||||
if (textureArea.w() == targetArea.w() && textureArea.h() == targetArea.h()) {
|
||||
this.gui.renderTexture(targetArea.pos(), textureArea);
|
||||
final IPoint position = targetArea.pos();
|
||||
GuiUtils.drawTexturedModalRect(position.x(), position.y(), textureArea.pos().x(), textureArea.pos().y(), textureArea.size().x(), textureArea.size().y(), 0);
|
||||
} else {
|
||||
this.gui.renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
|
||||
CraftGUIUtil.renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,15 +114,17 @@ public class Renderer {
|
||||
}
|
||||
|
||||
public int textWidth(final String text) {
|
||||
return this.gui.getFontRenderer().getStringWidth(text);
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
return fontRendererObj.getStringWidth(text);
|
||||
}
|
||||
|
||||
public int textHeight() {
|
||||
return (this.gui.getFontRenderer() == null) ? 0 : this.gui.getFontRenderer().FONT_HEIGHT;
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
return (fontRendererObj == null) ? 0 : fontRendererObj.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
public void text(final IPoint pos, final String text, final int colour) {
|
||||
this.text(new IArea(pos, new IPoint(500.0f, 500.0f)), TextJustification.TopLeft, text, colour);
|
||||
this.text(new IArea(pos, new IPoint(500, 500)), TextJustification.TopLeft, text, colour);
|
||||
}
|
||||
|
||||
public void text(final IArea area, final TextJustification justification, final String text, final int colour) {
|
||||
@@ -136,7 +132,8 @@ public class Renderer {
|
||||
if (area.size().x() <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
final List<String> wrappedStrings = this.gui.getFontRenderer().listFormattedStringToWidth(text, (int) area.size().x());
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
final List<String> wrappedStrings = fontRendererObj.listFormattedStringToWidth(text, area.size().x());
|
||||
final float totalHeight = wrappedStrings.size() * this.textHeight();
|
||||
float posY = area.pos().y();
|
||||
if (area.size().y() > totalHeight) {
|
||||
@@ -146,56 +143,97 @@ public class Renderer {
|
||||
final float stringWidth = this.textWidth(string);
|
||||
float posX = area.size().x() - stringWidth;
|
||||
posX *= justification.getXOffset();
|
||||
GL11.glDisable(2929);
|
||||
this.gui.getFontRenderer().drawString(string, (int) (pos.x() + posX), (int) posY, colour);
|
||||
GlStateManager.disableDepth();
|
||||
fontRendererObj.drawString(string, (int) (pos.x() + posX), (int) posY, colour);
|
||||
posY += this.textHeight();
|
||||
}
|
||||
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
public void solid(final IArea area, final int colour) {
|
||||
this.gui.drawRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), 0xFF000000 | colour);
|
||||
CraftGUIUtil.drawRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), 0xFF000000 | colour);
|
||||
}
|
||||
|
||||
public void solidAlpha(final IArea area, final int c1) {
|
||||
this.gui.drawGradientArea(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), c1, c1);
|
||||
public void solidAlpha(final IArea area, final int color) {
|
||||
CraftGUIUtil.drawRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), color);
|
||||
}
|
||||
|
||||
public void gradientRect(final IArea area, final int c1, final int c2) {
|
||||
this.gui.drawGradientArea(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), c1, c2);
|
||||
}
|
||||
|
||||
public void item(final IPoint pos, final ItemStack item) {
|
||||
this.gui.renderItem(pos, item, false);
|
||||
}
|
||||
|
||||
public void item(final IPoint pos, final ItemStack item, final boolean rotating) {
|
||||
this.gui.renderItem(pos, item, rotating);
|
||||
public void gradientRect(final IArea area, final int startColor, final int endColor) {
|
||||
GuiUtils.drawGradientRect(0, area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), startColor, endColor);
|
||||
}
|
||||
|
||||
public void sprite(final IPoint pos, final TextureAtlasSprite icon) {
|
||||
this.gui.renderSprite(pos, icon, TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
if (icon != null) {
|
||||
BinnieCore.proxy.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
CraftGUIUtil.drawTexture(pos.x(), pos.y(), icon, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void fluid(IPoint pos, FluidStack fluid){
|
||||
this.gui.renderFluid(fluid, pos);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (fluid != null) {
|
||||
Fluid fluid1 = fluid.getFluid();
|
||||
if (fluid1 != null) {
|
||||
TextureAtlasSprite fluidStillSprite = getStillFluidSprite(minecraft, fluid1);
|
||||
|
||||
int fluidColor = fluid1.getColor(fluid);
|
||||
|
||||
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
colour(fluidColor);
|
||||
CraftGUIUtil.drawTexture(pos.x(), pos.y(), fluidStillSprite, 0, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
public void limitArea(final IArea area) {
|
||||
this.gui.limitArea(area);
|
||||
private static TextureAtlasSprite getStillFluidSprite(Minecraft minecraft, Fluid fluid) {
|
||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||
ResourceLocation fluidStill = fluid.getStill();
|
||||
TextureAtlasSprite fluidStillSprite = null;
|
||||
if (fluidStill != null) {
|
||||
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
||||
}
|
||||
if (fluidStillSprite == null) {
|
||||
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
||||
}
|
||||
return fluidStillSprite;
|
||||
}
|
||||
|
||||
public float textHeight(final String text, final float width) {
|
||||
return this.gui.getFontRenderer().listFormattedStringToWidth(text, (int) width).size() * this.textHeight();
|
||||
}
|
||||
|
||||
public void texturePercentage(final Texture texture, final IArea area, final Position direction, final float percentage) {
|
||||
final float dist = (direction == Position.Top || direction == Position.Bottom) ? (percentage * texture.h()) : (percentage * texture.w());
|
||||
final float dim = (direction == Position.Top || direction == Position.Bottom) ? texture.h() : texture.w();
|
||||
public void limitArea(final IArea area, int guiWidth, int guiHeight) {
|
||||
float x = area.pos().x();
|
||||
float y = area.pos().y();
|
||||
float w = area.size().x();
|
||||
float h = area.size().y();
|
||||
y = guiHeight - (y + h);
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
final float scaleX = guiWidth / (float) minecraft.displayWidth;
|
||||
final float scaleY = guiHeight / (float) minecraft.displayHeight;
|
||||
x += 0.0f;
|
||||
y += 0.0f;
|
||||
w += 0.0f;
|
||||
h += 0.0f;
|
||||
GL11.glScissor((int) (x / scaleX), (int) (y / scaleY), (int) (w / scaleX), (int) (h / scaleY));
|
||||
}
|
||||
|
||||
public int textHeight(final String text, final int width) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
FontRenderer fontRenderer = minecraft.fontRendererObj;
|
||||
return fontRenderer.listFormattedStringToWidth(text, width).size() * this.textHeight();
|
||||
}
|
||||
|
||||
public void texturePercentage(final Texture texture, final IArea area, final Position direction, final float percentage) {
|
||||
final int dist = (direction == Position.Top || direction == Position.Bottom) ? Math.round(percentage * texture.h()) : Math.round(percentage * texture.w());
|
||||
final int dim = (direction == Position.Top || direction == Position.Bottom) ? texture.h() : texture.w();
|
||||
int x = area.pos().x();
|
||||
int y = area.pos().y();
|
||||
int w = area.size().x();
|
||||
int h = area.size().y();
|
||||
switch (direction) {
|
||||
case Top: {
|
||||
h *= percentage;
|
||||
|
||||
@@ -9,13 +9,13 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
public class ControlBlockIconDisplay extends Control {
|
||||
TextureAtlasSprite icon;
|
||||
|
||||
public ControlBlockIconDisplay(final IWidget parent, final float x, final float y, final TextureAtlasSprite icon) {
|
||||
super(parent, x, y, 18.0f, 18.0f);
|
||||
public ControlBlockIconDisplay(final IWidget parent, final int x, final int y, final TextureAtlasSprite icon) {
|
||||
super(parent, x, y, 18, 18);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.sprite(IPoint.ZERO, this.icon);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import binnie.core.util.ItemStackSet;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
@@ -24,34 +25,34 @@ public class ControlBreweryProgress extends ControlProgressBase {
|
||||
static Texture BreweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui);
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.texture(ControlBreweryProgress.Brewery, new IPoint(0.0f, 0.0f));
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(ControlBreweryProgress.Brewery, IPoint.ZERO);
|
||||
final BreweryLogic logic = Machine.getInterface(BreweryLogic.class, Window.get(this).getInventory());
|
||||
if (logic == null || logic.currentCrafting == null || logic.currentCrafting.inputFluid == null) {
|
||||
return;
|
||||
}
|
||||
final int fermentedHeight = (int) (32.0f * logic.getProgress() / 100.0f);
|
||||
CraftGUI.render.limitArea(new IArea(new IPoint(1.0f, 6.0f).add(this.getAbsolutePosition()), new IPoint(32.0f, 32 - fermentedHeight)));
|
||||
GL11.glEnable(3089);
|
||||
CraftGUI.render.fluid(new IPoint(1.0f, 6.0f), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(17.0f, 6.0f), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(1.0f, 22.0f), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(17.0f, 22.0f), logic.currentCrafting.inputFluid);
|
||||
GL11.glDisable(3089);
|
||||
CraftGUI.render.limitArea(new IArea(new IPoint(1.0f, 38 - fermentedHeight).add(this.getAbsolutePosition()), new IPoint(32.0f, fermentedHeight)));
|
||||
GL11.glEnable(3089);
|
||||
CraftGUI.render.fluid(new IPoint(1.0f, 6.0f), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(17.0f, 6.0f), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(1.0f, 22.0f), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(17.0f, 22.0f), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
GL11.glDisable(3089);
|
||||
CraftGUI.render.limitArea(new IArea(new IPoint(1, 6).add(this.getAbsolutePosition()), new IPoint(32, 32 - fermentedHeight)), guiWidth, guiHeight);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
CraftGUI.render.fluid(new IPoint(1, 6), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(17, 6), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(1, 22), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(17, 22), logic.currentCrafting.inputFluid);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
CraftGUI.render.limitArea(new IArea(new IPoint(1, 38 - fermentedHeight).add(this.getAbsolutePosition()), new IPoint(32, fermentedHeight)), guiWidth, guiHeight);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
CraftGUI.render.fluid(new IPoint(1, 6), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(17, 6), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(1, 22), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(17, 22), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
final ItemStackSet stacks = new ItemStackSet();
|
||||
Collections.addAll(stacks, logic.currentCrafting.inputGrains);
|
||||
stacks.add(logic.currentCrafting.ingredient);
|
||||
int x = 1;
|
||||
int y = 6;
|
||||
for (final ItemStack stack : stacks) {
|
||||
CraftGUI.render.item(new IPoint(x, y), stack);
|
||||
CraftGUIUtil.renderItem(new IPoint(x, y), stack);
|
||||
x += 16;
|
||||
if (x > 18) {
|
||||
x = 1;
|
||||
@@ -61,11 +62,11 @@ public class ControlBreweryProgress extends ControlProgressBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
}
|
||||
|
||||
protected ControlBreweryProgress(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 34.0f, 39.0f);
|
||||
protected ControlBreweryProgress(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 34, 39);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -23,9 +23,9 @@ public class ControlDistilleryProgress extends ControlProgressBase {
|
||||
public static final Texture OUTPUT = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui);
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.texture(DISTILLERY_BASE, new IPoint(0.0f, 0.0f));
|
||||
CraftGUI.render.texturePercentage(LIQUID_FLOW, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.Left, this.progress);
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(DISTILLERY_BASE, IPoint.ZERO);
|
||||
CraftGUI.render.texturePercentage(LIQUID_FLOW, new IArea(18, 0, 38, 66), Position.Left, this.progress);
|
||||
final DistilleryLogic component = Machine.getInterface(DistilleryLogic.class, Window.get(this).getInventory());
|
||||
FluidStack stack = null;
|
||||
if (component != null) {
|
||||
@@ -33,32 +33,32 @@ public class ControlDistilleryProgress extends ControlProgressBase {
|
||||
}
|
||||
if (stack != null) {
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
CraftGUI.render.fluid(new IPoint(1.0f, 1 + y * 16), stack);
|
||||
CraftGUI.render.fluid(new IPoint(1, 1 + y * 16), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
DistilleryLogic distilleryLogic = Machine.getInterface(DistilleryLogic.class, Window.get(this).getInventory());
|
||||
if (distilleryLogic != null) {
|
||||
final int level = distilleryLogic.level;
|
||||
CraftGUI.render.texture(OUTPUT, new IPoint(47.0f, 14 + level * 15));
|
||||
CraftGUI.render.texture(DISTILLERY_OVERLAY, new IPoint(0.0f, 0.0f));
|
||||
CraftGUI.render.texture(OUTPUT, new IPoint(47, 14 + level * 15));
|
||||
CraftGUI.render.texture(DISTILLERY_OVERLAY, IPoint.ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
protected ControlDistilleryProgress(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 58.0f, 66.0f);
|
||||
protected ControlDistilleryProgress(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 58, 66);
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Down event) {
|
||||
int distillationLevel = -1;
|
||||
if (new IArea(45.0f, 8.0f, 19.0f, 11.0f).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
|
||||
if (new IArea(45, 8, 19, 11).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
|
||||
distillationLevel = 0;
|
||||
} else if (new IArea(45.0f, 23.0f, 19.0f, 11.0f).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
|
||||
} else if (new IArea(45, 23, 19, 11).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
|
||||
distillationLevel = 1;
|
||||
} else if (new IArea(45.0f, 38.0f, 19.0f, 11.0f).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
|
||||
} else if (new IArea(45, 38, 19, 11).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
|
||||
distillationLevel = 2;
|
||||
}
|
||||
if (distillationLevel >= 0) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package binnie.craftgui.extratrees.dictionary;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
@@ -10,8 +11,8 @@ import binnie.craftgui.minecraft.control.ControlProgressBase;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import binnie.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.machines.fruitpress.FruitPressRecipes;
|
||||
import binnie.extratrees.machines.fruitpress.FruitPressMachine;
|
||||
import binnie.extratrees.machines.fruitpress.FruitPressRecipes;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -22,8 +23,8 @@ public class ControlFruitPressProgress extends ControlProgressBase {
|
||||
static Texture PressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui);
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.texture(ControlFruitPressProgress.PressSlot, new IPoint(3.0f, 52.0f));
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(ControlFruitPressProgress.PressSlot, new IPoint(3, 52));
|
||||
Slot slotFromInventory = Window.get(this).getContainer().getSlotFromInventory(Window.get(this).getInventory(), FruitPressMachine.SLOT_CURRENT);
|
||||
if (slotFromInventory == null) {
|
||||
return;
|
||||
@@ -33,17 +34,17 @@ public class ControlFruitPressProgress extends ControlProgressBase {
|
||||
return;
|
||||
}
|
||||
FluidStack fluid = FruitPressRecipes.getOutput(input);
|
||||
CraftGUI.render.fluid(new IPoint(4.0f, 52.0f), fluid);
|
||||
CraftGUI.render.item(new IPoint(4.0f, 52.0f), input);
|
||||
CraftGUI.render.fluid(new IPoint(4, 52), fluid);
|
||||
CraftGUIUtil.renderItem(new IPoint(4, 52), input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
CraftGUI.render.texture(ControlFruitPressProgress.PressTexture, new IPoint(0.0f, 16.0f * this.progress));
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(ControlFruitPressProgress.PressTexture, new IPoint(0, Math.round(16 * this.progress)));
|
||||
}
|
||||
|
||||
protected ControlFruitPressProgress(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 37.0f, 69.0f);
|
||||
protected ControlFruitPressProgress(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 37, 69);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
|
||||
+13
-13
@@ -29,15 +29,15 @@ public class ControlLumbermillProgress extends ControlProgressBase {
|
||||
super.onUpdateClient();
|
||||
if (this.oldProgress != this.progress) {
|
||||
this.oldProgress = this.progress;
|
||||
this.animation += 5.0f;
|
||||
this.animation += 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
GL11.glDisable(2896);
|
||||
final int sawX = (int) (63.0f * this.progress);
|
||||
CraftGUI.render.texture(ControlLumbermillProgress.Saw, new IPoint(sawX, -8.0f + 6.0f * (float) Math.sin(this.animation)));
|
||||
final int sawX = (int) (63 * this.progress);
|
||||
CraftGUI.render.texture(ControlLumbermillProgress.Saw, new IPoint(sawX, -8 + Math.round(6 * (float) Math.sin(this.animation))));
|
||||
final ItemStack item = Window.get(this).getInventory().getStackInSlot(LumbermillMachine.SLOT_LOG);
|
||||
if (item == null) {
|
||||
return;
|
||||
@@ -53,7 +53,7 @@ public class ControlLumbermillProgress extends ControlProgressBase {
|
||||
//TODO RENDERING
|
||||
//final IIcon icon = block.getIcon(2, item.getItemDamage());
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
//CraftGUI.Render.iconBlock(new IPoint(1 + i * 16, 1.0f), icon);
|
||||
//CraftGUI.Render.iconBlock(new IPoint(1 + i * 16, 1), icon);
|
||||
}
|
||||
final ItemStack result = LumbermillRecipes.getPlankProduct(item);
|
||||
if (result == null) {
|
||||
@@ -69,21 +69,21 @@ public class ControlLumbermillProgress extends ControlProgressBase {
|
||||
//final IIcon icon2 = block2.getIcon(2, result.getItemDamage());
|
||||
final IPoint size = this.getSize();
|
||||
final IPoint pos = this.getAbsolutePosition();
|
||||
CraftGUI.render.limitArea(new IArea(pos.add(new IPoint(0.0f, 0.0f)), new IPoint(this.progress * 64.0f + 2.0f, 18.0f)));
|
||||
CraftGUI.render.limitArea(new IArea(pos.add(IPoint.ZERO), new IPoint(Math.round(this.progress * 64) + 2, 18)), guiWidth, guiHeight);
|
||||
GL11.glEnable(3089);
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
//TODO RENDERING
|
||||
//CraftGUI.Render.iconBlock(new IPoint(1 + j * 16, 1.0f), icon2);
|
||||
//CraftGUI.Render.iconBlock(new IPoint(1 + j * 16, 1), icon2);
|
||||
}
|
||||
GL11.glDisable(3089);
|
||||
CraftGUI.render.texture(ControlLumbermillProgress.Saw2, new IPoint(sawX + 2, -8.0f + 6.0f * (float) Math.sin(this.animation)));
|
||||
CraftGUI.render.texture(ControlLumbermillProgress.Saw2, new IPoint(sawX + 2, -8 + Math.round(6 * (float) Math.sin(this.animation))));
|
||||
}
|
||||
|
||||
protected ControlLumbermillProgress(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 66.0f, 18.0f);
|
||||
this.oldProgress = 0.0f;
|
||||
this.animation = 0.0f;
|
||||
new Panel(this, 0.0f, 0.0f, 66.0f, 18.0f, MinecraftGUI.PanelType.Black);
|
||||
protected ControlLumbermillProgress(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 66, 18);
|
||||
this.oldProgress = 0;
|
||||
this.animation = 0;
|
||||
new Panel(this, 0, 0, 66, 18, MinecraftGUI.PanelType.Black);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
@@ -34,8 +35,8 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
|
||||
IDesign value;
|
||||
float shownHeight;
|
||||
|
||||
protected ControlTileSelect(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 102.0f, 20 * (CarpentryManager.carpentryInterface.getSortedDesigns().size() / 4) + 22);
|
||||
protected ControlTileSelect(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 102, 20 * (CarpentryManager.carpentryInterface.getSortedDesigns().size() / 4) + 22);
|
||||
this.value = EnumDesign.Blank;
|
||||
this.shownHeight = 92.0f;
|
||||
this.refresh("");
|
||||
@@ -122,8 +123,8 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
|
||||
public static class ControlTile extends Control implements IControlValue<IDesign>, ITooltip {
|
||||
IDesign value;
|
||||
|
||||
protected ControlTile(final IWidget parent, final float x, final float y, final IDesign value) {
|
||||
super(parent, x, y, 18.0f, 18.0f);
|
||||
protected ControlTile(final IWidget parent, final int x, final int y, final IDesign value) {
|
||||
super(parent, x, y, 18, 18);
|
||||
this.setValue(value);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@@ -152,14 +153,14 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(CraftGUITexture.Slot, IPoint.ZERO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
final ItemStack image = ((WindowWoodworker) this.getSuperParent()).getDesignerType().getDisplayStack(this.getValue());
|
||||
CraftGUI.render.item(new IPoint(1.0f, 1.0f), image);
|
||||
CraftGUIUtil.renderItem(new IPoint(1, 1), image);
|
||||
if (((IControlValue) this.getParent()).getValue() != this.getValue()) {
|
||||
if (Window.get(this).getMousedOverWidget() == this) {
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), 1157627903, 1157627903);
|
||||
|
||||
@@ -4,7 +4,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.minecraft.Dialog;
|
||||
|
||||
public class DialogBreweryRecipe extends Dialog {
|
||||
public DialogBreweryRecipe(final IWidget parent, final float w, final float h) {
|
||||
public DialogBreweryRecipe(final IWidget parent, final int w, final int h) {
|
||||
super(parent, w, h);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ public class PageFruit extends PageAbstract<ItemStack> {
|
||||
public void onValueChanged(final ItemStack species) {
|
||||
this.deleteAllChildren();
|
||||
final WindowAbstractDatabase database = Window.get(this);
|
||||
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), ExtraTrees.proxy.localise("gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MiddleCenter);
|
||||
new ControlText(this, new IArea(0, 0, this.size().x(), 24), ExtraTrees.proxy.localise("gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MiddleCenter);
|
||||
final Collection<IAlleleSpecies> trees = this.treesThatBearFruit ? ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatBearFruit(species, database.isNEI(), database.getWorld(), database.getUsername()) : ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatCanBearFruit(species, database.isNEI(), database.getWorld(), database.getUsername());
|
||||
new ControlSpeciesBox(this, 4.0f, 24.0f, this.size().x() - 8.0f, this.size().y() - 4.0f - 24.0f).setOptions(trees);
|
||||
new ControlSpeciesBox(this, 4, 24, this.size().x() - 8, this.size().y() - 4 - 24).setOptions(trees);
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,8 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
|
||||
public void onValueChanged(final ItemStack species) {
|
||||
this.deleteAllChildren();
|
||||
final WindowAbstractDatabase database = Window.get(this);
|
||||
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), species.getDisplayName(), TextJustification.MiddleCenter);
|
||||
new ControlText(this, new IArea(12.0f, 24.0f, this.size().x() - 24.0f, 24.0f), ExtraTrees.proxy.localise("gui.database.planks.use"), TextJustification.MiddleLeft);
|
||||
new ControlText(this, new IArea(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MiddleCenter);
|
||||
new ControlText(this, new IArea(12, 24, this.size().x() - 24, 24), ExtraTrees.proxy.localise("gui.database.planks.use"), TextJustification.MiddleLeft);
|
||||
final IPlankType type = WoodManager.get(species);
|
||||
int x = 12;
|
||||
if (type != null) {
|
||||
@@ -37,20 +37,20 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
|
||||
final ItemStack gate = WoodManager.getGate(type);
|
||||
final ItemStack door = WoodManager.getDoor(type, DoorType.Standard);
|
||||
if (fence != null) {
|
||||
new ControlItemDisplay(this, x, 48.0f).setItemStack(fence);
|
||||
new ControlItemDisplay(this, x, 48).setItemStack(fence);
|
||||
x += 22;
|
||||
}
|
||||
if (gate != null) {
|
||||
new ControlItemDisplay(this, x, 48.0f).setItemStack(gate);
|
||||
new ControlItemDisplay(this, x, 48).setItemStack(gate);
|
||||
x += 22;
|
||||
}
|
||||
if (door != null) {
|
||||
new ControlItemDisplay(this, x, 48.0f).setItemStack(door);
|
||||
new ControlItemDisplay(this, x, 48).setItemStack(door);
|
||||
x += 22;
|
||||
}
|
||||
}
|
||||
final ControlText controlDescription = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.MiddleCenter);
|
||||
final ControlText controlSignature = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.BottomRight);
|
||||
final ControlText controlDescription = new ControlText(this, new IArea(8, 84, this.getSize().x() - 16, 0), "", TextJustification.MiddleCenter);
|
||||
final ControlText controlSignature = new ControlText(this, new IArea(8, 84, this.getSize().x() - 16, 0), "", TextJustification.BottomRight);
|
||||
String desc = "";
|
||||
if (type != null) {
|
||||
desc = type.getDescription();
|
||||
@@ -71,7 +71,7 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
|
||||
}
|
||||
controlDescription.setValue(descBody + "§r");
|
||||
controlSignature.setValue(descSig + "§r");
|
||||
final float descHeight = CraftGUI.render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
|
||||
controlSignature.setPosition(new IPoint(controlSignature.pos().x(), controlDescription.getPosition().y() + descHeight + 10.0f));
|
||||
final int descHeight = CraftGUI.render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
|
||||
controlSignature.setPosition(new IPoint(controlSignature.pos().x(), controlDescription.getPosition().y() + descHeight + 10));
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ public class PagePlanksTrees extends PageAbstract<ItemStack> {
|
||||
public void onValueChanged(final ItemStack species) {
|
||||
this.deleteAllChildren();
|
||||
final WindowAbstractDatabase database = Window.get(this);
|
||||
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), species.getDisplayName(), TextJustification.MiddleCenter);
|
||||
new ControlText(this, new IArea(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MiddleCenter);
|
||||
final Collection<IAlleleSpecies> trees = ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatMakePlanks(species, database.isNEI(), database.getWorld(), database.getUsername());
|
||||
new ControlSpeciesBox(this, 4.0f, 24.0f, this.size().x() - 8.0f, this.size().y() - 4.0f - 24.0f).setOptions(trees);
|
||||
new ControlSpeciesBox(this, 4, 24, this.size().x() - 8, this.size().y() - 4 - 24).setOptions(trees);
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@ public class PageSpeciesImage extends PageSpecies {
|
||||
|
||||
public PageSpeciesImage(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
new Panel(this, 7.0f, 25.0f, 130.0f, 120.0f, MinecraftGUI.PanelType.Gray);
|
||||
this.display = new ControlDatabaseIndividualDisplay(this, 12.0f, 25.0f, 120.0f);
|
||||
new Panel(this, 7, 25, 130, 120, MinecraftGUI.PanelType.Gray);
|
||||
this.display = new ControlDatabaseIndividualDisplay(this, 12, 25, 120);
|
||||
this.display.hastooltip = false;
|
||||
new ControlTextCentered(this, 8.0f, this.getValue().toString());
|
||||
new ControlTextCentered(this, 8, this.getValue().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,9 +48,9 @@ public class PageSpeciesTreeGenome extends PageSpecies {
|
||||
final ItemStack log = treeSpecies.getWoodProvider().getWoodStack();
|
||||
final int w = 144;
|
||||
final int h = 176;
|
||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), this.getValue().toString(), TextJustification.MiddleCenter);
|
||||
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||
final Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||
new ControlText(this, new IArea(0, 4, w, 16), this.getValue().toString(), TextJustification.MiddleCenter);
|
||||
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4, 20, w - 8, h - 8 - 16, 12);
|
||||
final Control contents = new Control(scrollable, 0, 0, w - 8 - 12, h - 8 - 16);
|
||||
final int tw = w - 8 - 12;
|
||||
final int w2 = 65;
|
||||
final int w3 = tw - 50;
|
||||
@@ -58,10 +58,10 @@ public class PageSpeciesTreeGenome extends PageSpecies {
|
||||
final int th = 14;
|
||||
final int th2 = 18;
|
||||
final BreedingSystem syst = Binnie.GENETICS.treeBreedingSystem;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.PLANT) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.PLANT) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getPlantType().toString(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), BinnieCore.proxy.localise("gui.temperature.short") + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), BinnieCore.proxy.localise("gui.temperature.short") + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
//TODO RENDERING
|
||||
@@ -76,7 +76,7 @@ public class PageSpeciesTreeGenome extends PageSpecies {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
//if (leaf != null) {
|
||||
//new ControlText(contents, new IArea(0.0f, y, w2, th2), ExtraTrees.proxy.localise("gui.database.leaves") + " : ", TextJustification.MiddleRight);
|
||||
//new ControlText(contents, new IArea(0, y, w2, th2), ExtraTrees.proxy.localise("gui.database.leaves") + " : ", TextJustification.MiddleRight);
|
||||
//TODO RENDERING
|
||||
//new ControlBlockIconDisplay(contents, w2, y, leaf).setColour(treeSpecies.getLeafColour(false));
|
||||
//if (fruit != null && !treeSpecies.getUID().equals("forestry.treeOak")) {
|
||||
@@ -88,19 +88,19 @@ public class PageSpeciesTreeGenome extends PageSpecies {
|
||||
// final ItemStack log = (genome.getFruitProvider().getProducts().length
|
||||
// > 0) ? genome.getFruitProvider().getProducts()[0] : null;
|
||||
if (log != null) {
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th2), ExtraTrees.proxy.localise("gui.database.log") + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th2), ExtraTrees.proxy.localise("gui.database.log") + " : ", TextJustification.MiddleRight);
|
||||
final ControlItemDisplay display = new ControlItemDisplay(contents, w2, y);
|
||||
display.setItemStack(log);
|
||||
display.setTooltip();
|
||||
y += th2;
|
||||
}
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GROWTH) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GROWTH) + " : ", TextJustification.MiddleRight);
|
||||
//new ControlText(contents, new IArea(w2, y, w3, th), genome.getGrowthProvider().getDescription(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getHeight() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
final List<ItemStack> fruits = new ArrayList<>();
|
||||
@@ -108,7 +108,7 @@ public class PageSpeciesTreeGenome extends PageSpecies {
|
||||
fruits.add(stack);
|
||||
}
|
||||
if (!fruits.isEmpty()) {
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MiddleRight);
|
||||
for (final ItemStack fruitw : fruits) {
|
||||
final ControlItemDisplay display2 = new ControlItemDisplay(contents, w2, y);
|
||||
display2.setItemStack(fruitw);
|
||||
@@ -116,16 +116,16 @@ public class PageSpeciesTreeGenome extends PageSpecies {
|
||||
y += th2;
|
||||
}
|
||||
}
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getYield() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getSappiness() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getMaturationTime() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getGirth() + "x" + genome.getGirth(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
contents.setSize(new IPoint(contents.size().x(), y));
|
||||
|
||||
@@ -24,8 +24,8 @@ public class PageWood extends PageAbstract<ItemStack> {
|
||||
public void onValueChanged(final ItemStack species) {
|
||||
this.deleteAllChildren();
|
||||
final WindowAbstractDatabase database = Window.get(this);
|
||||
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), this.getValue().toString(), TextJustification.MiddleCenter);
|
||||
new ControlText(this, new IArea(0, 0, this.size().x(), 24), this.getValue().toString(), TextJustification.MiddleCenter);
|
||||
final Collection<IAlleleSpecies> trees = ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatHaveWood(species, database.isNEI(), database.getWorld(), database.getUsername());
|
||||
new ControlSpeciesBox(this, 4.0f, 24.0f, this.size().x() - 8.0f, this.size().y() - 4.0f - 24.0f).setOptions(trees);
|
||||
new ControlSpeciesBox(this, 4, 24, this.size().x() - 8, this.size().y() - 4 - 24).setOptions(trees);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class WindowArboristDatabase extends WindowAbstractDatabase {
|
||||
ControlListBox<ItemStack> selectionBoxPlanks;
|
||||
|
||||
public WindowArboristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
super(player, side, nei, Binnie.GENETICS.treeBreedingSystem, 120.0f);
|
||||
super(player, side, nei, Binnie.GENETICS.treeBreedingSystem, 120);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
@@ -49,7 +49,7 @@ public class WindowArboristDatabase extends WindowAbstractDatabase {
|
||||
this.createMode(TreeMode.Fruit, new ModeWidgets(TreeMode.Fruit, this) {
|
||||
@Override
|
||||
public void createListBox(final IArea area) {
|
||||
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12) {
|
||||
@Override
|
||||
public IWidget createOption(final ItemStack value, final int y) {
|
||||
return new ControlItemStackOption(this.getContent(), value, y);
|
||||
@@ -60,7 +60,7 @@ public class WindowArboristDatabase extends WindowAbstractDatabase {
|
||||
this.createMode(TreeMode.Wood, new ModeWidgets(TreeMode.Wood, this) {
|
||||
@Override
|
||||
public void createListBox(final IArea area) {
|
||||
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12) {
|
||||
@Override
|
||||
public IWidget createOption(final ItemStack value, final int y) {
|
||||
return new ControlItemStackOption(this.getContent(), value, y);
|
||||
@@ -71,7 +71,7 @@ public class WindowArboristDatabase extends WindowAbstractDatabase {
|
||||
this.createMode(TreeMode.Planks, new ModeWidgets(TreeMode.Planks, this) {
|
||||
@Override
|
||||
public void createListBox(final IArea area) {
|
||||
this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12) {
|
||||
@Override
|
||||
public IWidget createOption(final ItemStack value, final int y) {
|
||||
return new ControlItemStackOption(this.getContent(), value, y);
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowBrewery extends Window {
|
||||
public WindowBrewery(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(228.0f, 218.0f, player, inventory, side);
|
||||
super(228, 218, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,15 +35,15 @@ public class WindowBrewery extends Window {
|
||||
public void initialiseClient() {
|
||||
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
|
||||
new ControlSlotArray(this, 42, 32, 1, 3).create(BreweryMachine.SLOT_RECIPE_GRAINS);
|
||||
new ControlSlot(this, 16.0f, 41.0f).assign(BreweryMachine.SLOT_RECIPE_INPUT);
|
||||
new ControlSlot(this, 105.0f, 77.0f).assign(BreweryMachine.SLOT_YEAST);
|
||||
new ControlSlot(this, 16, 41).assign(BreweryMachine.SLOT_RECIPE_INPUT);
|
||||
new ControlSlot(this, 105, 77).assign(BreweryMachine.SLOT_YEAST);
|
||||
new ControlLiquidTank(this, 76, 32).setTankID(BreweryMachine.TANK_INPUT);
|
||||
new ControlLiquidTank(this, 162, 32).setTankID(BreweryMachine.TANK_OUTPUT);
|
||||
new ControlEnergyBar(this, 196, 32, 16, 60, Position.Bottom);
|
||||
new ControlBreweryProgress(this, 110.0f, 32.0f);
|
||||
new ControlSlotArray(this, (int) (this.getSize().x() / 2.0f - 81.0f), 104, 9, 1).create(BreweryMachine.SLOTS_INVENTORY);
|
||||
new ControlBreweryProgress(this, 110, 32);
|
||||
new ControlSlotArray(this, this.getSize().x() / 2 - 81, 104, 9, 1).create(BreweryMachine.SLOTS_INVENTORY);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, 133.0f, 79.0f);
|
||||
new ControlErrorState(this, 133, 79);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowDistillery extends Window {
|
||||
public WindowDistillery(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(224.0f, 192.0f, player, inventory, side);
|
||||
super(224, 192, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,13 +35,13 @@ public class WindowDistillery extends Window {
|
||||
int x = 16;
|
||||
new ControlLiquidTank(this, x, 35).setTankID(DistilleryMachine.TANK_INPUT);
|
||||
x += 34;
|
||||
new ControlDistilleryProgress(this, x, 32.0f);
|
||||
new ControlDistilleryProgress(this, x, 32);
|
||||
x += 64;
|
||||
new ControlLiquidTank(this, x, 35).setTankID(DistilleryMachine.TANK_OUTPUT);
|
||||
x += 34;
|
||||
new ControlEnergyBar(this, x, 36, 60, 16, Position.Left);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, x + 21, 62.0f);
|
||||
new ControlErrorState(this, x + 21, 62);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowLepidopteristDatabase extends WindowAbstractDatabase {
|
||||
public WindowLepidopteristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
super(player, side, nei, Binnie.GENETICS.mothBreedingSystem, 160.0f);
|
||||
super(player, side, nei, Binnie.GENETICS.mothBreedingSystem, 160);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowLumbermill extends Window {
|
||||
public WindowLumbermill(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(220.0f, 192.0f, player, inventory, side);
|
||||
super(220, 192, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,15 +33,15 @@ public class WindowLumbermill extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
|
||||
new ControlSlot(this, 42.0f, 43.0f).assign(LumbermillMachine.SLOT_LOG);
|
||||
new ControlSlot(this, 148.0f, 43.0f).assign(LumbermillMachine.SLOT_PLANKS);
|
||||
new ControlSlot(this, 172.0f, 28.0f).assign(LumbermillMachine.SLOT_BARK);
|
||||
new ControlSlot(this, 172.0f, 58.0f).assign(LumbermillMachine.SLOT_SAWDUST);
|
||||
new ControlLumbermillProgress(this, 70.0f, 43.0f);
|
||||
new ControlSlot(this, 42, 43).assign(LumbermillMachine.SLOT_LOG);
|
||||
new ControlSlot(this, 148, 43).assign(LumbermillMachine.SLOT_PLANKS);
|
||||
new ControlSlot(this, 172, 28).assign(LumbermillMachine.SLOT_BARK);
|
||||
new ControlSlot(this, 172, 58).assign(LumbermillMachine.SLOT_SAWDUST);
|
||||
new ControlLumbermillProgress(this, 70, 43);
|
||||
new ControlLiquidTank(this, 16, 32);
|
||||
new ControlEnergyBar(this, 8, 112, 16, 60, Position.Bottom);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, 95.0f, 73.0f);
|
||||
new ControlErrorState(this, 95, 73);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowPress extends Window {
|
||||
public WindowPress(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(194.0f, 192.0f, player, inventory, side);
|
||||
super(194, 192, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,12 +37,12 @@ public class WindowPress extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
|
||||
new ControlSlot(this, 24.0f, 52.0f).assign(FruitPressMachine.SLOT_FRUIT);
|
||||
new ControlSlot(this, 24, 52).assign(FruitPressMachine.SLOT_FRUIT);
|
||||
new ControlLiquidTank(this, 99, 32).setTankID(FruitPressMachine.TANK_OUTPUT);
|
||||
new ControlEnergyBar(this, 154, 32, 16, 60, Position.Bottom);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, 128.0f, 54.0f);
|
||||
new ControlFruitPressProgress(this, 62.0f, 24.0f);
|
||||
new ControlErrorState(this, 128, 54);
|
||||
new ControlFruitPressProgress(this, 62, 24);
|
||||
((Window) this.getSuperParent()).getContainer().getOrCreateSlot(InventoryType.Machine, FruitPressMachine.SLOT_CURRENT);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowSetSquare extends Window {
|
||||
public WindowSetSquare(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(150.0f, 150.0f, player, inventory, side);
|
||||
super(150, 150, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,26 +31,26 @@ public class WindowWoodworker extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
|
||||
new ControlText(this, new IArea(190.0f, 36.0f, 114.0f, 10.0f), BinnieCore.proxy.localise("gui.design"), TextJustification.TopCenter).setColour(4473924);
|
||||
new Panel(this, 188.0f, 48.0f, 118.0f, 126.0f, MinecraftGUI.PanelType.Gray);
|
||||
this.textEdit = new ControlTextEdit(this, 188.0f, 178.0f, 118.0f, 12.0f);
|
||||
final ControlScrollableContent scroll = new ControlScrollableContent(this, 190.0f, 50.0f, 114.0f, 122.0f, 12.0f);
|
||||
scroll.setScrollableContent(this.tileSelect = new ControlTileSelect(scroll, 0.0f, 0.0f));
|
||||
new ControlPlayerInventory(this).setPosition(new IPoint(14.0f, 96.0f));
|
||||
new ControlErrorState(this, 76.0f, 65.0f);
|
||||
new ControlText(this, new IArea(190, 36, 114, 10), BinnieCore.proxy.localise("gui.design"), TextJustification.TopCenter).setColour(4473924);
|
||||
new Panel(this, 188, 48, 118, 126, MinecraftGUI.PanelType.Gray);
|
||||
this.textEdit = new ControlTextEdit(this, 188, 178, 118, 12);
|
||||
final ControlScrollableContent scroll = new ControlScrollableContent(this, 190, 50, 114, 122, 12);
|
||||
scroll.setScrollableContent(this.tileSelect = new ControlTileSelect(scroll, 0, 0));
|
||||
new ControlPlayerInventory(this).setPosition(new IPoint(14, 96));
|
||||
new ControlErrorState(this, 76, 65);
|
||||
if (this.getInventory() != null) {
|
||||
final ControlSlot slotWood1 = new ControlSlot(this, 22.0f, 34.0f);
|
||||
final ControlSlot slotWood1 = new ControlSlot(this, 22, 34);
|
||||
slotWood1.assign(Designer.design1Slot);
|
||||
final ControlSlot slotWood2 = new ControlSlot(this, 62.0f, 34.0f);
|
||||
final ControlSlot slotWood2 = new ControlSlot(this, 62, 34);
|
||||
slotWood2.assign(Designer.design2Slot);
|
||||
final ControlSlot slotBeeswax = new ControlSlot(this, 42.0f, 64.0f);
|
||||
final ControlSlot slotBeeswax = new ControlSlot(this, 42, 64);
|
||||
slotBeeswax.assign(Designer.beeswaxSlot);
|
||||
final ControlRecipeSlot slotFinished = new ControlRecipeSlot(this, 112, 34);
|
||||
}
|
||||
}
|
||||
|
||||
public WindowWoodworker(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(320.0f, 216.0f, player, inventory, side);
|
||||
super(320, 216, player, inventory, side);
|
||||
this.addEventHandler(new EventTextEdit.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventTextEdit event) {
|
||||
|
||||
@@ -8,8 +8,8 @@ import binnie.craftgui.window.Panel;
|
||||
public class ControlDropDownMenu extends Panel {
|
||||
public boolean stayOpenOnChildClick;
|
||||
|
||||
public ControlDropDownMenu(final IWidget parent, final float x, final float y, final float width, final float height) {
|
||||
super(parent, x, y, width, 2.0f, MinecraftGUI.PanelType.Gray);
|
||||
public ControlDropDownMenu(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, 2, MinecraftGUI.PanelType.Gray);
|
||||
this.stayOpenOnChildClick = false;
|
||||
this.addAttribute(Attribute.CanFocus);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
|
||||
public abstract class ControlDropdownButton extends ControlButton {
|
||||
public ControlDropdownButton(final IWidget parent, final float x, final float y, final float width, final float height, final String text) {
|
||||
public ControlDropdownButton(final IWidget parent, final int x, final int y, final int width, final int height, final String text) {
|
||||
super(parent, x, y, width, height, text);
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
|
||||
@@ -24,31 +24,31 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public ControlFluidDisplay(final IWidget parent, final float f, final float y) {
|
||||
this(parent, f, y, 16.0f);
|
||||
public ControlFluidDisplay(final IWidget parent, final int x, final int y) {
|
||||
this(parent, x, y, 16);
|
||||
}
|
||||
|
||||
public ControlFluidDisplay(final IWidget parent, final float f, final float y, final FluidStack stack, final boolean tooltip) {
|
||||
this(parent, f, y, 16.0f);
|
||||
public ControlFluidDisplay(final IWidget parent, final int x, final int y, final FluidStack stack, final boolean tooltip) {
|
||||
this(parent, x, y, 16);
|
||||
this.setItemStack(stack);
|
||||
if (tooltip) {
|
||||
this.setTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
public ControlFluidDisplay(final IWidget parent, final float x, final float y, final float size) {
|
||||
public ControlFluidDisplay(final IWidget parent, final int x, final int y, final int size) {
|
||||
super(parent, x, y, size, size);
|
||||
this.itemStack = null;
|
||||
this.hastooltip = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
if (this.itemStack == null) {
|
||||
return;
|
||||
}
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100.0f || relativeToWindow.y() > Window.get(this).getSize().y() + 100.0f) {
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100 || relativeToWindow.y() > Window.get(this).getSize().y() + 100) {
|
||||
return;
|
||||
}
|
||||
if (this.itemStack != null) {
|
||||
@@ -62,7 +62,7 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
if (this.getSize().x() != 16.0f) {
|
||||
if (this.getSize().x() != 16) {
|
||||
GL11.glPushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
|
||||
@@ -23,24 +23,24 @@ public class ControlSlotFluid extends Control implements ITooltip {
|
||||
public ControlSlotFluid(final IWidget parent, final int x, final int y, final int size, final FluidStack fluid) {
|
||||
super(parent, x, y, size, size);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.itemDisplay = new ControlFluidDisplay(this, 1.0f, 1.0f, size - 2);
|
||||
this.itemDisplay = new ControlFluidDisplay(this, 1, 1, size - 2);
|
||||
this.fluidStack = fluid;
|
||||
this.addSelfEventHandler(new EventWidget.ChangeSize.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventWidget.ChangeSize event) {
|
||||
if (ControlSlotFluid.this.itemDisplay != null) {
|
||||
ControlSlotFluid.this.itemDisplay.setSize(ControlSlotFluid.this.getSize().sub(new IPoint(2.0f, 2.0f)));
|
||||
ControlSlotFluid.this.itemDisplay.setSize(ControlSlotFluid.this.getSize().sub(new IPoint(2, 2)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
final int size = (int) this.getSize().x();
|
||||
CraftGUI.render.texture(CraftGUITexture.Slot, this.getArea());
|
||||
if (this.getSuperParent().getMousedOverWidget() == this) {
|
||||
CraftGUI.render.gradientRect(new IArea(new IPoint(1.0f, 1.0f), this.getArea().size().sub(new IPoint(2.0f, 2.0f))), -2130706433, -2130706433);
|
||||
CraftGUI.render.gradientRect(new IArea(new IPoint(1, 1), this.getArea().size().sub(new IPoint(2, 2))), -2130706433, -2130706433);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ public class ControlTankSlot extends ControlSlotFluid {
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
this.fluidStack = Window.get(this).getContainer().getTankInfo(this.tankID).liquid;
|
||||
final int height = (int) (16.0f * (((this.fluidStack == null) ? 0 : this.fluidStack.amount) / 1000.0f));
|
||||
this.itemDisplay.setCroppedZone(this.itemDisplay, new IArea(0.0f, 16 - height, 16.0f, 16.0f));
|
||||
final int height = 16 * (((this.fluidStack == null) ? 0 : this.fluidStack.amount) / 1000);
|
||||
this.itemDisplay.setCroppedZone(this.itemDisplay, new IArea(0, 16 - height, 16, 16));
|
||||
super.onUpdateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowBottleRack extends Window {
|
||||
public WindowBottleRack(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(248.0f, 180.0f, player, inventory, side);
|
||||
super(248, 180, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
|
||||
@@ -40,8 +40,8 @@ public class ControlGene extends Control implements IControlValue<IGene>, IToolt
|
||||
return stack != null && stack.stackSize == 1 && Engineering.isGeneAcceptor(stack) && Engineering.canAcceptGene(stack, this.getValue());
|
||||
}
|
||||
|
||||
protected ControlGene(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
protected ControlGene(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
@@ -68,11 +68,11 @@ public class ControlGene extends Control implements IControlValue<IGene>, IToolt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (this.isMouseOver() && this.canFill(Window.get(this).getHeldItemStack())) {
|
||||
CraftGUI.render.solid(this.getArea(), -1);
|
||||
CraftGUI.render.solid(this.getArea().inset(1), -12303292);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ControlGeneScroll extends Control implements IControlValue<Breeding
|
||||
private String filter;
|
||||
private BreedingSystem system;
|
||||
|
||||
protected ControlGeneScroll(final IWidget parent, final float x, final float y, final float w, final float h) {
|
||||
protected ControlGeneScroll(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent, x, y, w, h);
|
||||
this.filter = "";
|
||||
this.system = null;
|
||||
|
||||
@@ -13,9 +13,9 @@ public class ControlProcessTemporary extends ControlMachineProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.solid(this.getArea(), -4868683);
|
||||
final float w = this.getSize().y() * this.progress / 100.0f;
|
||||
final int w = Math.round(this.getSize().y() * this.progress / 100.0f);
|
||||
CraftGUI.render.solid(new IArea(this.getArea().x(), this.getArea().y(), w, this.getArea().h()), -65536);
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,9 @@ public class ControlSequencerProgress extends ControlProgressBase {
|
||||
ControlText textControl;
|
||||
|
||||
public ControlSequencerProgress(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 100.0f, 52.0f);
|
||||
final Panel panel = new Panel(this, 0.0f, 0.0f, 100.0f, 52.0f, MinecraftGUI.PanelType.Gray);
|
||||
this.textControl = new ControlText(panel, new IArea(4.0f, 4.0f, 92.0f, 44.0f), "", TextJustification.MiddleCenter);
|
||||
super(parent, x, y, 100, 52);
|
||||
final Panel panel = new Panel(this, 0, 0, 100, 52, MinecraftGUI.PanelType.Gray);
|
||||
this.textControl = new ControlText(panel, new IArea(4, 4, 92, 44), "", TextJustification.MiddleCenter);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,10 +37,10 @@ public class ControlSequencerProgress extends ControlProgressBase {
|
||||
final int k = rand.nextInt(4);
|
||||
final String code = codes[k];
|
||||
if (rand.nextFloat() < this.progress) {
|
||||
final String col = "§" + colors[k];
|
||||
text = text + "§r" + col + "§l" + code;
|
||||
final String col = "�" + colors[k];
|
||||
text = text + "�r" + col + "�l" + code;
|
||||
} else {
|
||||
text = text + "§r§7§k§l" + code;
|
||||
text = text + "�r�7�k�l" + code;
|
||||
}
|
||||
}
|
||||
this.textControl.setValue(text);
|
||||
|
||||
@@ -8,22 +8,22 @@ import binnie.craftgui.minecraft.control.ControlProgressBase;
|
||||
public class ControlSplicerProgress extends ControlProgressBase {
|
||||
float strength;
|
||||
|
||||
public ControlSplicerProgress(final IWidget parent, final float x, final float y, final float w, final float h) {
|
||||
public ControlSplicerProgress(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent, x, y, w, h);
|
||||
this.strength = 0.0f;
|
||||
this.strength = 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
final float progress = this.getProcess().getCurrentProgress() / 100.0f;
|
||||
final float n = this.getProcess().getProcessTime() / 12.0f;
|
||||
final float spacing = 10.0f;
|
||||
final int spacing = 10;
|
||||
final float range = this.w();
|
||||
final float h = 8.0f;
|
||||
final int h = 8;
|
||||
final float ooy = -((n - 1.0f) * spacing) - range / 2.0f;
|
||||
final float ddy = (n - 1.0f) * spacing + range;
|
||||
final float oy = ooy + ddy * progress;
|
||||
final int oy = Math.round(ooy + ddy * progress);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
final int seed = 432523;
|
||||
final int[] colours = {10027008, 30464, 255, 10057472};
|
||||
@@ -31,7 +31,7 @@ public class ControlSplicerProgress extends ControlProgressBase {
|
||||
int c2 = colours[(int) Math.abs(23.0 * Math.sin(i) + 28.0 * Math.cos(i) + 15.0 * Math.sin(7 * i)) % 4];
|
||||
int c3 = colours[(int) Math.abs(43.0 * Math.sin(i) + 38.0 * Math.cos(i) + 55.0 * Math.sin(7 * i)) % 4];
|
||||
int c4 = colours[(int) Math.abs(3.0 * Math.sin(i) + 18.0 * Math.cos(i) + 35.0 * Math.sin(7 * i)) % 4];
|
||||
final float y = oy + i * spacing;
|
||||
final int y = oy + i * spacing;
|
||||
if (y > -range / 2.0f && y < range / 2.0f) {
|
||||
final float percentView = (float) Math.sqrt(1.0f - Math.abs(2.0f * y / range));
|
||||
final float offMovement = (this.h() - 2.0f * h) / 2.0f;
|
||||
@@ -40,10 +40,11 @@ public class ControlSplicerProgress extends ControlProgressBase {
|
||||
c2 += alpha;
|
||||
c3 += alpha;
|
||||
c4 += alpha;
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2.0f + y, offMovement * percentView, 4.0f, h / 2.0f), c1);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2.0f + y, offMovement * percentView + 4.0f, 4.0f, h / 2.0f), (y < 0.0f) ? c2 : c3);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2.0f + y, this.h() - offMovement * percentView - 8.0f, 4.0f, h / 2.0f), (y < 0.0f) ? c3 : c2);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2.0f + y, this.h() - offMovement * percentView - 4.0f, 4.0f, h / 2.0f), c4);
|
||||
int viewAmount = Math.round(offMovement * percentView);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, viewAmount, 4, h / 2), c1);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, viewAmount + 4, 4, h / 2), (y < 0) ? c2 : c3);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, this.h() - viewAmount - 8, 4, h / 2), (y < 0) ? c3 : c2);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, this.h() - viewAmount - 4, 4, h / 2), c4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class WindowAcclimatiser extends WindowMachine {
|
||||
x += 72;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_DRONE);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 181.0f, 83.0f);
|
||||
new ControlErrorState(this, 181, 83);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WindowAnalyser extends WindowMachine {
|
||||
x -= 28;
|
||||
new ControlIconDisplay(this, x + 36 + 2, y + 18, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 56;
|
||||
new Panel(this, x, y, 76.0f, 50.0f, MinecraftGUI.PanelType.Tinted);
|
||||
new Panel(this, x, y, 76, 50, MinecraftGUI.PanelType.Tinted);
|
||||
new ControlProgress(this, x + 5, y + 5, WindowAnalyser.ProgressBase, WindowAnalyser.Progress, Position.Left);
|
||||
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6);
|
||||
new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
|
||||
@@ -92,21 +92,21 @@ public class WindowGeneBank extends WindowMachine {
|
||||
x += 124;
|
||||
boxX = x;
|
||||
final int geneBoxWidth = 120;
|
||||
new Panel(this, boxX + 24, 32.0f, geneBoxWidth, 120.0f, MinecraftGUI.PanelType.Black);
|
||||
new Panel(this, boxX + 24 + geneBoxWidth, 32.0f, 14.0f, 120.0f, MinecraftGUI.PanelType.Gray);
|
||||
final ControlScrollableContent scroll = new ControlScrollableContent(this, boxX + 24 + 2, 34.0f, geneBoxWidth + 10, 116.0f, 12.0f);
|
||||
final ControlTextEdit edit = new ControlTextEdit(this, boxX + 27 + geneBoxWidth - 70, 18.0f, 80.0f, 12.0f);
|
||||
new Panel(this, boxX + 24, 32, geneBoxWidth, 120, MinecraftGUI.PanelType.Black);
|
||||
new Panel(this, boxX + 24 + geneBoxWidth, 32, 14, 120, MinecraftGUI.PanelType.Gray);
|
||||
final ControlScrollableContent scroll = new ControlScrollableContent(this, boxX + 24 + 2, 34, geneBoxWidth + 10, 116, 12);
|
||||
final ControlTextEdit edit = new ControlTextEdit(this, boxX + 27 + geneBoxWidth - 70, 18, 80, 12);
|
||||
this.addEventHandler(new EventTextEdit.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventTextEdit event) {
|
||||
WindowGeneBank.this.genes.setFilter(event.getValue());
|
||||
}
|
||||
}.setOrigin(EventHandler.Origin.Self, edit));
|
||||
scroll.setScrollableContent(this.genes = new ControlGeneScroll(scroll, 1.0f, 1.0f, geneBoxWidth, 116.0f));
|
||||
scroll.setScrollableContent(this.genes = new ControlGeneScroll(scroll, 1, 1, geneBoxWidth, 116));
|
||||
this.genes.setGenes(Binnie.GENETICS.beeBreedingSystem);
|
||||
final ControlTabBar<BreedingSystem> tabBar = new ControlTabBar<BreedingSystem>(this, boxX, 32.0f, 24.0f, 120.0f, Position.Left) {
|
||||
final ControlTabBar<BreedingSystem> tabBar = new ControlTabBar<BreedingSystem>(this, boxX, 32, 24, 120, Position.Left) {
|
||||
@Override
|
||||
public ControlTab<BreedingSystem> createTab(final float x, final float y, final float w, final float h, final BreedingSystem value) {
|
||||
public ControlTab<BreedingSystem> createTab(final int x, final int y, final int w, final int h, final BreedingSystem value) {
|
||||
return new ControlTabIcon<BreedingSystem>(this, x, y, w, h, value) {
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
@@ -132,10 +132,10 @@ public class WindowGeneBank extends WindowMachine {
|
||||
tabBar.setValues(Binnie.GENETICS.getActiveSystems());
|
||||
tabBar.setValue(Binnie.GENETICS.beeBreedingSystem);
|
||||
boxX -= 8;
|
||||
final ControlTabBar<String> infoTabs = new ControlTabBar<>(this, boxX + 8, 160.0f, 16.0f, 50.0f, Position.Left);
|
||||
final ControlTabBar<String> infoTabs = new ControlTabBar<>(this, boxX + 8, 160, 16, 50, Position.Left);
|
||||
infoTabs.setValues(Arrays.asList("Stats", "Ranking"));
|
||||
infoTabs.setValue("Info");
|
||||
final Panel panelProject = new Panel(this, boxX + 24, 160.0f, geneBoxWidth + 20, 50.0f, MinecraftGUI.PanelType.Black);
|
||||
final Panel panelProject = new Panel(this, boxX + 24, 160, geneBoxWidth + 20, 50, MinecraftGUI.PanelType.Black);
|
||||
int totalGenes = 0;
|
||||
int seqGenes = 0;
|
||||
for (final BreedingSystem system : Binnie.GENETICS.getActiveSystems()) {
|
||||
@@ -151,8 +151,8 @@ public class WindowGeneBank extends WindowMachine {
|
||||
}
|
||||
}
|
||||
}
|
||||
new ControlText(panelProject, new IPoint(4.0f, 4.0f), "§nFull Genome Project");
|
||||
new ControlText(panelProject, new IPoint(4.0f, 18.0f), "§oSequenced §r" + seqGenes + "/" + totalGenes + " §oGenes");
|
||||
new ControlText(panelProject, new IPoint(4, 4), "§nFull Genome Project");
|
||||
new ControlText(panelProject, new IPoint(4, 18), "§oSequenced §r" + seqGenes + "/" + totalGenes + " §oGenes");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowGeneProject extends Window {
|
||||
public WindowGeneProject(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(100.0f, 100.0f, player, inventory, side);
|
||||
super(100, 100, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,9 +46,9 @@ public class WindowGenepool extends WindowMachine {
|
||||
x += 130;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlSlot(this, 121.0f, 82.0f).assign(7);
|
||||
new ControlSlot(this, 121, 82).assign(7);
|
||||
new ControlSlotCharge(this, 143, 82, 7).setColour(15722671);
|
||||
new ControlErrorState(this, 181.0f, 83.0f);
|
||||
new ControlErrorState(this, 181, 83);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WindowIncubator extends WindowMachine {
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 34;
|
||||
new ControlEnergyBar(this, x, y + 3, 16, 54, Position.Bottom);
|
||||
new ControlErrorState(this, 91.0f, 82.0f);
|
||||
new ControlErrorState(this, 91, 82);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,23 @@ public class WindowInoculator extends WindowMachine {
|
||||
int x = 16;
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
|
||||
CraftGUIUtil.horizontalGrid(x, y, new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon().getResourceLocation()), new ControlSlot(this, 0.0f, 0.0f).assign(0), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon().getResourceLocation()), new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED));
|
||||
CraftGUIUtil.horizontalGrid(x, y,
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(0),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED)
|
||||
);
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 24, WindowInoculator.ProgressBase, WindowInoculator.Progress, Position.Left);
|
||||
new ControlEnergyBar(this, 91, 118, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, 161.0f, 118.0f);
|
||||
new ControlErrorState(this, 161, 118);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid(x, y, TextJustification.MiddleLeft, 8.0f, new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlSlot(this, x, y + 18 + 8).assign(9), new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED));
|
||||
CraftGUIUtil.verticalGrid(x, y, TextJustification.MiddleLeft, 8,
|
||||
new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlot(this, x, y + 18 + 8).assign(9),
|
||||
new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
);
|
||||
new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon().getResourceLocation());
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class WindowIsolator extends WindowMachine {
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
|
||||
new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 153.0f, 81.0f);
|
||||
new ControlErrorState(this, 153, 81);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WindowPolymeriser extends WindowMachine {
|
||||
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976);
|
||||
x += 138;
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
final ControlErrorState errorState = new ControlErrorState(this, 244.0f, 97.0f);
|
||||
final ControlErrorState errorState = new ControlErrorState(this, 244, 97);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,12 +47,18 @@ public class WindowSequencer extends WindowMachine {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2.0f, new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon().getResourceLocation()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon().getResourceLocation()), new ControlSlot(this, 0.0f, 0.0f).assign(6));
|
||||
CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2,
|
||||
new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSequencerProgress(this, 0, 0),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(6)
|
||||
);
|
||||
final ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16);
|
||||
slotTarget.assign(5);
|
||||
x = 34;
|
||||
y = 92;
|
||||
this.slotText = new ControlText(this, new IArea(0.0f, y, this.w(), 12.0f), TextFormatting.DARK_GRAY + Genetics.proxy.localise("machine.machine.sequencer.texts.userless"), TextJustification.MiddleCenter);
|
||||
this.slotText = new ControlText(this, new IArea(0, y, this.w(), 12), TextFormatting.DARK_GRAY + Genetics.proxy.localise("machine.machine.sequencer.texts.userless"), TextJustification.MiddleCenter);
|
||||
y += 20;
|
||||
final ControlSlot slotDye = new ControlSlot(this, x, y);
|
||||
slotDye.assign(0);
|
||||
|
||||
@@ -33,14 +33,24 @@ public class WindowSplicer extends WindowMachine {
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
new ControlSplicerProgress(this, 84.0f, 32.0f, this.w() - 172.0f, 102.0f);
|
||||
CraftGUIUtil.horizontalGrid(x, 62.0f, new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon().getResourceLocation()), new ControlSlot(this, 0.0f, 0.0f).assign(0));
|
||||
new ControlSplicerProgress(this, 84, 32, this.w() - 172, 102);
|
||||
CraftGUIUtil.horizontalGrid(x, 62,
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(0)
|
||||
);
|
||||
new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
|
||||
new ControlIconDisplay(this, x + 12 + 36 + 4, 86.0f, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlIconDisplay(this, x + 12 + 36 + 4, 86, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, 218.0f, 86.0f);
|
||||
new ControlErrorState(this, 218, 86);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid((this.w() - 72.0f) / 2.0f, 32.0f, TextJustification.MiddleCenter, 4.0f, new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon().getResourceLocation()), new ControlSlot(this, 0.0f, 0.0f).assign(9), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon().getResourceLocation()), new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED));
|
||||
CraftGUIUtil.verticalGrid((this.w() - 72) / 2, 32, TextJustification.MiddleCenter, 4,
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowDown.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(9),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowDown.getIcon().getResourceLocation()),
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public abstract class Dialog extends Control {
|
||||
public Dialog(final IWidget parent, final float w, final float h) {
|
||||
super(parent, (parent.w() - w) / 2.0f, (parent.h() - h) / 2.0f, w, h);
|
||||
public Dialog(final IWidget parent, final int w, final int h) {
|
||||
super(parent, (parent.w() - w) / 2, (parent.h() - h) / 2, w, h);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addAttribute(Attribute.AlwaysOnTop);
|
||||
this.addAttribute(Attribute.BlockTooltip);
|
||||
@@ -33,7 +33,7 @@ public abstract class Dialog extends Control {
|
||||
public abstract void onClose();
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.gradientRect(this.getArea().outset(400), -1442840576, -1442840576);
|
||||
CraftGUI.render.texture(CraftGUITexture.Window, this.getArea());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().inset(4));
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package binnie.craftgui.minecraft;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IBorder;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.events.EventKey;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
@@ -14,18 +11,11 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTException;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -53,7 +43,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
|
||||
public GuiCraftGUI(final Window window) {
|
||||
super(window.getContainer());
|
||||
this.mousePos = new IPoint(0.0f, 0.0f);
|
||||
this.mousePos = IPoint.ZERO;
|
||||
this.window = window;
|
||||
this.resize(window.getSize());
|
||||
}
|
||||
@@ -87,7 +77,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
GL11.glDisable(2929);
|
||||
this.zLevel = 10.0f;
|
||||
//GuiScreen.itemRender.zLevel = this.zLevel;
|
||||
this.window.render();
|
||||
this.window.render(this.width, this.height);
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -96,7 +86,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
final InventoryPlayer playerInventory = this.mc.thePlayer.inventory;
|
||||
this.draggedItem = playerInventory.getItemStack();
|
||||
if (this.draggedItem != null) {
|
||||
this.renderItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, 200, false);
|
||||
CraftGUIUtil.renderItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, false);
|
||||
}
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glDisable(32826);
|
||||
@@ -188,7 +178,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(i1, j1 - 1.5f, 0.0f);
|
||||
GL11.glScalef(0.6f, 0.6f, 1.0f);
|
||||
this.renderItem(new IPoint(0.0f, 0.0f), stack, false);
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, stack, false);
|
||||
GL11.glPopMatrix();
|
||||
} catch (NBTException e) {
|
||||
e.printStackTrace();
|
||||
@@ -271,191 +261,6 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
this.window.onClose();
|
||||
}
|
||||
|
||||
public void renderTexturedRect(final float x, final float y, final float u, final float v, final float w, final float h) {
|
||||
this.drawTexturedModalRect((int) x, (int) y, (int) u, (int) v, (int) w, (int) h);
|
||||
}
|
||||
|
||||
public void renderTexture(final IPoint position, final IArea textureArea) {
|
||||
this.drawTexturedModalRect((int) position.x(), (int) position.y(), (int) textureArea.pos().x(), (int) textureArea.pos().y(), (int) textureArea.size().x(), (int) textureArea.size().y());
|
||||
}
|
||||
|
||||
private void renderTexturedRect(final IArea area, final IPoint uv) {
|
||||
this.renderTexturedRect(area.pos().x(), area.pos().y(), uv.x(), uv.y(), area.size().x(), area.size().y());
|
||||
}
|
||||
|
||||
public void renderTexturePadded(final IArea area, final IArea texture, final IBorder padding) {
|
||||
int borderLeft = (int) padding.l();
|
||||
int borderRight = (int) padding.r();
|
||||
int borderTop = (int) padding.t();
|
||||
int borderBottom = (int) padding.b();
|
||||
final int posX = (int) area.pos().x();
|
||||
final int posY = (int) area.pos().y();
|
||||
final int width = (int) area.size().x();
|
||||
final int height = (int) area.size().y();
|
||||
final int textWidth = (int) texture.w();
|
||||
final int textHeight = (int) texture.h();
|
||||
final int u = (int) texture.x();
|
||||
final int v = (int) texture.y();
|
||||
if (borderTop + borderBottom > height) {
|
||||
borderTop = height / 2;
|
||||
borderBottom = height / 2;
|
||||
}
|
||||
if (borderLeft + borderRight > width) {
|
||||
borderLeft = width / 2;
|
||||
borderRight = width / 2;
|
||||
}
|
||||
final IPoint origin = area.pos();
|
||||
this.drawTexturedModalRect(posX, posY, u, v, borderLeft, borderTop);
|
||||
this.drawTexturedModalRect(posX + width - borderRight, posY, u + textWidth - borderRight, v, borderRight, borderTop);
|
||||
this.drawTexturedModalRect(posX, posY + height - borderBottom, u, v + textHeight - borderBottom, borderLeft, borderBottom);
|
||||
this.drawTexturedModalRect(posX + width - borderRight, posY + height - borderBottom, u + textWidth - borderRight, v + textHeight - borderBottom, borderRight, borderBottom);
|
||||
int texturingWidth;
|
||||
for (int currentXPos = borderLeft; currentXPos < width - borderRight; currentXPos += texturingWidth) {
|
||||
final int distanceXRemaining = width - borderRight - currentXPos;
|
||||
texturingWidth = textWidth - borderLeft - borderRight;
|
||||
if (texturingWidth > distanceXRemaining) {
|
||||
texturingWidth = distanceXRemaining;
|
||||
}
|
||||
if (texturingWidth <= 0) {
|
||||
break;
|
||||
}
|
||||
this.drawTexturedModalRect(posX + currentXPos, posY, u + borderLeft, v, texturingWidth, borderTop);
|
||||
this.drawTexturedModalRect(posX + currentXPos, posY + height - borderBottom, u + borderLeft, v + textHeight - borderBottom, texturingWidth, borderBottom);
|
||||
int texturingHeight;
|
||||
for (int currentYPos = borderTop; currentYPos < height - borderBottom; currentYPos += texturingHeight) {
|
||||
final int distanceYRemaining = height - borderBottom - currentYPos;
|
||||
texturingHeight = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight > distanceYRemaining) {
|
||||
texturingHeight = distanceYRemaining;
|
||||
}
|
||||
if (texturingHeight <= 0) {
|
||||
break;
|
||||
}
|
||||
this.drawTexturedModalRect(posX + currentXPos, posY + currentYPos, u + borderLeft, v + borderTop, texturingWidth, texturingHeight);
|
||||
}
|
||||
}
|
||||
int texturingHeight2;
|
||||
for (int currentYPos2 = borderTop; currentYPos2 < height - borderBottom; currentYPos2 += texturingHeight2) {
|
||||
final int distanceYRemaining2 = height - borderBottom - currentYPos2;
|
||||
texturingHeight2 = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight2 > distanceYRemaining2) {
|
||||
texturingHeight2 = distanceYRemaining2;
|
||||
}
|
||||
if (texturingHeight2 <= 0) {
|
||||
break;
|
||||
}
|
||||
this.drawTexturedModalRect(posX, posY + currentYPos2, u, v + borderTop, borderLeft, texturingHeight2);
|
||||
this.drawTexturedModalRect(posX + width - borderRight, posY + currentYPos2, u + textWidth - borderRight, v + borderTop, borderRight, texturingHeight2);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawGradientArea(final float p_73733_1_, final float p_73733_2_, final float p_73733_3_, final float p_73733_4_, final int p_73733_5_, final int p_73733_6_) {
|
||||
final float f = (p_73733_5_ >> 24 & 0xFF) / 255.0f;
|
||||
final float f2 = (p_73733_5_ >> 16 & 0xFF) / 255.0f;
|
||||
final float f3 = (p_73733_5_ >> 8 & 0xFF) / 255.0f;
|
||||
final float f4 = (p_73733_5_ & 0xFF) / 255.0f;
|
||||
final float f5 = (p_73733_6_ >> 24 & 0xFF) / 255.0f;
|
||||
final float f6 = (p_73733_6_ >> 16 & 0xFF) / 255.0f;
|
||||
final float f7 = (p_73733_6_ >> 8 & 0xFF) / 255.0f;
|
||||
final float f8 = (p_73733_6_ & 0xFF) / 255.0f;
|
||||
GL11.glDisable(3553);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glDisable(3008);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glShadeModel(7425);
|
||||
final Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vb = tessellator.getBuffer();
|
||||
vb.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
vb.pos(p_73733_3_, p_73733_2_, this.zLevel).color(f2, f3, f4, f).endVertex();
|
||||
vb.pos(p_73733_1_, p_73733_2_, this.zLevel).color(f2, f3, f4, f).endVertex();
|
||||
vb.pos(p_73733_1_, p_73733_4_, this.zLevel).color(f6, f7, f8, f5).endVertex();
|
||||
vb.pos(p_73733_3_, p_73733_4_, this.zLevel).color(f6, f7, f8, f5).endVertex();
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(7424);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glEnable(3008);
|
||||
GL11.glEnable(3553);
|
||||
}
|
||||
|
||||
public void renderItem(final IPoint pos, final ItemStack item, final boolean rotating) {
|
||||
this.renderItem(pos, item, (int) this.zLevel + 3, rotating);
|
||||
}
|
||||
|
||||
private void renderItem(final IPoint pos, final ItemStack item, final int zLevel, final boolean rotating) {
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(32826);
|
||||
GL11.glEnable(2929);
|
||||
FontRenderer font = item.getItem().getFontRenderer(item);
|
||||
if (font == null) {
|
||||
font = this.getFontRenderer();
|
||||
}
|
||||
if (item != null) {
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
final float phase = Minecraft.getSystemTime() / 20.0f;
|
||||
GL11.glPushMatrix();
|
||||
if (rotating) {
|
||||
GL11.glTranslatef(8.0f, 8.0f, 0.0f);
|
||||
GL11.glRotatef(phase, 0.0f, -0.866f, 0.5f);
|
||||
GL11.glTranslatef(-8.0f, -8.0f, -67.1f);
|
||||
}
|
||||
Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(item, (int) pos.x(), (int) pos.y());
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().getRenderItem().renderItemOverlayIntoGUI(font, item, (int) pos.x(), (int) pos.y(), null);
|
||||
}
|
||||
GL11.glClear(256);
|
||||
GL11.glEnable(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
CraftGUI.render.colour(-1);
|
||||
GL11.glEnable(32826);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderFluid(FluidStack fluid, IPoint pos) {
|
||||
final int hex = fluid.getFluid().getColor(fluid);
|
||||
final int r = (hex & 0xFF0000) >> 16;
|
||||
final int g = (hex & 0xFF00) >> 8;
|
||||
final int b = hex & 0xFF;
|
||||
TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString());
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
renderSprite(pos, icon, TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
|
||||
public void renderSprite(final IPoint pos, final TextureAtlasSprite icon, final ResourceLocation map) {
|
||||
if (icon == null) {
|
||||
return;
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(32826);
|
||||
BinnieCore.proxy.bindTexture(map);
|
||||
drawTexture((int) pos.x(), (int) pos.y(), icon, 0, 0, zLevel);
|
||||
GL11.glEnable(32826);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private static void drawTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
||||
double uMin = textureSprite.getMinU();
|
||||
double uMax = textureSprite.getMaxU();
|
||||
double vMin = textureSprite.getMinV();
|
||||
double vMax = textureSprite.getMaxV();
|
||||
uMax = uMax - maskRight / 16.0 * (uMax - uMin);
|
||||
vMax = vMax - maskTop / 16.0 * (vMax - vMin);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
|
||||
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public boolean isHelpMode() {
|
||||
return Keyboard.isKeyDown(15);
|
||||
}
|
||||
@@ -472,56 +277,4 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
this.window.setPosition(new IPoint(this.guiLeft, this.guiTop));
|
||||
}
|
||||
|
||||
public void limitArea(final IArea area) {
|
||||
float x = area.pos().x();
|
||||
float y = area.pos().y();
|
||||
float w = area.size().x();
|
||||
float h = area.size().y();
|
||||
y = this.height - (y + h);
|
||||
final float k = this.xSize;
|
||||
final float scaleX = this.width / (float) this.mc.displayWidth;
|
||||
final float scaleY = this.height / (float) this.mc.displayHeight;
|
||||
x += 0.0f;
|
||||
y += 0.0f;
|
||||
w += 0.0f;
|
||||
h += 0.0f;
|
||||
GL11.glScissor((int) (x / scaleX), (int) (y / scaleY), (int) (w / scaleX), (int) (h / scaleY));
|
||||
}
|
||||
|
||||
public int getZLevel() {
|
||||
return (int) this.zLevel;
|
||||
}
|
||||
|
||||
public void drawRect(float p_73734_0_, float p_73734_1_, float p_73734_2_, float p_73734_3_, final int p_73734_4_) {
|
||||
if (p_73734_0_ < p_73734_2_) {
|
||||
final float j1 = p_73734_0_;
|
||||
p_73734_0_ = p_73734_2_;
|
||||
p_73734_2_ = j1;
|
||||
}
|
||||
if (p_73734_1_ < p_73734_3_) {
|
||||
final float j1 = p_73734_1_;
|
||||
p_73734_1_ = p_73734_3_;
|
||||
p_73734_3_ = j1;
|
||||
}
|
||||
final float f3 = (p_73734_4_ >> 24 & 0xFF) / 255.0f;
|
||||
final float f4 = (p_73734_4_ >> 16 & 0xFF) / 255.0f;
|
||||
final float f5 = (p_73734_4_ >> 8 & 0xFF) / 255.0f;
|
||||
final float f6 = (p_73734_4_ & 0xFF) / 255.0f;
|
||||
final Tessellator tessellator = Tessellator.getInstance();
|
||||
GL11.glEnable(3042);
|
||||
GL11.glDisable(3553);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(f4, f5, f6, f3);
|
||||
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION);
|
||||
vertexBuffer.pos(p_73734_0_, p_73734_3_, 0.0).endVertex();
|
||||
vertexBuffer.pos(p_73734_2_, p_73734_3_, 0.0).endVertex();
|
||||
vertexBuffer.pos(p_73734_2_, p_73734_1_, 0.0).endVertex();
|
||||
vertexBuffer.pos(p_73734_0_, p_73734_1_, 0.0).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glEnable(3553);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.TopLevelWidget;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.Renderer;
|
||||
import binnie.craftgui.events.EventWidget;
|
||||
import binnie.craftgui.minecraft.control.ControlHelp;
|
||||
import binnie.craftgui.minecraft.control.ControlInfo;
|
||||
@@ -49,8 +48,8 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
private ContainerCraftGUI container;
|
||||
private WindowInventory windowInventory;
|
||||
private ControlText title;
|
||||
protected float titleButtonLeft;
|
||||
protected float titleButtonRight;
|
||||
protected int titleButtonLeft;
|
||||
protected int titleButtonRight;
|
||||
private StandardTexture bgText1;
|
||||
private StandardTexture bgText2;
|
||||
private boolean hasBeenInitialised;
|
||||
@@ -122,9 +121,9 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
return null;
|
||||
}
|
||||
|
||||
public Window(final float width, final float height, final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
this.titleButtonLeft = 8.0f;
|
||||
this.titleButtonRight = 8.0f;
|
||||
public Window(final int width, final int height, final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
this.titleButtonLeft = 8;
|
||||
this.titleButtonRight = 8;
|
||||
this.bgText1 = null;
|
||||
this.bgText2 = null;
|
||||
this.hasBeenInitialised = false;
|
||||
@@ -141,13 +140,13 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
for (final EnumHighlighting h : EnumHighlighting.values()) {
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
}
|
||||
(CraftGUI.render = new Renderer(this.gui)).stylesheet(StyleSheetManager.getDefault());
|
||||
this.titleButtonLeft = -14.0f;
|
||||
CraftGUI.render.stylesheet(StyleSheetManager.getDefault());
|
||||
this.titleButtonLeft = -14;
|
||||
if (this.showHelpButton()) {
|
||||
new ControlHelp(this, this.titleButtonLeft += 22.0f, 8.0f);
|
||||
new ControlHelp(this, this.titleButtonLeft += 22, 8);
|
||||
}
|
||||
if (this.showInfoButton() != null) {
|
||||
new ControlInfo(this, this.titleButtonLeft += 22.0f, 8.0f, this.showInfoButton());
|
||||
new ControlInfo(this, this.titleButtonLeft += 22, 8, this.showInfoButton());
|
||||
}
|
||||
this.addSelfEventHandler(new EventWidget.ChangeSize.Handler() {
|
||||
@Override
|
||||
@@ -163,7 +162,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
}
|
||||
|
||||
public void setTitle(final String title) {
|
||||
(this.title = new ControlTextCentered(this, 12.0f, title)).setColour(4210752);
|
||||
(this.title = new ControlTextCentered(this, 12, title)).setColour(4210752);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -184,7 +183,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
return;
|
||||
}
|
||||
this.bgText1 = new StandardTexture(0, 0, 256, 256, this.getBackgroundTextureFile(1));
|
||||
if (this.getSize().x() > 256.0f) {
|
||||
if (this.getSize().x() > 256) {
|
||||
this.bgText2 = new StandardTexture(0, 0, 256, 256, this.getBackgroundTextureFile(2));
|
||||
}
|
||||
if (!BinnieCore.proxy.checkTexture(this.bgText1.getTexture())) {
|
||||
@@ -201,13 +200,13 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.colour(16777215);
|
||||
if (this.getBackground1() != null) {
|
||||
CraftGUI.render.texture(this.getBackground1(), IPoint.ZERO);
|
||||
}
|
||||
if (this.getBackground2() != null) {
|
||||
CraftGUI.render.texture(this.getBackground2(), new IPoint(256.0f, 0.0f));
|
||||
CraftGUI.render.texture(this.getBackground2(), new IPoint(256, 0));
|
||||
}
|
||||
CraftGUI.render.colour(this.getColour());
|
||||
CraftGUI.render.texture(CraftGUITexture.Window, this.getArea());
|
||||
@@ -279,18 +278,18 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
@Override
|
||||
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
|
||||
if (side == Side.CLIENT && name.equals("username")) {
|
||||
final float w = this.w();
|
||||
final float titleButtonRight = this.titleButtonRight + 16.0f;
|
||||
final int w = this.w();
|
||||
final int titleButtonRight = this.titleButtonRight + 16;
|
||||
this.titleButtonRight = titleButtonRight;
|
||||
final ControlUser controlUser = new ControlUser(this, w - titleButtonRight, 8.0f, action.getString("username"));
|
||||
this.titleButtonRight += 6.0f;
|
||||
final ControlUser controlUser = new ControlUser(this, w - titleButtonRight, 8, action.getString("username"));
|
||||
this.titleButtonRight += 6;
|
||||
}
|
||||
if (side == Side.CLIENT && name.equals("power-system")) {
|
||||
final float w2 = this.w();
|
||||
final float titleButtonRight2 = this.titleButtonRight + 16.0f;
|
||||
final int w2 = this.w();
|
||||
final int titleButtonRight2 = this.titleButtonRight + 16;
|
||||
this.titleButtonRight = titleButtonRight2;
|
||||
final ControlPowerSystem controlPowerSystem = new ControlPowerSystem(this, w2 - titleButtonRight2, 8.0f, PowerSystem.get(action.getByte("system")));
|
||||
this.titleButtonRight += 6.0f;
|
||||
final ControlPowerSystem controlPowerSystem = new ControlPowerSystem(this, w2 - titleButtonRight2, 8, PowerSystem.get(action.getByte("system")));
|
||||
this.titleButtonRight += 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.minecraft.MinecraftTooltip;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -73,7 +74,7 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea());
|
||||
final float percentage = this.getPercentage() / 100.0f;
|
||||
CraftGUI.render.colour(this.getColourFromPercentage(percentage));
|
||||
@@ -81,13 +82,13 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
switch (this.direction) {
|
||||
case Top:
|
||||
case Bottom: {
|
||||
final float height = area.size().y() * percentage;
|
||||
final int height = Math.round(area.size().y() * percentage);
|
||||
area.setSize(new IPoint(area.size().x(), height));
|
||||
break;
|
||||
}
|
||||
case Left:
|
||||
case Right: {
|
||||
final float width = area.size().x() * percentage;
|
||||
final int width = Math.round(area.size().x() * percentage);
|
||||
area.setSize(new IPoint(width, area.size().y()));
|
||||
break;
|
||||
}
|
||||
@@ -100,12 +101,12 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), c, c);
|
||||
}
|
||||
CraftGUI.render.texture(CraftGUITexture.EnergyBarGlow, area);
|
||||
GL11.glColor3d(1.0, 1.0, 1.0);
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
CraftGUI.render.texture(CraftGUITexture.EnergyBarGlass, this.getArea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final IArea area = this.getArea();
|
||||
CraftGUI.render.colour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ControlErrorState extends Control implements ITooltip {
|
||||
private int type;
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
Object texture = CraftGUITexture.StateWarning;
|
||||
if (this.errorState == null) {
|
||||
texture = CraftGUITexture.StateNone;
|
||||
@@ -27,7 +27,7 @@ public class ControlErrorState extends Control implements ITooltip {
|
||||
texture = CraftGUITexture.StateError;
|
||||
}
|
||||
CraftGUI.render.texture(texture, IPoint.ZERO);
|
||||
super.onRenderBackground();
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
public ErrorState getError() {
|
||||
@@ -70,8 +70,8 @@ public class ControlErrorState extends Control implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
public ControlErrorState(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
public ControlErrorState(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.type = 0;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public class ControlHelp extends Control implements ITooltip {
|
||||
public ControlHelp(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
public ControlHelp(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(CraftGUITexture.HelpButton, this.getArea());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class ControlIconDisplay extends Control {
|
||||
private TextureAtlasSprite icon;
|
||||
|
||||
public ControlIconDisplay(final IWidget parent, final float x, final float y, final ResourceLocation icon) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
public ControlIconDisplay(final IWidget parent, final int x, final int y, final ResourceLocation icon) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.icon = BinnieCore.proxy.getTextureAtlasSprite(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.sprite(IPoint.ZERO, this.icon);
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,14 @@ import binnie.craftgui.resource.Texture;
|
||||
public class ControlImage extends Control {
|
||||
private Object key;
|
||||
|
||||
public ControlImage(final IWidget parent, final float x, final float y, final Texture text) {
|
||||
public ControlImage(final IWidget parent, final int x, final int y, final Texture text) {
|
||||
super(parent, x, y, text.w(), text.h());
|
||||
this.key = null;
|
||||
this.key = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(this.key, IPoint.ZERO);
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,14 @@ import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
public class ControlInfo extends Control implements ITooltip {
|
||||
private String info;
|
||||
|
||||
public ControlInfo(final IWidget parent, final float x, final float y, final String info) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
public ControlInfo(final IWidget parent, final int x, final int y, final String info) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(CraftGUITexture.InfoButton, this.getArea());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package binnie.craftgui.minecraft.control;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ControlItemDisplay extends Control implements ITooltip {
|
||||
private ItemStack itemStack;
|
||||
@@ -23,19 +21,19 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public ControlItemDisplay(final IWidget parent, final float x, final float y) {
|
||||
this(parent, x, y, 16.0f);
|
||||
public ControlItemDisplay(final IWidget parent, final int x, final int y) {
|
||||
this(parent, x, y, 16);
|
||||
}
|
||||
|
||||
public ControlItemDisplay(final IWidget parent, final float f, final float y, final ItemStack stack, final boolean tooltip) {
|
||||
this(parent, f, y, 16.0f);
|
||||
public ControlItemDisplay(final IWidget parent, final int f, final int y, final ItemStack stack, final boolean tooltip) {
|
||||
this(parent, f, y, 16);
|
||||
this.setItemStack(stack);
|
||||
if (tooltip) {
|
||||
this.setTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
public ControlItemDisplay(final IWidget parent, final float x, final float y, final float size) {
|
||||
public ControlItemDisplay(final IWidget parent, final int x, final int y, final int size) {
|
||||
super(parent, x, y, size, size);
|
||||
this.itemStack = null;
|
||||
this.hastooltip = false;
|
||||
@@ -43,25 +41,26 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100.0f || relativeToWindow.y() > Window.get(this).getSize().y() + 100.0f) {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (this.itemStack == null) {
|
||||
return;
|
||||
}
|
||||
if (this.itemStack != null) {
|
||||
|
||||
if (this.getSize().x() != 16.0f) {
|
||||
GL11.glPushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
final float phase = Minecraft.getSystemTime() / 20.0f;
|
||||
CraftGUI.render.item(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
CraftGUI.render.item(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
}
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100 || relativeToWindow.y() > Window.get(this).getSize().y() + 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getSize().x() != 16) {
|
||||
GlStateManager.pushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GlStateManager.scale(scale, scale, 1);
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
GlStateManager.popMatrix();
|
||||
} else {
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
}
|
||||
GlStateManager.enableAlpha();
|
||||
}
|
||||
|
||||
public void setItemStack(final ItemStack itemStack) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.MinecraftTooltip;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -37,7 +38,7 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
public ControlLiquidTank(final IWidget parent, final int x, final int y, final boolean horizontal) {
|
||||
super(parent, x, y, horizontal ? 60.0f : 18.0f, horizontal ? 18.0f : 60.0f);
|
||||
super(parent, x, y, horizontal ? 60 : 18, horizontal ? 18 : 60);
|
||||
this.tankID = 0;
|
||||
this.horizontal = false;
|
||||
this.horizontal = horizontal;
|
||||
@@ -71,7 +72,7 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(this.horizontal ? CraftGUITexture.HorizontalLiquidTank : CraftGUITexture.LiquidTank, IPoint.ZERO);
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.Help);
|
||||
@@ -87,42 +88,44 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
}
|
||||
}
|
||||
if (this.isTankValid()) {
|
||||
final Object content = null;
|
||||
final float height = this.horizontal ? 16.0f : 58.0f;
|
||||
final int squaled = (int) (height * (this.getTank().getAmount() / this.getTank().getCapacity()));
|
||||
final int yPos = (int) height + 1;
|
||||
final int height = this.horizontal ? 16 : 58;
|
||||
final int squaled = Math.round(height * (this.getTank().getAmount() / this.getTank().getCapacity()));
|
||||
final int yPos = height + 1;
|
||||
final Fluid fluid = this.getTank().liquid.getFluid();
|
||||
final int hex = fluid.getColor(this.getTank().liquid);
|
||||
final int r = (hex & 0xFF0000) >> 16;
|
||||
final int g = (hex & 0xFF00) >> 8;
|
||||
final int b = hex & 0xFF;
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
final IPoint pos = this.getAbsolutePosition();
|
||||
final IPoint offset = new IPoint(0.0f, height - squaled);
|
||||
final IArea limited = this.getArea().inset(1);
|
||||
if (this.horizontal) {
|
||||
limited.setSize(new IPoint(limited.w() - 1.0f, limited.h()));
|
||||
}
|
||||
CraftGUI.render.limitArea(new IArea(limited.pos().add(pos).add(offset), limited.size().sub(offset)));
|
||||
GL11.glEnable(3089);
|
||||
|
||||
BinnieCore.proxy.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
for (int y = 0; y < height; y += 16) {
|
||||
for (int x = 0; x < (this.horizontal ? 58 : 16); x += 16) {
|
||||
final TextureAtlasSprite icon = BinnieCore.proxy.getTextureAtlasSprite(fluid.getStill());
|
||||
CraftGUI.render.sprite(new IPoint(1 + x, 1 + y), icon);
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GlStateManager.enableBlend();
|
||||
{
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
final IPoint pos = this.getAbsolutePosition();
|
||||
final IPoint offset = new IPoint(0, height - squaled);
|
||||
final IArea limited = this.getArea().inset(1);
|
||||
if (this.horizontal) {
|
||||
limited.setSize(new IPoint(limited.w() - 1, limited.h()));
|
||||
}
|
||||
CraftGUI.render.limitArea(new IArea(limited.pos().add(pos).add(offset), limited.size().sub(offset)), guiWidth, guiHeight);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
{
|
||||
BinnieCore.proxy.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
for (int y = 0; y < height; y += 16) {
|
||||
for (int x = 0; x < (this.horizontal ? 58 : 16); x += 16) {
|
||||
final TextureAtlasSprite icon = BinnieCore.proxy.getTextureAtlasSprite(fluid.getStill());
|
||||
CraftGUI.render.sprite(new IPoint(1 + x, 1 + y), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
GL11.glDisable(3089);
|
||||
GL11.glDisable(3042);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(this.horizontal ? CraftGUITexture.HorizontalLiquidTankOverlay : CraftGUITexture.LiquidTankOverlay, IPoint.ZERO);
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final IArea area = this.getArea();
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ControlPlayerInventory extends Control {
|
||||
private List<ControlSlot> slots;
|
||||
|
||||
public ControlPlayerInventory(final IWidget parent, final boolean wide) {
|
||||
super(parent, (int) (parent.getSize().x() / 2.0f) - (wide ? 110 : 81), (int) parent.getSize().y() - (wide ? 54 : 76) - 12, wide ? 220 : 162, wide ? 54 : 76);
|
||||
super(parent, (int) (parent.getSize().x() / 2) - (wide ? 110 : 81), (int) parent.getSize().y() - (wide ? 54 : 76) - 12, wide ? 220 : 162, wide ? 54 : 76);
|
||||
this.slots = new ArrayList<>();
|
||||
for (int row = 0; row < 3; ++row) {
|
||||
for (int column = 0; column < 9; ++column) {
|
||||
@@ -28,7 +28,7 @@ public class ControlPlayerInventory extends Control {
|
||||
}
|
||||
} else {
|
||||
for (int i1 = 0; i1 < 9; ++i1) {
|
||||
final ControlSlot slot2 = new ControlSlot(this, i1 * 18, 58.0f);
|
||||
final ControlSlot slot2 = new ControlSlot(this, i1 * 18, 58);
|
||||
this.slots.add(slot2);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class ControlPlayerInventory extends Control {
|
||||
}
|
||||
|
||||
public ControlPlayerInventory(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 54.0f, 220.0f);
|
||||
super(parent, x, y, 54, 220);
|
||||
this.slots = new ArrayList<>();
|
||||
for (int row = 0; row < 6; ++row) {
|
||||
for (int column = 0; column < 6; ++column) {
|
||||
|
||||
@@ -12,14 +12,14 @@ import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
public class ControlPowerSystem extends Control implements ITooltip {
|
||||
private PowerSystem system;
|
||||
|
||||
public ControlPowerSystem(final IWidget parent, final float x, final float y, final PowerSystem system) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
public ControlPowerSystem(final IWidget parent, final int x, final int y, final PowerSystem system) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(CraftGUITexture.PowerButton, this.getArea());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ControlProgress extends ControlProgressBase {
|
||||
private Position direction;
|
||||
|
||||
public ControlProgress(final IWidget parent, final int x, final int y, final Texture progressBlank, final Texture progressBar, final Position dir) {
|
||||
super(parent, x, y, (progressBlank == null) ? 0.0f : progressBlank.w(), (progressBlank == null) ? 0.0f : progressBlank.h());
|
||||
super(parent, x, y, (progressBlank == null) ? 0 : progressBlank.w(), (progressBlank == null) ? 0 : progressBlank.h());
|
||||
this.progressBlank = progressBlank;
|
||||
this.progressBar = progressBar;
|
||||
this.progress = 0.0f;
|
||||
@@ -19,7 +19,7 @@ public class ControlProgress extends ControlProgressBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.texture(this.progressBlank, this.getArea());
|
||||
CraftGUI.render.texturePercentage(this.progressBar, this.getArea(), this.direction, this.progress);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import binnie.craftgui.minecraft.Window;
|
||||
public class ControlProgressBase extends Control {
|
||||
protected float progress;
|
||||
|
||||
public ControlProgressBase(final IWidget parent, final float x, final float y, final float w, final float h) {
|
||||
public ControlProgressBase(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent, x, y, w, h);
|
||||
this.progress = 0.0f;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
|
||||
Loaded 100 of 173 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user