Skip to content

Commit

Permalink
Update to 1.19.1 (#85)
Browse files Browse the repository at this point in the history
* Update to 1.19.1

* Remove dead imports
  • Loading branch information
triphora authored Jul 30, 2022
1 parent 8d957c9 commit 87f253f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -70,8 +70,8 @@ publishing {
}
}

tasks.getByName("configureClientLaunch") {
doFirst {
afterEvaluate {
tasks.getByName("configureClientLaunch").doFirst {
loom {
runs {
all {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
minecraft_version=1.19.1
yarn_mappings=1.19.1+build.4
loader_version=0.14.8
# Runtime
lazydfu_version=0.1.3
# Mod Properties
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package me.steinborn.krypton.mixin.shared.network.flushconsolidation;

import io.netty.channel.*;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import me.steinborn.krypton.mod.shared.network.ConfigurableAutoFlush;
import net.minecraft.class_7648;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.NetworkState;
import net.minecraft.network.Packet;
Expand Down Expand Up @@ -44,7 +43,8 @@ private void initAddedFields(CallbackInfo ci) {
cancellable = true,
method = "sendImmediately",
at = @At(value = "FIELD", target = "Lnet/minecraft/network/ClientConnection;packetsSentCounter:I", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER))
private void sendImmediately$rewrite(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, CallbackInfo info, NetworkState packetState, NetworkState protocolState) {
private void sendImmediately$rewrite(Packet<?> packet, @Nullable class_7648 callback, CallbackInfo info, NetworkState packetState, NetworkState protocolState) {
// class_7648 is net/minecraft/network/PacketSendListener in Mojmap
boolean newState = packetState != protocolState;

if (this.channel.eventLoop().inEventLoop()) {
Expand Down Expand Up @@ -88,12 +88,22 @@ public Channel disableForcedFlushEveryTick(ClientConnection clientConnection) {
return null;
}

private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) {
private void doSendPacket(Packet<?> packet, class_7648 callback) {
if (callback == null) {
this.channel.write(packet, this.channel.voidPromise());
} else {
ChannelFuture channelFuture = this.channel.write(packet);
channelFuture.addListener(callback);
channelFuture.addListener(listener -> {
if (listener.isSuccess()) {
callback.method_45083(); // onSuccess moj
} else {
Packet<?> failedPacket = callback.method_45086(); // onFailure moj
if (failedPacket != null) {
ChannelFuture failedChannelFuture = this.channel.writeAndFlush(failedPacket);
failedChannelFuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}
}
});
channelFuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}

Expand Down

0 comments on commit 87f253f

Please sign in to comment.