Removed old book test resources

This commit is contained in:
Arthur Uzulin committed 2018-07-24 09:16:04 +10:00
1 parent 13695e8464
commit ceec486257
29 files changed
-711

No files matched your search

@@ -1,68 +0,0 @@
package slimeknights.mantle.client.gui.book;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.math.MathHelper;
import static slimeknights.mantle.client.gui.book.Textures.TEX_BOX;
public class BoxRenderer {
public static final int TEX_SIZE = 128;
public static void drawBox(int x, int y, int width, int height, int index) {
drawBox(x, y, width, height, index, 16, 16, 4, 4, 2, 2);
}
public static void drawBox(int x, int y, int width, int height, int index, int sprW, int sprH, int segW, int segH, int segGW, int segGH) {
Minecraft.getMinecraft().renderEngine.bindTexture(TEX_BOX);
int sx = x, sy = y;
for(int i = 0; i < 3; i++) {
int sgW = width - segW * 2;
if(i % 2 == 0) {
sgW = segW;
}
for(int j = 0; j < 3; j++) {
int sgH = height - segH * 2;
if(j % 2 == 0) {
sgH = segH;
}
int[] matrix = getTextureMatrixCoords(index, sprW, sprH, segW, segH, segGW, segGH, i + j * 3);
Gui.drawScaledCustomSizeModalRect(sx, sy, matrix[0], matrix[1], segW, segH, sgW, sgH, TEX_SIZE, TEX_SIZE);
sy += sgH;
}
sx += sgW;
sy = y;
}
}
public static int[] getTextureMatrixCoords(int index, int sprW, int sprH, int segW, int segH, int segGW, int segGH, int segId) {
int totalWidth = segW * 3 + segGW * 2;
int totalHeight = segH * 3 + segGH * 2;
return getTextureMatrixCoords((index % (256 / sprW) * sprW) + (sprW / 2 - totalWidth / 2), (MathHelper
.floor(index / (256F / sprH)) * sprH) + (sprH / 2 - totalHeight / 2), segW, segH, segGW, segGH, segId);
}
public static int[] getTextureMatrixCoords(int u, int v, int segW, int segH, int segGW, int segGH, int segId) {
int[] coords = new int[4];
int col = segId % 3;
int row = MathHelper.floor(segId / 3F);
coords[0] = u + col * segW + col * segGW;
coords[1] = v + row * segH + row * segGH;
coords[2] = coords[0] + segW;
coords[3] = coords[1] + segH;
return coords;
}
}
@@ -6,7 +6,6 @@ public class Textures {
public static final ResourceLocation TEX_BOOK = new ResourceLocation("mantle:textures/gui/book/book.png");
public static final ResourceLocation TEX_BOOKFRONT = new ResourceLocation("mantle:textures/gui/book/bookfront.png");
public static final ResourceLocation TEX_BOX = new ResourceLocation("mantle:textures/gui/box.png");
public static final ResourceLocation TEX_CRAFTING = new ResourceLocation("mantle:textures/gui/book/crafting.png");
public static final ResourceLocation TEX_SMELTING = new ResourceLocation("mantle:textures/gui/book/smelting.png");
@@ -1,103 +0,0 @@
package slimeknights.mantle.client.gui.book.editor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import javax.annotation.Nullable;
import slimeknights.mantle.client.book.data.BookData;
import slimeknights.mantle.client.gui.book.BoxRenderer;
import slimeknights.mantle.client.gui.book.GuiBook;
import slimeknights.mantle.client.gui.book.Textures;
public class GuiBookEditor extends GuiScreen {
private static final int SIDEBAR_WIDTH = 120;
private GuiBook innerUi;
private int side;
public GuiBookEditor(@Nullable BookData book) {
if(book == null) {
book = new BookData();
}
innerUi = new GuiBook(book, null);
innerUi.mc = Minecraft.getMinecraft();
innerUi._setPage(-1);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
GlStateManager.pushMatrix();
TextureManager render = this.mc.renderEngine;
if(mc.gameSettings.guiScale == 1) {
GlStateManager.scale(2F, 2F, 2F);
mouseX /= 2;
mouseY /= 2;
}
BoxRenderer.drawBox(width / 2 - (GuiBook.PAGE_WIDTH_UNSCALED + SIDEBAR_WIDTH) / 2,
height / 2 - (GuiBook.PAGE_HEIGHT_UNSCALED - GuiBook.PAGE_PADDING_TOP) / 2,
SIDEBAR_WIDTH + GuiBook.PAGE_PADDING_RIGHT + GuiBook.PAGE_MARGIN,
GuiBook.PAGE_HEIGHT_UNSCALED - GuiBook.PAGE_PADDING_BOT, 0);
if(innerUi.getPage_() == -1) {
GlStateManager.pushMatrix();
if(mc.gameSettings.guiScale == 1) {
GlStateManager.scale(0.5F, 0.5F, 0.5F);
}
innerUi.openCover();
innerUi
.drawScreen(mouseX * (mc.gameSettings.guiScale == 1 ? 2 : 1), mouseY * (mc.gameSettings.guiScale == 1 ? 2 : 1), partialTicks);
GlStateManager.popMatrix();
} else {
render.bindTexture(Textures.TEX_BOOK);
GlStateManager.color(1F, 1F, 1F);
drawModalRectWithCustomSizedTexture(width / 2 - GuiBook.PAGE_WIDTH_UNSCALED / 2,
height / 2 - GuiBook.PAGE_HEIGHT_UNSCALED / 2,
0, GuiBook.PAGE_HEIGHT_UNSCALED,
GuiBook.PAGE_WIDTH_UNSCALED - GuiBook.PAGE_MARGIN - GuiBook.PAGE_PADDING_LEFT,
GuiBook.PAGE_HEIGHT_UNSCALED,
GuiBook.TEX_SIZE, GuiBook.TEX_SIZE);
drawModalRectWithCustomSizedTexture(width / 2 - GuiBook.PAGE_WIDTH_UNSCALED / 2 + GuiBook.PAGE_MARGIN + GuiBook.PAGE_PADDING_LEFT,
height / 2 - GuiBook.PAGE_HEIGHT_UNSCALED / 2,
GuiBook.PAGE_WIDTH_UNSCALED + GuiBook.PAGE_MARGIN + GuiBook.PAGE_PADDING_LEFT,
GuiBook.PAGE_HEIGHT_UNSCALED,
GuiBook.PAGE_WIDTH_UNSCALED - GuiBook.PAGE_MARGIN - GuiBook.PAGE_PADDING_RIGHT,
GuiBook.PAGE_HEIGHT_UNSCALED,
GuiBook.TEX_SIZE, GuiBook.TEX_SIZE);
}
super.drawScreen(mouseX, mouseY, partialTicks);
GlStateManager.popMatrix();
}
@Override
public void initGui() {
buttonList.clear();
innerUi.width = width + SIDEBAR_WIDTH * (mc.gameSettings.guiScale == 1 ? 2 : 1);
innerUi.height = height;
if(mc.gameSettings.guiScale == 1) {
width /= 2F;
height /= 2F;
}
innerUi.initGui();
innerUi.updateScreen();
innerUi.buttonList.clear();
buttonList.add(new GuiButton(0, 0, height - 20, 50, 20, "Import"));
buttonList.add(new GuiButton(1, 55, height - 20, 50, 20, "Export"));
}
}