fix various issues throughout the entire project

This commit is contained in:
2026-08-26 19:38:15 +02:00
parent 03deff254f
commit 5650e9979f
10 changed files with 164 additions and 53 deletions
@@ -6,15 +6,23 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageType;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import javax.annotation.Nullable;
public final class ModDamageSources {
public static final ResourceKey<DamageType> BLEED = ResourceKey.create(Registries.DAMAGE_TYPE,
ResourceLocation.fromNamespaceAndPath(AscendAilments.MOD_ID, "bleed"));
public static DamageSource bleed(Level level) {
return new DamageSource(level.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE)
.getHolderOrThrow(BLEED));
return bleed(level, null);
}
public static DamageSource bleed(Level level, @Nullable Entity source) {
var type = level.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(BLEED);
// Periodic Bleed has an owning attacker for attribution, but no direct entity (it is not another melee hit).
return source == null ? new DamageSource(type) : new DamageSource(type, null, source);
}
private ModDamageSources() {}
}