Skip to content

Commit

Permalink
Merge pull request #27 from TonimatasDEV/1.20.1
Browse files Browse the repository at this point in the history
Fix Patches
  • Loading branch information
C0D3-M4513R authored Jan 18, 2024
2 parents 0ab77fc + 5aaa0f1 commit 983aa87
Show file tree
Hide file tree
Showing 162 changed files with 1,115 additions and 1,259 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/LegacyQueryHandler.java
+++ b/net/minecraft/server/network/LegacyQueryHandler.java
@@ -28,9 +_,12 @@
@@ -30,9 +_,12 @@
if (bytebuf.readUnsignedByte() == 254) {
SocketAddress socketaddress = p_9686_.channel().remoteAddress();
int i = bytebuf.readableBytes();
Expand Down
14 changes: 14 additions & 0 deletions abdondonedHunks/LivingEntity.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2357,6 +_,11 @@
}

this.m_292733_();
+ org.bukkit.craftbukkit.v1_20_R2.SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
+ }
+
+ public void detectEquipmentUpdatesPublic() { // CraftBukkit
+ m_21315_(); //Ketting - just redirect this
}

private void m_21315_() {
20 changes: 20 additions & 0 deletions abdondonedHunks/PlayerList.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@@
+ public boolean disconnectAllPlayersWithProfile(GameProfile p_299278_, ServerPlayer player) { // CraftBukkit start - added EntityPlayer
+ return player == null;
+ }
+ // CraftBukkit end
+
@@

- public boolean m_292966_(GameProfile p_299278_) {
+ // CraftBukkit start - added EntityPlayer
+ public ServerPlayer getPlayerForLogin(GameProfile gameprofile, ClientInformation clientinformation, ServerPlayer player) {
+ player.m_9156_(clientinformation);
+ return player;
+ // CraftBukkit end
+ }
+
+ public boolean m_292966_(GameProfile p_299278_) {
UUID uuid = p_299278_.getId();
Set<ServerPlayer> set = Sets.newIdentityHashSet();

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
+ }
+ // CraftBukkit end
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@
int i = p_105030_.f_132360_();
this.f_104888_.f_91074_.m_20234_(i);
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
@@ -425,8 +_,9 @@
@@ -425,6 +_,7 @@
this.f_104888_.f_91074_.m_287199_(p_105030_.f_286971_());
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
+ net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_104885_, "PLAY_TO_SERVER");
this.f_104888_.f_91066_.m_92172_();
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.getClientModName())));
this.f_252517_ = null;
this.f_244346_ = new LastSeenMessagesTracker(20);
this.f_244113_ = MessageSignatureCache.m_246587_();
@@ -773,7 +_,7 @@
@@ -817,7 +_,7 @@

public void m_213990_(ClientboundSystemChatPacket p_233708_) {
PacketUtils.m_131363_(p_233708_, this, this.f_291812_);
- this.f_291812_.m_240442_().m_240494_(p_233708_.f_237849_(), p_233708_.f_240374_());
+ this.f_291812_.m_240442_().m_240494_(net.minecraft.network.chat.MutableComponent.Serializer.m_130714_(p_233708_.content()), p_233708_.f_240374_());
PacketUtils.m_131363_(p_233708_, this, this.f_104888_);
- this.f_104888_.m_240442_().m_240494_(p_233708_.f_237849_(), p_233708_.f_240374_());
+ // this.minecraft.getChatListener().handleSystemMessage(p_233708_.content(), p_233708_.overlay());
}

