mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Test the AmbientEffects values
This commit is contained in:
1 parent
a2bee86c1f
commit
07cb9a57eb
1 file changed
+14
@@ -3,6 +3,7 @@ package com.volmit;
|
||||
import com.volmit.entity.EntitySpec;
|
||||
import com.volmit.item.ItemDrop;
|
||||
import com.volmit.item.ItemEnchantment;
|
||||
import com.volmit.service.AmbientEffects;
|
||||
import com.volmit.service.BlockDrops;
|
||||
import com.volmit.service.EntitySpawns;
|
||||
import com.volmit.service.SaplingGrowth;
|
||||
@@ -57,6 +58,19 @@ class ItemAndEntityValuesTest {
|
||||
assertTrue(SaplingGrowth.TreeObjects.NONE.objects().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void anAmbientEffectKeepsItsCommandsApartAndRefusesPartsWithoutKeys() {
|
||||
List<AmbientEffects.Command> commands = new ArrayList<>(List.of(
|
||||
new AmbientEffects.Command(new EntitySpec.Command(List.of("say hi"), 0, false, 100), 1, 0, -1)));
|
||||
AmbientEffects.Effect effect = new AmbientEffects.Effect(null, null, commands, new AmbientEffects.Potion("luck", 0, 100));
|
||||
commands.clear();
|
||||
|
||||
assertEquals(1, effect.commands().size());
|
||||
assertThrows(UnsupportedOperationException.class, () -> effect.commands().clear());
|
||||
assertThrows(NullPointerException.class, () -> new AmbientEffects.Sound(null, 0, 0, 0, 1, 1));
|
||||
assertThrows(NullPointerException.class, () -> new AmbientEffects.Command(null, 0, 0, 0));
|
||||
}
|
||||
|
||||
private static EntitySpec entity(String type, String specialType) {
|
||||
return new EntitySpec(type, specialType, null, "", new EntitySpec.Flags(false, true, true, false, true, false, false,
|
||||
false, false, false, false), EntitySpec.Equipment.NONE, List.of(), List.of(), List.of(), 0L, null, null, false,
|
||||
|
||||
Reference in new issue
Block a user