Skip to content

Commit

Permalink
Fix the ReflectionLevel.FULL warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro593 committed Feb 1, 2025
1 parent bd224a4 commit b79b28a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.dafuqs.spectrum.entity.entity;

import com.google.common.util.concurrent.*;
import de.dafuqs.spectrum.api.entity.*;
import de.dafuqs.spectrum.api.item.*;
import de.dafuqs.spectrum.entity.*;
Expand Down Expand Up @@ -29,6 +28,7 @@
import net.minecraft.util.hit.*;
import net.minecraft.util.math.*;
import net.minecraft.world.*;
import org.apache.commons.lang3.mutable.*;
import org.jetbrains.annotations.*;

import java.util.*;
Expand Down Expand Up @@ -346,7 +346,8 @@ protected EntityHitResult getEntityCollision(Vec3d currentPosition, Vec3d nextPo
}

private float getDamage(ItemStack stack) {
var damage = new AtomicDouble(0);
//TODO can we use a built in function for this?
var damage = new MutableDouble(0);
var key = EntityAttributes.GENERIC_ATTACK_DAMAGE.getKey().orElse(null);
var base = EntityAttributes.GENERIC_ATTACK_DAMAGE.value().getDefaultValue();
var modifiers = stack.getOrDefault(DataComponentTypes.ATTRIBUTE_MODIFIERS, AttributeModifiersComponent.DEFAULT);
Expand All @@ -356,11 +357,11 @@ private float getDamage(ItemStack stack) {
damage.addAndGet(switch (modifier.operation()) {
case ADD_VALUE -> value;
case ADD_MULTIPLIED_BASE -> value * base;
case ADD_MULTIPLIED_TOTAL -> value * damage.get();
case ADD_MULTIPLIED_TOTAL -> value * damage.getValue();
});
}
});
return (float) damage.get();
return damage.getValue().floatValue();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.dafuqs.spectrum.entity.entity;

import com.google.common.util.concurrent.*;
import de.dafuqs.spectrum.api.item.*;
import de.dafuqs.spectrum.entity.*;
import de.dafuqs.spectrum.helpers.*;
Expand All @@ -25,6 +24,7 @@
import net.minecraft.util.hit.*;
import net.minecraft.util.math.*;
import net.minecraft.world.*;
import org.apache.commons.lang3.mutable.*;
import org.jetbrains.annotations.*;

import java.util.*;
Expand Down Expand Up @@ -102,7 +102,8 @@ protected void onEntityHit(EntityHitResult entityHitResult) {
}

private float getDamage(ItemStack stack) {
var damage = new AtomicDouble(0);
//TODO can we use a built in function for this?
var damage = new MutableDouble(0);
var key = EntityAttributes.GENERIC_ATTACK_DAMAGE.getKey().orElse(null);
var base = EntityAttributes.GENERIC_ATTACK_DAMAGE.value().getDefaultValue();
var modifiers = stack.getOrDefault(DataComponentTypes.ATTRIBUTE_MODIFIERS, AttributeModifiersComponent.DEFAULT);
Expand All @@ -112,11 +113,11 @@ private float getDamage(ItemStack stack) {
damage.addAndGet(switch (modifier.operation()) {
case ADD_VALUE -> value;
case ADD_MULTIPLIED_BASE -> value * base;
case ADD_MULTIPLIED_TOTAL -> value * damage.get();
case ADD_MULTIPLIED_TOTAL -> value * damage.getValue();
});
}
});
return (float) damage.get();
return damage.getValue().floatValue();
}

@Override
Expand Down

0 comments on commit b79b28a

Please sign in to comment.