public void m_213629_(ClientboundPlayerChatPacket p_233702_) {
@@ -1026,8 +_,10 @@
@@ -1069,8 +_,10 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

public void m_5705_(BooleanSupplier p_120049_) {
@@ -121,6 +_,13 @@
@@ -117,6 +_,13 @@
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public CommandSourceStack(CommandSource p_81302_, Vec3 p_81303_, Vec2 p_81304_, ServerLevel p_81305_, int p_81306_, String p_81307_, Component p_81308_, MinecraftServer p_81309_, @Nullable Entity p_81310_) {
this(p_81302_, p_81303_, p_81304_, p_81305_, p_81306_, p_81307_, p_81308_, p_81309_, p_81310_, false, (p_81361_, p_81362_, p_81363_) -> {
@@ -168,9 +_,23 @@
@@ -172,9 +_,23 @@
}

public boolean m_6761_(int p_81370_) {
Expand All @@ -42,7 +42,7 @@
public Vec3 m_81371_() {
return this.f_81289_;
}
@@ -295,13 +_,13 @@
@@ -299,13 +_,13 @@
Component component = Component.m_237110_("chat.type.admin", this.m_81357_(), p_81367_).m_130944_(ChatFormatting.GRAY, ChatFormatting.ITALIC);
if (this.f_81294_.m_129900_().m_46207_(GameRules.f_46144_)) {
for(ServerPlayer serverplayer : this.f_81294_.m_6846_().m_11314_()) {
Expand All @@ -58,7 +58,7 @@
this.f_81294_.m_213846_(component);
}

@@ -359,4 +_,10 @@
@@ -363,4 +_,10 @@
public FeatureFlagSet m_245239_() {
return this.f_81290_.m_246046_();
}
Expand Down
14 changes: 6 additions & 8 deletions patches/minecraft/net/minecraft/commands/Commands.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -130,8 +_,10 @@
@@ -128,8 +_,10 @@
public static final int f_165685_ = 3;
public static final int f_165686_ = 4;
private final CommandDispatcher<CommandSourceStack> f_82090_ = new CommandDispatcher<>();
Expand All @@ -11,8 +11,6 @@
AdvancementCommands.m_136310_(this.f_82090_);
AttributeCommand.m_245835_(this.f_82090_, p_230944_);
ExecuteCommand.m_214434_(this.f_82090_, p_230944_);
@@ -196,0 +_,0 @@

@@ -193,7 +_,7 @@
JfrCommand.m_183645_(this.f_82090_);
}
Expand Down Expand Up @@ -44,7 +42,7 @@
}

public static <S> ParseResults<S> m_242611_(ParseResults<S> p_242928_, UnaryOperator<S> p_242890_) {
@@ -236,12 +_,68 @@
@@ -230,12 +_,68 @@
return new ParseResults<>(commandcontextbuilder1, p_242928_.getReader(), p_242928_.getExceptions());
}

Expand Down Expand Up @@ -133,7 +131,7 @@
} catch (CommandRuntimeException commandruntimeexception) {
commandsourcestack.m_81352_(commandruntimeexception.m_79226_());
return 0;
@@ -258,7 +_,7 @@
@@ -252,7 +_,7 @@
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
MutableComponent mutablecomponent1 = Component.m_237119_().m_130940_(ChatFormatting.GRAY).m_130938_((p_82134_) -> {
Expand All @@ -142,7 +140,7 @@
});
if (j > 10) {
mutablecomponent1.m_7220_(CommonComponents.f_238772_);
@@ -301,16 +_,60 @@
@@ -295,16 +_,60 @@
}
}

Expand All @@ -165,7 +163,7 @@
RootCommandNode<SharedSuggestionProvider> rootcommandnode = new RootCommandNode<>();
map.put(this.f_82090_.getRoot(), rootcommandnode);
- this.m_82112_(this.f_82090_.getRoot(), rootcommandnode, p_82096_.m_20203_(), map);
- p_82096_.f_8906_.m_141995_(new ClientboundCommandsPacket(rootcommandnode));
- p_82096_.f_8906_.m_9829_(new ClientboundCommandsPacket(rootcommandnode));
+
+ net.minecraftforge.server.command.CommandHelper.mergeCommandNode(this.f_82090_.getRoot(), rootcommandnode, map, p_82096_.m_20203_(), ctx -> 0, suggest -> SuggestionProviders.m_121664_((com.mojang.brigadier.suggestion.SuggestionProvider<SharedSuggestionProvider>) (com.mojang.brigadier.suggestion.SuggestionProvider<?>) suggest));
+
Expand Down Expand Up @@ -206,7 +204,7 @@
if (commandnode.canUse(p_82115_)) {
ArgumentBuilder<SharedSuggestionProvider, ?> argumentbuilder = (ArgumentBuilder)commandnode.createBuilder();
argumentbuilder.requires((p_82126_) -> {
@@ -364,7 +_,44 @@
@@ -358,7 +_,44 @@
}

public CommandDispatcher<CommandSourceStack> m_82094_() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
+ }
+ // CraftBukkit end
+
Consumer<ArmorStand> consumer = EntityType.m_264081_((p_296333_) -> {
p_296333_.m_146922_(direction.m_122435_());
Consumer<ArmorStand> consumer = EntityType.m_264081_((p_277236_) -> {
p_277236_.m_146922_(direction.m_122435_());
}, serverlevel, p_123462_, (Player)null);
ArmorStand armorstand = EntityType.f_20529_.m_262455_(serverlevel, p_123462_.m_41783_(), consumer, blockpos, MobSpawnType.DISPENSER, false, false);
if (armorstand != null) {
Expand Down Expand Up @@ -125,7 +125,7 @@
return p_123530_;
} else {
@@ -242,7 +_,35 @@
return p_296334_.m_6084_() && p_296334_.m_7482_();
return p_289248_.m_6084_() && p_289248_.m_7482_();
})) {
if (abstracthorse.m_6010_(p_123536_) && !abstracthorse.m_7481_() && abstracthorse.m_30614_()) {
- abstracthorse.m_141942_(401).m_142104_(p_123536_.m_41620_(1));
Expand Down Expand Up @@ -162,8 +162,8 @@
return p_123536_;
}
@@ -278,8 +_,36 @@
for(AbstractChestedHorse abstractchestedhorse : p_123541_.m_7727_().m_6443_(AbstractChestedHorse.class, new AABB(blockpos), (p_296335_) -> {
return p_296335_.m_6084_() && !p_296335_.m_30502_();
for(AbstractChestedHorse abstractchestedhorse : p_123541_.m_7727_().m_6443_(AbstractChestedHorse.class, new AABB(blockpos), (p_289249_) -> {
return p_289249_.m_6084_() && !p_289249_.m_30502_();
})) {
- if (abstractchestedhorse.m_30614_() && abstractchestedhorse.m_141942_(499).m_142104_(p_123542_)) {
- p_123542_.m_41774_(1);
Expand Down Expand Up @@ -352,8 +352,8 @@
- BlockState blockstate = levelaccessor.m_8055_(blockpos);
+ BlockState blockstate = level.m_8055_(blockpos);
Block block = blockstate.m_60734_();
if (block instanceof BucketPickup bucketpickup) {
- ItemStack itemstack = bucketpickup.m_142598_((Player)null, levelaccessor, blockpos, blockstate);
if (block instanceof BucketPickup) {
- ItemStack itemstack = ((BucketPickup)block).m_142598_(levelaccessor, blockpos, blockstate);
+ ItemStack itemstack = bucketpickup.m_142598_((Player)null, org.bukkit.craftbukkit.v1_20_R2.util.DummyGeneratorAccess.INSTANCE, blockpos, blockstate); // CraftBukkit
+
if (itemstack.m_41619_()) {
Expand Down
23 changes: 8 additions & 15 deletions patches/minecraft/net/minecraft/network/Connection.java.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
--- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java
@@ -82,8 +_,13 @@
@@ -72,8 +_,13 @@
});
private final PacketFlow f_129466_;
private final Queue<Consumer<Connection>> f_290881_ = Queues.newConcurrentLinkedQueue();
private final Queue<Connection.PacketHolder> f_129467_ = Queues.newConcurrentLinkedQueue();
- private Channel f_129468_;
- private SocketAddress f_129469_;
+ public Channel f_129468_;
Expand All @@ -13,11 +13,11 @@
+ public com.mojang.authlib.properties.Property[] spoofedProfile;
+ public boolean preparing = true;
+ // Spigot End
@Nullable
private volatile PacketListener f_290681_;
@Nullable
private PacketListener f_129470_;
private Component f_129471_;
private boolean f_129472_;
@@ -86,6 +_,8 @@
private volatile Component f_290021_;
private boolean f_129479_;
@Nullable
private volatile Component f_290021_;
+ private java.util.function.Consumer<Connection> activationHandler;
Expand Down Expand Up @@ -48,22 +48,15 @@
}

public void channelInactive(ChannelHandlerContext p_129527_) {
@@ -159,7 +_,8 @@
@@ -147,6 +_,7 @@

}
}
+ if (net.minecraft.server.MinecraftServer.getServer().isDebugging()) p_129534_.printStackTrace(); // Spigot
}

protected void channelRead0(ChannelHandlerContext p_129487_, Packet<?> p_129488_) {

@@ -395,11 +_,14 @@
if (this.f_129469_ == null) {
return "local";
} else {
- return p_298740_ ? this.f_129469_.toString() : "IP hidden";
+ return p_298740_ ? net.minecraftforge.network.DualStackUtils.getAddressString(this.f_129469_) : "IP hidden";
}
@@ -285,6 +_,9 @@
}

public void m_129507_(Component p_129508_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
public static final int f_178337_ = 2097152;
private final ByteBuf f_130049_;
public static final short f_178333_ = Short.MAX_VALUE;
@@ -551,7 +_,7 @@
try {
NbtIo.m_292740_(p_300580_, new ByteBufOutputStream(this));
return this;
- } catch (IOException ioexception) {
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
throw new EncoderException(ioexception);
@@ -586,7 +_,7 @@
} else {
try {
NbtIo.m_128941_(p_130080_, new ByteBufOutputStream(this));
- } catch (IOException ioexception) {
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
throw new EncoderException(ioexception);
}
}
}
@@ -577,7 +_,16 @@
@@ -622,7 +_,16 @@
}

public FriendlyByteBuf m_130055_(ItemStack p_130056_) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
--- a/net/minecraft/network/protocol/PacketUtils.java
+++ b/net/minecraft/network/protocol/PacketUtils.java
@@ -18,6 +_,7 @@
@@ -17,6 +_,7 @@
public static <T extends PacketListener> void m_131363_(Packet<T> p_131364_, T p_131365_, BlockableEventLoop<?> p_131366_) throws RunningOnDifferentThreadException {
if (!p_131366_.m_18695_()) {
p_131366_.m_201446_(() -> {
+ if (net.minecraft.server.MinecraftServer.getServer().hasStopped() || (p_131365_ instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl && ((net.minecraft.server.network.ServerCommonPacketListenerImpl) p_131365_).processedDisconnect)) return; // CraftBukkit, MC-142590
if (p_131365_.m_294638_(p_131364_)) {
+ if (net.minecraft.server.MinecraftServer.getServer().hasStopped() || (p_131364_ instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl && ((net.minecraft.server.network.ServerCommonPacketListenerImpl) p_131364_).processedDisconnect)) return; // CraftBukkit, MC-142590
if (p_131365_.m_6198_()) {
try {
p_131364_.m_5797_(p_131365_);
@@ -42,6 +_,10 @@
@@ -33,6 +_,10 @@

});
throw RunningOnDifferentThreadException.f_136017_;
+ // CraftBukkit start - SPIGOT-5477, MC-142590
+ } else if (net.minecraft.server.MinecraftServer.getServer().hasStopped() || (p_131365_ instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl && ((net.minecraft.server.network.ServerCommonPacketListenerImpl) p_131365_).processedDisconnect)) {
+ } else if (net.minecraft.server.MinecraftServer.getServer().hasStopped() || (p_131364_ instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl && ((net.minecraft.server.network.ServerCommonPacketListenerImpl) p_131364_).processedDisconnect)) {
+ throw RunningOnDifferentThreadException.f_136017_;
+ // CraftBukkit end
}
Expand Down
Loading

0 comments on commit 983aa87

Please sign in to comment.