Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into anita-medal
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Dec 25, 2024
2 parents 456b4d2 + ea9d839 commit c413299
Show file tree
Hide file tree
Showing 12 changed files with 261 additions and 170 deletions.
196 changes: 70 additions & 126 deletions docs/INSTALLING.md
Original file line number Diff line number Diff line change
@@ -1,134 +1,78 @@
# Download and Install SkyHanni

SkyHanni is a Forge mod for **Minecraft 1.8.9 only**.
Trying to run this on Badlion, Lunar, Feather, or newer versions of Minecraft is **not supported**.
Running SkyHanni on Badlion, Lunar, Feather, or newer versions of Minecraft is **not supported**.

Follow this guide to install SkyHanni in regular Minecraft Forge.
If you already have Forge mods, you can skip to step 4. Otherwise, start from step 1.
If you already have the latest alpha version from NEU, you can skip to step 5.

<details>
<summary>1. Run vanilla 1.8.9</summary>

Run Minecraft 1.8.9, unmodded, for 10 seconds, then close it.

</details>


<details>
<summary>2. Install Java</summary>

To play with mods, you need Java.
Install [Java 8](https://www.java.com/download/ie_manual.jsp).
Double-click the file to install it.

</details>


<details>
<summary>3. Install Forge</summary>

Forge is the system that loads your mods into the game.
You need Java to run Forge.
Download [Forge for 1.8.9](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.8.9.html).
Click installer, when you double-click the file, install as client.
If Forge does not open with Java, download [Jarfix](https://johann.loefflmann.net/en/software/jarfix/index.html),
double click it, then try running Forge again.

</details>


<details>
<summary>4. Download NEU</summary>

Neu is NotEnoughUpdates, another Forge mod that contains files that SkyHanni depends on to function.
You can install it from [Moulberry's Bush Discord Server](https://discord.gg/moulberry) in the
channel [#🧪neu-alphas](https://discord.com/channels/516977525906341928/1028896920346841118) or
from [SkyHanni Discord](https://discord.com/invite/skyhanni-997079228510117908) in the
channel [#neu-updates](https://discord.com/channels/997079228510117908/1123201092193366027)

</details>


<details>
<summary>5. Download SkyHanni</summary>

SkyHanni has two different update circles: [Full Release](https://github.com/hannibal002/SkyHanni/releases/latest)
and [Beta](https://github.com/hannibal002/SkyHanni/releases).

In general, it is recommended to use the **Full Release**.
It updates every 3–4 weeks and should run very stable.
If you find bugs or miss features in the full version, they might be fixed/implemented already in a beta version.

The **Beta Version**, on the other hand, gets updated multiple times a week,
has new features earlier, but also may contain more bugs.

</details>


<details>
<summary>6. Find .minecraft</summary>

Once you have downloaded both NEU and SkyHanni, you need to navigate to your `.minecraft` folder.
On Windows, open file explorer, in the file location bar at the top type in `%appdata%` and open `.minecraft`.
On Mac, go to `~/Library/Application Support/minecraft`.

</details>


<details>

<summary>7. Move mods into mods folder</summary>

If there is a "mods" folder, great! Open it.
Otherwise, create one and name it exactly "mods".

Move both your downloaded NEU file and SkyHanni file into the folder.
(If you have already an older version of NEU or SkyHanni in that folder, delete it.)

*Note: if you have a problem, people may ask to see your mod folder - that is this folder.*

</details>


<details>
<summary>8. Setup RAM</summary>

If you're running mods, you also need to set up your allocated ram.
If you don't know how much ram your computer has,
follow [this guide](https://www.howtogeek.com/435644/how-to-see-how-much-ram-is-in-your-pc-and-its-speed/).
To allocate ram, go to installation, press the 3 dots next to the installation you are using,
click edit, press more options.
In JVM arguments, look for something that says -Xmx2G or some other number followed by G.
That number is the amount you have allocated for Minecraft to use.
If you have 2G of ram on your computer, you might struggle to play Minecraft.
Try to allocate 1G. If you have 4G, allocate 2G. If you
have 8 or more G, allocate 4G.
You should never need more than 4G, unless you have more mods, than you know what to do.

</details>


<details>
<summary>9. Launch the Forge profile in the launcher</summary>

Installing Minecraft Forge should have set the profile for you, but if it didn't, go to installations,
select new installation, under version you need to find Forge for 1.8.9 (most likely at the top or bottom)

</details>


<details>
<summary>10. Recommended additional mods (optional)</summary>

[OptiFine](https://optifine.net/adloadx?f=preview_OptiFine_1.8.9_HD_U_M6_pre2.jar)
and either [Sk1erLLC's Patcher](https://sk1er.club/mods/patcher) or [Polyfrost's PolyPatcher](<https://modrinth.com/mod/patcher>) (a fork of Patcher with OneConfig, slightly different features, and bug fixes, including fixed cactus hitboxes)

Those two mods help you get more FPS in game and let you change many more performance
settings.

*Ask on discord if you need help with those.*

</details>

<h2>And finally, don't forget to <i><b>never run a file that is sent to you in dms</b></i></h2>
> **1: Run vanilla 1.8.9**
> Run Minecraft 1.8.9, unmodded, for 10 seconds, then close it.
> **2: Install Java**
> To play with mods, you need Java 8.
> Install [Java 8](<https://www.java.com/en/download/>).
> Double-click the file to install it.
> **3: Install Forge**
> Forge is the system that loads your mods into the game.
> You need Java to run Forge.
> Download [Forge for 1.8.9](<https://maven.minecraftforge.net/net/minecraftforge/forge/1.8.9-11.15.1.2318-1.8.9/forge-1.8.9-11.15.1.2318-1.8.9-installer.jar>).
> When you double-click the file, install as client.
> If Forge does not open with Java, download [Jarfix](<https://johann.loefflmann.net/en/software/jarfix/index.html>), double-click it, then try running Forge again.
> **4: Download NEU**
> NEU is NotEnoughUpdates, another Forge mod that contains files that SkyHanni depends on to function.
> You can install it from any of those spots:
> - [Modrinth](<https://modrinth.com/mod/notenoughupdates>)
> - [Moulberry's Bush Discord Server](<https://discord.gg/moulberry>) in the channel [#neu-download](<https://discord.com/channels/516977525906341928/693586404256645231>)
> - [SkyHanni Discord](<https://discord.com/invite/skyhanni-997079228510117908>) in the channel #neu-updates.
> **5: Download SkyHanni**
> SkyHanni has two different update circles: [Full Release](<https://github.com/hannibal002/SkyHanni/releases/latest>) and [Beta](<https://github.com/hannibal002/SkyHanni/releases>).
> It is recommended to use the **Full Release**.
> It updates every 3–4 weeks and should run very stable.
> If you find bugs or miss features in the full version, they might be fixed/implemented already in a beta version.
> The **Beta Version**, on the other hand, gets updated multiple times a week, has new features earlier, but may also contain more bugs.
> **6: Find .minecraft**
> Once you have downloaded both NEU and SkyHanni, you need to navigate to your `.minecraft` folder.
> - On Windows, open File Explorer, in the file location bar at the top type in `%appdata%` and open `.minecraft`.
> - On Mac, open Finder, click on "Go" at the top of your screen and then "Go to Folder" and type in `~/Library/Application Support/Minecraft`.
> - On Linux, `.minecraft` is located in your home folder. `~/.minecraft`
> **7: Move mods into mods folder**
> If there is a `mods` folder, great! Open it.
> Otherwise, create a new folder and name it exactly `mods`.
> Move the NEU and SkyHanni files you downloaded into the folder.
> Remove older versions of NEU or SkyHanni in that folder before adding the new files.
> *Note: If you encounter a problem, support may ask for a screenshot of your mods folder: this is the folder you just set up.*
> **8: Setup RAM**
> If you're running mods, you also need to set up your RAM.
> If you don't know how much RAM your computer has, follow [this guide](<https://www.howtogeek.com/435644/how-to-see-how-much-ram-is-in-your-pc-and-its-speed/>).
> To allocate RAM, go to Installations, press the 3 dots next to the installation you are using, click edit, and press the `More Options` button.
> In JVM arguments, look for something that says `-Xmx2G` or some other number followed by `G`.
> - If you have 4GB, allocate 2GB.
> - If you have 8GB or more, allocate 4GB.
> You generally don't need more than 4GB unless you are using an extensive number of mods.
> **9: Launch the Forge profile in the launcher**
> Installing Minecraft Forge should have set the profile for you, but if it didn't, go to installations, select new installation, and under version, find Forge for 1.8.9 (most likely at the top or bottom).
> **10: Recommended additional mods (optional)**
> [OptiFine](<https://optifine.net/adloadx?f=preview_OptiFine_1.8.9_HD_U_M6_pre2.jar>) and either [Sk1erLLC's Patcher](<https://sk1er.club/mods/patcher>) or [Polyfrost's PolyPatcher](<https://modrinth.com/mod/patcher>) (a fork of Patcher with OneConfig, slightly different features, and bug fixes, including fixed cactus hitboxes).
> Those two mods help you get more FPS in-game and let you change many more performance settings.
*Ask in #support if you need help with a step during installation.
If you have any other questions about the mod, please read our #faq before asking in #support for help.*

> **Important note**
> Never run files sent to you via Discord or other messaging apps.
> **Quick Download Links**
> Full Release: #releases
> Beta: #beta
*This guide was last updated on December 24th, 2024.*
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public class ChocolateFactoryConfig {
@ConfigEditorBoolean
public boolean showStackSizes = true;

@Expose
@ConfigOption(name = "Contributor Rabbit Name", desc = "Replaces the rabbit names in the rabbit collection menu with SkyHanni contributor names.")
@ConfigEditorBoolean
public boolean contributorRabbitName = false;

@Expose
@ConfigOption(name = "Highlight Upgrades", desc = "Highlight any upgrades that you can afford.\n" +
"The upgrade with a star is the most optimal and the lightest color of green is the most optimal you can afford.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule

@SkyHanniModule
object HoppityCollectionData {
private val rabbitRarities = mutableMapOf<String, RabbitCollectionRarity>()
val rabbitRarities = mutableMapOf<String, RabbitCollectionRarity>()
private val rarityBonuses = mutableMapOf<RabbitCollectionRarity, ChocolateBonuses>()
private val specialBonuses = mutableMapOf<String, ChocolateBonuses>()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package at.hannibal2.skyhanni.features.event.hoppity

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.item.ItemHoverEvent
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI
import at.hannibal2.skyhanni.features.misc.ContributorManager
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.CircularList
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

@SkyHanniModule
object ReplaceHoppityWithContributor {

private val config get() = ChocolateFactoryAPI.config

private val replaceMap = mutableMapOf<String, String>()

@HandleEvent(priority = 5)
fun onNeuRepoReload(event: NeuRepositoryReloadEvent) {
update()
}

@SubscribeEvent(priority = EventPriority.LOW)
fun onRepoReload(event: RepositoryReloadEvent) {
update()
}

fun update() {
replaceMap.clear()

val contributors = ContributorManager.contributorNames
val rabbits = HoppityCollectionData.rabbitRarities

if (contributors.isEmpty()) return
if (rabbits.isEmpty()) return

val newNames = CircularList(contributors.toList())
for (internalName in rabbits.map { it.key }.shuffled()) {
val realName = internalName.allLettersFirstUppercase()
val newName = newNames.next()
replaceMap[realName] = newName
}
}

@HandleEvent(priority = HandleEvent.LOWEST)
fun onTooltip(event: ItemHoverEvent) {
if (!isEnabled()) return
if (!HoppityCollectionStats.inInventory) return

val itemStack = event.itemStack
val lore = itemStack.getLore()
val last = lore.lastOrNull() ?: return
if (!last.endsWith(" RABBIT")) return

val realName = itemStack.name
val cleanName = realName.removeColor()
val fakeName = replaceMap[cleanName] ?: return

val newName = event.toolTip[0].replace(cleanName, fakeName)
event.toolTip[0] = newName

event.toolTip.add(" ")
event.toolTip.add("§8§oSome might say this rabbit is also known as $realName")

// TODO find a way to handle non containing entries in a kotlin nullable way instead of checking for -1
val index = event.toolTip.indexOfFirst { it.contains(" a duplicate") }
if (index == -1) return
val oldLine = event.toolTip[index]
val newLine = oldLine.replace(cleanName, fakeName)
event.toolTip[index] = newLine
}

fun isEnabled() = LorenzUtils.inSkyBlock && config.contributorRabbitName
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,13 @@ object CustomScoreboard {

@HandleEvent
fun onIslandChange(event: IslandChangeEvent) {
if (event.newIsland != IslandType.NONE) updateIslandEntries()
if (event.newIsland != IslandType.NONE) {
updateIslandEntries()

runDelayed(3.seconds) {
updateIslandEntries()
}
}
}

private fun updateIslandEntries() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ object ChocolateFactoryStrayWarning {
else event.strayHighlight()
}

private fun GuiContainerEvent.getEventChest(): ContainerChest? =
gui.inventorySlots as? ContainerChest

private fun GuiContainerEvent.BackgroundDrawnEvent.partyModeHighlight() {
val eventChest = (gui.inventorySlots as ContainerChest)
val eventChest = getEventChest() ?: return
eventChest.getUpperItems().keys.forEach { it highlight CHROMA_COLOR_ALT.toSpecialColor() }
eventChest.inventorySlots.filter {
it.slotNumber != it.slotIndex
Expand All @@ -106,7 +109,8 @@ object ChocolateFactoryStrayWarning {
}

private fun GuiContainerEvent.BackgroundDrawnEvent.strayHighlight() {
(gui.inventorySlots as ContainerChest).getUpperItems().keys.filter {
val eventChest = getEventChest() ?: return
eventChest.getUpperItems().keys.filter {
it.slotNumber in activeStraySlots
}.forEach {
it highlight warningConfig.inventoryHighlightColor.toSpecialColor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object ContributorManager {
private val config get() = SkyHanniMod.feature.dev

// Key is the lowercase contributor name
private var contributors: Map<String, ContributorJsonEntry> = emptyMap()

// Just the names of the contributors including their proper case
var contributorNames = emptyList<String>()
private set

@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
contributors = event.getConstant<ContributorsJson>("Contributors").contributors.mapKeys { it.key.lowercase() }
val map = event.getConstant<ContributorsJson>("Contributors").contributors
contributors = map.mapKeys { it.key.lowercase() }
contributorNames = map.map { it.key }
}

@HandleEvent
Expand Down
Loading

0 comments on commit c413299

Please sign in to comment.