From d80f106140b30813432808f8b94da4d66e76dbfe Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 21 Sep 2023 16:25:51 -0700 Subject: [PATCH] Send known channels to the server when they send us theirs. --- .../net/minecraftforge/common/util/PacketLogger.java | 9 ++++++--- .../minecraftforge/network/ChannelListManager.java | 3 +++ src/main/resources/forge.exc | 11 ----------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/util/PacketLogger.java b/src/main/java/net/minecraftforge/common/util/PacketLogger.java index 94eb632a94..0ca3fb1b76 100644 --- a/src/main/java/net/minecraftforge/common/util/PacketLogger.java +++ b/src/main/java/net/minecraftforge/common/util/PacketLogger.java @@ -38,7 +38,7 @@ public class PacketLogger { common(connection.getReceiving(), connection.getSending(), packet); } - public void recv( Packet packet) { + public void recv(Packet packet) { common(connection.getReceiving(), connection.getReceiving(), packet); } @@ -51,12 +51,15 @@ public class PacketLogger { var data = new FriendlyByteBuf(Unpooled.buffer()); packet.write(data); - LOGGER.info(MARKER, "{} {} {}\n{}", side, dir(flow), packet.getClass().getName(), HexDumper.dump(data)); + LOGGER.info(MARKER, "{} {} {}\n{}", side(side), dir(flow), packet.getClass().getName(), HexDumper.dump(data)); } else { - LOGGER.info(MARKER, "{} {} {}", side, dir(flow), packet.getClass().getName()); + LOGGER.info(MARKER, "{} {} {}", side(side), dir(flow), packet.getClass().getName()); } } + private static String side(PacketFlow side) { + return side == PacketFlow.CLIENTBOUND ? "CLIENT" : "SERVER"; + } private static String dir(PacketFlow flow) { return flow == PacketFlow.CLIENTBOUND ? "S->C" : "C->S"; } diff --git a/src/main/java/net/minecraftforge/network/ChannelListManager.java b/src/main/java/net/minecraftforge/network/ChannelListManager.java index 5d6843619c..5f84b5b409 100644 --- a/src/main/java/net/minecraftforge/network/ChannelListManager.java +++ b/src/main/java/net/minecraftforge/network/ChannelListManager.java @@ -41,6 +41,9 @@ public class ChannelListManager { var ctx = evt.getSource(); updateFrom(ctx, evt.getPayload(), ChannelRegistrationChangeEvent.Type.REGISTER); ctx.setPacketHandled(true); + // Send the client's channels to the server whenever asked. If we're in the login state then our login wrapper will unwrap for us. + if (ctx.isClientSide()) + addChannels(ctx.getConnection()); } private static void unregisterListener(CustomPayloadEvent evt) { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index ab5cf1cd07..a82f527003 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -1,10 +1,7 @@ com/mojang/blaze3d/vertex/VertexConsumer.putBulkData(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lnet/minecraft/client/renderer/block/model/BakedQuad;[FFFFF[IIZ)V=|p_85996_,p_85997_,p_85998_,p_85999_,p_86000_,p_86001_,alpha,p_86002_,p_86003_,p_86004_ -net/minecraft/advancements/Advancement$Builder.fromJson(Lcom/google/gson/JsonObject;Lnet/minecraft/advancements/critereon/DeserializationContext;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)Lnet/minecraft/advancements/Advancement$Builder;=|p_138381_,p_138382_,context net/minecraft/client/Options.processOptionsForge(Lnet/minecraft/client/Options$FieldAccess;)V=|p_168428_ net/minecraft/client/gui/Gui.renderSelectedItemName(Lnet/minecraft/client/gui/GuiGraphics;I)V=|p_283501_,yShift -net/minecraft/client/gui/GuiGraphics.blitRepeating(Lnet/minecraft/resources/ResourceLocation;IIIIIIIIII)V=|p_283059_,p_283575_,p_283192_,p_281790_,p_283642_,p_282691_,p_281912_,p_281728_,p_282324_,textureWidth,textureHeight net/minecraft/client/gui/screens/MenuScreens.getScreenFactory(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/network/chat/Component;)Ljava/util/Optional;=|p_96202_,p_96203_,p_96204_,p_96205_ -net/minecraft/client/gui/screens/inventory/InventoryScreen.renderEntityInInventoryFollowsAngle(Lnet/minecraft/client/gui/GuiGraphics;IIIFFLnet/minecraft/world/entity/LivingEntity;)V=|p_282802_,p_275688_,p_275245_,p_275535_,angleXComponent,angleYComponent,p_275689_ net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.renderRectangle(Lnet/minecraft/client/gui/GuiGraphics;IIIIIII)V=|p_281392_,p_282294_,p_283353_,p_282640_,p_281964_,p_283211_,p_282349_,colorTo net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.renderTooltipBackground(Lnet/minecraft/client/gui/GuiGraphics;IIIIIIIII)V=|p_282666_,p_281901_,p_281846_,p_281559_,p_283336_,p_283422_,backgroundTop,backgroundBottom,borderTop,borderBottom net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.doLoadLevel(Lnet/minecraft/client/gui/screens/Screen;Ljava/lang/String;ZZZ)V=|p_233146_,p_233147_,p_233148_,p_233149_,confirmExperimentalWarning @@ -25,14 +22,9 @@ net/minecraft/client/renderer/block/model/BlockElementFace.(Lnet/minecraft net/minecraft/client/renderer/block/model/BlockModel.bakeVanilla(Lnet/minecraft/client/resources/model/ModelBaker;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;ZLnet/minecraftforge/client/RenderTypeGroup;)Lnet/minecraft/client/resources/model/BakedModel;=|p_249720_,p_111451_,p_111452_,p_111453_,p_111454_,p_111455_,renderTypes net/minecraft/client/renderer/block/model/ItemTransform.(Lorg/joml/Vector3f;Lorg/joml/Vector3f;Lorg/joml/Vector3f;Lorg/joml/Vector3f;)V=|p_254427_,p_254496_,p_254022_,rightRotation net/minecraft/client/renderer/block/model/ItemTransforms.(Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lcom/google/common/collect/ImmutableMap;)V=|p_111798_,p_111799_,p_111800_,p_111801_,p_111802_,p_111803_,p_111804_,p_111805_,moddedTransforms -net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ChunkCompileTask.(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;DZ)V=|p_194422_,pos,p_194423_,p_194424_ -net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$RebuildTask.(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;DLnet/minecraft/client/renderer/chunk/RenderChunkRegion;Z)V=|p_194426_,pos,p_194427_,p_194428_,p_194429_ -net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ResortTransparencyTask.(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;DLnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$CompiledChunk;)V=|p_112888_,pos,p_112889_,p_112890_ -net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.(Lnet/minecraft/client/multiplayer/ClientLevel;Lnet/minecraft/client/renderer/LevelRenderer;Ljava/util/concurrent/Executor;ZLnet/minecraft/client/renderer/ChunkBufferBuilderPack;I)V=|p_194405_,p_194406_,p_194407_,p_194408_,p_194409_,countRenderBuilders net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.renderGlint(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/model/Model;)V=|p_289673_,p_289654_,p_289649_,p_289659_ net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/item/ArmorItem;Lnet/minecraft/client/model/Model;ZFFFLnet/minecraft/resources/ResourceLocation;)V=|p_289664_,p_289689_,p_289681_,p_289650_,p_289658_,p_289668_,p_289678_,p_289674_,p_289693_,armorResource net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.renderTrim(Lnet/minecraft/world/item/ArmorMaterial;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/item/armortrim/ArmorTrim;Lnet/minecraft/client/model/Model;Z)V=|p_289690_,p_289687_,p_289643_,p_289683_,p_289692_,p_289663_,p_289651_ -net/minecraft/client/renderer/texture/SpriteContents.(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/resources/metadata/animation/FrameSize;Lcom/mojang/blaze3d/platform/NativeImage;Lnet/minecraft/client/resources/metadata/animation/AnimationMetadataSection;Lnet/minecraftforge/client/textures/ForgeTextureMetadata;)V=|p_249787_,p_251031_,p_252131_,p_250432_,forgeMeta net/minecraft/client/resources/model/MultiPartBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)Ljava/util/List;=|p_235050_,p_235051_,p_235052_,modelData,renderType net/minecraft/client/resources/model/SimpleBakedModel$Builder.build(Lnet/minecraftforge/client/RenderTypeGroup;)Lnet/minecraft/client/resources/model/BakedModel;=|renderTypes net/minecraft/client/resources/model/SimpleBakedModel.(Ljava/util/List;Ljava/util/Map;ZZZLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/client/renderer/block/model/ItemTransforms;Lnet/minecraft/client/renderer/block/model/ItemOverrides;Lnet/minecraftforge/client/RenderTypeGroup;)V=|p_119489_,p_119490_,p_119491_,p_119492_,p_119493_,p_119494_,p_119495_,p_119496_,renderTypes @@ -69,7 +61,6 @@ net/minecraft/server/level/ServerChunkCache.removeRegionTicket(Lnet/minecraft/se net/minecraft/server/level/ServerPlayer.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_9180_,teleporter net/minecraft/server/level/ServerPlayerGameMode.removeBlock(Lnet/minecraft/core/BlockPos;Z)Z=|p_180235_1_,canHarvest net/minecraft/server/level/Ticket.(Lnet/minecraft/server/level/TicketType;ILjava/lang/Object;Z)V=|p_9425_,p_9426_,p_9427_,forceTicks -net/minecraft/server/packs/metadata/pack/PackMetadataSection.(Lnet/minecraft/network/chat/Component;ILjava/util/Map;)V=|p_10371_,p_10372_,packTypeVersions net/minecraft/world/entity/Entity.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_20118_,teleporter net/minecraft/world/entity/Entity.playCombinationStepSounds(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)V=|p_277472_,p_277630_,primaryPos,secondaryPos net/minecraft/world/entity/EntityType.(Lnet/minecraft/world/entity/EntityType$EntityFactory;Lnet/minecraft/world/entity/MobCategory;ZZZZLcom/google/common/collect/ImmutableSet;Lnet/minecraft/world/entity/EntityDimensions;IILnet/minecraft/world/flag/FeatureFlagSet;Ljava/util/function/Predicate;Ljava/util/function/ToIntFunction;Ljava/util/function/ToIntFunction;Ljava/util/function/BiFunction;)V=|p_251402_,p_251431_,p_251439_,p_251973_,p_252007_,p_250908_,p_250201_,p_251742_,p_250479_,p_249249_,p_250427_,velocityUpdateSupplier,trackingRangeSupplier,updateIntervalSupplier,customClientFactory @@ -88,7 +79,6 @@ net/minecraft/world/item/ItemStack.onItemUseFirst(Lnet/minecraft/world/item/cont net/minecraft/world/item/MapItem.getCustomMapData(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;)Lnet/minecraft/world/level/saveddata/maps/MapItemSavedData;=|p_42910_,p_42911_ net/minecraft/world/item/alchemy/PotionBrewing$Mix.(Lnet/minecraftforge/registries/IForgeRegistry;Ljava/lang/Object;Lnet/minecraft/world/item/crafting/Ingredient;Ljava/lang/Object;)V=|registry,p_43536_,p_43537_,p_43538_ net/minecraft/world/item/crafting/RecipeManager.(Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)V=|context -net/minecraft/world/item/crafting/RecipeManager.fromJson(Lnet/minecraft/resources/ResourceLocation;Lcom/google/gson/JsonObject;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)Lnet/minecraft/world/item/crafting/Recipe;=|p_44046_,p_44047_,context net/minecraft/world/item/enchantment/EnchantmentHelper.getTagEnchantmentLevel(Lnet/minecraft/world/item/enchantment/Enchantment;Lnet/minecraft/world/item/ItemStack;)I=|p_44844_,p_44845_ net/minecraft/world/level/Level.markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V=|p_46605_,levelchunk,blockstate,p_46606_,p_46607_,p_46608_ net/minecraft/world/level/LevelSettings.(Ljava/lang/String;Lnet/minecraft/world/level/GameType;ZLnet/minecraft/world/Difficulty;ZLnet/minecraft/world/level/GameRules;Lnet/minecraft/world/level/WorldDataConfiguration;Lcom/mojang/serialization/Lifecycle;)V=|p_250485_,p_250207_,p_251631_,p_252122_,p_248961_,p_248536_,p_249797_,lifecycle @@ -96,7 +86,6 @@ net/minecraft/world/level/block/Block.dropResources(Lnet/minecraft/world/level/b net/minecraft/world/level/block/ConcretePowderBlock.shouldSolidify(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/material/FluidState;)Z=|p_52081_,p_52082_,p_52083_,fluidState net/minecraft/world/level/block/ConcretePowderBlock.touchesLiquid(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z=|p_52065_,p_52066_,state net/minecraft/world/level/block/FireBlock.tryCatchFire(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;ILnet/minecraft/util/RandomSource;ILnet/minecraft/core/Direction;)V=|p_53432_,p_53433_,p_53434_,p_53435_,p_53436_,face -net/minecraft/world/level/block/FlowerBlock.(Ljava/util/function/Supplier;ILnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|effectSupplier,p_53513_,p_53514_ net/minecraft/world/level/block/FlowerPotBlock.(Ljava/util/function/Supplier;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|emptyPot,p_53528_,properties net/minecraft/world/level/block/LiquidBlock.(Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|p_54694_,p_54695_ net/minecraft/world/level/block/PoweredRailBlock.(Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Z)V=|p_55218_,isPoweredRail