diff --git a/src/main/java/de/bixilon/minosoft/data/entities/entities/decoration/armorstand/ArmorStand.kt b/src/main/java/de/bixilon/minosoft/data/entities/entities/decoration/armorstand/ArmorStand.kt index 1fb7e26b3..d0f51fb20 100644 --- a/src/main/java/de/bixilon/minosoft/data/entities/entities/decoration/armorstand/ArmorStand.kt +++ b/src/main/java/de/bixilon/minosoft/data/entities/entities/decoration/armorstand/ArmorStand.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2024 Moritz Zwerger + * Copyright (C) 2020-2025 Moritz Zwerger * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * @@ -48,7 +48,7 @@ class ArmorStand(session: PlaySession, entityType: EntityType, data: EntityData, return flags.isBitMask(bitMask) } - override val canRaycast: Boolean get() = super.canRaycast && !isMarker + override val canRaycast: Boolean get() = !isMarker && super.canRaycast override val hitboxColor: RGBColor? get() = if (isMarker) null else super.hitboxColor override var defaultAABB: AABB = AABB.EMPTY override var dimensions: Vec2 = DIMENSIONS diff --git a/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/EntityAttributes.kt b/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/EntityAttributes.kt index b1914939d..9fe3ec500 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/EntityAttributes.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/EntityAttributes.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2025 Moritz Zwerger * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * @@ -64,9 +64,9 @@ class EntityAttributes( } operator fun get(type: AttributeType, fallback: Double = this.fallback[type] ?: type.fallback): Double { - val attributes = this.attributes[type] - val base = attributes?.base ?: fallback - val modifiers = process(attributes) + val attributes = this.attributes[type] ?: return fallback + val modifiers = attributes.process() + val base = attributes.base var added = base for (modifier in modifiers[AttributeOperations.ADD] ?: emptySet()) { diff --git a/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/container/AttributeContainer.kt b/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/container/AttributeContainer.kt index 829b9eaa1..947e4849e 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/container/AttributeContainer.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/effects/attributes/container/AttributeContainer.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2025 Moritz Zwerger * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * @@ -13,6 +13,7 @@ package de.bixilon.minosoft.data.registries.effects.attributes.container +import de.bixilon.minosoft.data.registries.effects.attributes.AttributeOperations import java.util.* class AttributeContainer( @@ -42,6 +43,19 @@ class AttributeContainer( } } + + fun process(): Map> { + // ToDo: Deduplicate uuids? + if (modifier.isEmpty()) return emptyMap() + val result: MutableMap> = EnumMap(AttributeOperations::class.java) + + for (modifier in this) { + result.getOrPut(modifier.operation) { mutableSetOf() } += modifier + } + + return result + } + operator fun contains(uuid: UUID) = uuid in modifier override fun iterator(): Iterator {