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

@@ -1,6 +1,17 @@
--- a/net/minecraft/server/Convertable.java
+++ b/net/minecraft/server/Convertable.java
@@ -73,21 +73,21 @@
--- a/net/minecraft/world/level/storage/Convertable.java
+++ b/net/minecraft/world/level/storage/Convertable.java
@@ -47,6 +47,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.dimension.WorldDimension;
+// CraftBukkit end
+
public class Convertable {
private static final Logger LOGGER = LogManager.getLogger();
@@ -96,21 +100,21 @@
Logger logger1 = Convertable.LOGGER;
logger1.getClass();
@@ -25,7 +36,7 @@
return new IllegalStateException("Failed to get noise settings registry");
});
@@ -195,8 +195,10 @@
@@ -218,8 +222,10 @@
};
}
@@ -38,10 +49,10 @@
}
public class ConversionSession implements AutoCloseable {
@@ -205,8 +207,12 @@
public final java.nio.file.Path folder;
@@ -228,8 +234,12 @@
public final Path folder;
private final String levelName;
private final Map<SavedFile, java.nio.file.Path> e = Maps.newHashMap();
private final Map<SavedFile, Path> e = Maps.newHashMap();
+ // CraftBukkit start
+ private final ResourceKey<WorldDimension> dimensionType;
@@ -52,15 +63,15 @@
this.levelName = s;
this.folder = Convertable.this.universe.resolve(s);
this.lock = SessionLock.a(this.folder);
@@ -223,9 +229,23 @@
@@ -246,8 +256,22 @@
}
public File a(ResourceKey<World> resourcekey) {
- return DimensionManager.a(resourcekey, this.folder.toFile());
+ // CraftBukkit start
+ return this.getFolder(this.folder.toFile());
}
+ }
+
+ private File getFolder(File file) {
+ if (dimensionType == WorldDimension.OVERWORLD) {
+ return file;
@@ -71,9 +82,8 @@
+ } else {
+ throw new IllegalArgumentException("Unknwon dimension " + this.dimensionType);
+ }
+ }
}
+ // CraftBukkit end
+
private void checkSession() {
if (!this.lock.a()) {
throw new IllegalStateException("Lock is no longer valid");

View File

@@ -1,10 +1,13 @@
--- a/net/minecraft/server/WorldDataServer.java
+++ b/net/minecraft/server/WorldDataServer.java
@@ -14,10 +14,16 @@
--- a/net/minecraft/world/level/storage/WorldDataServer.java
+++ b/net/minecraft/world/level/storage/WorldDataServer.java
@@ -38,10 +38,19 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.protocol.game.PacketPlayOutServerDifficulty;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.WorldServer;
+import org.bukkit.Bukkit;
+import org.bukkit.event.weather.ThunderChangeEvent;
+import org.bukkit.event.weather.WeatherChangeEvent;
@@ -18,7 +21,7 @@
private final GeneratorSettings c;
private final Lifecycle d;
private int e;
@@ -51,6 +57,7 @@
@@ -75,6 +84,7 @@
private final Set<String> C;
private boolean D;
private final CustomFunctionCallbackTimerQueue<MinecraftServer> E;
@@ -26,7 +29,7 @@
private WorldDataServer(@Nullable DataFixer datafixer, int i, @Nullable NBTTagCompound nbttagcompound, boolean flag, int j, int k, int l, float f, long i1, long j1, int k1, int l1, int i2, boolean flag1, int j2, boolean flag2, boolean flag3, boolean flag4, WorldBorder.c worldborder_c, int k2, int l2, @Nullable UUID uuid, LinkedHashSet<String> linkedhashset, CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue, @Nullable NBTTagCompound nbttagcompound1, NBTTagCompound nbttagcompound2, WorldSettings worldsettings, GeneratorSettings generatorsettings, Lifecycle lifecycle) {
this.k = datafixer;
@@ -94,7 +101,8 @@
@@ -118,7 +128,8 @@
return (NBTBase) dynamic.get("DimensionData").get("1").get("DragonFight").orElseEmptyMap().getValue();
});
@@ -36,7 +39,7 @@
return SystemUtils.a(dynamic1.asString().result());
}).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new CustomFunctionCallbackTimerQueue<>(CustomFunctionCallbackTimers.a, dynamic.get("ScheduledEvents").asStream()), (NBTTagCompound) dynamic.get("CustomBossEvents").orElseEmptyMap().getValue(), nbttagcompound1, worldsettings, generatorsettings, lifecycle);
}
@@ -126,7 +134,7 @@
@@ -150,7 +161,7 @@
nbttagcompound.set("Version", nbttagcompound2);
nbttagcompound.setInt("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
RegistryWriteOps<NBTBase> registrywriteops = RegistryWriteOps.a(DynamicOpsNBT.a, iregistrycustom);
@@ -45,7 +48,7 @@
Logger logger = WorldDataServer.LOGGER;
logger.getClass();
@@ -174,6 +182,7 @@
@@ -198,6 +209,7 @@
nbttagcompound.a("WanderingTraderId", this.B);
}
@@ -53,7 +56,7 @@
}
@Override
@@ -291,6 +300,20 @@
@@ -315,6 +327,20 @@
@Override
public void setThundering(boolean flag) {
@@ -74,7 +77,7 @@
this.thundering = flag;
}
@@ -311,6 +334,20 @@
@@ -335,6 +361,20 @@
@Override
public void setStorm(boolean flag) {
@@ -95,7 +98,7 @@
this.raining = flag;
}
@@ -377,6 +414,12 @@
@@ -401,6 +441,12 @@
@Override
public void setDifficulty(EnumDifficulty enumdifficulty) {
this.b = this.b.a(enumdifficulty);
@@ -108,7 +111,7 @@
}
@Override
@@ -481,4 +524,12 @@
@@ -505,4 +551,12 @@
public IWorldDataServer H() {
return this;
}

