generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
173 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 0 additions & 19 deletions
19
src/main/java/org/hiedacamellia/whispergrove/content/client/screen/VisceraScreen.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
src/main/java/org/hiedacamellia/whispergrove/content/client/tab/ViscerEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.hiedacamellia.whispergrove.content.client.tab; | ||
|
||
import com.mojang.datafixers.util.Pair; | ||
import dev.xkmc.l2library.util.TextWrapper; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.util.FormattedCharSequence; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.hiedacamellia.whispergrove.WhisperGrove; | ||
import org.hiedacamellia.whispergrove.api.viscera.VisceraHolder; | ||
import org.hiedacamellia.whispergrove.content.viscera.*; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public record ViscerEntry( | ||
List<Component> hover, | ||
Component content, | ||
ResourceLocation icon | ||
){ | ||
|
||
public static List<ViscerEntry> aggregate(@Nullable Player le) { | ||
if (le == null) return List.of(); | ||
List<ViscerEntry> raw = new ArrayList<>(); | ||
|
||
raw.add(new ViscerEntry(HeartEvent.getHover(le), HeartEvent.getdesc(le), | ||
WhisperGrove.prefix("textures/viscera/heart.png"))); | ||
raw.add(new ViscerEntry(KidneyEvent.getHover(le), KidneyEvent.getdesc(le), | ||
WhisperGrove.prefix("textures/viscera/kidney.png"))); | ||
raw.add(new ViscerEntry(LiverEvent.getHover(le), LiverEvent.getdesc(le), | ||
WhisperGrove.prefix("textures/viscera/liver.png"))); | ||
raw.add(new ViscerEntry(LungEvent.getHover(le), LungEvent.getdesc(le), | ||
WhisperGrove.prefix("textures/viscera/lung.png"))); | ||
raw.add(new ViscerEntry(SpleenEvent.getHover(le), SpleenEvent.getdesc(le), | ||
WhisperGrove.prefix("textures/viscera/spleen.png"))); | ||
|
||
return raw; | ||
} | ||
|
||
} |
71 changes: 71 additions & 0 deletions
71
src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.hiedacamellia.whispergrove.content.client.tab; | ||
|
||
import dev.xkmc.l2core.util.Proxy; | ||
import dev.xkmc.l2tabs.tabs.contents.BaseTextScreen; | ||
import dev.xkmc.l2tabs.tabs.core.TabManager; | ||
import dev.xkmc.l2tabs.tabs.inventory.InvTabData; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Font; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.player.Player; | ||
import org.hiedacamellia.whispergrove.core.debug.Debug; | ||
import org.hiedacamellia.whispergrove.registers.WGTab; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public class VisceraScreen extends BaseTextScreen { | ||
|
||
private final int page; | ||
|
||
protected VisceraScreen(Component title) { | ||
this(title, 0); | ||
} | ||
|
||
protected VisceraScreen(Component title, int page) { | ||
super(title, ResourceLocation.fromNamespaceAndPath("l2tabs", "textures/gui/empty.png")); | ||
this.page = page; | ||
} | ||
|
||
@Override | ||
public void init() { | ||
super.init(); | ||
new TabManager<>(this, new InvTabData()).init(this::addRenderableWidget, WGTab.TAB_VISCERA.get()); | ||
} | ||
|
||
|
||
@Override | ||
public void render(GuiGraphics g, int mx, int my, float ptick) { | ||
super.render(g, mx, my, ptick); | ||
Player player = Proxy.getClientPlayer(); | ||
int x = leftPos + 8; | ||
int y = topPos + 6; | ||
var all = ViscerEntry.aggregate(player); | ||
//Debug.getLogger().debug("all: " + all); | ||
List<Component> hover = null; | ||
Font font = Minecraft.getInstance().font; | ||
for (var pair : all) { | ||
//Debug.getLogger().debug("pair: " + pair); | ||
int index = all.indexOf(pair); | ||
g.blit(pair.icon(), x , y+ index*32, 0, 0, 16, 16, 16, 16); | ||
g.drawString(font, pair.content().getString(), x, y + index*32 +16, 0,false); | ||
|
||
//Debug.getLogger().debug("pair: " + pair); | ||
int row = y + index * 32 +16; | ||
int column = x; | ||
int rowAft = y + index * 32 + 26; | ||
int columnAft = x + font.width(pair.content()); | ||
if (my >= row && my < rowAft && mx >= column && mx < columnAft) { | ||
hover = pair.hover(); | ||
} | ||
|
||
} | ||
if (hover != null) { | ||
g.renderTooltip(font, hover, Optional.empty(), mx, my); | ||
} | ||
} | ||
|
||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.hiedacamellia.whispergrove.content.client.tab; | ||
|
||
import dev.xkmc.l2tabs.init.L2Tabs; | ||
import dev.xkmc.l2tabs.tabs.core.TabBase; | ||
import dev.xkmc.l2tabs.tabs.core.TabManager; | ||
import dev.xkmc.l2tabs.tabs.core.TabToken; | ||
import dev.xkmc.l2tabs.tabs.inventory.InvTabData; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.hiedacamellia.whispergrove.registers.WGItem; | ||
|
||
public class VisceraTab extends TabBase<InvTabData, VisceraTab> { | ||
public VisceraTab(int index, TabToken<InvTabData, VisceraTab> token, TabManager<InvTabData> manager, Component title) { | ||
super(index, token, manager, title); | ||
} | ||
|
||
@Override | ||
public void onTabClicked() { | ||
Minecraft.getInstance().setScreen(new VisceraScreen(this.getMessage())); | ||
} | ||
|
||
@Override | ||
protected void renderIcon(GuiGraphics g) { | ||
ItemStack stack = WGItem.BAMBOO_LEAF.toStack(); | ||
if (!stack.isEmpty()) { | ||
this.token.getType().drawIcon(g, this.getX(), this.getY(), stack); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ public ItemStack getItem(int slot) { | |
|
||
@Override | ||
public int size() { | ||
return 10; | ||
return 9; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters