mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Add paper comments
This commit is contained in:
parent
e5b3b72c83
commit
51a33de5eb
4 changed files with 16 additions and 11 deletions
|
@ -6,6 +6,7 @@ import org.bukkit.Sound;
|
|||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Represents a type of effect that occurs when damage is inflicted. Currently,
|
||||
* effects only determine the sound that plays.
|
||||
|
@ -54,3 +55,4 @@ public enum DamageEffect {
|
|||
return Bukkit.getUnsafe().getSoundForDamageEffect(this);
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
|
|
|
@ -5,8 +5,10 @@ import org.bukkit.Sound;
|
|||
import org.bukkit.craftbukkit.CraftSound;
|
||||
import org.bukkit.damage.DamageEffect;
|
||||
|
||||
// Paper start
|
||||
@Deprecated
|
||||
public class CraftDamageEffect {
|
||||
// Paper end
|
||||
|
||||
private final DamageEffects damageEffects;
|
||||
|
||||
|
@ -19,7 +21,7 @@ public class CraftDamageEffect {
|
|||
}
|
||||
|
||||
public Sound getSound() {
|
||||
return CraftSound.minecraftToBukkit(this.getHandle().sound());
|
||||
return CraftSound.minecraftToBukkit(this.getHandle().sound()); // Paper
|
||||
}
|
||||
|
||||
public static DamageEffect getById(String id) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.bukkit.craftbukkit.damage;
|
|||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.damagesource.DamageEffects;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.craftbukkit.CraftRegistry;
|
||||
|
@ -99,7 +98,8 @@ public class CraftDamageType implements DamageType, Handleable<net.minecraft.wor
|
|||
};
|
||||
}
|
||||
|
||||
public static DamageEffect damageEffectToBukkit(DamageEffects damageEffect) {
|
||||
// Paper start
|
||||
public static DamageEffect damageEffectToBukkit(net.minecraft.world.damagesource.DamageEffects damageEffect) {
|
||||
return switch (damageEffect) {
|
||||
case HURT -> DamageEffect.HURT;
|
||||
case THORNS -> DamageEffect.THORNS;
|
||||
|
@ -111,17 +111,18 @@ public class CraftDamageType implements DamageType, Handleable<net.minecraft.wor
|
|||
};
|
||||
}
|
||||
|
||||
public static DamageEffects damageEffectToNMS(DamageEffect damageEffect) {
|
||||
public static net.minecraft.world.damagesource.DamageEffects damageEffectToNMS(DamageEffect damageEffect) {
|
||||
return switch (damageEffect) {
|
||||
case DamageEffect.HURT -> DamageEffects.HURT;
|
||||
case DamageEffect.THORNS -> DamageEffects.THORNS;
|
||||
case DamageEffect.DROWNING -> DamageEffects.DROWNING;
|
||||
case DamageEffect.BURNING -> DamageEffects.BURNING;
|
||||
case DamageEffect.POKING -> DamageEffects.POKING;
|
||||
case DamageEffect.FREEZING -> DamageEffects.FREEZING;
|
||||
case DamageEffect.HURT -> net.minecraft.world.damagesource.DamageEffects.HURT;
|
||||
case DamageEffect.THORNS -> net.minecraft.world.damagesource.DamageEffects.THORNS;
|
||||
case DamageEffect.DROWNING -> net.minecraft.world.damagesource.DamageEffects.DROWNING;
|
||||
case DamageEffect.BURNING -> net.minecraft.world.damagesource.DamageEffects.BURNING;
|
||||
case DamageEffect.POKING -> net.minecraft.world.damagesource.DamageEffects.POKING;
|
||||
case DamageEffect.FREEZING -> net.minecraft.world.damagesource.DamageEffects.FREEZING;
|
||||
default -> throw new IllegalArgumentException("Bukkit DamageEffect." + damageEffect + " cannot be converted to a NMS DamageEffect");
|
||||
};
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public static DamageType minecraftHolderToBukkit(Holder<net.minecraft.world.damagesource.DamageType> minecraftHolder) {
|
||||
return CraftDamageType.minecraftToBukkit(minecraftHolder.value());
|
||||
|
|
|
@ -467,7 +467,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Deprecated // Paper
|
||||
public DamageEffect getDamageEffect(String key) {
|
||||
Preconditions.checkArgument(key != null, "key cannot be null");
|
||||
return CraftDamageEffect.getById(key);
|
||||
|
|
Loading…
Reference in a new issue