Skip to content

Commit

Permalink
Fix TAGS_LOADED event not being invoked on client join
Browse files Browse the repository at this point in the history
  • Loading branch information
apple502j authored and modmuss50 committed Jan 28, 2024
1 parent 5c01334 commit eabbae3
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.s2c.common.SynchronizeTagsS2CPacket;
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
import net.minecraft.world.chunk.WorldChunk;
Expand Down Expand Up @@ -96,16 +95,12 @@ private void onClearWorld(CallbackInfo ci) {
}
}

/**
* Also invoked during GameJoin, but before Networking API fires the Ready event.
*/
@SuppressWarnings("ConstantConditions")
@Inject(
method = "onSynchronizeTags",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/network/ClientCommonNetworkHandler;onSynchronizeTags(Lnet/minecraft/network/packet/s2c/common/SynchronizeTagsS2CPacket;)V",
shift = At.Shift.AFTER, by = 1
)
)
private void hookOnSynchronizeTags(SynchronizeTagsS2CPacket packet, CallbackInfo ci) {
@Inject(method = "refreshTagBasedData", at = @At("RETURN"))
private void hookOnSynchronizeTags(CallbackInfo ci) {
ClientPlayNetworkHandler self = (ClientPlayNetworkHandler) (Object) this;
CommonLifecycleEvents.TAGS_LOADED.invoker().onTagsLoaded(self.getRegistryManager(), true);
}
Expand Down

0 comments on commit eabbae3

Please sign in to comment.