From 69a9e12bd09e2ed936d25ccb7c3e1bd1a01f03ad Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 11 Jul 2022 02:52:45 +0200 Subject: updated to version 0.4.2 --- .../at/lorenz/mod/ItemDisplayOverlayFeatures.kt | 2 +- src/main/java/at/lorenz/mod/LorenzMod.java | 2 +- .../damageindicator/DungeonBossDamageIndicator.kt | 12 ++++-- .../dungeon/damageindicator/DungeonBossFinder.kt | 48 +++++++++++++++++++++- 4 files changed, 56 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/lorenz/mod/ItemDisplayOverlayFeatures.kt b/src/main/java/at/lorenz/mod/ItemDisplayOverlayFeatures.kt index 00b81f3ee..e051e9438 100644 --- a/src/main/java/at/lorenz/mod/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/lorenz/mod/ItemDisplayOverlayFeatures.kt @@ -73,7 +73,7 @@ class ItemDisplayOverlayFeatures { } if (LorenzMod.feature.item.displayNewYearCakeNumber) { - if (name.startsWith("New Year Cake")) { + if (name.startsWith("New Year Cake (")) { try { return "§b" + name.between("(Year ", ")") } catch (e: IndexOutOfBoundsException) { diff --git a/src/main/java/at/lorenz/mod/LorenzMod.java b/src/main/java/at/lorenz/mod/LorenzMod.java index 6365d9906..634841201 100644 --- a/src/main/java/at/lorenz/mod/LorenzMod.java +++ b/src/main/java/at/lorenz/mod/LorenzMod.java @@ -29,7 +29,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; public class LorenzMod { public static final String MODID = "lorenzmod"; - public static final String VERSION = "0.4.1"; + public static final String VERSION = "0.4.2"; // public static SBHConfig config; //TODO delete diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt index 47e0d7f52..5d6be2a51 100644 --- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt +++ b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt @@ -108,12 +108,16 @@ class DungeonBossDamageIndicator { val currentMaxHealth = event.entity.baseMaxHealth val debugMaxHealth = getMaxHealthFor(event.entity) - val biggestHealth = max(currentMaxHealth, debugMaxHealth) - if (biggestHealth > debugMaxHealth) { + val biggestHealth: Double + val health = event.entity.health + 0.0 + if (debugMaxHealth == 0.0) { + biggestHealth = max(currentMaxHealth, health) setMaxHealth(event.entity, biggestHealth) + } else { + biggestHealth = debugMaxHealth } - val percentage = event.entity.health / max(debugMaxHealth, currentMaxHealth) + val percentage = health / biggestHealth val color = when { percentage > 0.9 -> LorenzColor.DARK_GREEN percentage > 0.75 -> LorenzColor.GREEN @@ -124,7 +128,7 @@ class DungeonBossDamageIndicator { data[entity] = EntityData( entity, - NumberUtil.format(event.entity.health), + NumberUtil.format(health), color, System.currentTimeMillis(), ignoreBlocks, diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt index edc38edeb..0a4090b21 100644 --- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt +++ b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt @@ -4,6 +4,7 @@ import at.lorenz.mod.dungeon.DungeonData import at.lorenz.mod.utils.LorenzUtils import at.lorenz.mod.utils.LorenzUtils.baseMaxHealth import at.lorenz.mod.utils.LorenzUtils.matchRegex +import at.lorenz.mod.utils.LorenzVec import at.lorenz.mod.utils.getLorenzVec import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP @@ -11,6 +12,7 @@ import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.monster.EntityGiantZombie import net.minecraft.entity.monster.EntityGuardian +import java.util.* class DungeonBossFinder { @@ -44,6 +46,7 @@ class DungeonBossFinder { //F6 private var floor6Giants = false private var floor6GiantsSpawnTime = 0L //TODO different giants cooldown delayed from each other + private var floor6GiantsSeparateDelay = mutableMapOf() private var floor6Sadan = false private var floor6SadanSpawnTime = 0L @@ -168,8 +171,10 @@ class DungeonBossFinder { if (DungeonData.isOneOf("F6", "M6")) { if (entity is EntityGiantZombie && !entity.isInvisible) { if (floor6Giants && entity.posY > 68) { - ignoreBlocks(floor6GiantsSpawnTime + 1_000 > System.currentTimeMillis()) - delayedStart(floor6GiantsSpawnTime) + val extraDelay = checkExtraF6GiantsDelay(entity) + ignoreBlocks(floor6GiantsSpawnTime + extraDelay + 1_000 > System.currentTimeMillis()) + + delayedStart(floor6GiantsSpawnTime + extraDelay) return true } @@ -184,6 +189,45 @@ class DungeonBossFinder { return false } + private fun checkExtraF6GiantsDelay(entity: EntityGiantZombie): Long { + val uuid = entity.uniqueID + + if (floor6GiantsSeparateDelay.contains(uuid)) { + return floor6GiantsSeparateDelay[uuid]!! + } + + val middle = LorenzVec(-8, 0, 56) + + val loc = entity.getLorenzVec() + + var pos = 0 + + //first + if (loc.x > middle.x && loc.z > middle.z) { + pos = 2 + } + + //second + if (loc.x > middle.x && loc.z < middle.z) { + pos = 3 + } + + //third + if (loc.x < middle.x && loc.z < middle.z) { + pos = 0 + } + + //fourth + if (loc.x < middle.x && loc.z > middle.z) { + pos = 1 + } + + val extraDelay = 900L * pos + floor6GiantsSeparateDelay[uuid] = extraDelay + + return extraDelay + } + fun handleChat(message: String) { when (message) { //F1 -- cgit