mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-23 13:39:43 +00:00
Forge 1.19.1
Load natives from classpath Make command argument types a forge registry Add `EntityMobGriefingEvent` to `Allay#wantsToPickUp` Overhaul `ServerChatEvent` to use `ChatDecorator` system Remove `ClientChatEvent#setMessage` for now Gradle 7.5 Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
3c1126a7b4
commit
6845c094ab
98 files changed
+1025
-733
No files matched your search
@@ -8,6 +8,7 @@ package net.minecraftforge.network.filters;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import net.minecraft.network.Connection;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -27,11 +28,15 @@ public class NetworkFilters
|
||||
|
||||
public static void injectIfNecessary(Connection manager)
|
||||
{
|
||||
ChannelPipeline pipeline = manager.channel().pipeline();
|
||||
if (pipeline.get("packet_handler") == null)
|
||||
return; // Realistically this can only ever be null if the connection was prematurely closed due to an error. We return early here to reduce further log spam.
|
||||
|
||||
instances.forEach((key, filterFactory) -> {
|
||||
VanillaPacketFilter filter = filterFactory.apply(manager);
|
||||
if (filter.isNecessary(manager))
|
||||
{
|
||||
manager.channel().pipeline().addBefore("packet_handler", key, filter);
|
||||
pipeline.addBefore("packet_handler", key, filter);
|
||||
LOGGER.debug("Injected {} into {}", filter, manager);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,6 +18,8 @@ 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.gametest.framework.TestClassNameArgument;
|
||||
import net.minecraft.gametest.framework.TestFunctionArgument;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.protocol.game.ClientboundCommandsPacket;
|
||||
@@ -91,6 +93,9 @@ public class VanillaConnectionNetworkFilter extends VanillaPacketFilter
|
||||
commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY);
|
||||
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);
|
||||
return id != null && (id.getNamespace().equals("minecraft") || id.getNamespace().equals("brigadier"));
|
||||
|
||||
Reference in new issue
Block a user