@@ -8,9 +8,10 @@ import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.world.entity.decoration.Paintings;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.entity.decoration.PaintingVariant;
|
||||
import org.bukkit.craftbukkit.CraftArt;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.Test;
|
||||
@@ -22,11 +23,11 @@ public class ArtTest extends AbstractTestingBase {
|
||||
public void verifyMapping() {
|
||||
List<Art> arts = Lists.newArrayList(Art.values());
|
||||
|
||||
for (MinecraftKey key : IRegistry.MOTIVE.keySet()) {
|
||||
Paintings enumArt = IRegistry.MOTIVE.get(key);
|
||||
String name = key.getPath();
|
||||
int width = enumArt.getWidth() / UNIT_MULTIPLIER;
|
||||
int height = enumArt.getHeight() / UNIT_MULTIPLIER;
|
||||
for (ResourceKey<PaintingVariant> key : IRegistry.PAINTING_VARIANT.registryKeySet()) {
|
||||
Holder<PaintingVariant> enumArt = IRegistry.PAINTING_VARIANT.getHolderOrThrow(key);
|
||||
String name = key.location().getPath();
|
||||
int width = enumArt.value().getWidth() / UNIT_MULTIPLIER;
|
||||
int height = enumArt.value().getHeight() / UNIT_MULTIPLIER;
|
||||
|
||||
Art subject = CraftArt.NotchToBukkit(enumArt);
|
||||
|
||||
@@ -45,9 +46,9 @@ public class ArtTest extends AbstractTestingBase {
|
||||
|
||||
@Test
|
||||
public void testCraftArtToNotch() {
|
||||
Map<Paintings, Art> cache = new HashMap<>();
|
||||
Map<Holder<PaintingVariant>, Art> cache = new HashMap<>();
|
||||
for (Art art : Art.values()) {
|
||||
Paintings enumArt = CraftArt.BukkitToNotch(art);
|
||||
Holder<PaintingVariant> enumArt = CraftArt.BukkitToNotch(art);
|
||||
assertNotNull(art.name(), enumArt);
|
||||
assertThat(art.name(), cache.put(enumArt, art), is(nullValue()));
|
||||
}
|
||||
@@ -55,8 +56,8 @@ public class ArtTest extends AbstractTestingBase {
|
||||
|
||||
@Test
|
||||
public void testCraftArtToBukkit() {
|
||||
Map<Art, Paintings> cache = new EnumMap(Art.class);
|
||||
for (Paintings enumArt : IRegistry.MOTIVE) {
|
||||
Map<Art, Holder<PaintingVariant>> cache = new EnumMap(Art.class);
|
||||
for (Holder<PaintingVariant> enumArt : IRegistry.PAINTING_VARIANT.asHolderIdMap()) {
|
||||
Art art = CraftArt.NotchToBukkit(enumArt);
|
||||
assertNotNull("Could not CraftArt.NotchToBukkit " + enumArt, art);
|
||||
assertThat("Duplicate artwork " + enumArt, cache.put(art, enumArt), is(nullValue()));
|
||||
|
||||
Reference in New Issue
Block a user