diff --git a/src/testmod/java/nl/theepicblock/polymc/testmod/Testmod.java b/src/testmod/java/nl/theepicblock/polymc/testmod/Testmod.java index 7214840e..64b4e8d6 100644 --- a/src/testmod/java/nl/theepicblock/polymc/testmod/Testmod.java +++ b/src/testmod/java/nl/theepicblock/polymc/testmod/Testmod.java @@ -38,6 +38,8 @@ import java.util.EnumMap; import java.util.List; +import static nl.theepicblock.polymc.testmod.YellowStatusEffect.YELLOW; + public class Testmod implements ModInitializer { private static final String MODID = "polymc-testmod"; @@ -82,7 +84,7 @@ public class Testmod implements ModInitializer { public static final EntityType TEST_ENTITY_OTHER = FabricEntityTypeBuilder.create().entityFactory(TestOtherEntity::new).trackRangeChunks(4).dimensions(EntityDimensions.fixed(0.5f, 0.5f)).build(); public static final EntityType TEST_FLYING_WAXED_WEATHERED_CUT_COPPER_STAIRS_ENTITY = FabricEntityTypeBuilder.create().entityFactory(TestFlyingWaxedWeatheredCutCopperStairs::new).trackRangeChunks(4).dimensions(EntityDimensions.fixed(0.5f, 0.5f)).build(); - public static final RegistryEntry TEST_EFFECT = Registry.registerReference(Registries.STATUS_EFFECT, id("yellow_effect"), new YellowStatusEffect(StatusEffectCategory.HARMFUL, 0xf4e42c)); + public static final RegistryEntry TEST_EFFECT = Registry.registerReference(Registries.STATUS_EFFECT, id("yellow_effect"), new YellowStatusEffect(StatusEffectCategory.HARMFUL, YELLOW)); public static final Potion TEST_POTION_TYPE = Registry.register(Registries.POTION, id("yellow_potion"), new Potion(new StatusEffectInstance(TEST_EFFECT, 9600))); @Override diff --git a/src/testmod/java/nl/theepicblock/polymc/testmod/YellowStatusEffect.java b/src/testmod/java/nl/theepicblock/polymc/testmod/YellowStatusEffect.java index 75dbb864..4a3b9579 100644 --- a/src/testmod/java/nl/theepicblock/polymc/testmod/YellowStatusEffect.java +++ b/src/testmod/java/nl/theepicblock/polymc/testmod/YellowStatusEffect.java @@ -4,6 +4,7 @@ import net.minecraft.entity.effect.StatusEffectCategory; public class YellowStatusEffect extends StatusEffect { + public static int YELLOW = 0xfff4e42c; /** * Helpful for automatic testing, to simulate the fact that * this status effect will not be a registered one on the client diff --git a/src/testmod/java/nl/theepicblock/polymc/testmod/automated/MiscTests.java b/src/testmod/java/nl/theepicblock/polymc/testmod/automated/MiscTests.java index 5da0493d..0b739560 100644 --- a/src/testmod/java/nl/theepicblock/polymc/testmod/automated/MiscTests.java +++ b/src/testmod/java/nl/theepicblock/polymc/testmod/automated/MiscTests.java @@ -21,6 +21,8 @@ import java.util.Objects; +import static nl.theepicblock.polymc.testmod.YellowStatusEffect.YELLOW; + public class MiscTests implements FabricGameTest { // These tests are broken, I am aware @@ -95,16 +97,17 @@ public void potionItem(TestContext ctx) { // Create a potion item var serverPotion = testPotion(); + TestUtil.assertEq(serverPotion.get(DataComponentTypes.POTION_CONTENTS).getColor(), YELLOW, "Sanity check"); var clientPotion = map.getClientItem(serverPotion, null, ItemLocation.INVENTORY); try { YellowStatusEffect.SIMULATE_UNAVAILABLE = true; var clientPotionData = clientPotion.get(DataComponentTypes.POTION_CONTENTS); TestUtil.assertNonNull(clientPotionData, "polyd potions should still have potion data"); - TestUtil.assertEq(clientPotionData.getColor(), 0xf4e42c, "potion should be yellow"); + TestUtil.assertEq(clientPotionData.getColor(), YELLOW, "potion should be yellow"); TestUtil.assertEq(clientPotion.getName().getLiteralString(), serverPotion.getName().getLiteralString()); - TestUtil.assertDifferent(serverPotion.get(DataComponentTypes.POTION_CONTENTS).customColor(), 0xf4e42c, "Untransformed item should be broken. This test may be invalid"); + TestUtil.assertDifferent(serverPotion.get(DataComponentTypes.POTION_CONTENTS).getColor(), YELLOW, "Untransformed item should be broken. This test may be invalid"); } finally { YellowStatusEffect.SIMULATE_UNAVAILABLE = false; }