Repackage NMS

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-03-16 09:00:00 +11:00
parent 18496e998f
commit 9da047989c
968 changed files with 5448 additions and 5050 deletions

View File

@@ -8,9 +8,9 @@ import java.util.EnumMap;
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;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.decoration.Paintings;
import org.bukkit.craftbukkit.CraftArt;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;

View File

@@ -1,7 +1,7 @@
package org.bukkit;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.RegistryGeneration;
import net.minecraft.data.RegistryGeneration;
import net.minecraft.world.level.biome.BiomeBase;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.support.AbstractTestingBase;

View File

@@ -2,9 +2,9 @@ package org.bukkit;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.Block;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IRegistry;
import net.minecraft.core.IRegistry;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;

View File

@@ -1,10 +1,10 @@
package org.bukkit;
import static org.hamcrest.Matchers.*;
import net.minecraft.server.BlockCake;
import net.minecraft.server.BlockChest;
import net.minecraft.server.Blocks;
import net.minecraft.server.EnumDirection;
import net.minecraft.core.EnumDirection;
import net.minecraft.world.level.block.BlockCake;
import net.minecraft.world.level.block.BlockChest;
import net.minecraft.world.level.block.Blocks;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Cake;

View File

@@ -1,8 +1,8 @@
package org.bukkit;
import static org.junit.Assert.*;
import net.minecraft.server.EnumChatFormat;
import net.minecraft.server.IChatBaseComponent;
import net.minecraft.EnumChatFormat;
import net.minecraft.network.chat.IChatBaseComponent;
import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -4,7 +4,7 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.EnumColor;
import net.minecraft.world.item.EnumColor;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -1,7 +1,7 @@
package org.bukkit;
import net.minecraft.server.IRegistry;
import net.minecraft.server.MinecraftKey;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.support.AbstractTestingBase;
@@ -13,7 +13,7 @@ public class EnchantmentTest extends AbstractTestingBase {
@Test
public void verifyMapping() {
for (MinecraftKey key : IRegistry.ENCHANTMENT.keySet()) {
net.minecraft.server.Enchantment nms = IRegistry.ENCHANTMENT.get(key);
net.minecraft.world.item.enchantment.Enchantment nms = IRegistry.ENCHANTMENT.get(key);
Enchantment bukkitById = Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(key));

View File

@@ -1,7 +1,7 @@
package org.bukkit;
import java.util.Map;
import net.minecraft.server.GameRules;
import net.minecraft.world.level.GameRules;
import org.bukkit.craftbukkit.CraftWorld;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -1,6 +1,6 @@
package org.bukkit;
import net.minecraft.server.MinecraftKey;
import net.minecraft.resources.MinecraftKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.loot.LootTable;
import org.bukkit.loot.LootTables;
@@ -24,7 +24,7 @@ public class LootTablesTest extends AbstractTestingBase {
@Test
public void testNMS() {
for (MinecraftKey key : net.minecraft.server.LootTables.a()) {
for (MinecraftKey key : net.minecraft.world.level.storage.loot.LootTables.a()) {
NamespacedKey bukkitKey = CraftNamespacedKey.fromMinecraft(key);
LootTables lootTable = Registry.LOOT_TABLES.get(bukkitKey);

View File

@@ -11,9 +11,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.StreamSupport;
import net.minecraft.server.IRegistry;
import net.minecraft.server.Item;
import net.minecraft.server.MinecraftKey;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.item.Item;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;

View File

@@ -1,6 +1,6 @@
package org.bukkit;
import net.minecraft.server.IRegistry;
import net.minecraft.core.IRegistry;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftParticle;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -28,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 : IRegistry.PARTICLE_TYPE) {
for (net.minecraft.core.particles.Particle nms : IRegistry.PARTICLE_TYPE) {
Assert.assertNotNull("Missing NMS->Bukkit particle mapping for " + IRegistry.PARTICLE_TYPE.getKey(nms), CraftParticle.toBukkit(nms));
}
}

View File

@@ -5,20 +5,20 @@ import static org.junit.Assert.*;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Map;
import net.minecraft.server.Block;
import net.minecraft.server.BlockAccessAir;
import net.minecraft.server.BlockBase;
import net.minecraft.server.BlockFalling;
import net.minecraft.server.BlockFire;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.Blocks;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.EnumHand;
import net.minecraft.server.IBlockData;
import net.minecraft.server.Item;
import net.minecraft.server.ItemRecord;
import net.minecraft.server.MovingObjectPositionBlock;
import net.minecraft.server.TileEntityFurnace;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.EnumHand;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemRecord;
import net.minecraft.world.level.BlockAccessAir;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.BlockFalling;
import net.minecraft.world.level.block.BlockFire;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityFurnace;
import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.enchantments.EnchantmentTarget;
@@ -148,7 +148,7 @@ public class PerMaterialTest extends AbstractTestingBase {
@Test
public void isFuel() {
assertThat(material.isFuel(), is(TileEntityFurnace.isFuel(new net.minecraft.server.ItemStack(CraftMagicNumbers.getItem(material)))));
assertThat(material.isFuel(), is(TileEntityFurnace.isFuel(new net.minecraft.world.item.ItemStack(CraftMagicNumbers.getItem(material)))));
}
@Test
@@ -219,7 +219,7 @@ public class PerMaterialTest extends AbstractTestingBase {
if (material.isBlock()) {
assertThat(material.isInteractable(),
is(!CraftMagicNumbers.getBlock(material).getClass()
.getMethod("interact", IBlockData.class, net.minecraft.server.World.class, BlockPosition.class, EntityHuman.class, EnumHand.class, MovingObjectPositionBlock.class)
.getMethod("interact", IBlockData.class, net.minecraft.world.level.World.class, BlockPosition.class, EntityHuman.class, EnumHand.class, MovingObjectPositionBlock.class)
.getDeclaringClass().equals(BlockBase.class)));
} else {
assertFalse(material.isInteractable());

View File

@@ -2,8 +2,8 @@ package org.bukkit;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import net.minecraft.server.IRegistry;
import net.minecraft.server.MinecraftKey;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import org.bukkit.craftbukkit.CraftSound;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
@@ -27,13 +27,13 @@ public class SoundTest extends AbstractTestingBase {
@Test
public void testCategory() {
for (SoundCategory category : SoundCategory.values()) {
assertNotNull(category + "", net.minecraft.server.SoundCategory.valueOf(category.name()));
assertNotNull(category + "", net.minecraft.sounds.SoundCategory.valueOf(category.name()));
}
}
@Test
public void testCategoryReverse() {
for (net.minecraft.server.SoundCategory category : net.minecraft.server.SoundCategory.values()) {
for (net.minecraft.sounds.SoundCategory category : net.minecraft.sounds.SoundCategory.values()) {
assertNotNull(category + "", SoundCategory.valueOf(category.name()));
}
}

View File

@@ -3,9 +3,9 @@ package org.bukkit;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import com.google.common.collect.HashMultiset;
import net.minecraft.server.EntityTypes;
import net.minecraft.server.IRegistry;
import net.minecraft.server.StatisticWrapper;
import net.minecraft.core.IRegistry;
import net.minecraft.stats.StatisticWrapper;
import net.minecraft.world.entity.EntityTypes;
import org.bukkit.craftbukkit.CraftStatistic;
import org.bukkit.entity.EntityType;
import org.bukkit.support.AbstractTestingBase;
@@ -33,7 +33,7 @@ public class StatisticsAndAchievementsTest extends AbstractTestingBase {
HashMultiset<Statistic> statistics = HashMultiset.create();
for (StatisticWrapper wrapper : IRegistry.STATS) {
for (Object child : wrapper.getRegistry()) {
net.minecraft.server.Statistic<?> statistic = wrapper.b(child);
net.minecraft.stats.Statistic<?> statistic = wrapper.b(child);
String message = String.format("org.bukkit.Statistic is missing: '%s'", statistic);
Statistic subject = CraftStatistic.getBukkitStatistic(statistic);
@@ -42,7 +42,7 @@ public class StatisticsAndAchievementsTest extends AbstractTestingBase {
if (wrapper.getRegistry() == IRegistry.BLOCK || wrapper.getRegistry() == IRegistry.ITEM) {
assertNotNull("Material type map missing for " + wrapper.getRegistry().getKey(child), CraftStatistic.getMaterialFromStatistic(statistic));
} else if (wrapper.getRegistry() == IRegistry.ENTITY_TYPE) {
assertNotNull("Entity type map missing for " + EntityTypes.getName((EntityTypes<?>) child), CraftStatistic.getEntityTypeFromStatistic((net.minecraft.server.Statistic<EntityTypes<?>>) statistic));
assertNotNull("Entity type map missing for " + EntityTypes.getName((EntityTypes<?>) child), CraftStatistic.getEntityTypeFromStatistic((net.minecraft.stats.Statistic<EntityTypes<?>>) statistic));
}
statistics.add(subject);

View File

@@ -1,8 +1,8 @@
package org.bukkit;
import java.util.Map;
import net.minecraft.server.IRegistry;
import net.minecraft.server.MinecraftKey;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
import org.junit.BeforeClass;

View File

@@ -1,7 +1,7 @@
package org.bukkit.block.banner;
import junit.framework.Assert;
import net.minecraft.server.EnumBannerPatternType;
import net.minecraft.world.level.block.entity.EnumBannerPatternType;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;

View File

@@ -8,7 +8,7 @@ public class HeightMapTest {
@Test
public void heightMapConversionFromNMSToBukkitShouldNotThrowExceptio() {
for (net.minecraft.server.HeightMap.Type nmsHeightMapType : net.minecraft.server.HeightMap.Type.values()) {
for (net.minecraft.world.level.levelgen.HeightMap.Type nmsHeightMapType : net.minecraft.world.level.levelgen.HeightMap.Type.values()) {
Assert.assertNotNull("fromNMS", CraftHeightMap.fromNMS(nmsHeightMapType));
}
}

View File

@@ -1,8 +1,8 @@
package org.bukkit.craftbukkit.attribute;
import net.minecraft.server.AttributeBase;
import net.minecraft.server.IRegistry;
import net.minecraft.server.MinecraftKey;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.ai.attributes.AttributeBase;
import org.bukkit.attribute.Attribute;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;

View File

@@ -6,7 +6,7 @@ import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.UUID;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.nbt.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;

View File

@@ -6,13 +6,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
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;
import net.minecraft.server.ItemBlockWallable;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.core.IRegistry;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemBlock;
import net.minecraft.world.item.ItemBlockWallable;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ITileEntity;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.DyeColor;

View File

@@ -2,7 +2,7 @@ package org.bukkit.craftbukkit.inventory;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import net.minecraft.server.Enchantments;
import net.minecraft.world.item.enchantment.Enchantments;
import org.bukkit.inventory.ItemStack;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
@@ -11,7 +11,7 @@ public class NMSCraftItemStackTest extends AbstractTestingBase {
@Test
public void testCloneEnchantedItem() throws Exception {
net.minecraft.server.ItemStack nmsItemStack = new net.minecraft.server.ItemStack(net.minecraft.server.Items.POTION);
net.minecraft.world.item.ItemStack nmsItemStack = new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.POTION);
nmsItemStack.addEnchantment(Enchantments.DAMAGE_ALL, 1);
ItemStack itemStack = CraftItemStack.asCraftMirror(nmsItemStack);
ItemStack clone = itemStack.clone();
@@ -25,7 +25,7 @@ public class NMSCraftItemStackTest extends AbstractTestingBase {
@Test
public void testCloneNullItem() throws Exception {
net.minecraft.server.ItemStack nmsItemStack = null;
net.minecraft.world.item.ItemStack nmsItemStack = null;
ItemStack itemStack = CraftItemStack.asCraftMirror(nmsItemStack);
ItemStack clone = itemStack.clone();
assertThat(clone, is(itemStack));

View File

@@ -6,7 +6,7 @@ import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.UUID;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.nbt.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;

View File

@@ -1,9 +1,9 @@
package org.bukkit.craftbukkit.inventory;
import static org.junit.Assert.*;
import net.minecraft.server.ItemStack;
import net.minecraft.server.Items;
import net.minecraft.server.PlayerInventory;
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;

View File

@@ -1,9 +1,9 @@
package org.bukkit.craftbukkit.util;
import static org.junit.Assert.*;
import net.minecraft.server.ChatComponentText;
import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.IChatMutableComponent;
import net.minecraft.network.chat.ChatComponentText;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.chat.IChatMutableComponent;
import org.junit.Test;
public class CraftChatMessageTest {

View File

@@ -1,8 +1,8 @@
package org.bukkit.enchantments;
import net.minecraft.server.EnchantmentSlotType;
import net.minecraft.server.IRegistry;
import net.minecraft.server.Item;
import net.minecraft.core.IRegistry;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.enchantment.EnchantmentSlotType;
import org.bukkit.Material;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.junit.Assert;

View File

@@ -1,6 +1,6 @@
package org.bukkit.entity;
import net.minecraft.server.DragonControllerPhase;
import net.minecraft.world.entity.boss.enderdragon.phases.DragonControllerPhase;
import org.bukkit.craftbukkit.entity.CraftEnderDragon;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -3,9 +3,9 @@ package org.bukkit.entity;
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 net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.EntityTypes;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -1,6 +1,6 @@
package org.bukkit.entity;
import net.minecraft.server.EntityPanda;
import net.minecraft.world.entity.animal.EntityPanda;
import org.bukkit.craftbukkit.entity.CraftPanda;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -1,8 +1,8 @@
package org.bukkit.entity.memory;
import net.minecraft.server.GlobalPos;
import net.minecraft.server.IRegistry;
import net.minecraft.server.MemoryModuleType;
import net.minecraft.core.GlobalPos;
import net.minecraft.core.IRegistry;
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryKey;
import org.bukkit.support.AbstractTestingBase;

View File

@@ -3,7 +3,7 @@ package org.bukkit.map;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.MaterialMapColor;
import net.minecraft.world.level.material.MaterialMapColor;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -4,11 +4,11 @@ import static org.junit.Assert.*;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import net.minecraft.server.IRegistry;
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList;
import net.minecraft.server.PotionRegistry;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectList;
import net.minecraft.world.item.alchemy.PotionRegistry;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;

View File

@@ -6,13 +6,13 @@ import java.util.Collections;
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;
import net.minecraft.server.TagRegistry;
import net.minecraft.server.Unit;
import net.minecraft.server.packs.EnumResourcePackType;
import net.minecraft.server.packs.ResourcePackVanilla;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.tags.TagRegistry;
import net.minecraft.util.Unit;
import net.minecraft.world.level.storage.loot.LootPredicateManager;
import net.minecraft.world.level.storage.loot.LootTableRegistry;
import org.bukkit.Material;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.junit.Assert;

View File

@@ -1,6 +1,6 @@
package org.bukkit.support;
import net.minecraft.server.Enchantments;
import net.minecraft.world.item.enchantment.Enchantments;
public class DummyEnchantments {
static {