View File

@@ -1,19 +1,20 @@
--- a/net/minecraft/server/WorldNBTStorage.java
+++ b/net/minecraft/server/WorldNBTStorage.java
@@ -6,6 +6,12 @@
--- a/net/minecraft/world/level/storage/WorldNBTStorage.java
+++ b/net/minecraft/world/level/storage/WorldNBTStorage.java
@@ -12,6 +12,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.io.FileInputStream;
+import java.io.InputStream;
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+// CraftBukkit end
+
public class WorldNBTStorage {
private static final Logger LOGGER = LogManager.getLogger();
@@ -49,6 +55,16 @@
@@ -55,6 +62,16 @@
}
if (nbttagcompound != null) {
@@ -30,7 +31,7 @@
int i = nbttagcompound.hasKeyOfType("DataVersion", 3) ? nbttagcompound.getInt("DataVersion") : -1;
entityhuman.load(GameProfileSerializer.a(this.a, DataFixTypes.PLAYER, nbttagcompound, i));
@@ -57,6 +73,22 @@
@@ -63,6 +80,22 @@
return nbttagcompound;
}
@@ -53,7 +54,7 @@
public String[] getSeenPlayers() {
String[] astring = this.playerDir.list();
@@ -72,4 +104,10 @@
@@ -78,4 +111,10 @@
return astring;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootTable.java
+++ b/net/minecraft/server/LootTable.java
@@ -19,6 +19,13 @@
--- a/net/minecraft/world/level/storage/loot/LootTable.java
+++ b/net/minecraft/world/level/storage/loot/LootTable.java
@@ -29,6 +29,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -14,7 +14,7 @@
public class LootTable {
private static final Logger LOGGER = LogManager.getLogger();
@@ -103,8 +110,21 @@
@@ -113,8 +120,21 @@
}
public void fillInventory(IInventory iinventory, LootTableInfo loottableinfo) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootTableRegistry.java
+++ b/net/minecraft/server/LootTableRegistry.java
@@ -15,6 +15,7 @@
--- a/net/minecraft/world/level/storage/loot/LootTableRegistry.java
+++ b/net/minecraft/world/level/storage/loot/LootTableRegistry.java
@@ -21,6 +21,7 @@
private static final Logger LOGGER = LogManager.getLogger();
private static final Gson b = LootSerialization.c().create();
private Map<MinecraftKey, LootTable> keyToLootTable = ImmutableMap.of();
@@ -8,16 +8,16 @@
private final LootPredicateManager d;
public LootTableRegistry(LootPredicateManager lootpredicatemanager) {
@@ -50,7 +51,7 @@
@@ -56,7 +57,7 @@
LootPredicateManager lootpredicatemanager = this.d;
this.d.getClass();
- Function function = lootpredicatemanager::a;
+ Function<MinecraftKey, LootItemCondition> function = lootpredicatemanager::a; // CraftBukkit - decompile error
+ Function<MinecraftKey, net.minecraft.world.level.storage.loot.predicates.LootItemCondition> function = lootpredicatemanager::a; // CraftBukkit - decompile error
immutablemap.getClass();
LootCollector lootcollector = new LootCollector(lootcontextparameterset, function, immutablemap::get);
@@ -62,6 +63,11 @@
@@ -68,6 +69,11 @@
LootTableRegistry.LOGGER.warn("Found validation problem in " + s + ": " + s1);
});
this.keyToLootTable = immutablemap;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootEntryAbstract.java
+++ b/net/minecraft/server/LootEntryAbstract.java
@@ -34,7 +34,16 @@
--- a/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java
+++ b/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java
@@ -41,7 +41,16 @@
public Serializer() {}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootEnchantFunction.java
+++ b/net/minecraft/server/LootEnchantFunction.java
@@ -37,8 +37,13 @@
--- a/net/minecraft/world/level/storage/loot/functions/LootEnchantFunction.java
+++ b/net/minecraft/world/level/storage/loot/functions/LootEnchantFunction.java
@@ -47,8 +47,13 @@
if (entity instanceof EntityLiving) {
int i = EnchantmentManager.g((EntityLiving) entity);
@@ -15,7 +15,7 @@
return itemstack;
}
@@ -62,7 +67,7 @@
@@ -72,7 +77,7 @@
public b() {}
public void a(JsonObject jsonobject, LootEnchantFunction lootenchantfunction, JsonSerializationContext jsonserializationcontext) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootContextParameters.java
+++ b/net/minecraft/server/LootContextParameters.java
@@ -12,6 +12,7 @@
--- a/net/minecraft/world/level/storage/loot/parameters/LootContextParameters.java
+++ b/net/minecraft/world/level/storage/loot/parameters/LootContextParameters.java
@@ -21,6 +21,7 @@
public static final LootContextParameter<TileEntity> BLOCK_ENTITY = a("block_entity");
public static final LootContextParameter<ItemStack> TOOL = a("tool");
public static final LootContextParameter<Float> EXPLOSION_RADIUS = a("explosion_radius");

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootItemConditionRandomChanceWithLooting.java
+++ b/net/minecraft/server/LootItemConditionRandomChanceWithLooting.java
@@ -33,6 +33,11 @@
--- a/net/minecraft/world/level/storage/loot/predicates/LootItemConditionRandomChanceWithLooting.java
+++ b/net/minecraft/world/level/storage/loot/predicates/LootItemConditionRandomChanceWithLooting.java
@@ -41,6 +41,11 @@
if (entity instanceof EntityLiving) {
i = EnchantmentManager.g((EntityLiving) entity);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LootItemConditionSurvivesExplosion.java
+++ b/net/minecraft/server/LootItemConditionSurvivesExplosion.java
@@ -30,7 +30,8 @@
--- a/net/minecraft/world/level/storage/loot/predicates/LootItemConditionSurvivesExplosion.java
+++ b/net/minecraft/world/level/storage/loot/predicates/LootItemConditionSurvivesExplosion.java
@@ -34,7 +34,8 @@
Random random = loottableinfo.a();
float f = 1.0F / ofloat;