@@ -46,6 +46,8 @@ public class LegacyTest extends AbstractTestingBase {
|
||||
Material.SMOOTH_QUARTZ_SLAB, Material.SMOOTH_QUARTZ_STAIRS, Material.SMOOTH_RED_SANDSTONE_SLAB, Material.SMOOTH_RED_SANDSTONE_STAIRS, Material.SMOOTH_SANDSTONE_SLAB, Material.SMOOTH_SANDSTONE_STAIRS, Material.SMOOTH_STONE_SLAB, Material.SPRUCE_SIGN,
|
||||
Material.SPRUCE_WALL_SIGN, Material.STONECUTTER, Material.STONE_BRICK_WALL, Material.STONE_STAIRS, Material.SUSPICIOUS_STEW, Material.SWEET_BERRIES, Material.SWEET_BERRY_BUSH, Material.WHITE_DYE, Material.WITHER_ROSE, Material.YELLOW_DYE,
|
||||
Material.COMPOSTER, Material.TRADER_LLAMA_SPAWN_EGG, Material.WANDERING_TRADER_SPAWN_EGG, Material.FOX_SPAWN_EGG, Material.LEATHER_HORSE_ARMOR, Material.GLOBE_BANNER_PATTERN, Material.CUT_RED_SANDSTONE_SLAB, Material.CUT_SANDSTONE_SLAB,
|
||||
// 1.15
|
||||
Material.BEEHIVE, Material.BEE_NEST, Material.BEE_SPAWN_EGG, Material.HONEYCOMB, Material.HONEYCOMB_BLOCK, Material.HONEY_BLOCK, Material.HONEY_BOTTLE,
|
||||
//
|
||||
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));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ItemFactoryTest extends AbstractTestingBase {
|
||||
continue;
|
||||
}
|
||||
|
||||
final Class<?> clazz = Class.forName(entryName.substring(0, entryName.length() - ".class".length()).replace('/', '.'));
|
||||
final Class<?> clazz = Class.forName(entryName.substring(0, entryName.length() - ".class".length()).replace('/', '.'), false, ClassLoader.getSystemClassLoader());
|
||||
assertThat(entryName, clazz, is(not(nullValue())));
|
||||
for (final Field field : clazz.getDeclaredFields()) {
|
||||
if (IAttribute.class.isAssignableFrom(field.getType()) && Modifier.isStatic(field.getModifiers())) {
|
||||
|
||||
@@ -144,44 +144,6 @@ public class ItemMetaTest extends AbstractTestingBase {
|
||||
assertThat(bukkit, is((ItemStack) craft));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoDamageEquality() {
|
||||
CraftItemStack noTag = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS));
|
||||
|
||||
CraftItemStack noDamage = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS));
|
||||
noDamage.handle.setDamage(0);
|
||||
|
||||
CraftItemStack enchanted = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS));
|
||||
enchanted.addEnchantment(Enchantment.DIG_SPEED, 1);
|
||||
|
||||
CraftItemStack enchantedNoDamage = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS));
|
||||
enchantedNoDamage.addEnchantment(Enchantment.DIG_SPEED, 1);
|
||||
enchantedNoDamage.handle.setDamage(0);
|
||||
|
||||
// check tags:
|
||||
assertThat("noTag should have no NBT tag", CraftItemStack.hasItemMeta(noTag.handle), is(false));
|
||||
assertThat("noTag should have no meta", noTag.hasItemMeta(), is(false));
|
||||
|
||||
assertThat("noDamage should have no NBT tag", CraftItemStack.hasItemMeta(noDamage.handle), is(false));
|
||||
assertThat("noDamage should have no meta", noDamage.hasItemMeta(), is(false));
|
||||
|
||||
assertThat("enchanted should have NBT tag", CraftItemStack.hasItemMeta(enchanted.handle), is(true));
|
||||
assertThat("enchanted should have meta", enchanted.hasItemMeta(), is(true));
|
||||
|
||||
assertThat("enchantedNoDamage should have NBT tag", CraftItemStack.hasItemMeta(enchantedNoDamage.handle), is(true));
|
||||
assertThat("enchantedNoDamage should have meta", enchantedNoDamage.hasItemMeta(), is(true));
|
||||
|
||||
// check comparisons:
|
||||
assertThat("noTag and noDamage stacks should be similar", noTag.isSimilar(noDamage), is(true));
|
||||
assertThat("noTag and noDamage stacks should be equal", noTag.equals(noDamage), is(true));
|
||||
|
||||
assertThat("enchanted and enchantedNoDamage stacks should be similar", enchanted.isSimilar(enchantedNoDamage), is(true));
|
||||
assertThat("enchanted and enchantedNoDamage stacks should be equal", enchanted.equals(enchantedNoDamage), is(true));
|
||||
|
||||
assertThat("noTag and enchanted stacks should not be similar", noTag.isSimilar(enchanted), is(false));
|
||||
assertThat("noTag and enchanted stacks should not be equal", noTag.equals(enchanted), is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlockStateMeta() {
|
||||
List<Block> queue = new ArrayList<>();
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import net.minecraft.server.DispenserRegistry;
|
||||
import net.minecraft.server.EnumResourcePackType;
|
||||
import net.minecraft.server.LootPredicateManager;
|
||||
import net.minecraft.server.LootTableRegistry;
|
||||
import net.minecraft.server.ResourceManager;
|
||||
import net.minecraft.server.ResourcePackVanilla;
|
||||
@@ -37,7 +38,7 @@ public abstract class AbstractTestingBase {
|
||||
ResourceManager resourceManager = new ResourceManager(EnumResourcePackType.SERVER_DATA, Thread.currentThread());
|
||||
// add tags and loot tables for unit tests
|
||||
resourceManager.a(TAG_REGISTRY = new TagRegistry());
|
||||
resourceManager.a(LOOT_TABLE_REGISTRY = new LootTableRegistry());
|
||||
resourceManager.a(LOOT_TABLE_REGISTRY = new LootTableRegistry(new LootPredicateManager()));
|
||||
// Register vanilla pack
|
||||
resourceManager.a(MoreExecutors.directExecutor(), MoreExecutors.directExecutor(), Collections.singletonList(new ResourcePackVanilla("minecraft")), CompletableFuture.completedFuture(Unit.INSTANCE)).join();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user