Update to the latest forge, latest mappings and latest JEI version

This commit is contained in:
alexbegt committed 2020-07-22 19:07:37 -04:00
1 parent 1883825987
commit c96d1f4f05
23 files changed
+133 -137

No files matched your search

@@ -28,7 +28,7 @@ public class ExtraHeartRenderHandler {
private static final ResourceLocation ICON_HEARTS = new ResourceLocation(Mantle.modId, "textures/gui/hearts.png");
private static final ResourceLocation ICON_ABSORB = new ResourceLocation(Mantle.modId, "textures/gui/absorb.png");
private static final ResourceLocation ICON_VANILLA = AbstractGui.field_230665_h_;
private static final ResourceLocation ICON_VANILLA = AbstractGui.GUI_ICONS_LOCATION;
private final Minecraft mc = Minecraft.getInstance();
@@ -45,7 +45,7 @@ public class ExtraHeartRenderHandler {
private static int left_height = 39;
public void blit(MatrixStack matrixStack, int x, int y, int textureX, int textureY, int width, int height) {
Minecraft.getInstance().ingameGUI.func_238474_b_(matrixStack, x, y, textureX, textureY, width, height);
Minecraft.getInstance().ingameGUI.blit(matrixStack, x, y, textureX, textureY, width, height);
}
/* HUD */
@@ -93,7 +93,7 @@ public class ExtraHeartRenderHandler {
this.playerHealth = health;
int healthLast = this.lastPlayerHealth;
ModifiableAttributeInstance attrMaxHealth = player.getAttribute(Attributes.field_233818_a_);
ModifiableAttributeInstance attrMaxHealth = player.getAttribute(Attributes.MAX_HEALTH);
float healthMax = (float) attrMaxHealth.getValue();
float absorb = MathHelper.ceil(player.getAbsorptionAmount());
@@ -121,7 +121,7 @@ public class ItemStackData implements IDataElement {
ITag<Item> values = ItemTags.getCollection().get(new ResourceLocation(this.tag));
if (values != null) {
this.items = values.func_230236_b_().stream().map(ItemStack::new).collect(Collectors.toCollection(NonNullList::create));
this.items = values.getAllElements().stream().map(ItemStack::new).collect(Collectors.toCollection(NonNullList::create));
}
else {
this.items = NonNullList.create();
@@ -56,7 +56,7 @@ public class ElementScreen {
* @param yPos Y-Coordinate on the screen
*/
public int draw(MatrixStack matrixStack, int xPos, int yPos) {
Screen.func_238463_a_(matrixStack, xPos, yPos, this.x, this.y, this.w, this.h, this.texW, this.texH);
Screen.blit(matrixStack, xPos, yPos, this.x, this.y, this.w, this.h, this.texW, this.texH);
return this.w;
}
@@ -45,9 +45,9 @@ public abstract class ModuleScreen extends ContainerScreen {
}
@Override
public void func_231160_c_() {
this.guiLeft = (this.field_230708_k_ - this.xSize) / 2;
this.guiTop = (this.field_230709_l_ - this.ySize) / 2;
public void init() {
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
}
public void updatePosition(int parentX, int parentY, int parentSizeX, int parentSizeY) {
@@ -32,7 +32,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
this.realWidth = -1;
this.realHeight = -1;
this.field_230711_n_ = true;
this.passEvents = true;
}
protected void addModule(ModuleScreen module) {
@@ -48,14 +48,14 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
}
@Override
public void func_231160_c_() {
public void init() {
if (this.realWidth > -1) {
// has to be reset before calling initGui so the position is getting retained
this.xSize = this.realWidth;
this.ySize = this.realHeight;
}
super.func_231160_c_();
super.init();
this.cornerX = this.guiLeft;
this.cornerY = this.guiTop;
@@ -92,42 +92,42 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
protected void drawBackground(MatrixStack matrixStack, ResourceLocation background) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_230706_i_.getTextureManager().bindTexture(background);
this.func_238474_b_(matrixStack, this.cornerX, this.cornerY, 0, 0, this.realWidth, this.realHeight);
this.minecraft.getTextureManager().bindTexture(background);
this.blit(matrixStack, this.cornerX, this.cornerY, 0, 0, this.realWidth, this.realHeight);
}
protected void drawContainerName(MatrixStack matrixStack) {
this.field_230712_o_.func_238422_b_(matrixStack, this.func_231171_q_(), 8, 6, 0x404040);
this.font.func_238422_b_(matrixStack, this.getTitle(), 8, 6, 0x404040);
}
protected void drawPlayerInventoryName(MatrixStack matrixStack) {
ITextComponent localizedName = Minecraft.getInstance().player.inventory.getDisplayName();
this.field_230712_o_.func_238422_b_(matrixStack, localizedName, 8, this.ySize - 96 + 2, 0x404040);
this.font.func_238422_b_(matrixStack, localizedName, 8, this.ySize - 96 + 2, 0x404040);
}
@Override
public void func_231158_b_(Minecraft mc, int width, int height) {
super.func_231158_b_(mc, width, height);
public void init(Minecraft mc, int width, int height) {
super.init(mc, width, height);
for (ModuleScreen module : this.modules) {
module.func_231158_b_(mc, width, height);
module.init(mc, width, height);
this.updateSubmodule(module);
}
}
@Override
public void func_231152_a_(@Nonnull Minecraft mc, int width, int height) {
super.func_231152_a_(mc, width, height);
public void resize(@Nonnull Minecraft mc, int width, int height) {
super.resize(mc, width, height);
for (ModuleScreen module : this.modules) {
module.func_231152_a_(mc, width, height);
module.resize(mc, width, height);
this.updateSubmodule(module);
}
}
@Override
public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.func_230446_a_(matrixStack);
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(matrixStack);
int oldX = this.guiLeft;
int oldY = this.guiTop;
int oldW = this.xSize;
@@ -137,7 +137,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
this.guiTop = this.cornerY;
this.xSize = this.realWidth;
this.ySize = this.realHeight;
super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.func_230459_a_(matrixStack, mouseX, mouseY);
this.guiLeft = oldX;
this.guiTop = oldY;
@@ -221,7 +221,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
}
@Override
public boolean func_231044_a_(double mouseX, double mouseY, int mouseButton) {
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
ModuleScreen module = this.getModuleForPoint(mouseX, mouseY);
if (module != null) {
@@ -230,11 +230,11 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
}
}
return super.func_231044_a_(mouseX, mouseY, mouseButton);
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
public boolean func_231045_a_(double mouseX, double mouseY, int clickedMouseButton, double timeSinceLastClick, double unkowwn) {
public boolean mouseDragged(double mouseX, double mouseY, int clickedMouseButton, double timeSinceLastClick, double unkowwn) {
ModuleScreen module = this.getModuleForPoint(mouseX, mouseY);
if (module != null) {
@@ -243,11 +243,11 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
}
}
return super.func_231045_a_(mouseX, mouseY, clickedMouseButton, timeSinceLastClick, unkowwn);
return super.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick, unkowwn);
}
@Override
public boolean func_231043_a_(double mouseX, double mouseY, double delta) {
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
ModuleScreen module = this.getModuleForPoint(mouseX, mouseY);
if (module != null) {
@@ -256,11 +256,11 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
}
}
return super.func_231043_a_(mouseX, mouseY, delta);
return super.mouseScrolled(mouseX, mouseY, delta);
}
@Override
public boolean func_231048_c_(double mouseX, double mouseY, int state) {
public boolean mouseReleased(double mouseX, double mouseY, int state) {
ModuleScreen module = this.getModuleForPoint(mouseX, mouseY);
if (module != null) {
@@ -269,7 +269,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
}
}
return super.func_231048_c_(mouseX, mouseY, state);
return super.mouseReleased(mouseX, mouseY, state);
}
protected ModuleScreen getModuleForPoint(double x, double y) {
@@ -23,7 +23,7 @@ public class ScalableElementScreen extends ElementScreen {
// remainder that doesn't fit total width
int remainder = width % this.w;
if (remainder > 0) {
Screen.func_238463_a_(matrixStack, xPos + width - remainder, yPos, this.x, this.y, remainder, this.h, this.texW, this.texH);
Screen.blit(matrixStack, xPos + width - remainder, yPos, this.x, this.y, remainder, this.h, this.texW, this.texH);
}
return width;
@@ -36,7 +36,7 @@ public class ScalableElementScreen extends ElementScreen {
// remainder that doesn't fit total width
int remainder = height % this.h;
if (remainder > 0) {
Screen.func_238463_a_(matrixStack, xPos, yPos + height - remainder, this.x, this.y, this.w, remainder, this.texW, this.texH);
Screen.blit(matrixStack, xPos, yPos + height - remainder, this.x, this.y, this.w, remainder, this.texW, this.texH);
}
return this.w;
@@ -62,7 +62,7 @@ public class ScalableElementScreen extends ElementScreen {
int remainder = width % this.w;
if (remainder > 0) {
Screen.func_238463_a_(matrixStack, xPos + width - remainder, yPos, this.x, this.y, remainder, yRest, this.texW, this.texH);
Screen.blit(matrixStack, xPos + width - remainder, yPos, this.x, this.y, remainder, yRest, this.texW, this.texH);
}
return width;
@@ -137,7 +137,7 @@ public class TabsWidget extends Widget {
ElementScreen actualTab;
if (i == 0 && x == this.parent.cornerX) {
actualTab = toDraw[0];
} else if (x == this.parent.cornerX + this.parent.field_230708_k_) {
} else if (x == this.parent.cornerX + this.parent.width) {
actualTab = toDraw[2];
} else {
actualTab = toDraw[1];
@@ -22,7 +22,7 @@ public class ArrowButton extends Button {
public int hoverColor;
public ArrowButton(int x, int y, ArrowType arrowType, int color, int hoverColor, IPressable iPressable) {
super(x, y, arrowType.w, arrowType.h, StringTextComponent.field_240750_d_, iPressable);
super(x, y, arrowType.w, arrowType.h, StringTextComponent.EMPTY, iPressable);
this.arrowType = arrowType;
this.color = color;
@@ -30,21 +30,21 @@ public class ArrowButton extends Button {
}
@Override
public void func_230431_b_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
Minecraft minecraft = Minecraft.getInstance();
minecraft.getTextureManager().bindTexture(TEX_BOOK);
this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int color = this.field_230692_n_ ? this.hoverColor : this.color;
int color = this.isHovered ? this.hoverColor : this.color;
float r = ((color >> 16) & 0xff) / 255.F;
float g = ((color >> 8) & 0xff) / 255.F;
float b = (color & 0xff) / 255.F;
RenderSystem.color3f(r, g, b);
func_238466_a_(matrixStack, this.field_230690_l_, this.field_230691_m_, this.field_230688_j_, this.field_230689_k_, this.arrowType.x, this.arrowType.y, this.field_230688_j_, this.field_230689_k_, 512, 512);
this.func_230441_a_(matrixStack, minecraft, mouseX, mouseY);
blit(matrixStack, this.x, this.y, this.width, this.height, this.arrowType.x, this.arrowType.y, this.width, this.height, 512, 512);
this.renderBg(matrixStack, minecraft, mouseX, mouseY);
}
public enum ArrowType {
@@ -82,29 +82,29 @@ public class BookScreen extends Screen {
this.book = book;
this.item = item;
this.field_230706_i_ = Minecraft.getInstance();
this.field_230712_o_ = this.field_230706_i_.fontRenderer;
this.minecraft = Minecraft.getInstance();
this.font = this.minecraft.fontRenderer;
initWidthsAndHeights();
this.advancementCache = new AdvancementCache();
this.field_230706_i_.player.connection.getAdvancementManager().setListener(this.advancementCache);
this.minecraft.player.connection.getAdvancementManager().setListener(this.advancementCache);
this.openPage(book.findPageNumber(BookHelper.getSavedPage(item), this.advancementCache));
}
@Override
@SuppressWarnings("ForLoopReplaceableByForEach")
public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
initWidthsAndHeights();
FontRenderer fontRenderer = this.book.fontRenderer;
if (fontRenderer == null) {
fontRenderer = this.field_230706_i_.fontRenderer;
fontRenderer = this.minecraft.fontRenderer;
}
if (debug) {
func_238467_a_(matrixStack, 0, 0, fontRenderer.getStringWidth("DEBUG") + 4, fontRenderer.FONT_HEIGHT + 4, 0x55000000);
fontRenderer.func_238421_b_(matrixStack, "DEBUG", 2, 2, 0xFFFFFFFF);
fill(matrixStack, 0, 0, fontRenderer.getStringWidth("DEBUG") + 4, fontRenderer.FONT_HEIGHT + 4, 0x55000000);
fontRenderer.drawString(matrixStack, "DEBUG", 2, 2, 0xFFFFFFFF);
}
RenderSystem.enableAlphaTest();
@@ -118,32 +118,32 @@ public class BookScreen extends Screen {
float coverG = ((this.book.appearance.coverColor >> 8) & 0xff) / 255.F;
float coverB = (this.book.appearance.coverColor & 0xff) / 255.F;
TextureManager render = this.field_230706_i_.textureManager;
TextureManager render = this.minecraft.textureManager;
if (this.page == -1) {
render.bindTexture(TEX_BOOKFRONT);
RenderHelper.disableStandardItemLighting();
RenderSystem.color3f(coverR, coverG, coverB);
func_238463_a_(matrixStack, this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED / 2, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, 0, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
blit(matrixStack, this.width / 2 - PAGE_WIDTH_UNSCALED / 2, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, 0, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
RenderSystem.color3f(1F, 1F, 1F);
if (!this.book.appearance.title.isEmpty()) {
func_238463_a_(matrixStack, this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED / 2, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, PAGE_HEIGHT_UNSCALED, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
blit(matrixStack, this.width / 2 - PAGE_WIDTH_UNSCALED / 2, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, PAGE_HEIGHT_UNSCALED, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
RenderSystem.pushMatrix();
float scale = fontRenderer.getStringWidth(this.book.appearance.title) <= 67 ? 2.5F : 2F;
RenderSystem.scalef(scale, scale, 1F);
fontRenderer.func_238405_a_(matrixStack, this.book.appearance.title, (this.field_230708_k_ / 2) / scale + 3 - fontRenderer.getStringWidth(this.book.appearance.title) / 2, (this.field_230709_l_ / 2 - fontRenderer.FONT_HEIGHT / 2) / scale - 4, 0xAE8000);
fontRenderer.drawStringWithShadow(matrixStack, this.book.appearance.title, (this.width / 2) / scale + 3 - fontRenderer.getStringWidth(this.book.appearance.title) / 2, (this.height / 2 - fontRenderer.FONT_HEIGHT / 2) / scale - 4, 0xAE8000);
RenderSystem.popMatrix();
}
if (!this.book.appearance.subtitle.isEmpty()) {
RenderSystem.pushMatrix();
RenderSystem.scalef(1.5F, 1.5F, 1F);
fontRenderer.func_238405_a_(matrixStack, this.book.appearance.subtitle, (this.field_230708_k_ / 2) / 1.5F + 7 - fontRenderer.getStringWidth(this.book.appearance.subtitle) / 2, (this.field_230709_l_ / 2 + 100 - fontRenderer.FONT_HEIGHT * 2) / 1.5F, 0xAE8000);
fontRenderer.drawStringWithShadow(matrixStack, this.book.appearance.subtitle, (this.width / 2) / 1.5F + 7 - fontRenderer.getStringWidth(this.book.appearance.subtitle) / 2, (this.height / 2 + 100 - fontRenderer.FONT_HEIGHT * 2) / 1.5F, 0xAE8000);
RenderSystem.popMatrix();
}
}
@@ -152,12 +152,12 @@ public class BookScreen extends Screen {
RenderHelper.disableStandardItemLighting();
RenderSystem.color3f(coverR, coverG, coverB);
func_238463_a_(matrixStack, this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, 0, PAGE_WIDTH_UNSCALED * 2, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
blit(matrixStack, this.width / 2 - PAGE_WIDTH_UNSCALED, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, 0, PAGE_WIDTH_UNSCALED * 2, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
RenderSystem.color3f(1F, 1F, 1F);
if (this.page != 0) {
func_238463_a_(matrixStack, this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, PAGE_HEIGHT_UNSCALED, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
blit(matrixStack, this.width / 2 - PAGE_WIDTH_UNSCALED, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, PAGE_HEIGHT_UNSCALED, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
RenderSystem.pushMatrix();
this.drawerTransform(false);
@@ -166,7 +166,7 @@ public class BookScreen extends Screen {
if (this.book.appearance.drawPageNumbers) {
String pNum = (this.page - 1) * 2 + 2 + "";
fontRenderer.func_238421_b_(matrixStack, pNum, PAGE_WIDTH / 2 - fontRenderer.getStringWidth(pNum) / 2, PAGE_HEIGHT - 10, 0xFFAAAAAA);
fontRenderer.drawString(matrixStack, pNum, PAGE_WIDTH / 2 - fontRenderer.getStringWidth(pNum) / 2, PAGE_HEIGHT - 10, 0xFFAAAAAA);
}
int mX = this.getMouseX(false);
@@ -199,7 +199,7 @@ public class BookScreen extends Screen {
int fullPageCount = this.book.getFullPageCount(this.advancementCache);
if (this.page < fullPageCount - 1 || this.book.getPageCount(this.advancementCache) % 2 != 0) {
func_238463_a_(matrixStack, this.field_230708_k_ / 2, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
blit(matrixStack, this.width / 2, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
RenderSystem.pushMatrix();
this.drawerTransform(true);
@@ -208,7 +208,7 @@ public class BookScreen extends Screen {
if (this.book.appearance.drawPageNumbers) {
String pNum = (this.page - 1) * 2 + 3 + "";
fontRenderer.func_238421_b_(matrixStack, pNum, PAGE_WIDTH / 2 - fontRenderer.getStringWidth(pNum) / 2, PAGE_HEIGHT - 10, 0xFFAAAAAA);
fontRenderer.drawString(matrixStack, pNum, PAGE_WIDTH / 2 - fontRenderer.getStringWidth(pNum) / 2, PAGE_HEIGHT - 10, 0xFFAAAAAA);
}
int mX = this.getMouseX(true);
@@ -234,14 +234,14 @@ public class BookScreen extends Screen {
}
}
super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks);
RenderSystem.popMatrix();
}
@Override
protected void func_231160_c_() {
super.func_231160_c_();
protected void init() {
super.init();
// The books are unreadable at Gui Scale set to small, so we'll double the scale, and of course half the size so that all our code still works as it should
/*
@@ -250,10 +250,10 @@ public class BookScreen extends Screen {
height /= 2F;
}*/
this.field_230710_m_.clear();
this.field_230705_e_.clear();
this.buttons.clear();
this.children.clear();
this.previousArrow = this.func_230480_a_(new ArrowButton(-50, -50, ArrowButton.ArrowType.PREV, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.previousArrow = this.addButton(new ArrowButton(-50, -50, ArrowButton.ArrowType.PREV, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.page--;
if (this.page < -1) {
@@ -264,7 +264,7 @@ public class BookScreen extends Screen {
this.buildPages();
}));
this.nextArrow = this.func_230480_a_(new ArrowButton(-50, -50, ArrowButton.ArrowType.NEXT, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.nextArrow = this.addButton(new ArrowButton(-50, -50, ArrowButton.ArrowType.NEXT, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.page++;
int fullPageCount = this.book.getFullPageCount(this.advancementCache);
@@ -277,7 +277,7 @@ public class BookScreen extends Screen {
this.buildPages();
}));
this.backArrow = this.func_230480_a_(new ArrowButton(this.field_230708_k_ / 2 - ArrowButton.WIDTH / 2, this.field_230709_l_ / 2 + ArrowButton.HEIGHT / 2 + PAGE_HEIGHT / 2, ArrowButton.ArrowType.LEFT, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.backArrow = this.addButton(new ArrowButton(this.width / 2 - ArrowButton.WIDTH / 2, this.height / 2 + ArrowButton.HEIGHT / 2 + PAGE_HEIGHT / 2, ArrowButton.ArrowType.LEFT, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
if (this.oldPage >= -1) {
this.page = this.oldPage;
}
@@ -286,7 +286,7 @@ public class BookScreen extends Screen {
this.buildPages();
}));
this.indexArrow = this.func_230480_a_(new ArrowButton(this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED - ArrowButton.WIDTH / 2, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2, ArrowButton.ArrowType.BACK_UP, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.indexArrow = this.addButton(new ArrowButton(this.width / 2 - PAGE_WIDTH_UNSCALED - ArrowButton.WIDTH / 2, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, ArrowButton.ArrowType.BACK_UP, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.openPage(this.book.findPageNumber("index.page1"));
this.oldPage = -2;
@@ -297,26 +297,26 @@ public class BookScreen extends Screen {
}
@Override
public void func_231023_e_() {
super.func_231023_e_();
public void tick() {
super.tick();
this.previousArrow.field_230694_p_ = this.page != -1;
this.nextArrow.field_230694_p_ = this.page + 1 < this.book.getFullPageCount(this.advancementCache);
this.backArrow.field_230694_p_ = this.oldPage >= -1;
this.previousArrow.visible = this.page != -1;
this.nextArrow.visible = this.page + 1 < this.book.getFullPageCount(this.advancementCache);
this.backArrow.visible = this.oldPage >= -1;
if (this.page == -1) {
this.nextArrow.field_230690_l_ = this.field_230708_k_ / 2 + 80;
this.indexArrow.field_230694_p_ = false;
this.nextArrow.x = this.width / 2 + 80;
this.indexArrow.visible = false;
}
else {
this.previousArrow.field_230690_l_ = this.field_230708_k_ / 2 - 184;
this.nextArrow.field_230690_l_ = this.field_230708_k_ / 2 + 165;
this.previousArrow.x = this.width / 2 - 184;
this.nextArrow.x = this.width / 2 + 165;
this.indexArrow.field_230694_p_ = this.book.findSection("index") != null && (this.page - 1) * 2 + 2 > this.book.findSection("index").getPageCount();
this.indexArrow.visible = this.book.findSection("index") != null && (this.page - 1) * 2 + 2 > this.book.findSection("index").getPageCount();
}
this.previousArrow.field_230691_m_ = this.field_230709_l_ / 2 + 75;
this.nextArrow.field_230691_m_ = this.field_230709_l_ / 2 + 75;
this.previousArrow.y = this.height / 2 + 75;
this.nextArrow.y = this.height / 2 + 75;
}
/*@Override
@@ -330,8 +330,8 @@ public class BookScreen extends Screen {
}*/
@Override
public boolean func_231046_a_(int keyCode, int scanCode, int modifiers) {
super.func_231046_a_(keyCode, scanCode, modifiers);
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
super.keyPressed(keyCode, scanCode, modifiers);
switch (keyCode) {
case GLFW.GLFW_KEY_LEFT:
@@ -359,12 +359,11 @@ public class BookScreen extends Screen {
return true;
}
return super.func_231046_a_(keyCode, scanCode, modifiers);
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public boolean func_231043_a_(double unKnown1, double unKnown2, double scrollDelta) {
public boolean mouseScrolled(double unKnown1, double unKnown2, double scrollDelta) {
if (scrollDelta < 0.0D) {
this.page++;
int fullPageCount = this.book.getFullPageCount(this.advancementCache);
@@ -388,11 +387,11 @@ public class BookScreen extends Screen {
return true;
}
return super.func_231043_a_(scrollDelta, unKnown1, unKnown2);
return super.mouseScrolled(scrollDelta, unKnown1, unKnown2);
}
@Override
public boolean func_231044_a_(double originalMouseX, double originalMouseY, int mouseButton) {
public boolean mouseClicked(double originalMouseX, double originalMouseY, int mouseButton) {
boolean right = false;
double mouseX = this.getMouseX(false);
@@ -414,11 +413,11 @@ public class BookScreen extends Screen {
}
}
return super.func_231044_a_(originalMouseX, originalMouseY, mouseButton);
return super.mouseClicked(originalMouseX, originalMouseY, mouseButton);
}
@Override
public boolean func_231048_c_(double originalMouseX, double originalMouseY, int mouseButton) {
public boolean mouseReleased(double originalMouseX, double originalMouseY, int mouseButton) {
boolean right = false;
double mouseX = this.getMouseX(false);
double mouseY = this.getMouseY();
@@ -433,11 +432,11 @@ public class BookScreen extends Screen {
BookElement element = right ? this.rightElements.get(i) : this.leftElements.get(i);
element.mouseReleased(mouseX, mouseY, mouseButton);
}
return super.func_231048_c_(originalMouseX, originalMouseY, mouseButton);
return super.mouseReleased(originalMouseX, originalMouseY, mouseButton);
}
@Override
public boolean func_231045_a_(double mouseX, double mouseY, int clickedMouseButton, double timeSinceLaslick, double unknown) {
public boolean mouseDragged(double mouseX, double mouseY, int clickedMouseButton, double timeSinceLaslick, double unknown) {
boolean right = false;
mouseX = this.getMouseX(false);
mouseY = this.getMouseY();
@@ -457,8 +456,8 @@ public class BookScreen extends Screen {
}
@Override
public void func_231164_f_() {
if (this.field_230706_i_.player == null) {
public void removed() {
if (this.minecraft.player == null) {
return;
}
@@ -469,24 +468,24 @@ public class BookScreen extends Screen {
}
if (this.page == -1) {
BookLoader.updateSavedPage(this.field_230706_i_.player, this.item, "");
BookLoader.updateSavedPage(this.minecraft.player, this.item, "");
}
else if (page != null && page.parent != null) {
BookLoader.updateSavedPage(this.field_230706_i_.player, this.item, page.parent.name + "." + page.name);
BookLoader.updateSavedPage(this.minecraft.player, this.item, page.parent.name + "." + page.name);
}
}
@Override
public boolean func_231177_au__() {
public boolean isPauseScreen() {
return false;
}
public void drawerTransform(boolean rightSide) {
if (rightSide) {
RenderSystem.translatef(this.field_230708_k_ / 2 + PAGE_PADDING_RIGHT + PAGE_MARGIN, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2 + PAGE_PADDING_TOP + PAGE_MARGIN, 0);
RenderSystem.translatef(this.width / 2 + PAGE_PADDING_RIGHT + PAGE_MARGIN, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2 + PAGE_PADDING_TOP + PAGE_MARGIN, 0);
}
else {
RenderSystem.translatef(this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED + PAGE_PADDING_LEFT + PAGE_MARGIN, this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2 + PAGE_PADDING_TOP + PAGE_MARGIN, 0);
RenderSystem.translatef(this.width / 2 - PAGE_WIDTH_UNSCALED + PAGE_PADDING_LEFT + PAGE_MARGIN, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2 + PAGE_PADDING_TOP + PAGE_MARGIN, 0);
}
}
@@ -494,24 +493,24 @@ public class BookScreen extends Screen {
protected float leftOffset(boolean rightSide) {
if (rightSide) {
// from center: go padding + margin to the right
return this.field_230708_k_ / 2 + PAGE_PADDING_RIGHT + PAGE_MARGIN;
return this.width / 2 + PAGE_PADDING_RIGHT + PAGE_MARGIN;
}
else {
// from center: go page width left, then right with padding and margin
return this.field_230708_k_ / 2 - PAGE_WIDTH_UNSCALED + PAGE_PADDING_LEFT + PAGE_MARGIN;
return this.width / 2 - PAGE_WIDTH_UNSCALED + PAGE_PADDING_LEFT + PAGE_MARGIN;
}
}
protected float topOffset() {
return this.field_230709_l_ / 2 - PAGE_HEIGHT_UNSCALED / 2 + PAGE_PADDING_TOP + PAGE_MARGIN;
return this.height / 2 - PAGE_HEIGHT_UNSCALED / 2 + PAGE_PADDING_TOP + PAGE_MARGIN;
}
protected int getMouseX(boolean rightSide) {
return (int) ((Minecraft.getInstance().mouseHelper.getMouseX() * this.field_230708_k_ / this.field_230706_i_.getMainWindow().getFramebufferWidth() - this.leftOffset(rightSide)) / PAGE_SCALE);
return (int) ((Minecraft.getInstance().mouseHelper.getMouseX() * this.width / this.minecraft.getMainWindow().getFramebufferWidth() - this.leftOffset(rightSide)) / PAGE_SCALE);
}
protected int getMouseY() {
return (int) ((Minecraft.getInstance().mouseHelper.getMouseY() * this.field_230709_l_ / this.field_230706_i_.getMainWindow().getFramebufferHeight() - 1 - this.topOffset()) / PAGE_SCALE);
return (int) ((Minecraft.getInstance().mouseHelper.getMouseY() * this.height / this.minecraft.getMainWindow().getFramebufferHeight() - 1 - this.topOffset()) / PAGE_SCALE);
}
public int openPage(int page) {
@@ -27,13 +27,13 @@ public class BookmarkButton extends Button {
public final BookmarkData data;
public BookmarkButton(BookmarkData data, IPressable iPressable) {
super(-500, -500, WIDTH, HEIGHT, StringTextComponent.field_240750_d_, iPressable);
super(-500, -500, WIDTH, HEIGHT, StringTextComponent.EMPTY, iPressable);
this.data = data;
}
@Override
public void func_230431_b_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
Minecraft minecraft = Minecraft.getInstance();
int tex_y = TEX_Y + HEIGHT * this.type;
@@ -44,16 +44,16 @@ public class BookmarkButton extends Button {
float b = (this.data.color & 0xff) / 255.F;
RenderSystem.color3f(r, g, b);
func_238466_a_(matrixStack, this.field_230690_l_, this.field_230691_m_, this.field_230688_j_, this.field_230691_m_, TEX_X, tex_y, WIDTH, HEIGHT, 512, 512);
blit(matrixStack, this.x, this.y, this.width, this.y, TEX_X, tex_y, WIDTH, HEIGHT, 512, 512);
if (this.data.text != null && !this.data.text.isEmpty()) {
TextDataRenderer.drawScaledString(matrixStack, minecraft.fontRenderer, this.data.text, this.field_230690_l_ + 1, this.field_230691_m_ + this.field_230691_m_ / 2 - minecraft.fontRenderer.FONT_HEIGHT * TEXT_SCALE / 2 + 1, 0xFFFFFFFF, true, TEXT_SCALE);
TextDataRenderer.drawScaledString(matrixStack, minecraft.fontRenderer, this.data.text, this.x + 1, this.y + this.y / 2 - minecraft.fontRenderer.FONT_HEIGHT * TEXT_SCALE / 2 + 1, 0xFFFFFFFF, true, TEXT_SCALE);
}
RenderSystem.color3f(1F, 1F, 1F);
if (this.data.page.equals("ADD")) {
func_238463_a_(matrixStack, this.field_230690_l_ + this.field_230688_j_ / 2 - ADD_W / 2, this.field_230691_m_ + this.field_230691_m_ / 2 - ADD_H / 2, ADD_X, ADD_Y, ADD_W, ADD_H, 512, 512);
blit(matrixStack, this.x + this.width / 2 - ADD_W / 2, this.y + this.y / 2 - ADD_H / 2, ADD_X, ADD_Y, ADD_W, ADD_H, 512, 512);
}
}
}
@@ -155,10 +155,10 @@ public class TextDataRenderer {
if (atY >= y + boxHeight) {
if (item.dropshadow) {
fr.func_238405_a_(matrixStack, "...", atX, atY, 0);
fr.drawStringWithShadow(matrixStack, "...", atX, atY, 0);
}
else {
fr.func_238421_b_(matrixStack, "...", atX, atY, 0);
fr.drawString(matrixStack, "...", atX, atY, 0);
}
break;
}
@@ -166,7 +166,7 @@ public class TextDataRenderer {
}
if (BookScreen.debug && action != null && !action.isEmpty()) {
tooltip.add(StringTextComponent.field_240750_d_);
tooltip.add(StringTextComponent.EMPTY);
tooltip.add(new StringTextComponent("Action: " + action).func_240699_a_(TextFormatting.GRAY));
}
@@ -234,10 +234,10 @@ public class TextDataRenderer {
RenderSystem.translatef(x, y, 0);
RenderSystem.scalef(scale, scale, 1F);
if (dropShadow) {
font.func_238405_a_(matrixStack, text, 0, 0, color);
font.drawStringWithShadow(matrixStack, text, 0, 0, color);
}
else {
font.func_238421_b_(matrixStack, text, 0, 0, color);
font.drawString(matrixStack, text, 0, 0, color);
}
RenderSystem.popMatrix();
}
@@ -268,4 +268,4 @@ public class TextDataRenderer {
RenderSystem.enableTexture();
}
//END METHODS FROM GUI
}
}
@@ -20,7 +20,7 @@ public class AnimationToggleElement extends ArrowElement {
@Override
public void mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (this.button != null && this.isHovered(mouseX, mouseY)) {
this.button.func_230930_b_();
this.button.onPress();
this.toggled = !this.toggled;
this.updateColor();
}
@@ -17,13 +17,13 @@ public class ArrowElement extends ButtonElement {
@Override
public void draw(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, FontRenderer fontRenderer) {
this.button.func_230431_b_(matrixStack, mouseX, mouseY, partialTicks);
this.button.renderButton(matrixStack, mouseX, mouseY, partialTicks);
}
@Override
public void mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (this.button != null && this.isHovered(mouseX, mouseY)) {
this.button.func_230930_b_();
this.button.onPress();
}
}
@@ -68,7 +68,7 @@ public abstract class BookElement extends AbstractGui {
}
public void drawHoveringText(MatrixStack matrixStack, List<ITextComponent> textLines, int x, int y, FontRenderer font) {
GuiUtils.drawHoveringText(matrixStack, textLines, x, y, this.parent.field_230708_k_, this.parent.field_230709_l_, -1, font);
GuiUtils.drawHoveringText(matrixStack, textLines, x, y, this.parent.width, this.parent.height, -1, font);
RenderHelper.disableStandardItemLighting();
}
}
@@ -84,6 +84,6 @@ public class ImageElement extends SizedBookElement {
}
public static void blitRaw(MatrixStack matrixStack, int x, int y, int w, int h, int minU, int maxU, int minV, int maxV, float tw, float th) {
func_238461_a_(matrixStack.getLast().getMatrix(), x, x + w, y, y + h, 0, minU / tw, maxU / tw, minV / th, maxV / th);
innerBlit(matrixStack.getLast().getMatrix(), x, x + w, y, y + h, 0, minU / tw, maxU / tw, minV / th, maxV / th);
}
}
@@ -40,7 +40,7 @@ public class SelectionElement extends SizedBookElement {
boolean hover = this.isHovered(mouseX, mouseY);
if (hover) {
func_238467_a_(matrixStack, this.iconX, this.iconY, this.iconX + IMG_SIZE, this.iconY + IMG_SIZE, this.parent.book.appearance.hoverColor);
fill(matrixStack, this.iconX, this.iconY, this.iconX + IMG_SIZE, this.iconY + IMG_SIZE, this.parent.book.appearance.hoverColor);
}
if (unlocked) {
RenderSystem.color4f(1F, 1F, 1F, hover ? 1F : 0.5F);
@@ -58,7 +58,7 @@ public class SelectionElement extends SizedBookElement {
int textW = fontRenderer.getStringWidth(this.section.getTitle());
int textX = this.x + WIDTH / 2 - textW / 2;
int textY = this.y + HEIGHT - fontRenderer.FONT_HEIGHT / 2;
fontRenderer.func_238421_b_(matrixStack, this.section.getTitle(),
fontRenderer.drawString(matrixStack, this.section.getTitle(),
textX,
textY,
hover ? 0xFF000000 : 0x7F000000);
@@ -48,10 +48,10 @@ class ExampleSync {
public void playerJoinedWorld(TickEvent.ClientTickEvent event) {
ClientPlayerEntity player = Minecraft.getInstance().player;
if (needsRestart) {
player.sendMessage(new StringTextComponent("Configs synced with server. Configs require a restart"), Util.field_240973_b_);
player.sendMessage(new StringTextComponent("Configs synced with server. Configs require a restart"), Util.DUMMY_UUID);
}
else {
player.sendMessage(new StringTextComponent("Configs synced with server."), Util.field_240973_b_);
player.sendMessage(new StringTextComponent("Configs synced with server."), Util.DUMMY_UUID);
}
MinecraftForge.EVENT_BUS.unregister(this);
}
@@ -1,17 +1,14 @@
package slimeknights.mantle.item;
import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import slimeknights.mantle.util.LocUtils;
import javax.annotation.Nullable;
import java.util.List;
@@ -129,8 +129,8 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
}
@Override
public void func_230337_a_(BlockState blockState, CompoundNBT tags) {
super.func_230337_a_(blockState, tags);
public void read(BlockState blockState, CompoundNBT tags) {
super.read(blockState, tags);
this.readCustomNBT(tags);
}
@@ -240,8 +240,8 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
/* NBT */
@Override
public void func_230337_a_(BlockState blockState, CompoundNBT tags) {
super.func_230337_a_(blockState, tags);
public void read(BlockState blockState, CompoundNBT tags) {
super.read(blockState, tags);
this.resizeInternal(tags.getInt("InventorySize"));
this.readInventoryFromNBT(tags);