diff options
author | md_5 <git@md-5.net> | 2018-08-26 12:00:00 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-08-26 12:00:00 +1000 |
commit | ce1af0c348a8477f9ec58d79e6267e9226dc5dba (patch) | |
tree | 369972a692f450001c06a13e202d916f9c1bb5a8 /src/test | |
parent | 162bda93ff76fe96a6138a14176807f21a6ddef4 (diff) | |
download | craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar.gz craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar.lz craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar.xz craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.zip |
Update to Minecraft 1.13.1
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/bukkit/ArtTest.java | 10 | ||||
-rw-r--r-- | src/test/java/org/bukkit/BiomeTest.java | 3 | ||||
-rw-r--r-- | src/test/java/org/bukkit/EnchantmentTest.java | 5 | ||||
-rw-r--r-- | src/test/java/org/bukkit/LegacyTest.java | 2 | ||||
-rw-r--r-- | src/test/java/org/bukkit/MaterialTest.java | 5 | ||||
-rw-r--r-- | src/test/java/org/bukkit/ParticleTest.java | 3 | ||||
-rw-r--r-- | src/test/java/org/bukkit/PerMaterialTest.java | 6 | ||||
-rw-r--r-- | src/test/java/org/bukkit/SoundTest.java | 4 | ||||
-rw-r--r-- | src/test/java/org/bukkit/StatisticsAndAchievementsTest.java | 10 | ||||
-rw-r--r-- | src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java | 3 | ||||
-rw-r--r-- | src/test/java/org/bukkit/entity/EntityTypesTest.java | 3 | ||||
-rw-r--r-- | src/test/java/org/bukkit/potion/PotionTest.java | 4 | ||||
-rw-r--r-- | src/test/java/org/bukkit/support/DummyServer.java | 2 |
13 files changed, 33 insertions, 27 deletions
diff --git a/src/test/java/org/bukkit/ArtTest.java b/src/test/java/org/bukkit/ArtTest.java index 29d14d4b..e6888dec 100644 --- a/src/test/java/org/bukkit/ArtTest.java +++ b/src/test/java/org/bukkit/ArtTest.java @@ -9,6 +9,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraft.server.IRegistry; import net.minecraft.server.MinecraftKey; import net.minecraft.server.Paintings; @@ -16,16 +17,17 @@ import org.bukkit.craftbukkit.CraftArt; import org.junit.Test; import com.google.common.collect.Lists; +import org.bukkit.support.AbstractTestingBase; -public class ArtTest { +public class ArtTest extends AbstractTestingBase { private static final int UNIT_MULTIPLIER = 16; @Test public void verifyMapping() { List<Art> arts = Lists.newArrayList(Art.values()); - for (MinecraftKey key : Paintings.a.keySet()) { - Paintings enumArt = Paintings.a.get(key); + for (MinecraftKey key : IRegistry.MOTIVE.keySet()) { + Paintings enumArt = IRegistry.MOTIVE.get(key); String name = key.getKey(); int width = enumArt.b() / UNIT_MULTIPLIER; int height = enumArt.c() / UNIT_MULTIPLIER; @@ -58,7 +60,7 @@ public class ArtTest { @Test public void testCraftArtToBukkit() { Map<Art, Paintings> cache = new EnumMap(Art.class); - for (Paintings enumArt : (Iterable<Paintings>) Paintings.a) { // Eclipse fail + for (Paintings enumArt : (Iterable<Paintings>) IRegistry.MOTIVE) { // Eclipse fail Art art = CraftArt.NotchToBukkit(enumArt); assertNotNull("Could not CraftArt.NotchToBukkit " + enumArt, art); assertThat("Duplicate artwork " + enumArt, cache.put(art, enumArt), is(nullValue())); diff --git a/src/test/java/org/bukkit/BiomeTest.java b/src/test/java/org/bukkit/BiomeTest.java index 17a8005a..913c4cf3 100644 --- a/src/test/java/org/bukkit/BiomeTest.java +++ b/src/test/java/org/bukkit/BiomeTest.java @@ -1,6 +1,7 @@ package org.bukkit; import net.minecraft.server.BiomeBase; +import net.minecraft.server.IRegistry; import org.bukkit.block.Biome; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.support.AbstractTestingBase; @@ -18,7 +19,7 @@ public class BiomeTest extends AbstractTestingBase { @Test public void testMinecraftToBukkit() { - for (Object biome : BiomeBase.REGISTRY_ID) { + for (Object biome : IRegistry.BIOME) { Assert.assertNotNull("No Bukkit mapping for " + biome, CraftBlock.biomeBaseToBiome((BiomeBase) biome)); } } diff --git a/src/test/java/org/bukkit/EnchantmentTest.java b/src/test/java/org/bukkit/EnchantmentTest.java index 86bfbb45..e69283b1 100644 --- a/src/test/java/org/bukkit/EnchantmentTest.java +++ b/src/test/java/org/bukkit/EnchantmentTest.java @@ -1,5 +1,6 @@ package org.bukkit; +import net.minecraft.server.IRegistry; import net.minecraft.server.MinecraftKey; import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -11,8 +12,8 @@ public class EnchantmentTest extends AbstractTestingBase { @Test public void verifyMapping() { - for (MinecraftKey key : net.minecraft.server.Enchantment.enchantments.keySet()) { - net.minecraft.server.Enchantment nms = net.minecraft.server.Enchantment.enchantments.get(key); + for (MinecraftKey key : IRegistry.ENCHANTMENT.keySet()) { + net.minecraft.server.Enchantment nms = IRegistry.ENCHANTMENT.get(key); Enchantment bukkitById = Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(key)); diff --git a/src/test/java/org/bukkit/LegacyTest.java b/src/test/java/org/bukkit/LegacyTest.java index fbc9e85c..b441d40d 100644 --- a/src/test/java/org/bukkit/LegacyTest.java +++ b/src/test/java/org/bukkit/LegacyTest.java @@ -33,7 +33,7 @@ public class LegacyTest extends AbstractTestingBase { Material.ACACIA_WOOD, Material.BIRCH_WOOD, Material.DARK_OAK_WOOD, Material.JUNGLE_WOOD, Material.OAK_WOOD, Material.SPRUCE_WOOD, Material.TUBE_CORAL_WALL_FAN, Material.BRAIN_CORAL_WALL_FAN, Material.BUBBLE_CORAL_WALL_FAN, Material.FIRE_CORAL_WALL_FAN, Material.HORN_CORAL_WALL_FAN, Material.DEAD_TUBE_CORAL_WALL_FAN, Material.DEAD_BRAIN_CORAL_WALL_FAN, Material.DEAD_BUBBLE_CORAL_WALL_FAN, Material.DEAD_FIRE_CORAL_WALL_FAN, Material.DEAD_HORN_CORAL_WALL_FAN, Material.DEAD_TUBE_CORAL_FAN, Material.DEAD_BRAIN_CORAL_FAN, Material.DEAD_BUBBLE_CORAL_FAN, Material.DEAD_FIRE_CORAL_FAN, - Material.DEAD_HORN_CORAL_FAN, + Material.DEAD_HORN_CORAL_FAN, Material.DEAD_BRAIN_CORAL, Material.DEAD_BUBBLE_CORAL, Material.DEAD_FIRE_CORAL, Material.DEAD_HORN_CORAL, Material.DEAD_TUBE_CORAL, // Material.LEGACY_AIR, Material.LEGACY_DEAD_BUSH, Material.LEGACY_BURNING_FURNACE, Material.LEGACY_WALL_SIGN, Material.LEGACY_REDSTONE_TORCH_OFF, Material.LEGACY_SKULL, Material.LEGACY_REDSTONE_COMPARATOR_ON, Material.LEGACY_WALL_BANNER, Material.LEGACY_MONSTER_EGG)); diff --git a/src/test/java/org/bukkit/MaterialTest.java b/src/test/java/org/bukkit/MaterialTest.java index be0690f3..8c972447 100644 --- a/src/test/java/org/bukkit/MaterialTest.java +++ b/src/test/java/org/bukkit/MaterialTest.java @@ -6,6 +6,7 @@ import static org.hamcrest.Matchers.*; import java.util.Collections; import java.util.Map; +import net.minecraft.server.IRegistry; import net.minecraft.server.Item; import net.minecraft.server.MinecraftKey; @@ -29,13 +30,13 @@ public class MaterialTest extends AbstractTestingBase { materials.put(CraftMagicNumbers.key(material), material); } - Iterator<Item> items = Item.REGISTRY.iterator(); + Iterator<Item> items = IRegistry.ITEM.iterator(); while (items.hasNext()) { Item item = items.next(); if (item == null) continue; - MinecraftKey id = Item.REGISTRY.b(item); + MinecraftKey id = IRegistry.ITEM.getKey(item); String name = item.getName(); Material material = materials.remove(id); diff --git a/src/test/java/org/bukkit/ParticleTest.java b/src/test/java/org/bukkit/ParticleTest.java index c0cb4a1e..829dfa11 100644 --- a/src/test/java/org/bukkit/ParticleTest.java +++ b/src/test/java/org/bukkit/ParticleTest.java @@ -1,5 +1,6 @@ package org.bukkit; +import net.minecraft.server.IRegistry; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.CraftParticle; import org.bukkit.craftbukkit.block.data.CraftBlockData; @@ -27,7 +28,7 @@ public class ParticleTest extends AbstractTestingBase { Assert.assertNotNull("Missing Bukkit->NMS particle mapping for " + bukkit, CraftParticle.toNMS(bukkit, data)); } - for (net.minecraft.server.Particle nms : (Iterable<net.minecraft.server.Particle<?>>) net.minecraft.server.Particle.REGISTRY) { // Eclipse fail + for (net.minecraft.server.Particle nms : (Iterable<net.minecraft.server.Particle<?>>) IRegistry.PARTICLE_TYPE) { // Eclipse fail Assert.assertNotNull("Missing NMS->Bukkit particle mapping for " + nms, CraftParticle.toBukkit(nms)); } } diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java index 57e779ec..82b5b1af 100644 --- a/src/test/java/org/bukkit/PerMaterialTest.java +++ b/src/test/java/org/bukkit/PerMaterialTest.java @@ -60,7 +60,7 @@ public class PerMaterialTest extends AbstractTestingBase { @Test public void isBlock() { if (material != Material.AIR && material != Material.CAVE_AIR && material != Material.VOID_AIR) { - assertThat(material.isBlock(), is(not(CraftMagicNumbers.getBlock(material).getBlockData().isAir()))); + assertThat(material.isBlock(), is(not(CraftMagicNumbers.getBlock(material) == null))); } } @@ -191,7 +191,7 @@ public class PerMaterialTest extends AbstractTestingBase { if (material == Material.AIR) { assertTrue(material.isBlock()); } else { - assertThat(material.isBlock(), is(equalTo(CraftMagicNumbers.getBlock(material) != Blocks.AIR))); + assertThat(material.isBlock(), is(equalTo(CraftMagicNumbers.getBlock(material) != null))); } } @@ -226,7 +226,7 @@ public class PerMaterialTest extends AbstractTestingBase { @Test public void testBlastResistance() { if (material.isBlock()) { - assertThat(material.getBlastResistance(), is(CraftMagicNumbers.getBlock(material).k())); // PAIL getDurability + assertThat(material.getBlastResistance(), is(CraftMagicNumbers.getBlock(material).getDurability())); } } } diff --git a/src/test/java/org/bukkit/SoundTest.java b/src/test/java/org/bukkit/SoundTest.java index 942cb4ea..a2bb73f0 100644 --- a/src/test/java/org/bukkit/SoundTest.java +++ b/src/test/java/org/bukkit/SoundTest.java @@ -1,7 +1,7 @@ package org.bukkit; +import net.minecraft.server.IRegistry; import net.minecraft.server.MinecraftKey; -import net.minecraft.server.SoundEffect; import static org.junit.Assert.*; import static org.hamcrest.Matchers.*; @@ -20,7 +20,7 @@ public class SoundTest { @Test public void testReverse() { - for (MinecraftKey effect : SoundEffect.a.keySet()) { + for (MinecraftKey effect : IRegistry.SOUND_EVENT.keySet()) { assertNotNull(effect + "", Sound.valueOf(effect.getKey().replace('.', '_').toUpperCase(java.util.Locale.ENGLISH))); } } diff --git a/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java b/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java index 055bc426..4edbc126 100644 --- a/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java +++ b/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java @@ -3,10 +3,8 @@ package org.bukkit; import static org.junit.Assert.*; import static org.hamcrest.Matchers.*; -import net.minecraft.server.Block; import net.minecraft.server.EntityTypes; -import net.minecraft.server.Item; -import net.minecraft.server.StatisticList; +import net.minecraft.server.IRegistry; import net.minecraft.server.StatisticWrapper; import org.bukkit.entity.EntityType; @@ -36,7 +34,7 @@ public class StatisticsAndAchievementsTest extends AbstractTestingBase { @SuppressWarnings("unchecked") public void verifyStatisticMapping() throws Throwable { HashMultiset<Statistic> statistics = HashMultiset.create(); - for (StatisticWrapper wrapper : (Iterable<StatisticWrapper<?>>) StatisticList.REGISTRY) { // Eclipse fail + for (StatisticWrapper wrapper : (Iterable<StatisticWrapper<?>>) IRegistry.STATS) { // Eclipse fail for (Object child : wrapper.a()) { net.minecraft.server.Statistic<?> statistic = wrapper.b(child); String message = String.format("org.bukkit.Statistic is missing: '%s'", statistic); @@ -44,9 +42,9 @@ public class StatisticsAndAchievementsTest extends AbstractTestingBase { Statistic subject = CraftStatistic.getBukkitStatistic(statistic); assertThat(message, subject, is(not(nullValue()))); - if (wrapper.a() == Block.REGISTRY || wrapper.a() == Item.REGISTRY) { + if (wrapper.a() == IRegistry.BLOCK || wrapper.a() == IRegistry.ITEM) { assertNotNull("Material type map missing for " + child, CraftStatistic.getMaterialFromStatistic(statistic)); - } else if (wrapper.a() == EntityTypes.REGISTRY) { + } else if (wrapper.a() == IRegistry.ENTITY_TYPE) { assertNotNull("Entity type map missing for " + EntityTypes.getName((EntityTypes<?>) child), CraftStatistic.getEntityTypeFromStatistic((net.minecraft.server.Statistic<EntityTypes<?>>) statistic)); } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index f66cc81d..00f89f22 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import net.minecraft.server.Block; +import net.minecraft.server.IRegistry; import net.minecraft.server.ITileEntity; import net.minecraft.server.Item; import net.minecraft.server.ItemBlock; @@ -159,7 +160,7 @@ public class ItemMetaTest extends AbstractTestingBase { public void testBlockStateMeta() { List<Block> queue = new ArrayList<>(); - for (Item item : (Iterable<Item>) Item.REGISTRY) { // Eclipse fail + for (Item item : (Iterable<Item>) IRegistry.ITEM) { // Eclipse fail if (item instanceof ItemBlock) { queue.add(((ItemBlock) item).getBlock()); } diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java index d8c3b013..ce9a098a 100644 --- a/src/test/java/org/bukkit/entity/EntityTypesTest.java +++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; import net.minecraft.server.EntityTypes; +import net.minecraft.server.IRegistry; import net.minecraft.server.MinecraftKey; import org.junit.Assert; import org.junit.Test; @@ -14,7 +15,7 @@ public class EntityTypesTest { public void testMaps() { Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet()); - for (Object o : EntityTypes.REGISTRY) { + for (Object o : IRegistry.ENTITY_TYPE) { EntityTypes<?> nms = (EntityTypes<?>) o; // Eclipse fail MinecraftKey key = EntityTypes.getName(nms); diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java index 74ed926f..f6c23ebb 100644 --- a/src/test/java/org/bukkit/potion/PotionTest.java +++ b/src/test/java/org/bukkit/potion/PotionTest.java @@ -1,11 +1,11 @@ package org.bukkit.potion; import static org.junit.Assert.*; -import static org.hamcrest.Matchers.*; import java.util.EnumMap; import java.util.List; import java.util.Map; +import net.minecraft.server.IRegistry; import net.minecraft.server.MobEffect; import net.minecraft.server.MobEffectList; @@ -17,7 +17,7 @@ public class PotionTest extends AbstractTestingBase { @Test public void testEffectCompleteness() throws Throwable { Map<PotionType, String> effects = new EnumMap(PotionType.class); - for (Object reg : PotionRegistry.a) { + for (Object reg : IRegistry.POTION) { List<MobEffect> eff = ((PotionRegistry)reg).a(); if (eff.size() != 1) continue; int id = MobEffectList.getId(eff.get(0).getMobEffect()); diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java index 02a31f09..c9fd5e27 100644 --- a/src/test/java/org/bukkit/support/DummyServer.java +++ b/src/test/java/org/bukkit/support/DummyServer.java @@ -87,7 +87,7 @@ public class DummyServer implements InvocationHandler { @Override
public Object handle(DummyServer server, Object[] args) {
NamespacedKey key = (NamespacedKey) args[0];
- return new CraftLootTable(key, AbstractTestingBase.LOOT_TABLE_REGISTRY.a(CraftNamespacedKey.toMinecraft(key)));
+ return new CraftLootTable(key, AbstractTestingBase.LOOT_TABLE_REGISTRY.getLootTable(CraftNamespacedKey.toMinecraft(key)));
}
}
);
|