Forge 1.19

* Bump pack.mcmeta formats
* 1.19 biome modifiers
* Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable
* Add docs and package-info to client extension interfaces package
* Move RenderBlockOverlayEvent hooks to ForgeHooksClient
* Add package-infos to client events package
* Rename SoundLoadEvent to SoundEngineLoadEvent

This reduces confusion from consumers which may think the
name SoundLoadEvent refers to an individual sound being loaded rather
than the sound engine.
* Document and change SoundLoadEvent to fire on mod bus

Previously, it fired on both the mod bus and the Forge bus, which is
confusing for consumers.
* Delete SoundSetupEvent

Looking at its original implementation shows that there isn't an
appropriate place in the new sound code to reinsert the event, and the
place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent.
* Perform some cleanup on client events

 - Removed nullable annotations from ClientPlayerNetworkEvent
 - Renamed #getPartialTicks methods to #getPartialTick, to be consistent
  with vanilla's naming of the partial tick
 - Cleanup documentation to remove line breaks, use the
  spelling 'cancelled' over
  'canceled', and improve docs on existing and
   new methods.
* Remove EntityEvent.CanUpdate

Closes MinecraftForge/MinecraftForge#6394
* Switch to Jetbrains nullability annotations
* New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent
* Remove ForgeWorldPresetScreens
* Remove IForgeRegistryEntry
* Remove use of List<Throwable> in FML's CompletableFutures
* Add docs to mod loading stages, stages, and phases
* Gradle 7.4.2
* Use SLF4J in FMLLoader and other subprojects
* Switch dynamic versions in subprojects to pinned ones
* Switch ForgeRoot and MDK to FG plugin markers
* Configure Forge javadoc task

The task now uses a custom stylesheet with MCForge elements, and
configured to combine the generation from the four FML subprojects
(fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project
into the javadoc output.
* Update docs/md files, for 1.19 update and the move away from IRC to Discord.
* Make "Potentially dangerous alternative prefix" a debug warning, not info.

Co-authored-by: Curle <[email protected]>
Co-authored-by: sciwhiz12 <[email protected]>
Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
committed 2022-06-07 15:31:26 -05:00
1 parent 270e778ac5
commit 4ed9117799
1485 files changed
+14960 -15446

No files matched your search

@@ -8,6 +8,7 @@ package net.minecraftforge.server;
import static net.minecraftforge.fml.Logging.CORE;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
@@ -16,13 +17,18 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.gametest.framework.GameTestServer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.packs.repository.PackSource;
import net.minecraft.server.packs.repository.RepositorySource;
import net.minecraft.world.level.storage.LevelResource;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.common.util.LogicalSidedProvider;
import net.minecraftforge.common.world.BiomeModifier;
import net.minecraftforge.fml.ModLoader;
import net.minecraftforge.fml.ModLoadingStage;
import net.minecraftforge.fml.ModLoadingWarning;
@@ -46,7 +52,6 @@ import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.config.ConfigTracker;
@@ -59,6 +64,7 @@ import net.minecraftforge.event.server.ServerStoppingEvent;
import net.minecraftforge.fml.loading.FileUtils;
import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.registries.DataPackRegistriesHooks;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.GameData;
public class ServerLifecycleHooks
@@ -83,6 +89,7 @@ public class ServerLifecycleHooks
// on the dedi server we need to force the stuff to setup properly
LogicalSidedProvider.setServer(()->server);
ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server));
runBiomeModifiers(server);
return !MinecraftForge.EVENT_BUS.post(new ServerAboutToStartEvent(server));
}
@@ -140,7 +147,7 @@ public class ServerLifecycleHooks
public static boolean handleServerLogin(final ClientIntentionPacket packet, final Connection manager) {
if (!allowLogins.get())
{
TextComponent text = new TextComponent("Server is still starting! Please wait before reconnecting.");
MutableComponent text = Component.literal("Server is still starting! Please wait before reconnecting.");
LOGGER.info(SERVERHOOKS,"Disconnecting Player (server is still starting): {}", text.getContents());
manager.send(new ClientboundLoginDisconnectPacket(text));
manager.disconnect(text);
@@ -151,25 +158,9 @@ public class ServerLifecycleHooks
final ConnectionType connectionType = ConnectionType.forVersionFlag(packet.getFMLVersion());
final int versionNumber = connectionType.getFMLVersionNumber(packet.getFMLVersion());
if (connectionType == ConnectionType.MODDED)
{
// Allow clients with incorrect netcode version to connect to netversion 3 servers,
// if and only if client is netversion 2 and server has no syncable non-vanilla datapack registries.
// TODO 1.19: Remove netcode backwards-compatability in 1.19, as there will be no clients on netversion 2 in 1.19.
Set<ResourceKey<? extends Registry<?>>> customDatapackRegistries = DataPackRegistriesHooks.getSyncedCustomRegistries();
if (versionNumber == 2)
{
if (!customDatapackRegistries.isEmpty())
{
rejectConnection(manager, connectionType, "Missing required datapack registries: " + String.join(", ", customDatapackRegistries.stream().map(key -> key.location().toString()).toList()));
return false;
}
}
else if (versionNumber != NetworkConstants.FMLNETVERSION)
{
rejectConnection(manager, connectionType, "This modded server is not impl compatible with your modded client. Please verify your Forge version closely matches the server. Got net version "+ versionNumber + " this server is net version "+ NetworkConstants.FMLNETVERSION);
return false;
}
if (connectionType == ConnectionType.MODDED && versionNumber != NetworkConstants.FMLNETVERSION) {
rejectConnection(manager, connectionType, "This modded server is not impl compatible with your modded client. Please verify your Forge version closely matches the server. Got net version " + versionNumber + " this server is net version " + NetworkConstants.FMLNETVERSION);
return false;
}
if (connectionType == ConnectionType.VANILLA && !NetworkRegistry.acceptsVanillaClientConnections()) {
@@ -188,7 +179,7 @@ public class ServerLifecycleHooks
private static void rejectConnection(final Connection manager, ConnectionType type, String message) {
manager.setProtocol(ConnectionProtocol.LOGIN);
LOGGER.info(SERVERHOOKS, "Disconnecting {} connection attempt: {}", type, message);
TextComponent text = new TextComponent(message);
MutableComponent text = Component.literal(message);
manager.send(new ClientboundLoginDisconnectPacket(text));
manager.disconnect(text);
}
@@ -219,4 +210,21 @@ public class ServerLifecycleHooks
consumer.accept(packInfo);
}
}
private static void runBiomeModifiers(final MinecraftServer server)
{
final RegistryAccess registries = server.registryAccess();
// The order of holders() is the order modifiers were loaded in.
final List<BiomeModifier> modifiers = registries.registryOrThrow(ForgeRegistries.Keys.BIOME_MODIFIERS)
.holders()
.map(Holder::value)
.toList();
// Apply sorted biome modifiers to each biome.
registries.registryOrThrow(Registry.BIOME_REGISTRY).holders().forEach(biomeHolder ->
{
biomeHolder.value().modifiableBiomeInfo().applyBiomeModifiers(biomeHolder, modifiers);
});
}
}