mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-20 03:59:49 +00:00
Added cook time display to smelting recipe content
This commit is contained in:
1 parent
6971051b90
commit
16fa298bfd
3 files changed
+35
No files matched your search
@@ -1,7 +1,9 @@
|
||||
package slimeknights.mantle.client.book.data.content;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.AbstractCookingRecipe;
|
||||
@@ -18,6 +20,7 @@ import slimeknights.mantle.client.screen.book.element.BookElement;
|
||||
import slimeknights.mantle.client.screen.book.element.ElementImage;
|
||||
import slimeknights.mantle.client.screen.book.element.ElementItem;
|
||||
import slimeknights.mantle.client.screen.book.element.ElementText;
|
||||
import slimeknights.mantle.client.screen.book.element.ElementTooltip;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -55,6 +58,7 @@ public class ContentSmelting extends PageContent {
|
||||
tdTitle.underlined = true;
|
||||
list.add(new ElementText(0, 0, BookScreen.PAGE_WIDTH, 9, tdTitle));
|
||||
list.add(new ElementImage(x, y, IMG_SMELTING.width, IMG_SMELTING.height, IMG_SMELTING, book.appearance.slotColor));
|
||||
list.add(new ElementTooltip(ImmutableList.of(I18n.format("mantle:tooltip.cooktime", cookTime)), x + 7, y + 42, 60, 28));
|
||||
|
||||
if (this.input != null && !this.input.getItems().isEmpty()) {
|
||||
list.add(new ElementItem(x + INPUT_X, y + INPUT_Y, ITEM_SCALE, this.input.getItems(), this.input.action));
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package slimeknights.mantle.client.screen.book.element;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import slimeknights.mantle.client.screen.book.BookScreen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ElementTooltip extends SizedBookElement {
|
||||
private List<String> tooltip;
|
||||
|
||||
public ElementTooltip(List<String> tooltip, int x, int y, int width, int height) {
|
||||
super(x, y, width, height);
|
||||
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY, float partialTicks, FontRenderer fontRenderer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOverlay(int mouseX, int mouseY, float partialTicks, FontRenderer fontRenderer) {
|
||||
if (this.isHovered(mouseX, mouseY)) {
|
||||
GuiUtils.drawHoveringText(tooltip, mouseX, mouseY, BookScreen.PAGE_WIDTH, BookScreen.PAGE_HEIGHT, BookScreen.PAGE_WIDTH, fontRenderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user