Update to Minecraft 1.18.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-03-01 02:00:00 +11:00
parent bd40300a4f
commit 9ee989ea81
184 changed files with 1785 additions and 1785 deletions

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/DispenserRegistry.java
+++ b/net/minecraft/server/DispenserRegistry.java
@@ -34,6 +34,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -33,6 +33,12 @@
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.util.datafix.fixes.DataConverterFlattenData;
@@ -13,7 +13,7 @@
public class DispenserRegistry {
public static final PrintStream STDOUT = System.out;
@@ -44,6 +50,23 @@
@@ -43,6 +49,23 @@
public static void bootStrap() {
if (!DispenserRegistry.isBootstrapped) {
@@ -37,8 +37,8 @@
DispenserRegistry.isBootstrapped = true;
if (IRegistry.REGISTRY.keySet().isEmpty()) {
throw new IllegalStateException("Unable to load registries");
@@ -61,6 +84,69 @@
TagStatic.bootStrap();
@@ -60,6 +83,69 @@
IRegistry.freezeBuiltins();
wrapStreams();
}
+ // CraftBukkit start - easier than fixing the decompile

View File

@@ -1,19 +1,19 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -56,6 +56,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -57,6 +57,12 @@
import net.minecraft.world.level.storage.WorldInfo;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.concurrent.atomic.AtomicReference;
+import net.minecraft.SharedConstants;
+import net.minecraft.world.level.dimension.DimensionManager;
+import net.minecraft.world.level.dimension.WorldDimension;
+// CraftBukkit end
+
public class Main {
private static final Logger LOGGER;
@@ -63,8 +69,9 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -64,8 +70,9 @@
public Main() {}
@DontObfuscate
@@ -24,7 +24,7 @@
OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -89,9 +96,12 @@
@@ -90,9 +97,12 @@
optionparser.printHelpOn(System.err);
return;
}
@@ -39,8 +39,8 @@
}
@@ -100,13 +110,13 @@
DispenserRegistry.validate();
SystemUtils.startTimerHackThread();
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.builtin();
Path path = Paths.get("server.properties");
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path);
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
@@ -73,10 +73,10 @@
WorldInfo worldinfo = convertable_conversionsession.getSummary();
if (worldinfo != null) {
@@ -139,13 +150,30 @@
@@ -138,13 +149,32 @@
}
}
DataPackConfiguration datapackconfiguration = convertable_conversionsession.getDataPacks();
- boolean flag = optionset.has(optionspec6);
+ boolean flag = optionset.has("safeMode");
@@ -101,26 +101,49 @@
+ } catch (java.io.IOException ex) {
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
+ }
+ AtomicReference<DataPackConfiguration> config = new AtomicReference<>();
+ AtomicReference<DynamicOps<NBTBase>> ops = new AtomicReference<>();
+ // CraftBukkit end
DataPackConfiguration datapackconfiguration1 = MinecraftServer.configurePackRepository(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.DEFAULT : datapackconfiguration, flag);
CompletableFuture completablefuture = DataPackResources.loadResources(resourcepackrepository.openAllSelected(), iregistrycustom_dimension, CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.backgroundExecutor(), Runnable::run);
@@ -160,6 +188,7 @@
WorldStem worldstem;
@@ -158,6 +188,12 @@
}, (iresourcemanager, datapackconfiguration) -> {
IRegistryCustom.e iregistrycustom_e = IRegistryCustom.builtinCopy();
DynamicOps<NBTBase> dynamicops = RegistryOps.createAndLoad(DynamicOpsNBT.INSTANCE, iregistrycustom_e, iresourcemanager);
+ // CraftBukkit start
+ config.set(datapackconfiguration);
+ ops.set(dynamicops);
+ return Pair.of(null, iregistrycustom_e.freeze());
+ // CraftBukkit end
+ /*
SaveData savedata = convertable_conversionsession.getDataTag(dynamicops, datapackconfiguration, iregistrycustom_e.allElementsLifecycle());
if (savedata != null) {
@@ -180,6 +216,7 @@
return Pair.of(worlddataserver, iregistrycustom_e.freeze());
}
+ */
}, SystemUtils.backgroundExecutor(), Runnable::run).get();
} catch (Exception exception) {
Main.LOGGER.warn("Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode", exception);
@@ -188,6 +225,7 @@
}
datapackresources.updateGlobals();
worldstem.updateGlobals();
+ /*
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.createAndLoad(DynamicOpsNBT.INSTANCE, datapackresources.getResourceManager(), iregistrycustom_dimension);
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registryAccess();
dedicatedserversettings.getProperties().getWorldGenSettings(iregistrycustom_dimension);
@@ -189,21 +218,32 @@
@@ -200,21 +238,32 @@
}
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, (SaveData) object);
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
+ */
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> {
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, object, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, config.get(), ops.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
+ /*
dedicatedserver1.setSingleplayerName((String) optionset.valueOf(optionspec8));
@@ -148,15 +171,15 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.halt(true);
@@ -212,6 +252,7 @@
@@ -223,6 +272,7 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
+ */ // CraftBukkit end
} catch (Exception exception1) {
Main.LOGGER.fatal("Failed to start the minecraft server", exception1);
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
}
@@ -219,7 +260,7 @@
@@ -230,7 +280,7 @@
}
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, GeneratorSettings generatorsettings) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -160,6 +160,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -163,6 +163,26 @@
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.DynamicOps;
@@ -11,7 +11,6 @@
+import joptsimple.OptionSet;
+import net.minecraft.nbt.DynamicOpsNBT;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.resources.RegistryReadOps;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.dedicated.DedicatedServerProperties;
+import net.minecraft.util.datafix.DataConverterRegistry;
@@ -27,14 +26,14 @@
+
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
public static final Logger LOGGER = LogManager.getLogger();
@@ -252,6 +273,21 @@
public static final Logger LOGGER = LogUtils.getLogger();
@@ -255,6 +275,21 @@
protected SaveData worldData;
private volatile boolean isSaving;
+ // CraftBukkit start
+ public final DataPackConfiguration datapackconfiguration;
+ public final RegistryReadOps<NBTBase> registryreadops;
+ public final DynamicOps<NBTBase> registryreadops;
+ public org.bukkit.craftbukkit.CraftServer server;
+ public OptionSet options;
+ public org.bukkit.command.ConsoleCommandSender console;
@@ -50,7 +49,7 @@
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> {
@@ -265,14 +301,14 @@
@@ -268,14 +303,14 @@
thread.setPriority(8);
}
@@ -62,12 +61,12 @@
return s0;
}
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- public MinecraftServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, DynamicOps<NBTBase> registryreadops, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
super("Server");
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
this.profiler = this.metricsRecorder.getProfiler();
@@ -284,7 +320,7 @@
@@ -287,7 +322,7 @@
this.status = new ServerPing();
this.random = new Random();
this.port = -1;
@@ -76,15 +75,15 @@
this.running = true;
this.tickTimes = new long[100];
this.resourcePack = "";
@@ -314,13 +350,41 @@
this.structureManager = new DefinedStructureManager(datapackresources.getResourceManager(), convertable_conversionsession, datafixer);
@@ -317,13 +352,41 @@
this.structureManager = new DefinedStructureManager(worldstem.resourceManager(), convertable_conversionsession, datafixer);
this.serverThread = thread;
this.executor = SystemUtils.backgroundExecutor();
+ // CraftBukkit start
+ this.options = options;
+ this.datapackconfiguration = datapackconfiguration;
+ this.registryreadops = RegistryReadOps.createAndLoad(DynamicOpsNBT.INSTANCE, datapackresources.getResourceManager(), iregistrycustom_dimension);
+ this.vanillaCommandDispatcher = datapackresources.commands; // CraftBukkit
+ this.registryreadops = registryreadops;
+ this.vanillaCommandDispatcher = worldstem.dataPackResources().commands; // CraftBukkit
+ // Try to see if we're actually running in a terminal, disable jline if not
+ if (System.console() == null && System.getProperty("jline.terminal") == null) {
+ System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
@@ -119,7 +118,7 @@
ScoreboardServer scoreboardserver1 = this.getScoreboard();
Objects.requireNonNull(scoreboardserver1);
@@ -329,7 +393,7 @@
@@ -332,7 +395,7 @@
protected abstract boolean initServer() throws IOException;
@@ -128,7 +127,7 @@
if (!JvmProfiler.INSTANCE.isRunning()) {
;
}
@@ -337,13 +401,8 @@
@@ -340,13 +403,8 @@
boolean flag = false;
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
@@ -143,7 +142,7 @@
if (profiledduration != null) {
profiledduration.finish();
}
@@ -358,36 +417,206 @@
@@ -361,36 +419,206 @@
}
@@ -152,7 +151,7 @@
+ private void loadWorld0(String s) {
+ Convertable.ConversionSession worldSession = this.storageSource;
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registryHolder;
+ WorldDataServer overworldData = (WorldDataServer) worldSession.getDataTag(registryreadops, datapackconfiguration);
+ WorldDataServer overworldData = (WorldDataServer) worldSession.getDataTag(registryreadops, datapackconfiguration, iregistrycustom_dimension.allElementsLifecycle());
+ if (overworldData == null) {
+ WorldSettings worldsettings;
+ GeneratorSettings generatorsettings;
@@ -170,16 +169,16 @@
- long i = generatorsettings.seed();
- long j = BiomeManager.obfuscateSeed(i);
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
- RegistryMaterials<WorldDimension> registrymaterials = generatorsettings.dimensions();
- WorldDimension worlddimension = (WorldDimension) registrymaterials.get(WorldDimension.OVERWORLD);
- DimensionManager dimensionmanager;
- IRegistry<WorldDimension> iregistry = generatorsettings.dimensions();
- WorldDimension worlddimension = (WorldDimension) iregistry.get(WorldDimension.OVERWORLD);
- Holder holder;
- Object object;
-
- if (worlddimension == null) {
- dimensionmanager = (DimensionManager) this.registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionManager.OVERWORLD_LOCATION);
- object = GeneratorSettings.makeDefaultOverworld(this.registryHolder, (new Random()).nextLong());
- holder = this.registryAccess().registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrCreateHolder(DimensionManager.OVERWORLD_LOCATION);
- object = GeneratorSettings.makeDefaultOverworld(this.registryAccess(), (new Random()).nextLong());
- } else {
- dimensionmanager = worlddimension.type();
- holder = worlddimension.typeHolder();
- object = worlddimension.generator();
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension).withBonusChest() : dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension);
@@ -189,9 +188,9 @@
+ }
+
+ GeneratorSettings overworldSettings = overworldData.worldGenSettings();
+ RegistryMaterials<WorldDimension> registrymaterials = overworldSettings.dimensions();
+ for (Entry<ResourceKey<WorldDimension>, WorldDimension> entry : registrymaterials.entrySet()) {
+ ResourceKey<WorldDimension> dimensionKey = entry.getKey();
+ IRegistry<WorldDimension> iregistry = overworldSettings.dimensions();
+ for (WorldDimension worldDimension : iregistry) {
+ ResourceKey<WorldDimension> dimensionKey = iregistry.getResourceKey(worldDimension).get();
+
+ WorldServer world;
+ int dimension = 0;
@@ -259,7 +258,7 @@
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
+
+ WorldDataServer worlddata = (WorldDataServer) worldSession.getDataTag((DynamicOps) registryreadops, datapackconfiguration);
+ WorldDataServer worlddata = (WorldDataServer) worldSession.getDataTag((DynamicOps) registryreadops, datapackconfiguration, iregistrycustom_dimension.allElementsLifecycle());
+ if (worlddata == null) {
+ WorldSettings worldsettings;
+ GeneratorSettings generatorsettings;
@@ -289,27 +288,27 @@
+ long i = generatorsettings.seed();
+ long j = BiomeManager.obfuscateSeed(i);
+ List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
+ WorldDimension worlddimension = (WorldDimension) registrymaterials.get(dimensionKey);
+ DimensionManager dimensionmanager;
+ WorldDimension worlddimension = (WorldDimension) iregistry.get(dimensionKey);
+ Holder<DimensionManager> holder;
+ ChunkGenerator chunkgenerator;
+
+ if (worlddimension == null) {
+ dimensionmanager = (DimensionManager) this.registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionManager.OVERWORLD_LOCATION);
+ holder = this.registryAccess().registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrCreateHolder(DimensionManager.OVERWORLD_LOCATION);
+ chunkgenerator = GeneratorSettings.makeDefaultOverworld(this.registryHolder, (new Random()).nextLong());
+ } else {
+ dimensionmanager = worlddimension.type();
+ holder = worlddimension.typeHolder();
+ chunkgenerator = worlddimension.generator();
+ }
+
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), dimensionmanager);
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), holder.value());
+ if (biomeProvider == null && gen != null) {
+ biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
+ }
+
+ if (biomeProvider != null) {
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(worldInfo, biomeProvider, registryHolder.ownedRegistryOrThrow(IRegistry.BIOME_REGISTRY));
+ if (chunkgenerator instanceof ChunkGeneratorAbstract) {
+ chunkgenerator = new ChunkGeneratorAbstract(((ChunkGeneratorAbstract) chunkgenerator).noises, worldChunkManager, chunkgenerator.strongholdSeed, ((ChunkGeneratorAbstract) chunkgenerator).settings);
+ if (chunkgenerator instanceof ChunkGeneratorAbstract cga) {
+ chunkgenerator = new ChunkGeneratorAbstract(cga.structureSets, cga.noises, worldChunkManager, chunkgenerator.ringPlacementSeed, cga.settings);
+ }
+ }
+
@@ -321,14 +320,14 @@
+
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
+
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ WorldPersistentData worldpersistentdata = world.getDataStorage();
+ this.readScoreboard(worldpersistentdata);
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
+ } else {
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ }
+
+ worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
@@ -348,7 +347,7 @@
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, holder, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
+ this.connection.acceptConnections();
@@ -374,7 +373,7 @@
if (!iworlddataserver.isInitialized()) {
try {
@@ -411,31 +640,8 @@
@@ -414,31 +642,8 @@
iworlddataserver.setInitialized(true);
}
@@ -383,7 +382,7 @@
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents());
- }
-
- Iterator iterator = registrymaterials.entrySet().iterator();
- Iterator iterator = iregistry.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Entry<ResourceKey<WorldDimension>, WorldDimension> entry = (Entry) iterator.next();
@@ -391,10 +390,10 @@
-
- if (resourcekey != WorldDimension.OVERWORLD) {
- ResourceKey<World> resourcekey1 = ResourceKey.create(IRegistry.DIMENSION_REGISTRY, resourcekey.location());
- DimensionManager dimensionmanager1 = ((WorldDimension) entry.getValue()).type();
- Holder<DimensionManager> holder1 = ((WorldDimension) entry.getValue()).typeHolder();
- ChunkGenerator chunkgenerator = ((WorldDimension) entry.getValue()).generator();
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, holder1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
-
- worldborder.addListener(new IWorldBorderListener.a(worldserver1.getWorldBorder()));
- this.levels.put(resourcekey1, worldserver1);
@@ -407,7 +406,7 @@
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
if (flag1) {
@@ -443,6 +649,21 @@
@@ -446,6 +651,21 @@
} else {
ChunkGenerator chunkgenerator = worldserver.getChunkSource().getGenerator();
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkgenerator.climateSampler().findSpawnPosition());
@@ -429,7 +428,7 @@
int i = chunkgenerator.getSpawnHeight(worldserver);
if (i < worldserver.getMinBuildHeight()) {
@@ -500,8 +721,15 @@
@@ -503,8 +723,15 @@
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
}
@@ -447,7 +446,7 @@
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
BlockPosition blockposition = worldserver.getSharedSpawnPos();
@@ -514,16 +742,20 @@
@@ -517,16 +744,20 @@
chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
while (chunkproviderserver.getTickingGenerated() != 441) {
@@ -476,7 +475,7 @@
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
if (forcedchunk != null) {
@@ -538,11 +770,18 @@
@@ -541,11 +772,18 @@
}
}
@@ -498,7 +497,7 @@
}
protected void detectBundledResources() {
@@ -587,12 +826,16 @@
@@ -590,12 +828,16 @@
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
}
@@ -509,13 +508,13 @@
iworlddataserver.setWorldBorder(worldserver1.getWorldBorder().createSettings());
this.worldData.setCustomBossEvents(this.getCustomBossEvents().save());
this.storageSource.saveDataTag(this.registryHolder, this.worldData, this.getPlayerList().getSingleplayerData());
this.storageSource.saveDataTag(this.registryAccess(), this.worldData, this.getPlayerList().getSingleplayerData());
+ */
+ // CraftBukkit end
if (flag1) {
Iterator iterator1 = this.getAllLevels().iterator();
@@ -627,8 +870,29 @@
@@ -630,8 +872,29 @@
this.stopServer();
}
@@ -545,7 +544,7 @@
if (this.getConnection() != null) {
this.getConnection().stop();
}
@@ -638,6 +902,7 @@
@@ -641,6 +904,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.playerList.saveAll();
this.playerList.removeAll();
@@ -553,7 +552,7 @@
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -712,9 +977,10 @@
@@ -732,9 +996,10 @@
while (this.running) {
long i = SystemUtils.getMillis() - this.nextTickTime;
@@ -565,15 +564,15 @@
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
this.nextTickTime += j * 50L;
this.lastOverloadWarning = this.nextTickTime;
@@ -725,6 +991,7 @@
this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getNanos(), this.tickCount);
@@ -745,6 +1010,7 @@
this.debugCommandProfiler = new MinecraftServer.b(SystemUtils.getNanos(), this.tickCount);
}
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
this.nextTickTime += 50L;
this.startMetricsRecordingTick();
this.profiler.push("tick");
@@ -775,6 +1042,12 @@
@@ -789,6 +1055,12 @@
this.profileCache.clearExecutor();
}
@@ -586,7 +585,7 @@
this.onServerExit();
}
@@ -783,8 +1056,15 @@
@@ -822,8 +1094,15 @@
}
private boolean haveTime() {
@@ -603,7 +602,7 @@
protected void waitUntilNextTick() {
this.runAllTasks();
@@ -830,7 +1110,7 @@
@@ -869,7 +1148,7 @@
}
}
@@ -612,7 +611,7 @@
this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -901,7 +1181,7 @@
@@ -940,7 +1219,7 @@
}
}
@@ -621,7 +620,7 @@
MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save");
this.saveEverything(true, false, false);
@@ -920,22 +1200,39 @@
@@ -959,22 +1238,39 @@
}
public void tickChildren(BooleanSupplier booleansupplier) {
@@ -661,7 +660,7 @@
this.profiler.push("tick");
@@ -1024,7 +1321,7 @@
@@ -1063,7 +1359,7 @@
@DontObfuscate
public String getServerModName() {
@@ -670,9 +669,9 @@
}
public SystemReport fillSystemReport(SystemReport systemreport) {
@@ -1354,16 +1651,17 @@
@@ -1406,11 +1702,11 @@
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
IRegistryCustom.Dimension iregistrycustom_dimension = this.registryAccess();
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
- Stream stream = collection.stream();
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
@@ -682,15 +681,17 @@
- return (ImmutableList) stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(ResourcePackLoader::open).collect(ImmutableList.toImmutableList());
+ return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(ResourcePackLoader::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
}, this).thenCompose((immutablelist) -> {
return DataPackResources.loadResources(immutablelist, this.registryHolder, this.isDedicatedServer() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.getFunctionCompilationLevel(), this.executor, this);
}).thenAcceptAsync((datapackresources) -> {
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
@@ -1425,6 +1721,7 @@
}).thenAcceptAsync((minecraftserver_a) -> {
this.resources.close();
this.resources = datapackresources;
this.resources = minecraftserver_a;
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
this.packRepository.setSelected(collection);
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
datapackresources.updateGlobals();
@@ -1717,7 +2015,7 @@
this.resources.managers.updateRegistryTags(this.registryAccess());
@@ -1774,7 +2071,7 @@
try {
label51:
{
@@ -699,7 +700,7 @@
try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -1767,6 +2065,22 @@
@@ -1824,6 +2121,22 @@
}
@@ -722,3 +723,24 @@
private void startMetricsRecordingTick() {
if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
@@ -1935,8 +2248,10 @@
}
}
- private static record a(IReloadableResourceManager a, DataPackResources b) implements AutoCloseable {
+ // CraftBukkit start - decompile error
+ public static record a(IReloadableResourceManager resourceManager, DataPackResources managers) implements AutoCloseable {
+ /*
final IReloadableResourceManager resourceManager;
final DataPackResources managers;
@@ -1944,6 +2259,8 @@
this.resourceManager = ireloadableresourcemanager;
this.managers = datapackresources;
}
+ */
+ // CraftBukkit end
public void close() {
this.resourceManager.close();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
@@ -79,7 +79,7 @@
@@ -90,7 +90,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getTeam());
} else {
@@ -9,7 +9,7 @@
}
}
@@ -288,7 +288,7 @@
@@ -299,7 +299,7 @@
for (boolean flag2 = iblockaccess.getBlockState(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
blockposition_mutableblockposition.move(EnumDirection.DOWN);
@@ -18,7 +18,7 @@
if (!flag1 && flag2 && flag) {
return blockposition_mutableblockposition.getY() + 1;
}
@@ -301,7 +301,7 @@
@@ -312,7 +312,7 @@
public boolean isSafe(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = new BlockPosition(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
@@ -27,7 +27,7 @@
Material material = iblockdata.getMaterial();
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
@@ -311,5 +311,12 @@
@@ -322,5 +322,12 @@
this.x = MathHelper.nextDouble(random, d0, d2);
this.z = MathHelper.nextDouble(random, d1, d3);
}

View File

@@ -1,12 +1,15 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -61,6 +61,15 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -59,6 +59,18 @@
import net.minecraft.world.level.storage.Convertable;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.DynamicOps;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.world.level.DataPackConfiguration;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.io.IoBuilder;
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.server.ServerCommandEvent;
@@ -15,21 +18,21 @@
+
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
static final Logger LOGGER = LogManager.getLogger();
@@ -81,8 +90,10 @@
static final Logger LOGGER = LogUtils.getLogger();
@@ -79,8 +91,10 @@
@Nullable
private final IChatBaseComponent resourcePackPrompt;
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
- public DedicatedServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ // CraftBukkit start - Signature changed
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ super(options, datapackconfiguration, thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, DynamicOps<NBTBase> registryreadops, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ super(options, datapackconfiguration, registryreadops, thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ // CraftBukkit end
this.settings = dedicatedserversettings;
this.rconConsoleSource = new RemoteControlCommandListener(this);
this.textFilterClient = TextFilter.createFromConfig(dedicatedserversettings.getProperties().textFilteringConfig);
@@ -93,13 +104,44 @@
@@ -91,13 +105,44 @@
public boolean initServer() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
@@ -77,7 +80,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -108,6 +150,27 @@
@@ -106,6 +151,27 @@
}
};
@@ -105,7 +108,7 @@
thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start();
@@ -133,7 +196,7 @@
@@ -131,7 +197,7 @@
this.setMotd(dedicatedserverproperties.motd);
super.setPlayerIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
@@ -114,7 +117,7 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
@@ -157,6 +220,12 @@
@@ -155,6 +221,12 @@
return false;
}
@@ -127,12 +130,12 @@
if (!this.usesAuthentication()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -171,13 +240,13 @@
@@ -169,13 +241,13 @@
if (!NameReferencingFileConverter.serverReadyAfterUserconversion(this)) {
return false;
} else {
- this.setPlayerList(new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage));
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)); // CraftBukkit - moved up
- this.setPlayerList(new DedicatedPlayerList(this, this.registryAccess(), this.playerDataStorage));
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registryAccess(), this.playerDataStorage)); // CraftBukkit - moved up
long i = SystemUtils.getNanos();
TileEntitySkull.setup(this.getProfileCache(), this.getSessionService(), this);
@@ -143,7 +146,7 @@
long j = SystemUtils.getNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -194,6 +263,7 @@
@@ -192,6 +264,7 @@
if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener");
this.rconThread = RemoteControlListener.create(this);
@@ -151,7 +154,7 @@
}
if (this.getMaxTickLength() > 0L) {
@@ -337,6 +407,7 @@
@@ -335,6 +408,7 @@
this.queryThreadGs4.stop();
}
@@ -159,7 +162,7 @@
}
@Override
@@ -358,7 +429,15 @@
@@ -356,7 +430,15 @@
while (!this.consoleInput.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
@@ -176,7 +179,7 @@
}
}
@@ -568,14 +647,45 @@
@@ -566,14 +648,45 @@
@Override
public String getPluginNames() {
@@ -224,7 +227,7 @@
});
return this.rconConsoleSource.getCommandResponse();
}
@@ -649,4 +759,15 @@
@@ -647,4 +760,15 @@
public IChatBaseComponent getResourcePackPrompt() {
return this.resourcePackPrompt;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -10,8 +10,14 @@
@@ -13,8 +13,14 @@
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.levelgen.GeneratorSettings;
@@ -15,7 +15,7 @@
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
@@ -67,8 +73,10 @@
@@ -71,8 +77,10 @@
@Nullable
private GeneratorSettings worldGenSettings;
@@ -28,8 +28,8 @@
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
this.levelName = this.get("level-name", "world");
@@ -112,13 +120,15 @@
this.whiteList = this.getMutable("white-list", false);
@@ -121,13 +129,15 @@
}, "default"));
}
- public static DedicatedServerProperties fromFile(Path path) {
@@ -48,3 +48,24 @@
dedicatedserverproperties.getWorldGenSettings(iregistrycustom);
return dedicatedserverproperties;
@@ -141,8 +151,10 @@
return this.worldGenSettings;
}
- public static record a(String a, JsonObject b, boolean c, String d) {
+ // CraftBukkit start - decompile error
+ public static record a(String levelSeed, JsonObject generatorSettings, boolean generateStructures, String levelType) {
+ /*
private final String levelSeed;
private final JsonObject generatorSettings;
private final boolean generateStructures;
@@ -154,6 +166,8 @@
this.generateStructures = flag;
this.levelType = s1;
}
+ */
+ // CraftBukkit end
public String levelSeed() {
return this.levelSeed;

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/server/dedicated/PropertyManager.java
+++ b/net/minecraft/server/dedicated/PropertyManager.java
@@ -17,15 +17,30 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.core.IRegistryCustom;
import org.slf4j.Logger;
+import joptsimple.OptionSet; // CraftBukkit
+
public abstract class PropertyManager<T extends PropertyManager<T>> {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
public final Properties properties;
+ // CraftBukkit start
+ private OptionSet options = null;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkMapDistance.java
+++ b/net/minecraft/server/level/ChunkMapDistance.java
@@ -125,10 +125,25 @@
@@ -126,10 +126,25 @@
}
if (!this.chunksToUpdateFutures.isEmpty()) {
@@ -29,7 +29,7 @@
return true;
} else {
if (!this.ticketsToRelease.isEmpty()) {
@@ -164,7 +179,7 @@
@@ -165,7 +180,7 @@
}
}
@@ -38,7 +38,7 @@
ArraySetSorted<Ticket<?>> arraysetsorted = this.getTickets(i);
int j = getTicketLevelAt(arraysetsorted);
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
@@ -174,13 +189,15 @@
@@ -175,13 +190,15 @@
this.ticketTracker.update(i, ticket.getTicketLevel(), true);
}
@@ -56,7 +56,7 @@
}
if (arraysetsorted.isEmpty()) {
@@ -188,6 +205,7 @@
@@ -189,6 +206,7 @@
}
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
@@ -64,7 +64,7 @@
}
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@@ -201,19 +219,33 @@
@@ -202,19 +220,33 @@
}
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@@ -100,7 +100,7 @@
}
private ArraySetSorted<Ticket<?>> getTickets(long i) {
@@ -252,6 +284,7 @@
@@ -253,6 +285,7 @@
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
long i = chunkcoordintpair.toLong();
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
@@ -108,8 +108,8 @@
objectset.remove(entityplayer);
if (objectset.isEmpty()) {
@@ -347,6 +380,26 @@
return this.tickingTicketsTracker;
@@ -382,6 +415,26 @@
return !this.tickets.isEmpty();
}
+ // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -86,6 +86,24 @@
@@ -83,6 +83,24 @@
this.clearCache();
}
@@ -18,14 +18,14 @@
+ if (chunk == null) {
+ return null;
+ }
+ return chunk.getFullChunkUnchecked();
+ return chunk.getFullChunk();
+ }
+ // CraftBukkit end
+
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -130,7 +148,7 @@
@@ -127,7 +145,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
ichunkaccess = this.lastChunk[l];
@@ -34,7 +34,7 @@
return ichunkaccess;
}
}
@@ -178,12 +196,12 @@
@@ -175,12 +193,12 @@
if (playerchunk == null) {
return null;
} else {
@@ -49,7 +49,7 @@
if (ichunkaccess1 != null) {
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
@@ -231,7 +249,15 @@
@@ -228,7 +246,15 @@
int l = 33 + ChunkStatus.getDistance(chunkstatus);
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
@@ -66,7 +66,7 @@
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.chunkAbsent(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -250,7 +276,7 @@
@@ -247,7 +273,7 @@
}
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
@@ -75,7 +75,7 @@
}
@Override
@@ -317,7 +343,7 @@
@@ -314,7 +340,7 @@
} else if (!this.level.shouldTickBlocksAt(i)) {
return false;
} else {
@@ -84,7 +84,7 @@
return either != null && either.left().isPresent();
}
@@ -330,11 +356,31 @@
@@ -327,11 +353,31 @@
@Override
public void close() throws IOException {
@@ -115,7 +115,7 @@
+ // CraftBukkit end
+
@Override
public void tick(BooleanSupplier booleansupplier) {
public void tick(BooleanSupplier booleansupplier, boolean flag) {
this.level.getProfiler().push("purge");
@@ -363,7 +409,7 @@
@@ -135,7 +135,7 @@
Collections.shuffle(list);
Iterator iterator1 = list.iterator();
@@ -579,18 +625,26 @@
@@ -581,18 +627,26 @@
}
@Override
@@ -164,7 +164,7 @@
final Chunk chunk;
final PlayerChunk holder;
@@ -606,5 +660,7 @@
@@ -608,5 +662,7 @@
public PlayerChunk holder() {
return this.holder;
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -140,6 +140,33 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
@@ -33,7 +33,7 @@
+
public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -194,6 +221,20 @@
public int latency;
public boolean wonGame;
@@ -113,7 +113,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -319,11 +404,20 @@
@@ -319,17 +404,26 @@
if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
}
@@ -134,6 +134,13 @@
if (nbttagcompound.contains("SpawnX", 99) && nbttagcompound.contains("SpawnY", 99) && nbttagcompound.contains("SpawnZ", 99)) {
this.respawnPosition = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.respawnForced = nbttagcompound.getBoolean("SpawnForced");
this.respawnAngle = nbttagcompound.getFloat("SpawnAngle");
if (nbttagcompound.contains("SpawnDimension")) {
- DataResult dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension"));
+ DataResult<ResourceKey<World>> dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension")); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -356,7 +450,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@@ -414,7 +421,7 @@
+ /*
WorldData worlddata = worldserver.getLevelData();
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeRegistration(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
@@ -780,22 +993,52 @@
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
@@ -454,7 +461,7 @@
+ if (true) { // CraftBukkit
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
+
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeRegistration(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
+ PlayerList playerlist = this.server.getPlayerList();
+

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -40,6 +40,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.network.ServerPlayerConnection;
@@ -12,7 +12,7 @@
+
public class EntityTrackerEntry {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -61,8 +67,12 @@
private List<Entity> lastPassengers;
private boolean wasRiding;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/PlayerChunk.java
+++ b/net/minecraft/server/level/PlayerChunk.java
@@ -35,6 +35,10 @@
@@ -37,6 +37,10 @@
import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.lighting.LightEngine;
@@ -11,7 +11,7 @@
public class PlayerChunk {
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
@@ -72,11 +76,11 @@
@@ -75,11 +79,11 @@
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -25,27 +25,7 @@
this.pos = chunkcoordintpair;
this.levelHeightAccessor = levelheightaccessor;
this.lightEngine = lightengine;
@@ -89,6 +93,19 @@
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
}
+ // CraftBukkit start
+ public Chunk getFullChunk() {
+ if (!getFullChunkStatus(this.oldTicketLevel).isOrAfter(PlayerChunk.State.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks
+ return this.getFullChunkUnchecked();
+ }
+
+ public Chunk getFullChunkUnchecked() {
+ CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL);
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either<IChunkAccess, PlayerChunk.Failure>) statusFuture.getNow(null);
+ return (either == null) ? null : (Chunk) either.left().orElse(null);
+ }
+ // CraftBukkit end
+
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
@@ -114,9 +131,9 @@
@@ -117,17 +121,17 @@
@Nullable
public Chunk getTickingChunk() {
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getTickingChunkFuture();
@@ -57,7 +37,17 @@
}
@Nullable
@@ -161,6 +178,7 @@
public Chunk getFullChunk() {
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getFullChunkFuture();
- Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
+ Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
- return either == null ? null : (Chunk) either.left().orElse((Object) null);
+ return either == null ? null : (Chunk) either.left().orElse(null); // CraftBukkit - decompile error
}
@Nullable
@@ -172,6 +176,7 @@
if (chunk != null) {
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
@@ -65,16 +55,7 @@
if (this.changedBlocksPerSection[i] == null) {
this.hasChangedSections = true;
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
@@ -271,7 +289,7 @@
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(i);
if (completablefuture != null) {
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
boolean flag = either != null && either.right().isPresent();
if (!flag) {
@@ -348,7 +366,7 @@
@@ -368,7 +373,7 @@
this.pendingFullStateConfirmation = completablefuture1;
completablefuture.thenAccept((either) -> {
either.ifLeft((chunk) -> {
@@ -83,7 +64,7 @@
});
});
}
@@ -365,6 +383,30 @@
@@ -385,6 +390,30 @@
boolean flag1 = this.ticketLevel <= PlayerChunkMap.MAX_CHUNK_DISTANCE;
PlayerChunk.State playerchunk_state = getFullChunkStatus(this.oldTicketLevel);
PlayerChunk.State playerchunk_state1 = getFullChunkStatus(this.ticketLevel);
@@ -103,7 +84,7 @@
+ }
+ }).exceptionally((throwable) -> {
+ // ensure exceptions are printed, by default this is not the case
+ MinecraftServer.LOGGER.fatal("Failed to schedule unload callback for chunk " + PlayerChunk.this.pos, throwable);
+ MinecraftServer.LOGGER.error("Failed to schedule unload callback for chunk " + PlayerChunk.this.pos, throwable);
+ return null;
+ });
+
@@ -114,7 +95,7 @@
if (flag) {
Either<IChunkAccess, PlayerChunk.Failure> either = Either.right(new PlayerChunk.Failure() {
@@ -435,6 +477,26 @@
@@ -455,6 +484,26 @@
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
this.oldTicketLevel = this.ticketLevel;
@@ -130,7 +111,7 @@
+ }
+ }).exceptionally((throwable) -> {
+ // ensure exceptions are printed, by default this is not the case
+ MinecraftServer.LOGGER.fatal("Failed to schedule load callback for chunk " + PlayerChunk.this.pos, throwable);
+ MinecraftServer.LOGGER.error("Failed to schedule load callback for chunk " + PlayerChunk.this.pos, throwable);
+ return null;
+ });
+

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -96,6 +96,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -98,6 +98,11 @@
import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.levelgen.GeneratorSettings;
@@ -12,7 +12,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -135,6 +140,27 @@
@@ -139,6 +144,27 @@
private final Queue<Runnable> unloadQueue;
int viewDistance;
@@ -40,7 +40,7 @@
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -291,9 +317,12 @@
@@ -296,9 +322,12 @@
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
List<IChunkAccess> list3 = Lists.newArrayList();
@@ -53,9 +53,9 @@
+ final int l1 = cnt;
+ // CraftBukkit end
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
Optional<IChunkAccess> optional = either.left();
@@ -463,7 +492,7 @@
if (either == null) {
@@ -503,7 +532,7 @@
private void scheduleUnload(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
@@ -64,7 +64,7 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
if (completablefuture1 != completablefuture) {
@@ -642,7 +671,21 @@
@@ -683,7 +712,21 @@
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
if (!list.isEmpty()) {
@@ -87,7 +87,7 @@
}
}
@@ -740,7 +783,7 @@
@@ -782,7 +825,7 @@
if (!playerchunk.wasAccessibleSinceLastSave()) {
return false;
} else {
@@ -96,7 +96,7 @@
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
return false;
@@ -890,7 +933,8 @@
@@ -944,7 +987,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@@ -106,7 +106,7 @@
return chunk.getBlockEntities().size();
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
return chunk.getBlockTicks().count();
@@ -903,7 +947,7 @@
@@ -957,7 +1001,7 @@
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@@ -115,7 +115,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -921,7 +965,7 @@
@@ -975,7 +1019,7 @@
private NBTTagCompound readChunk(ChunkCoordIntPair chunkcoordintpair) throws IOException {
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@@ -124,7 +124,7 @@
}
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
@@ -1342,7 +1386,7 @@
@@ -1396,7 +1440,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@@ -133,7 +133,7 @@
this.entity = entity;
this.range = i;
this.lastSectionPos = SectionPosition.of(entity);
@@ -1395,12 +1439,17 @@
@@ -1449,12 +1493,17 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.entity) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -24,6 +24,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -26,6 +26,27 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -27,8 +27,8 @@
+
public class PlayerInteractManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -54,6 +75,13 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -56,6 +77,13 @@
if (enumgamemode == this.gameModeForPlayer) {
return false;
} else {
@@ -42,7 +42,7 @@
this.setGameModeForPlayer(enumgamemode, this.gameModeForPlayer);
return true;
}
@@ -64,7 +92,7 @@
@@ -66,7 +94,7 @@
this.gameModeForPlayer = enumgamemode;
enumgamemode.updatePlayerAbilities(this.player.getAbilities());
this.player.onUpdateAbilities();
@@ -51,7 +51,7 @@
this.level.updateSleepingPlayerList();
}
@@ -86,7 +114,7 @@
@@ -88,7 +116,7 @@
}
public void tick() {
@@ -60,7 +60,7 @@
IBlockData iblockdata;
if (this.hasDelayedDestroy) {
@@ -142,10 +170,32 @@
@@ -152,10 +180,32 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.level.mayInteract(this.player, blockposition)) {
@@ -93,11 +93,11 @@
if (this.isCreative()) {
this.destroyAndAck(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
return;
@@ -160,11 +210,43 @@
@@ -170,11 +220,43 @@
float f = 1.0F;
iblockdata = this.level.getBlockState(blockposition);
- if (!iblockdata.isAir()) {
iblockdata1 = this.level.getBlockState(blockposition);
- if (!iblockdata1.isAir()) {
+ // CraftBukkit start - Swings at air do *NOT* exist.
+ if (event.useInteractedBlock() == Event.Result.DENY) {
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
@@ -110,9 +110,9 @@
+ } else if (data.getBlock() instanceof BlockTrapdoor) {
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
+ }
+ } else if (!iblockdata.isAir()) {
iblockdata.attack(this.level, blockposition, this.player);
f = iblockdata.getDestroyProgress(this.player, this.player.level, blockposition);
+ } else if (!iblockdata1.isAir()) {
iblockdata1.attack(this.level, blockposition, this.player);
f = iblockdata1.getDestroyProgress(this.player, this.player.level, blockposition);
}
+ if (event.useItemInHand() == Event.Result.DENY) {
@@ -135,10 +135,10 @@
+ }
+ // CraftBukkit end
+
if (!iblockdata.isAir() && f >= 1.0F) {
if (!iblockdata1.isAir() && f >= 1.0F) {
this.destroyAndAck(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
} else {
@@ -208,13 +290,15 @@
@@ -218,13 +300,15 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
if (!Objects.equals(this.destroyPos, blockposition)) {
@@ -155,7 +155,7 @@
}
}
@@ -224,17 +308,72 @@
@@ -234,17 +318,72 @@
if (this.destroyBlock(blockposition)) {
this.player.connection.send(new PacketPlayOutBlockBreak(blockposition, this.level.getBlockState(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
} else {
@@ -230,7 +230,7 @@
TileEntity tileentity = this.level.getBlockEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -244,6 +383,10 @@
@@ -254,6 +393,10 @@
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
return false;
} else {
@@ -241,7 +241,7 @@
block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
boolean flag = this.level.removeBlock(blockposition, false);
@@ -252,19 +395,32 @@
@@ -262,19 +405,32 @@
}
if (this.isCreative()) {
@@ -277,7 +277,7 @@
}
}
}
@@ -306,12 +462,52 @@
@@ -316,12 +472,52 @@
}
}
@@ -330,7 +330,7 @@
if (itileinventory != null) {
entityplayer.openMenu(itileinventory);
@@ -325,7 +521,7 @@
@@ -335,7 +531,7 @@
ItemStack itemstack1 = itemstack.copy();
if (!flag1) {
@@ -339,7 +339,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.ITEM_USED_ON_BLOCK.trigger(entityplayer, blockposition, itemstack1);
@@ -333,17 +529,17 @@
@@ -343,17 +539,17 @@
}
}
@@ -360,7 +360,7 @@
}
if (enuminteractionresult1.consumesAction()) {
@@ -351,10 +547,10 @@
@@ -361,10 +557,10 @@
}
return enuminteractionresult1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
@@ -200,7 +200,7 @@
@@ -199,7 +199,7 @@
if (iblockdata.isAir()) {
return false;
} else {
@@ -9,7 +9,7 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(blockposition) : null;
Block.dropResources(iblockdata, this.level, blockposition, tileentity, entity, ItemStack.EMPTY);
@@ -319,6 +319,13 @@
@@ -318,6 +318,13 @@
@Override
public boolean addFreshEntity(Entity entity) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -149,6 +149,20 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -150,6 +150,20 @@
import net.minecraft.world.ticks.TickListServer;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.entity.monster.EntityDrowned;
@@ -21,7 +21,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
@@ -166,7 +180,7 @@
@@ -167,7 +181,7 @@
final List<EntityPlayer> players;
private final ChunkProviderServer chunkSource;
private final MinecraftServer server;
@@ -30,13 +30,13 @@
final EntityTickList entityTickList;
public final PersistentEntitySectionManager<Entity> entityManager;
public boolean noSave;
@@ -189,9 +203,29 @@
@@ -190,9 +204,29 @@
private final StructureCheck structureCheck;
private final boolean tickTime;
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
- Objects.requireNonNull(minecraftserver);
- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i);
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i);
+
+ // CraftBukkit start
+ private int tickPosition;
@@ -53,9 +53,9 @@
+ }
+
+ // Add env and gen to constructor, WorldData -> WorldDataServer
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
+ this.pvpMode = minecraftserver.isPvpAllowed();
+ convertable = convertable_conversionsession;
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
@@ -63,7 +63,7 @@
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
@@ -203,7 +237,13 @@
@@ -204,7 +238,13 @@
this.tickTime = flag1;
this.server = minecraftserver;
this.customSpawners = list;
@@ -75,10 +75,10 @@
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
+ }
+ // CraftBukkit end
chunkgenerator.ensureStructuresGenerated();
boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
@@ -234,14 +274,15 @@
@@ -236,14 +276,15 @@
long l = minecraftserver.getWorldData().worldGenSettings().seed();
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer);
@@ -96,7 +96,7 @@
}
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
@@ -273,12 +314,20 @@
@@ -275,12 +316,20 @@
long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@@ -120,7 +120,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -304,7 +353,7 @@
@@ -306,7 +355,7 @@
this.runBlockEvents();
this.handlingTick = false;
gameprofilerfiller.pop();
@@ -129,7 +129,7 @@
if (flag) {
this.resetEmptyTime();
@@ -320,7 +369,7 @@
@@ -322,7 +371,7 @@
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
@@ -138,7 +138,7 @@
entity.discard();
} else {
gameprofilerfiller.push("checkDespawn");
@@ -392,7 +441,7 @@
@@ -394,7 +443,7 @@
private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers();
@@ -147,7 +147,7 @@
entityplayer.stopSleepInBed(false, false);
});
}
@@ -419,14 +468,14 @@
@@ -421,14 +470,14 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -164,8 +164,8 @@
}
}
@@ -437,12 +486,12 @@
BiomeBase biomebase = this.getBiome(blockposition);
@@ -439,12 +488,12 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
if (biomebase.shouldFreeze(this, blockposition1)) {
- this.setBlockAndUpdate(blockposition1, Blocks.ICE.defaultBlockState());
@@ -179,7 +179,7 @@
}
IBlockData iblockdata = this.getBlockState(blockposition1);
@@ -638,6 +687,7 @@
@@ -640,6 +689,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
}
@@ -187,7 +187,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
}
@@ -656,14 +706,47 @@
@@ -658,14 +708,47 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
@@ -237,7 +237,7 @@
}
public void resetEmptyTime() {
@@ -698,6 +781,7 @@
@@ -700,6 +783,7 @@
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick();
@@ -245,7 +245,7 @@
this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator();
@@ -721,6 +805,7 @@
@@ -723,6 +807,7 @@
});
gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick();
@@ -253,7 +253,7 @@
gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator();
@@ -745,6 +830,7 @@
@@ -747,6 +832,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) {
@@ -261,7 +261,7 @@
if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(new ChatMessage("menu.savingLevel"));
}
@@ -762,11 +848,19 @@
@@ -764,11 +850,19 @@
}
}
@@ -282,7 +282,7 @@
}
this.getChunkSource().getDataStorage().save();
@@ -812,15 +906,34 @@
@@ -814,15 +908,34 @@
@Override
public boolean addFreshEntity(Entity entity) {
@@ -320,7 +320,7 @@
}
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -851,24 +964,36 @@
@@ -853,24 +966,36 @@
this.entityManager.addNewEntity(entityplayer);
}
@@ -361,7 +361,7 @@
return true;
}
}
@@ -882,10 +1007,32 @@
@@ -884,10 +1009,32 @@
entityplayer.remove(entity_removalreason);
}
@@ -394,7 +394,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -894,6 +1041,12 @@
@@ -896,6 +1043,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@@ -407,7 +407,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -948,7 +1101,18 @@
@@ -950,7 +1103,18 @@
Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) {
@@ -427,7 +427,7 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -984,10 +1148,20 @@
@@ -986,10 +1150,20 @@
@Override
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
@@ -448,7 +448,7 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearToBlow();
}
@@ -1068,13 +1242,20 @@
@@ -1070,13 +1244,20 @@
}
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@@ -471,16 +471,16 @@
++j;
}
}
@@ -1125,7 +1306,7 @@
@@ -1127,7 +1308,7 @@
@Nullable
public BlockPosition findNearestMapFeature(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
- return !this.server.getWorldData().worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag);
+ return !this.serverLevelData.worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
}
@Nullable
@@ -1162,11 +1343,21 @@
public BlockPosition findNearestMapFeature(TagKey<StructureFeature<?, ?>> tagkey, BlockPosition blockposition, int i, boolean flag) {
- if (!this.server.getWorldData().worldGenSettings().generateFeatures()) {
+ if (!this.serverLevelData.worldGenSettings().generateFeatures()) { // CraftBukkit
return null;
} else {
Optional<HolderSet.Named<StructureFeature<?, ?>>> optional = this.registryAccess().registryOrThrow(IRegistry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY).getTag(tagkey);
@@ -1169,11 +1350,21 @@
@Nullable
@Override
public WorldMap getMapData(String s) {
@@ -503,7 +503,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1478,6 +1669,11 @@
@@ -1485,6 +1676,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@@ -515,7 +515,7 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1497,12 +1693,12 @@
@@ -1504,12 +1700,12 @@
}
public boolean isFlat() {
@@ -530,7 +530,7 @@
}
@Nullable
@@ -1530,7 +1726,7 @@
@@ -1532,7 +1728,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@@ -539,7 +539,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1539,7 +1735,7 @@
@@ -1541,7 +1737,7 @@
object2intopenhashmap.addTo(s, 1);
}
@@ -548,7 +548,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1550,17 +1746,33 @@
@@ -1552,17 +1748,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@@ -584,7 +584,7 @@
}
@Override
@@ -1666,6 +1878,7 @@
@@ -1672,6 +1884,7 @@
}
}
@@ -592,7 +592,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1707,6 +1920,14 @@
@@ -1713,6 +1926,14 @@
gameeventlistenerregistrar.onListenerRemoved(entity.level);
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/network/LoginListener.java
+++ b/net/minecraft/server/network/LoginListener.java
@@ -36,6 +36,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.chat.ChatComponentText;
@@ -68,7 +68,7 @@
if (entityplayer != null) {
this.state = LoginListener.EnumProtocolState.DELAY_ACCEPT;
@@ -192,6 +216,43 @@
@@ -199,6 +223,43 @@
try {
LoginListener.this.gameProfile = LoginListener.this.server.getSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.getAddress());
if (LoginListener.this.gameProfile != null) {
@@ -112,7 +112,7 @@
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.gameProfile.getName(), LoginListener.this.gameProfile.getId());
LoginListener.this.state = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.isSingleplayer()) {
@@ -211,6 +272,11 @@
@@ -218,6 +279,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
@@ -28,6 +28,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.storage.SavedFile;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTCompressedStreamTools;
@@ -11,7 +11,7 @@
+
public class NameReferencingFileConverter {
static final Logger LOGGER = LogManager.getLogger();
static final Logger LOGGER = LogUtils.getLogger();
@@ -88,7 +93,7 @@
try {
gameprofilebanlist.load();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -95,6 +95,26 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.google.common.base.Predicate;
@@ -73,7 +73,7 @@
this.server = minecraftserver;
this.registryHolder = iregistrycustom_dimension;
this.maxPlayers = i;
@@ -145,6 +177,12 @@
@@ -145,9 +177,15 @@
usercache.add(gameprofile);
NBTTagCompound nbttagcompound = this.load(entityplayer);
ResourceKey resourcekey;
@@ -85,21 +85,25 @@
+ // CraftBukkit end
if (nbttagcompound != null) {
DataResult dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
- DataResult dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
+ DataResult<ResourceKey<World>> dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
Logger logger = PlayerList.LOGGER;
Objects.requireNonNull(logger);
@@ -174,7 +212,8 @@
s1 = networkmanager.getRemoteAddress().toString();
}
- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ());
- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()});
+ // CraftBukkit - Moved message to after join
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ());
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()});
WorldData worlddata = worldserver1.getLevelData();
entityplayer.loadGameTypes(nbttagcompound);
@@ -184,6 +223,7 @@
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat()));
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat()));
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -451,7 +455,7 @@
+ if (worldserver1 != null) {
+ Optional optional;
- if (!iblockdata.is((Tag) TagsBlock.BEDS) && !flag3) {
- if (!iblockdata.is(TagsBlock.BEDS) && !flag3) {
- f1 = f;
- } else {
- Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
@@ -467,7 +471,7 @@
+ Vec3D vec3d = (Vec3D) optional.get();
+ float f1;
+
+ if (!iblockdata.is((Tag) TagsBlock.BEDS) && !flag3) {
+ if (!iblockdata.is(TagsBlock.BEDS) && !flag3) {
+ f1 = f;
+ } else {
+ Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
@@ -511,12 +515,12 @@
+ // CraftBukkit end
- while (!worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
+ while (avoidSuffocation && !worldserver1.noCollision(entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
+ while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
+ // CraftBukkit start
+ WorldData worlddata = worldserver1.getLevelData();
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
+ entityplayer1.spawnIn(worldserver1);
+ entityplayer1.unsetRemoved();
+ entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
@@ -524,7 +528,7 @@
- WorldData worlddata = entityplayer1.level.getLevelData();
-
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionType(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), flag));
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionTypeRegistration(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), flag));
- entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
+ // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
@@ -785,5 +789,5 @@
}
+ // CraftBukkit end
this.broadcastAll(new PacketPlayOutTags(this.server.getTags().serializeToNetwork(this.registryHolder)));
this.broadcastAll(new PacketPlayOutTags(TagNetworkSerialization.serializeTagsToNetwork(this.registryHolder)));
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getRecipeManager().getRecipes());