Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into remove-neu
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/utils/NEUVersionCheck.kt
  • Loading branch information
CalMWolfs committed Nov 24, 2024
2 parents 3cb7b84 + 40f3918 commit 6f27d6d
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public class DungeonConfig {
@ConfigOption(name = "Terminal Waypoints", desc = "Displays Waypoints in the F7/M7 Goldor Phase.")
@ConfigEditorBoolean
@FeatureToggle
public boolean terminalWaypoints = false;
public boolean terminalWaypoints = true;

@Expose
@ConfigOption(name = "Dungeon Races Guide", desc = "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class MiningConfig {
@ConfigOption(name = "Private Island Ability Block", desc = "Block the mining ability when on private island.")
@ConfigEditorBoolean
@FeatureToggle
public boolean privateIslandNoPickaxeAbility = false;
public boolean privateIslandNoPickaxeAbility = true;

@Expose
@ConfigOption(name = "Highlight your Golden Goblin", desc = "Highlight golden goblins you have spawned in green.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package at.hannibal2.skyhanni.data.jsonobjects.other

import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.pests.PestType
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

Expand All @@ -14,10 +12,10 @@ data class WeightProfile(
@Expose val profileId: String,
@Expose val profileName: String,
@Expose val totalWeight: Double,
@Expose val cropWeight: Map<CropType, Double>,
@Expose val cropWeight: Map<String, Double>,
@Expose val bonusWeight: Map<String, Int>,
@Expose val uncountedCrops: Map<CropType, Int>,
@Expose val pests: Map<PestType, Int>,
@Expose val uncountedCrops: Map<String, Int>,
@Expose val pests: Map<String, Int>,
)

data class EliteLeaderboardJson(
Expand All @@ -36,11 +34,11 @@ data class UpcomingLeaderboardPlayer(
)

data class EliteWeightsJson(
@Expose val crops: Map<CropType, Double>,
@Expose val crops: Map<String, Double>,
@Expose val pests: PestWeightData,
)

data class PestWeightData(
@Expose val brackets: Map<Int, Int>,
@Expose @SerializedName("values") val pestWeights: Map<PestType, Map<Int, Double>>,
@Expose @SerializedName("values") val pestWeights: Map<String, Map<Int, Double>>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@ object FarmingWeightDisplay {
val apiData = eliteWeightApiGson.fromJson<EliteWeightsJson>(apiResponse)
apiData.crops
for (crop in apiData.crops) {
cropWeight[crop.key] = crop.value
val cropType = CropType.getByNameOrNull(crop.key) ?: continue
cropWeight[cropType] = crop.value
}
hasFetchedCropWeights = true
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ object GardenCropSpeed {
}

private fun checkSpeed() {
val blocksBroken = blocksBroken.coerceAtMost(20)
val blocksBroken = blocksBroken
this.blocksBroken = 0

if (blocksBroken == 0) {
Expand All @@ -105,9 +105,9 @@ object GardenCropSpeed {
}
}
averageBlocksPerSecond = if (blocksSpeedList.size > 5) {
blocksSpeedList.drop(3).average()
blocksSpeedList.drop(3).average().coerceAtMost(20.0)
} else if (blocksSpeedList.size > 1) {
blocksSpeedList.drop(1).average()
blocksSpeedList.drop(1).average().coerceAtMost(20.0)
} else 0.0
GardenAPI.getCurrentlyFarmedCrop()?.let {
val heldTool = InventoryUtils.getItemInHand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.mixins.transformers.AccessorKeyBinding
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyClicked
import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import io.github.notenoughupdates.moulconfig.observer.Property
import net.minecraft.client.Minecraft
Expand All @@ -34,15 +33,11 @@ object GardenCustomKeybinds {
private var lastDuplicateKeybindsWarnTime = SimpleTimeMark.farPast()
private var isDuplicate = false

private fun Int.keybind() = (mcSettings.keyBindAttack as AccessorKeyBinding).hash_skyhanni.lookup(this)
?: ErrorManager.skyHanniError("Keybind $this not found")

@JvmStatic
fun isKeyDown(keyBinding: KeyBinding, cir: CallbackInfoReturnable<Boolean>) {
if (!isActive()) return
val override = map[keyBinding]?.keybind() ?: return
val accessor = override as AccessorKeyBinding
cir.returnValue = accessor.pressed_skyhanni
val override = map[keyBinding] ?: return
cir.returnValue = override.isKeyHeld()
}

@JvmStatic
Expand Down Expand Up @@ -86,8 +81,7 @@ object GardenCustomKeybinds {
with(mcSettings) {
map = buildMap {
fun add(keyBinding: KeyBinding, property: Property<Int>) {
val value = property.get()
if (value != keyBinding.keyCode) put(keyBinding, value)
put(keyBinding, property.get())
}
add(keyBindAttack, attack)
add(keyBindUseItem, useItem)
Expand All @@ -114,7 +108,9 @@ object GardenCustomKeybinds {
private fun isEnabled() = GardenAPI.inGarden() && config.enabled && !(GardenAPI.onBarnPlot && config.excludeBarn)

private fun isActive(): Boolean =
isEnabled() && GardenAPI.toolInHand != null && !isDuplicate && lastWindowOpenTime.passedSince() > 300.milliseconds
isEnabled() && GardenAPI.toolInHand != null && !isDuplicate && !hasGuiOpen() && lastWindowOpenTime.passedSince() > 300.milliseconds

private fun hasGuiOpen() = Minecraft.getMinecraft().currentScreen != null

@JvmStatic
fun disableAll() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ object GraphEditorBugFinder {
val areaNode = pathToNearestArea.lastOrNull() ?: error("Empty path to nearest area")
nearestArea[node] = areaNode
}
var bugs = 0
for (node in nodes) {
val areaNode = nearestArea[node]?.name ?: continue
for (neighbour in node.neighbours.keys) {
val neighbouringAreaNode = nearestArea[neighbour]?.name ?: continue
if (neighbouringAreaNode == areaNode) continue
if ((null == node.getAreaTag())) {
bugs++
errorsInWorld[node] = "§cConflicting areas $areaNode and $neighbouringAreaNode"
}
}
Expand All @@ -67,11 +65,9 @@ object GraphEditorBugFinder {
val tagsEmpty = node.tags.isEmpty()
if (nameNull > tagsEmpty) {
errorsInWorld[node] = "§cMissing name despite having tags"
bugs++
}
if (tagsEmpty > nameNull) {
errorsInWorld[node] = "§cMissing tags despite having name"
bugs++
}
}

Expand All @@ -82,14 +78,12 @@ object GraphEditorBugFinder {
val closestForeignNodes = foreignClusters.map { network -> network.minBy { it.position.distanceSqToPlayer() } }
closestForeignNodes.forEach {
errorsInWorld[it] = "§cDisjoint node network"
bugs++
}
val closestForeignNode = closestForeignNodes.minBy { it.position.distanceSqToPlayer() }
val closestNodeToForeignNode = closestCluster.minBy { it.position.distanceSq(closestForeignNode.position) }
closestNodeToForeignNode.pathFind("Graph Editor Bug", Color.RED, condition = { isEnabled() })
}

println("found $bugs bugs!")
this.errorsInWorld = errorsInWorld
if (clusters.size <= 1) {
errorsInWorld.keys.minByOrNull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ private static void openMenu(URI host) {

// Compile the regex pattern for matching an empty host
Pattern pattern = Pattern.compile("https:\\/\\/.*.com\\/$|about:internet");
Matcher matcher = pattern.matcher(uriToSimpleString(host));
String readableHost = uriToSimpleString(host);
Matcher matcher = pattern.matcher(readableHost);

// Check if the host is empty (Brave is cutting everything past .com/ from the host)
String cutHostMessage = "";
Expand All @@ -91,9 +92,10 @@ private static void openMenu(URI host) {
"Try downloading the file using a different browser (Microsoft Edge, Google Chrome, etc.).";
}

System.err.println("SkyHanni-" + MOD_VERSION + " detected a untrusted download source host: '" + readableHost + "'");
JOptionPane.showOptionDialog(
frame,
String.format(String.join("\n", SECURITY_POPUP), uriToSimpleString(host)) + cutHostMessage,
String.format(String.join("\n", SECURITY_POPUP), readableHost) + cutHostMessage,
"SkyHanni " + MOD_VERSION + " Security Error",
JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void acceptOptions(List<String> args, File gameDir, File assetsDir, Strin
CoreModManager.getIgnoredMods().remove(file);
CoreModManager.getReparseableCoremods().add(file);
} catch (URISyntaxException e) {
System.err.println("SkyHanni could not re-add itself as mod.");
System.err.println("SkyHanni-@MOD_VERSION@ could not re-add itself as mod.");
e.printStackTrace();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,5 @@ object ChatUtils {
replaceSameMessage = true,
)
}

}
7 changes: 3 additions & 4 deletions src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,9 @@ object LorenzUtils {
inline fun <reified T : Enum<T>> T.isAnyOf(vararg array: T): Boolean = array.contains(this)

fun shutdownMinecraft(reason: String? = null) {
System.err.println("SkyHanni-${SkyHanniMod.version} forced the game to shutdown.")
reason?.let {
System.err.println("Reason: $it")
}
val reasonLine = reason?.let { " Reason: $it" }.orEmpty()
System.err.println("SkyHanni-@MOD_VERSION@ ${"forced the game to shutdown.$reasonLine"}")

FMLCommonHandler.instance().handleExit(-1)
}

Expand Down

0 comments on commit 6f27d6d

Please sign in to comment.