mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
Forge 1.19.3
Created a CreativeModeTabEvent to register creative mode tabs and populate entries per tab Moved datapack registries to DataPackRegistryEvent.NewRegistry event instead of tying them to ForgeRegistry Made it easier for mods to datagen datapack builtin entries with DatapackBuiltinEntriesProvider Provided access to lookupProvider for datagen Updated dependencies to match versions used by vanilla and update JarJar to 0.3.18 Added a test mod for the new CreativeModeTabEvent Throws better error message for Forge registries in tag datagen Deleted ForgeRegistryTagsProvider Updated ClientChatReceivedEvent and ServerChatEvent for Mojang changes Added patches for both sign related methods in ModelLayers Changed RegisterShadersEvent to use ResourceProvider Migrated old Mojang math types to JOML Co-authored-by: Marc Hermans <[email protected]> Co-authored-by: LexManos <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Co-authored-by: coehlrich <[email protected]>
This commit is contained in:
1 parent
617ecb7ad3
commit
8255d7aed3
726 files changed
+7615
-6653
No files matched your search
@@ -12,6 +12,7 @@ import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.MenuAccess;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
@@ -53,7 +54,7 @@ public class PlayMessages
|
||||
SpawnEntity(Entity e)
|
||||
{
|
||||
this.entity = e;
|
||||
this.typeId = Registry.ENTITY_TYPE.getId(e.getType()); //TODO: Codecs
|
||||
this.typeId = BuiltInRegistries.ENTITY_TYPE.getId(e.getType()); //TODO: Codecs
|
||||
this.entityId = e.getId();
|
||||
this.uuid = e.getUUID();
|
||||
this.posX = e.getX();
|
||||
@@ -144,7 +145,7 @@ public class PlayMessages
|
||||
ctx.get().enqueueWork(() -> {
|
||||
try
|
||||
{
|
||||
EntityType<?> type = Registry.ENTITY_TYPE.byId(msg.typeId);
|
||||
EntityType<?> type = BuiltInRegistries.ENTITY_TYPE.byId(msg.typeId);
|
||||
Optional<Level> world = LogicalSidedProvider.CLIENTWORLD.get(ctx.get().getDirection().getReceptionSide());
|
||||
Entity e = world.map(w -> type.customClientSpawn(msg, w)).orElse(null);
|
||||
if (e == null)
|
||||
@@ -257,7 +258,7 @@ public class PlayMessages
|
||||
|
||||
OpenContainer(MenuType<?> id, int windowId, Component name, FriendlyByteBuf additionalData)
|
||||
{
|
||||
this(Registry.MENU.getId(id), windowId, name, additionalData);
|
||||
this(BuiltInRegistries.MENU.getId(id), windowId, name, additionalData);
|
||||
}
|
||||
|
||||
private OpenContainer(int id, int windowId, Component name, FriendlyByteBuf additionalData)
|
||||
@@ -304,7 +305,7 @@ public class PlayMessages
|
||||
|
||||
public final MenuType<?> getType()
|
||||
{
|
||||
return Registry.MENU.byId(this.id);
|
||||
return BuiltInRegistries.MENU.byId(this.id);
|
||||
}
|
||||
|
||||
public int getWindowId()
|
||||
|
||||
+11
-5
@@ -13,11 +13,14 @@ import java.util.stream.Collectors;
|
||||
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import net.minecraft.commands.CommandBuildContext;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
|
||||
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.registries.VanillaRegistries;
|
||||
import net.minecraft.gametest.framework.TestClassNameArgument;
|
||||
import net.minecraft.gametest.framework.TestFunctionArgument;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
@@ -27,11 +30,15 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tags.TagNetworkSerialization;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import net.minecraftforge.registries.RegistryManager;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -89,15 +96,14 @@ public class VanillaConnectionNetworkFilter extends VanillaPacketFilter
|
||||
@NotNull
|
||||
private static ClientboundCommandsPacket filterCommandList(ClientboundCommandsPacket packet)
|
||||
{
|
||||
CommandBuildContext commandBuildContext = new CommandBuildContext(RegistryAccess.BUILTIN.get());
|
||||
commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY);
|
||||
CommandBuildContext commandBuildContext = Commands.createValidationContext(VanillaRegistries.createLookup());
|
||||
RootCommandNode<SharedSuggestionProvider> root = packet.getRoot(commandBuildContext);
|
||||
RootCommandNode<SharedSuggestionProvider> newRoot = CommandTreeCleaner.cleanArgumentTypes(root, argType -> {
|
||||
if (argType instanceof TestFunctionArgument || argType instanceof TestClassNameArgument)
|
||||
return false; // Vanilla connections should not have gametest on, so we should filter these out always
|
||||
|
||||
ArgumentTypeInfo<?, ?> info = ArgumentTypeInfos.byClass(argType);
|
||||
ResourceLocation id = Registry.COMMAND_ARGUMENT_TYPE.getKey(info);
|
||||
ResourceLocation id = BuiltInRegistries.COMMAND_ARGUMENT_TYPE.getKey(info);
|
||||
return id != null && (id.getNamespace().equals("minecraft") || id.getNamespace().equals("brigadier"));
|
||||
});
|
||||
return new ClientboundCommandsPacket(newRoot);
|
||||
@@ -116,8 +122,8 @@ public class VanillaConnectionNetworkFilter extends VanillaPacketFilter
|
||||
|
||||
private static boolean isVanillaRegistry(ResourceLocation location)
|
||||
{
|
||||
// Checks if the registry name is contained within the static view of vanilla registries both in Registry and builtin registries
|
||||
// Checks if the registry name is contained within the static view of both BuiltInRegistries and VanillaRegistries
|
||||
return RegistryManager.getVanillaRegistryKeys().contains(location)
|
||||
|| RegistryAccess.REGISTRIES.keySet().stream().anyMatch(k -> k.location().equals(location));
|
||||
|| VanillaRegistries.DATAPACK_REGISTRY_KEYS.stream().anyMatch(k -> k.location().equals(location));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user