mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 15:00:48 +00:00
Loose Paper appearance type, fixes, new page textures
This commit is contained in:
parent
117d0116d2
commit
77c1b53e31
@ -46,7 +46,7 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
ySize = setup.mainPage.sizeY;
|
ySize = setup.mainPage.sizeY;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxPage = setup.mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages;
|
maxPage = setup.mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages - 1;
|
||||||
System.out.print((int)Math.ceil(type.pages / 2D) - 1);
|
System.out.print((int)Math.ceil(type.pages / 2D) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,18 +69,21 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
if(page == maxPage && setup.mainPage.isTwoPages && this.page * 2 >= this.type.pages) //odd numbered pages
|
if(page == maxPage && (page + 1) * 2 > type.pages) { //odd numbered pages
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(setup.auxPage.texture);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(setup.auxPage.texture);
|
||||||
else
|
func_146110_a(guiLeft, guiTop, setup.auxPage.u, setup.auxPage.v, setup.auxPage.sizeX, setup.auxPage.sizeY, 512, 512);
|
||||||
|
} else {
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(setup.mainPage.texture);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(setup.mainPage.texture);
|
||||||
|
func_146110_a(guiLeft, guiTop, setup.mainPage.u, setup.mainPage.v, setup.mainPage.sizeX, setup.mainPage.sizeY, 512, 512);
|
||||||
|
}
|
||||||
|
|
||||||
func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, 512, 512);
|
int width = page == maxPage && (page + 1) * 2 > type.pages ? setup.auxPage.sizeX : setup.mainPage.sizeX;
|
||||||
|
|
||||||
if(page > 0)
|
if(page > 0)
|
||||||
setup.button.renderButton(this, xSize, guiLeft, guiTop, false, i, j);
|
setup.button.renderButton(this, width, guiLeft, guiTop, false, i, j);
|
||||||
|
|
||||||
if(page < maxPage)
|
if(page < maxPage)
|
||||||
setup.button.renderButton(this, xSize, guiLeft, guiTop, true, i, j);
|
setup.button.renderButton(this, width, guiLeft, guiTop, true, i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
@ -96,7 +99,11 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
setup.auxPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false);
|
setup.auxPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setup.mainPage.renderText(key + page, fontRendererObj, guiLeft, guiTop, false);
|
|
||||||
|
if(page < maxPage)
|
||||||
|
setup.mainPage.renderText(key + (page + 1), fontRendererObj, guiLeft, guiTop, false);
|
||||||
|
else
|
||||||
|
setup.auxPage.renderText(key + (page + 1), fontRendererObj, guiLeft, guiTop, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -127,14 +134,18 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
// turn page buttons, one-page, both page textures, sizes, positions, etc.
|
// turn page buttons, one-page, both page textures, sizes, positions, etc.
|
||||||
public enum GUIAppearance {
|
public enum GUIAppearance {
|
||||||
GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F),
|
GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F),
|
||||||
new GUIPageButton(18, 10, 24, 155, 0, 0, 500, 200, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")),
|
new GUIPageButton(18, 10, 24, 155, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")).setUV(0, 0, 500, 200),
|
||||||
0);
|
0),
|
||||||
|
LOOSEPAPER(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F),
|
||||||
|
new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0),
|
||||||
|
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||||
|
1);
|
||||||
|
|
||||||
public int itemTexture;
|
public int itemTexture;
|
||||||
|
|
||||||
protected GUIPage mainPage; //"Main" page, usually two pages. GUI accounts for one-paged main pages.
|
protected GUIPage mainPage; //"Main" page, usually two pages. GUI accounts for one-paged main pages.
|
||||||
protected GUIPage auxPage; //"Aux" page, AKA the final page if the max pages is oddly numbered.
|
protected GUIPage auxPage; //"Aux" page, AKA the final page if the max pages is oddly numbered.
|
||||||
//If two-sided, text will be positioned on the left page. Can be null if main page is one-sided.
|
//If two-sided, text will be positioned on the left page.
|
||||||
protected GUIPageButton button;
|
protected GUIPageButton button;
|
||||||
|
|
||||||
private GUIAppearance(GUIPage main, GUIPage aux, GUIPageButton button, int texture) {
|
private GUIAppearance(GUIPage main, GUIPage aux, GUIPageButton button, int texture) {
|
||||||
@ -156,6 +167,10 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
private static class GUIPage {
|
private static class GUIPage {
|
||||||
protected ResourceLocation texture;
|
protected ResourceLocation texture;
|
||||||
|
|
||||||
|
//UV positioning
|
||||||
|
protected int u = 0;
|
||||||
|
protected int v = 0;
|
||||||
|
|
||||||
protected int sizeX;
|
protected int sizeX;
|
||||||
protected int sizeY;
|
protected int sizeY;
|
||||||
|
|
||||||
@ -164,7 +179,7 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
protected int marginY; //Mirrored on both sides if two-sided.
|
protected int marginY; //Mirrored on both sides if two-sided.
|
||||||
protected boolean isTwoPages = true;
|
protected boolean isTwoPages = true;
|
||||||
protected float scale = 1.0F;
|
protected float scale = 1.0F;
|
||||||
|
//TODO: split marginX into a left and right margin
|
||||||
protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture, boolean twoPages) {
|
protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture, boolean twoPages) {
|
||||||
this.sizeX = x;
|
this.sizeX = x;
|
||||||
this.sizeY = y;
|
this.sizeY = y;
|
||||||
@ -182,6 +197,12 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected GUIPage setUV(int u, int v) {
|
||||||
|
this.u = u;
|
||||||
|
this.v = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected GUIPage setScale(float scale) {
|
protected GUIPage setScale(float scale) {
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
return this;
|
return this;
|
||||||
@ -235,21 +256,25 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
/* Left, Unsel | Right, Unsel
|
/* Left, Unsel | Right, Unsel
|
||||||
* Left, Sel | Right, Sel
|
* Left, Sel | Right, Sel
|
||||||
*/
|
*/
|
||||||
protected int u; //upper lefthand corner where the button textures lie.
|
protected int u = 0; //upper lefthand corner where the button textures lie.
|
||||||
protected int v; //assumes uniform size for each.
|
protected int v = 0; //assumes uniform size for each.
|
||||||
protected int sizeU;
|
protected int sizeU = sizeX * 2; //Size of UV texture
|
||||||
protected int sizeV;
|
protected int sizeV = sizeY * 2;
|
||||||
|
|
||||||
protected GUIPageButton(int sizeX, int sizeY, int x, int y, int u, int v, int sizeU, int sizeV, ResourceLocation tex) {
|
protected GUIPageButton(int sizeX, int sizeY, int x, int y, ResourceLocation tex) {
|
||||||
this.sizeX = sizeX;
|
this.sizeX = sizeX;
|
||||||
this.sizeY = sizeY;
|
this.sizeY = sizeY;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
this.texture = tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GUIPageButton setUV(int u, int v, int sizeU, int sizeV) {
|
||||||
this.u = u;
|
this.u = u;
|
||||||
this.v = v;
|
this.v = v;
|
||||||
this.texture = tex;
|
|
||||||
this.sizeU = sizeU;
|
this.sizeU = sizeU;
|
||||||
this.sizeV = sizeV;
|
this.sizeV = sizeV;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderButton(GuiScreen screen, int width, int left, int top, boolean rightPage, int i, int j) {
|
protected void renderButton(GuiScreen screen, int width, int left, int top, boolean rightPage, int i, int j) {
|
||||||
@ -258,15 +283,15 @@ public class GUIBookLore extends GuiScreen {
|
|||||||
|
|
||||||
if(!rightPage) {
|
if(!rightPage) {
|
||||||
if(i >= left + x && i < left + x + sizeX && overY) {
|
if(i >= left + x && i < left + x + sizeX && overY) {
|
||||||
func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeX * 2, sizeY * 2);
|
func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeU, sizeV);
|
||||||
} else {
|
} else {
|
||||||
func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeX * 2, sizeY * 2);
|
func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeU, sizeV);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(i >= left + width - x - sizeX && i < left + width - x && overY) {
|
if(i >= left + width - x - sizeX && i < left + width - x && overY) {
|
||||||
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeX * 2, sizeY * 2);
|
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeU, sizeV);
|
||||||
} else {
|
} else {
|
||||||
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeX * 2, sizeY * 2);
|
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeU, sizeV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
|||||||
|
|
||||||
protected IIcon[] icons;
|
protected IIcon[] icons;
|
||||||
//fuck you, fuck enums, fuck guis, fuck this shitty ass fork. shove that string array up your ass.
|
//fuck you, fuck enums, fuck guis, fuck this shitty ass fork. shove that string array up your ass.
|
||||||
public static String[] itemTextures = new String[] { ":book_guide" };
|
public static String[] itemTextures = new String[] { ":book_guide", ":papers_loose" };
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IIconRegister reg) {
|
public void registerIcons(IIconRegister reg) {
|
||||||
@ -98,7 +98,7 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum BookLoreType {
|
public enum BookLoreType {
|
||||||
TEST(true, "test", 5, GUIAppearance.GUIDEBOOK);
|
TEST(true, "test", 5, GUIAppearance.LOOSEPAPER);
|
||||||
|
|
||||||
//Why? it's quite simple; i am too burnt out and also doing it the other way
|
//Why? it's quite simple; i am too burnt out and also doing it the other way
|
||||||
//is too inflexible for my taste
|
//is too inflexible for my taste
|
||||||
|
|||||||
@ -23,6 +23,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
public class BunkerComponents extends ProceduralComponents {
|
public class BunkerComponents extends ProceduralComponents {
|
||||||
|
|
||||||
public BunkerComponents() {
|
public BunkerComponents() {
|
||||||
|
//TODO:
|
||||||
|
//add an abstract method to check if each boundingbox/structure is a valid component to ProceduralComponent
|
||||||
|
//Pass each respective method as a method reference (::) to the weight constructors, in order to boost clarity
|
||||||
weightArray = new Weight[] {
|
weightArray = new Weight[] {
|
||||||
new Weight(30, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version
|
new Weight(30, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version
|
||||||
if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode);
|
if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
src/main/resources/assets/hbm/textures/items/papers_loose.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/papers_loose.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 263 B |
Loading…
x
Reference in New Issue
Block a user