SPIGOT-5753: Back PotionType by a minecraft registry

This commit is contained in:
DerFrZocker 2023-10-09 20:22:53 +11:00 committed by md_5
parent a6bcb84890
commit 71b0135cc7
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
8 changed files with 220 additions and 99 deletions

View File

@ -3,8 +3,6 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.List;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectList;
import net.minecraft.world.entity.EntityAreaEffectCloud;
@ -14,13 +12,16 @@ import org.bukkit.Particle;
import org.bukkit.craftbukkit.CraftParticle;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
import org.bukkit.craftbukkit.potion.CraftPotionType;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.projectiles.ProjectileSource;
import org.jetbrains.annotations.NotNull;
public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud {
@ -203,12 +204,27 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@Override
public void setBasePotionData(PotionData data) {
Preconditions.checkArgument(data != null, "PotionData cannot be null");
getHandle().setPotion(BuiltInRegistries.POTION.get(new MinecraftKey(CraftPotionUtil.fromBukkit(data))));
getHandle().setPotion(CraftPotionType.bukkitToMinecraft(CraftPotionUtil.fromBukkit(data)));
}
@Override
public PotionData getBasePotionData() {
return CraftPotionUtil.toBukkit((BuiltInRegistries.POTION.getKey(getHandle().potion)).toString());
return CraftPotionUtil.toBukkit(CraftPotionType.minecraftToBukkit(getHandle().getPotion()));
}
@Override
public void setBasePotionType(@NotNull PotionType potionType) {
// TODO: 10/6/23 Change PotionType.UNCRAFTABLE to PotionType.EMPTY in error message
Preconditions.checkArgument(potionType != null, "PotionType cannot be null use PotionType.UNCRAFTABLE to represent no effect instead.");
getHandle().setPotion(CraftPotionType.bukkitToMinecraft(potionType));
}
@NotNull
@Override
public PotionType getBasePotionType() {
return CraftPotionType.minecraftToBukkit(getHandle().getPotion());
}
@Override

View File

@ -3,19 +3,20 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.List;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectList;
import net.minecraft.world.entity.projectile.EntityTippedArrow;
import org.bukkit.Color;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
import org.bukkit.craftbukkit.potion.CraftPotionType;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.Arrow;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.NotNull;
public class CraftTippedArrow extends CraftArrow implements Arrow {
@ -103,12 +104,26 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
@Override
public void setBasePotionData(PotionData data) {
Preconditions.checkArgument(data != null, "PotionData cannot be null");
this.getHandle().potion = BuiltInRegistries.POTION.get(new MinecraftKey(CraftPotionUtil.fromBukkit(data)));
this.getHandle().potion = CraftPotionType.bukkitToMinecraft(CraftPotionUtil.fromBukkit(data));
}
@Override
public PotionData getBasePotionData() {
return CraftPotionUtil.toBukkit(BuiltInRegistries.POTION.getKey(this.getHandle().potion).toString());
return CraftPotionUtil.toBukkit(CraftPotionType.minecraftToBukkit(getHandle().potion));
}
@Override
public void setBasePotionType(@NotNull PotionType potionType) {
// TODO: 10/6/23 Change PotionType.UNCRAFTABLE to PotionType.EMPTY in error message
Preconditions.checkArgument(potionType != null, "PotionType cannot be null use PotionType.UNCRAFTABLE to represent no effect instead.");
getHandle().potion = CraftPotionType.bukkitToMinecraft(potionType);
}
@NotNull
@Override
public PotionType getBasePotionType() {
return CraftPotionType.minecraftToBukkit(getHandle().potion);
}
@Override

View File

@ -16,6 +16,7 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta;
import org.bukkit.craftbukkit.potion.CraftPotionType;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.meta.PotionMeta;
@ -23,6 +24,7 @@ import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.NotNull;
@DelegateDeserialization(SerializableMeta.class)
class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
@ -46,7 +48,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
// Having an initial "state" in ItemMeta seems bit dirty but the UNCRAFTABLE potion type
// is treated as the empty form of the meta because it represents an empty potion with no effect
private PotionData type = new PotionData(PotionType.UNCRAFTABLE, false, false);
private PotionType type = PotionType.UNCRAFTABLE;
private List<PotionEffect> customEffects;
private Color color;
@ -65,7 +67,10 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
CraftMetaPotion(NBTTagCompound tag) {
super(tag);
if (tag.contains(DEFAULT_POTION.NBT)) {
type = CraftPotionUtil.toBukkit(tag.getString(DEFAULT_POTION.NBT));
type = CraftPotionType.stringToBukkit(tag.getString(DEFAULT_POTION.NBT));
if (type == null) {
type = PotionType.UNCRAFTABLE;
}
}
if (tag.contains(POTION_COLOR.NBT)) {
try {
@ -99,7 +104,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
CraftMetaPotion(Map<String, Object> map) {
super(map);
type = CraftPotionUtil.toBukkit(SerializableMeta.getString(map, DEFAULT_POTION.BUKKIT, true));
String typeString = SerializableMeta.getString(map, DEFAULT_POTION.BUKKIT, true);
if (typeString != null) {
type = CraftPotionType.stringToBukkit(typeString);
}
if (type == null) {
type = PotionType.UNCRAFTABLE;
}
Color color = SerializableMeta.getObject(Color.class, map, POTION_COLOR.BUKKIT, true);
if (color != null) {
@ -121,7 +132,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
void applyToItem(NBTTagCompound tag) {
super.applyToItem(tag);
tag.putString(DEFAULT_POTION.NBT, CraftPotionUtil.fromBukkit(type));
tag.putString(DEFAULT_POTION.NBT, CraftPotionType.bukkitToString(type));
if (hasColor()) {
tag.putInt(POTION_COLOR.NBT, color.asRGB());
@ -150,7 +161,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
}
boolean isPotionEmpty() {
return (type.getType() == PotionType.UNCRAFTABLE) && !(hasCustomEffects() || hasColor());
return (type == PotionType.UNCRAFTABLE) && !(hasCustomEffects() || hasColor());
}
@Override
@ -171,11 +182,25 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
@Override
public void setBasePotionData(PotionData data) {
Preconditions.checkArgument(data != null, "PotionData cannot be null");
this.type = data;
this.type = CraftPotionUtil.fromBukkit(data);
}
@Override
public PotionData getBasePotionData() {
return CraftPotionUtil.toBukkit(type);
}
@Override
public void setBasePotionType(@NotNull PotionType potionType) {
// TODO: 10/6/23 Change PotionType.UNCRAFTABLE to PotionType.EMPTY in error message
Preconditions.checkArgument(potionType != null, "PotionType cannot be null use PotionType.UNCRAFTABLE to represent no effect instead.");
type = potionType;
}
@NotNull
@Override
public PotionType getBasePotionType() {
return type;
}
@ -299,7 +324,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
int applyHash() {
final int original;
int hash = original = super.applyHash();
if (type.getType() != PotionType.UNCRAFTABLE) {
if (type != PotionType.UNCRAFTABLE) {
hash = 73 * hash + type.hashCode();
}
if (hasColor()) {
@ -334,8 +359,8 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
@Override
Builder<String, Object> serialize(Builder<String, Object> builder) {
super.serialize(builder);
if (type.getType() != PotionType.UNCRAFTABLE) {
builder.put(DEFAULT_POTION.BUKKIT, CraftPotionUtil.fromBukkit(type));
if (type != PotionType.UNCRAFTABLE) {
builder.put(DEFAULT_POTION.BUKKIT, CraftPotionType.bukkitToString(type));
}
if (hasColor()) {

View File

@ -1,13 +1,8 @@
package org.bukkit.craftbukkit.potion;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.item.alchemy.PotionRegistry;
import org.bukkit.potion.PotionBrewer;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
@ -15,23 +10,13 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
public class CraftPotionBrewer implements PotionBrewer {
private static final Map<PotionType, Collection<PotionEffect>> cache = Maps.newHashMap();
@Override
public Collection<PotionEffect> getEffects(PotionType damage, boolean upgraded, boolean extended) {
if (cache.containsKey(damage))
return cache.get(damage);
public Collection<PotionEffect> getEffects(PotionType type, boolean upgraded, boolean extended) {
Preconditions.checkArgument(!type.getKey().getKey().startsWith("strong_"), "Strong potion type cannot be used directly, got %s", type.getKey());
Preconditions.checkArgument(!type.getKey().getKey().startsWith("long_"), "Extended potion type cannot be used directly, got %s", type.getKey());
List<MobEffect> mcEffects = PotionRegistry.byName(CraftPotionUtil.fromBukkit(new PotionData(damage, extended, upgraded))).getEffects();
ImmutableList.Builder<PotionEffect> builder = new ImmutableList.Builder<PotionEffect>();
for (MobEffect effect : mcEffects) {
builder.add(CraftPotionUtil.toBukkit(effect));
}
cache.put(damage, builder.build());
return cache.get(damage);
return CraftPotionUtil.fromBukkit(new PotionData(type, upgraded, extended)).getPotionEffects();
}
@Override

View File

@ -0,0 +1,95 @@
package org.bukkit.craftbukkit.potion;
import com.google.common.base.Preconditions;
import com.google.common.base.Suppliers;
import java.util.List;
import java.util.function.Supplier;
import net.minecraft.core.IRegistry;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.alchemy.PotionRegistry;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.craftbukkit.CraftRegistry;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
public class CraftPotionType implements PotionType.InternalPotionData {
public static PotionType minecraftToBukkit(PotionRegistry minecraft) {
Preconditions.checkArgument(minecraft != null);
IRegistry<PotionRegistry> registry = CraftRegistry.getMinecraftRegistry(Registries.POTION);
PotionType bukkit = Registry.POTION.get(CraftNamespacedKey.fromMinecraft(registry.getResourceKey(minecraft).orElseThrow().location()));
Preconditions.checkArgument(bukkit != null);
return bukkit;
}
public static PotionRegistry bukkitToMinecraft(PotionType bukkit) {
Preconditions.checkArgument(bukkit != null);
return CraftRegistry.getMinecraftRegistry(Registries.POTION)
.getOptional(CraftNamespacedKey.toMinecraft(bukkit.getKey())).orElseThrow();
}
public static String bukkitToString(PotionType potionType) {
Preconditions.checkArgument(potionType != null);
return potionType.getKey().toString();
}
public static PotionType stringToBukkit(String string) {
Preconditions.checkArgument(string != null);
return Registry.POTION.get(NamespacedKey.fromString(string));
}
private final NamespacedKey key;
private final PotionRegistry potion;
private final Supplier<List<PotionEffect>> potionEffects;
private final Supplier<Boolean> upgradeable;
private final Supplier<Boolean> extendable;
private final Supplier<Integer> maxLevel;
public CraftPotionType(NamespacedKey key, PotionRegistry potion) {
this.key = key;
this.potion = potion;
this.potionEffects = Suppliers.memoize(() -> potion.getEffects().stream().map(CraftPotionUtil::toBukkit).toList());
this.upgradeable = Suppliers.memoize(() -> Registry.POTION.get(new NamespacedKey(key.getNamespace(), "strong_" + key.getKey())) != null);
this.extendable = Suppliers.memoize(() -> Registry.POTION.get(new NamespacedKey(key.getNamespace(), "long_" + key.getKey())) != null);
this.maxLevel = Suppliers.memoize(() -> isUpgradeable() ? 2 : 1);
}
@Override
public PotionEffectType getEffectType() {
return getPotionEffects().isEmpty() ? null : getPotionEffects().get(0).getType();
}
@Override
public List<PotionEffect> getPotionEffects() {
return potionEffects.get();
}
@Override
public boolean isInstant() {
return potion.hasInstantEffects();
}
@Override
public boolean isUpgradeable() {
return upgradeable.get();
}
@Override
public boolean isExtendable() {
return extendable.get();
}
@Override
public int getMaxLevel() {
return maxLevel.get();
}
}

View File

@ -12,78 +12,53 @@ import org.bukkit.potion.PotionType;
public class CraftPotionUtil {
private static final BiMap<PotionType, String> regular = ImmutableBiMap.<PotionType, String>builder()
.put(PotionType.UNCRAFTABLE, "empty")
.put(PotionType.WATER, "water")
.put(PotionType.MUNDANE, "mundane")
.put(PotionType.THICK, "thick")
.put(PotionType.AWKWARD, "awkward")
.put(PotionType.NIGHT_VISION, "night_vision")
.put(PotionType.INVISIBILITY, "invisibility")
.put(PotionType.JUMP, "leaping")
.put(PotionType.FIRE_RESISTANCE, "fire_resistance")
.put(PotionType.SPEED, "swiftness")
.put(PotionType.SLOWNESS, "slowness")
.put(PotionType.WATER_BREATHING, "water_breathing")
.put(PotionType.INSTANT_HEAL, "healing")
.put(PotionType.INSTANT_DAMAGE, "harming")
.put(PotionType.POISON, "poison")
.put(PotionType.REGEN, "regeneration")
.put(PotionType.STRENGTH, "strength")
.put(PotionType.WEAKNESS, "weakness")
.put(PotionType.LUCK, "luck")
.put(PotionType.TURTLE_MASTER, "turtle_master")
.put(PotionType.SLOW_FALLING, "slow_falling")
private static final BiMap<PotionType, PotionType> upgradeable = ImmutableBiMap.<PotionType, PotionType>builder()
.put(PotionType.JUMP, PotionType.STRONG_LEAPING)
.put(PotionType.SPEED, PotionType.STRONG_SWIFTNESS)
.put(PotionType.INSTANT_HEAL, PotionType.STRONG_HEALING)
.put(PotionType.INSTANT_DAMAGE, PotionType.STRONG_HARMING)
.put(PotionType.POISON, PotionType.STRONG_POISON)
.put(PotionType.REGEN, PotionType.STRONG_REGENERATION)
.put(PotionType.STRENGTH, PotionType.STRONG_STRENGTH)
.put(PotionType.SLOWNESS, PotionType.STRONG_SLOWNESS)
.put(PotionType.TURTLE_MASTER, PotionType.STRONG_TURTLE_MASTER)
.build();
private static final BiMap<PotionType, String> upgradeable = ImmutableBiMap.<PotionType, String>builder()
.put(PotionType.JUMP, "strong_leaping")
.put(PotionType.SPEED, "strong_swiftness")
.put(PotionType.INSTANT_HEAL, "strong_healing")
.put(PotionType.INSTANT_DAMAGE, "strong_harming")
.put(PotionType.POISON, "strong_poison")
.put(PotionType.REGEN, "strong_regeneration")
.put(PotionType.STRENGTH, "strong_strength")
.put(PotionType.SLOWNESS, "strong_slowness")
.put(PotionType.TURTLE_MASTER, "strong_turtle_master")
.build();
private static final BiMap<PotionType, String> extendable = ImmutableBiMap.<PotionType, String>builder()
.put(PotionType.NIGHT_VISION, "long_night_vision")
.put(PotionType.INVISIBILITY, "long_invisibility")
.put(PotionType.JUMP, "long_leaping")
.put(PotionType.FIRE_RESISTANCE, "long_fire_resistance")
.put(PotionType.SPEED, "long_swiftness")
.put(PotionType.SLOWNESS, "long_slowness")
.put(PotionType.WATER_BREATHING, "long_water_breathing")
.put(PotionType.POISON, "long_poison")
.put(PotionType.REGEN, "long_regeneration")
.put(PotionType.STRENGTH, "long_strength")
.put(PotionType.WEAKNESS, "long_weakness")
.put(PotionType.TURTLE_MASTER, "long_turtle_master")
.put(PotionType.SLOW_FALLING, "long_slow_falling")
private static final BiMap<PotionType, PotionType> extendable = ImmutableBiMap.<PotionType, PotionType>builder()
.put(PotionType.NIGHT_VISION, PotionType.LONG_NIGHT_VISION)
.put(PotionType.INVISIBILITY, PotionType.LONG_INVISIBILITY)
.put(PotionType.JUMP, PotionType.LONG_LEAPING)
.put(PotionType.FIRE_RESISTANCE, PotionType.LONG_FIRE_RESISTANCE)
.put(PotionType.SPEED, PotionType.LONG_SWIFTNESS)
.put(PotionType.SLOWNESS, PotionType.LONG_SLOWNESS)
.put(PotionType.WATER_BREATHING, PotionType.LONG_WATER_BREATHING)
.put(PotionType.POISON, PotionType.LONG_POISON)
.put(PotionType.REGEN, PotionType.LONG_REGENERATION)
.put(PotionType.STRENGTH, PotionType.LONG_STRENGTH)
.put(PotionType.WEAKNESS, PotionType.LONG_WEAKNESS)
.put(PotionType.TURTLE_MASTER, PotionType.LONG_TURTLE_MASTER)
.put(PotionType.SLOW_FALLING, PotionType.LONG_SLOW_FALLING)
.build();
public static String fromBukkit(PotionData data) {
String type;
public static PotionType fromBukkit(PotionData data) {
PotionType type;
if (data.isUpgraded()) {
type = upgradeable.get(data.getType());
} else if (data.isExtended()) {
type = extendable.get(data.getType());
} else {
type = regular.get(data.getType());
type = data.getType();
}
Preconditions.checkNotNull(type, "Unknown potion type from data " + data);
return "minecraft:" + type;
return type;
}
public static PotionData toBukkit(String type) {
public static PotionData toBukkit(PotionType type) {
if (type == null) {
return new PotionData(PotionType.UNCRAFTABLE, false, false);
}
if (type.startsWith("minecraft:")) {
type = type.substring(10);
}
PotionType potionType = null;
PotionType potionType;
potionType = extendable.inverse().get(type);
if (potionType != null) {
return new PotionData(potionType, true, false);
@ -92,11 +67,8 @@ public class CraftPotionUtil {
if (potionType != null) {
return new PotionData(potionType, false, true);
}
potionType = regular.inverse().get(type);
if (potionType != null) {
return new PotionData(potionType, false, false);
}
return new PotionData(PotionType.UNCRAFTABLE, false, false);
return new PotionData(type, false, false);
}
public static MobEffect fromBukkit(PotionEffect effect) {

View File

@ -25,6 +25,7 @@ import net.minecraft.SharedConstants;
import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.advancements.critereon.LootDeserializationContext;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.DynamicOpsNBT;
import net.minecraft.nbt.MojangsonParser;
import net.minecraft.nbt.NBTBase;
@ -39,6 +40,7 @@ import net.minecraft.util.datafix.fixes.DataConverterTypes;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.ai.attributes.AttributeBase;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.alchemy.PotionRegistry;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.storage.SavedFile;
@ -53,11 +55,13 @@ import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftEquipmentSlot;
import org.bukkit.craftbukkit.CraftFeatureFlag;
import org.bukkit.craftbukkit.CraftRegistry;
import org.bukkit.craftbukkit.attribute.CraftAttribute;
import org.bukkit.craftbukkit.attribute.CraftAttributeInstance;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.legacy.CraftLegacy;
import org.bukkit.craftbukkit.potion.CraftPotionType;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.CreativeCategory;
import org.bukkit.inventory.EquipmentSlot;
@ -65,6 +69,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.bukkit.plugin.InvalidPluginException;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.potion.PotionType;
@SuppressWarnings("deprecation")
public final class CraftMagicNumbers implements UnsafeValues {
@ -374,6 +379,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftFeatureFlag.getFromNMS(namespacedKey);
}
@Override
public PotionType.InternalPotionData getInternalPotionData(NamespacedKey namespacedKey) {
PotionRegistry potionRegistry = CraftRegistry.getMinecraftRegistry(Registries.POTION)
.getOptional(CraftNamespacedKey.toMinecraft(namespacedKey)).orElseThrow();
return new CraftPotionType(namespacedKey, potionRegistry);
}
/**
* This helper class represents the different NBT Tags.
* <p>

View File

@ -29,7 +29,7 @@ public class PotionTest extends AbstractTestingBase {
effects.put(enumType, enumType.name());
}
assertEquals(effects.entrySet().size(), PotionType.values().length - /* PotionTypes with no/shared Effects */ 6);
assertEquals(effects.entrySet().size(), PotionType.values().length - /* PotionTypes with no/shared Effects */ (6 + 22 /* There are 22 new strong / long potion types */));
}
@Test