diff options
Diffstat (limited to 'src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java')
-rw-r--r-- | src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java new file mode 100644 index 0000000..8f15fa7 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java @@ -0,0 +1,31 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class StartsWithSolver { + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + String displayName = event.displayName; + if (ToggleCommand.startsWithToggled && Utils.inDungeons && displayName.startsWith("What starts with:")) { + char letter = displayName.charAt(displayName.indexOf("'") + 1); + for (Slot slot : event.slots) { + if (slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) continue; + ItemStack item = slot.getStack(); + if (item == null) continue; + if (item.isItemEnchanted()) continue; + if (StringUtils.stripControlCodes(item.getDisplayName()).charAt(0) == letter) { + Utils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); + } + } + } + } + +} |