Refactoring custom GUI components

This commit is contained in:
kordum committed 2017-06-29 11:25:44 +03:00
1 parent e83d0e3fa6
commit 2475710a6a
70 files changed
+353 -343

No files matched your search

@@ -218,7 +218,7 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
int meta = TileEntityMetadata.getItemDamage(stack);
String typeName = getDoorType(meta).getName();
String woodName = WoodManager.getPlankType(meta & 0xFF).getName();
if (typeName.equals("")) {
if (typeName.isEmpty()) {
return I18N.localise("extratrees.block.door.name", woodName);
}
return I18N.localise("extratrees.block.door.name.adv", woodName, typeName);
@@ -16,6 +16,6 @@ public class ControlBlockIconDisplay extends Control {
@Override
public void onRenderBackground() {
CraftGUI.Render.iconBlock(IPoint.ZERO, icon);
CraftGUI.render.iconBlock(IPoint.ZERO, icon);
}
}
@@ -68,10 +68,10 @@ public class ControlFluidDisplay extends Control implements ITooltip {
GL11.glPushMatrix();
float scale = getSize().x() / 16.0f;
GL11.glScalef(scale, scale, 1.0f);
CraftGUI.Render.iconBlock(IPoint.ZERO, itemStack.getFluid().getIcon(itemStack));
CraftGUI.render.iconBlock(IPoint.ZERO, itemStack.getFluid().getIcon(itemStack));
GL11.glPopMatrix();
} else {
CraftGUI.Render.iconBlock(IPoint.ZERO, itemStack.getFluid().getIcon(itemStack));
CraftGUI.render.iconBlock(IPoint.ZERO, itemStack.getFluid().getIcon(itemStack));
}
GL11.glDisable(3042);
}
@@ -45,7 +45,7 @@ public class ControlLumbermillProgress extends ControlProgressBase {
public void onRenderForeground() {
GL11.glDisable(2896);
int sawX = (int) (63.0f * progress);
CraftGUI.Render.texture(ControlLumbermillProgress.saw, new IPoint(sawX, -8.0f + 6.0f * (float) Math.sin(animation)));
CraftGUI.render.texture(ControlLumbermillProgress.saw, new IPoint(sawX, -8.0f + 6.0f * (float) Math.sin(animation)));
ItemStack item = Window.get(this).getInventory().getStackInSlot(Lumbermill.SLOT_WOOD);
if (item == null) {
return;
@@ -62,7 +62,7 @@ public class ControlLumbermillProgress extends ControlProgressBase {
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.0f), icon);
}
ItemStack result = Lumbermill.getPlankProduct(item);
if (result == null) {
@@ -79,12 +79,12 @@ public class ControlLumbermillProgress extends ControlProgressBase {
IIcon icon2 = block2.getIcon(2, result.getItemDamage());
IPoint pos = getAbsolutePosition();
CraftGUI.Render.limitArea(new IArea(pos.add(new IPoint(0.0f, 0.0f)), new IPoint(progress * 64.0f + 2.0f, 18.0f)));
CraftGUI.render.limitArea(new IArea(pos.add(new IPoint(0.0f, 0.0f)), new IPoint(progress * 64.0f + 2.0f, 18.0f)));
GL11.glEnable(3089);
for (int j = 0; j < 4; ++j) {
CraftGUI.Render.iconBlock(new IPoint(1 + j * 16, 1.0f), icon2);
CraftGUI.render.iconBlock(new IPoint(1 + j * 16, 1.0f), icon2);
}
GL11.glDisable(3089);
CraftGUI.Render.texture(ControlLumbermillProgress.saw2, new IPoint(sawX + 2, -8.0f + 6.0f * (float) Math.sin(animation)));
CraftGUI.render.texture(ControlLumbermillProgress.saw2, new IPoint(sawX + 2, -8.0f + 6.0f * (float) Math.sin(animation)));
}
}
@@ -38,9 +38,9 @@ public class ControlSlotFluid extends Control implements ITooltip {
@Override
public void onRenderBackground() {
int size = (int) getSize().x();
CraftGUI.Render.texture(CraftGUITexture.Slot, getArea());
CraftGUI.render.texture(CraftGUITexture.Slot, getArea());
if (getSuperParent().getMousedOverWidget() == this) {
CraftGUI.Render.gradientRect(new IArea(new IPoint(1.0f, 1.0f), getArea().size().sub(new IPoint(2.0f, 2.0f))), 0x80ffffff, 0x80ffffff);
CraftGUI.render.gradientRect(new IArea(new IPoint(1.0f, 1.0f), getArea().size().sub(new IPoint(2.0f, 2.0f))), 0x80ffffff, 0x80ffffff);
}
}
@@ -147,21 +147,21 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(CraftGUITexture.Slot, IPoint.ZERO);
CraftGUI.render.texture(CraftGUITexture.Slot, IPoint.ZERO);
}
@Override
public void onRenderForeground() {
ItemStack image = ((WindowWoodworker) getSuperParent()).getDesignerType().getDisplayStack(getValue());
CraftGUI.Render.item(new IPoint(1.0f, 1.0f), image);
CraftGUI.render.item(new IPoint(1.0f, 1.0f), image);
if (((IControlValue) getParent()).getValue() == getValue()) {
return;
}
if (Window.get(this).getMousedOverWidget() == this) {
CraftGUI.Render.gradientRect(getArea().inset(1), 0x44ffffff, 0x44ffffff);
CraftGUI.render.gradientRect(getArea().inset(1), 0x44ffffff, 0x44ffffff);
} else {
CraftGUI.Render.gradientRect(getArea().inset(1), 0xaa888888, 0xaa888888);
CraftGUI.render.gradientRect(getArea().inset(1), 0xaa888888, 0xaa888888);
}
}
@@ -70,7 +70,7 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
controlDescription.setValue(descBody + EnumChatFormatting.RESET);
controlSignature.setValue(descSig + EnumChatFormatting.RESET);
float descHeight = CraftGUI.Render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
float descHeight = CraftGUI.render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
controlSignature.setPosition(new IPoint(controlSignature.pos().x(), controlDescription.getPosition().y() + descHeight + 10.0f));
}
}