diff options
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/events')
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/events/GatherComponentsExtEvent.java | 21 | ||||
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/events/RenderTooltipExtEvent.java | 38 |
2 files changed, 51 insertions, 8 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/events/GatherComponentsExtEvent.java b/src/main/java/com/anthonyhilyard/iceberg/events/GatherComponentsExtEvent.java new file mode 100644 index 0000000..753c7c0 --- /dev/null +++ b/src/main/java/com/anthonyhilyard/iceberg/events/GatherComponentsExtEvent.java @@ -0,0 +1,21 @@ +package com.anthonyhilyard.iceberg.events; + +import java.util.List; + +import com.mojang.datafixers.util.Either; + +import net.minecraft.network.chat.FormattedText; +import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.client.event.RenderTooltipEvent.GatherComponents; + +public class GatherComponentsExtEvent extends GatherComponents +{ + private final int index; + public GatherComponentsExtEvent(ItemStack itemStack, int screenWidth, int screenHeight, List<Either<FormattedText, TooltipComponent>> tooltipElements, int maxWidth, int index) + { + super(itemStack, screenWidth, screenHeight, tooltipElements, maxWidth); + this.index = index; + } + public int getIndex() { return index; } +} diff --git a/src/main/java/com/anthonyhilyard/iceberg/events/RenderTooltipExtEvent.java b/src/main/java/com/anthonyhilyard/iceberg/events/RenderTooltipExtEvent.java index 98f01a6..febe70f 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/events/RenderTooltipExtEvent.java +++ b/src/main/java/com/anthonyhilyard/iceberg/events/RenderTooltipExtEvent.java @@ -14,30 +14,45 @@ public class RenderTooltipExtEvent public static class Pre extends RenderTooltipEvent.Pre { private final boolean comparisonTooltip; + private final int index; - public Pre(ItemStack stack, PoseStack PoseStack, int x, int y, int screenWidth, int screenHeight, Font font, List<ClientTooltipComponent> components, boolean comparison) + public Pre(ItemStack stack, PoseStack PoseStack, int x, int y, int screenWidth, int screenHeight, Font font, List<ClientTooltipComponent> components, boolean comparison, int index) { super(stack, PoseStack, x, y, screenWidth, screenHeight, font, components); - comparisonTooltip = comparison; + this.comparisonTooltip = comparison; + this.index = index; + } + + public Pre(ItemStack stack, PoseStack PoseStack, int x, int y, int screenWidth, int screenHeight, Font font, List<ClientTooltipComponent> components, boolean comparison) + { + this(stack, PoseStack, x, y, screenWidth, screenHeight, font, components, comparison, 0); } public boolean isComparison() { return comparisonTooltip; } + public int getIndex() { return index; } } public static class Post extends RenderTooltipEvent { private final boolean comparisonTooltip; + private final int index; private final int width; private final int height; - public Post(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int width, int height, List<ClientTooltipComponent> components, boolean comparison) + public Post(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int width, int height, List<ClientTooltipComponent> components, boolean comparison, int index) { super(stack, PoseStack, x, y, font, components); this.width = width; this.height = height; + this.comparisonTooltip = comparison; + this.index = index; + } - comparisonTooltip = comparison; + public Post(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int width, int height, List<ClientTooltipComponent> components, boolean comparison) + { + this(stack, PoseStack, x, y, font, width, height, components, comparison, 0); } public boolean isComparison() { return comparisonTooltip; } + public int getIndex() { return index; } public int getWidth() { return width; } public int getHeight() { return height; } } @@ -45,18 +60,25 @@ public class RenderTooltipExtEvent public static class Color extends RenderTooltipEvent.Color { private final boolean comparisonTooltip; + private final int index; - public Color(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int background, int borderStart, int borderEnd, List<ClientTooltipComponent> components, boolean comparison) + public Color(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int background, int borderStart, int borderEnd, List<ClientTooltipComponent> components, boolean comparison, int index) { super(stack, PoseStack, x, y, font, background, borderStart, borderEnd, components); - comparisonTooltip = comparison; + this.comparisonTooltip = comparison; + this.index = index; + } + public Color(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int background, int borderStart, int borderEnd, List<ClientTooltipComponent> components, boolean comparison) + { + this(stack, PoseStack, x, y, font, background, borderStart, borderEnd, components, comparison, 0); } - public Color(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int backgroundStart, int backgroundEnd, int borderStart, int borderEnd, List<ClientTooltipComponent> components, boolean comparison) + public Color(ItemStack stack, PoseStack PoseStack, int x, int y, Font font, int backgroundStart, int backgroundEnd, int borderStart, int borderEnd, List<ClientTooltipComponent> components, boolean comparison, int index) { - this(stack, PoseStack, x, y, font, backgroundStart, borderStart, borderEnd, components, comparison); + this(stack, PoseStack, x, y, font, backgroundStart, borderStart, borderEnd, components, comparison, index); setBackgroundStart(backgroundStart); setBackgroundEnd(backgroundEnd); } public boolean isComparison() { return comparisonTooltip; } + public int getIndex() { return index; } } } |