Skip to content

Commit

Permalink
Krypton 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
astei committed Jun 10, 2023
1 parent 6562a2e commit 545721a
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 66 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.17
# Mod Properties
mod_version=0.2.2
mod_version=0.2.3
maven_group=me.steinborn
archives_base_name=krypton

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void updatePosition(ServerPlayerEntity player) {

// The player *always* needs to be send chunks, as for some reason both chunk loading & unloading packets are handled
// by the same method (why mojang)
if (player.world == this.world)
if (player.getWorld() == this.world)
this.sendChunkWatchPackets(oldPos, player);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,11 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

@Mixin(ClientConnection.class)
public class ClientConnectionMixin {
private static Constructor<?> krypton_viaEventConstructor;

static {
krypton_findViaEvent();
}

@Shadow
private Channel channel;

private static void krypton_findViaEvent() {
// ViaFabric compatibility
try {
krypton_viaEventConstructor =
Class.forName("com.viaversion.fabric.common.handler.PipelineReorderEvent").getConstructor();
} catch (ClassNotFoundException | NoSuchMethodException ignored) {
}
}

@Inject(method = "setCompressionThreshold", at = @At("HEAD"), cancellable = true)
public void setCompressionThreshold(int compressionThreshold, boolean validate, CallbackInfo ci) {
if (compressionThreshold < 0) {
Expand Down Expand Up @@ -71,7 +53,6 @@ public void setCompressionThreshold(int compressionThreshold, boolean validate,
this.channel.pipeline().fireUserEventTriggered(KryptonPipelineEvent.COMPRESSION_ENABLED);
}
}
this.handleViaCompression();

ci.cancel();
}
Expand All @@ -83,13 +64,4 @@ private static boolean isKryptonOrVanillaDecompressor(Object o) {
private static boolean isKryptonOrVanillaCompressor(Object o) {
return o instanceof PacketDeflater || o instanceof MinecraftCompressEncoder;
}

private void handleViaCompression() {
if (krypton_viaEventConstructor == null) return;
try {
this.channel.pipeline().fireUserEventTriggered(krypton_viaEventConstructor.newInstance());
} catch (InvocationTargetException | InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import me.steinborn.krypton.mixin.shared.network.util.ServerPlayNetworkHandlerAccessor;
import me.steinborn.krypton.mod.shared.network.ConfigurableAutoFlush;
import net.minecraft.network.ClientConnection;
import net.minecraft.server.network.ServerPlayerEntity;

public class AutoFlushUtil {
Expand All @@ -13,12 +12,5 @@ public static void setAutoFlush(ServerPlayerEntity player, boolean val) {
}
}

public static void setAutoFlush(ClientConnection conn, boolean val) {
if (conn.getClass() == ClientConnection.class) {
ConfigurableAutoFlush configurableAutoFlusher = ((ConfigurableAutoFlush) conn);
configurableAutoFlusher.setShouldAutoFlush(val);
}
}

private AutoFlushUtil() {}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"accessWidener": "krypton.accesswidener",
"depends": {
"fabricloader": ">=0.11.3",
"minecraft": "1.19.x"
"minecraft": "1.20.x"
},
"custom": {
"_lithium_mixin_comment": "We disable the player_chunk_tick mixin as Krypton contains a superior version that does flush consolidation.",
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/krypton.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"shared.fastchunkentityaccess.SectionedEntityCacheMixin",
"shared.network.avoidwork.ThreadedAnvilChunkStorageMixin",
"shared.network.flushconsolidation.ClientConnectionMixin",
"shared.network.flushconsolidation.EntityTrackerEntryMixin",
"shared.network.flushconsolidation.ThreadedAnvilChunkStorageMixin",
"shared.network.microopt.EntityTrackerEntryMixin",
"shared.network.microopt.PacketByteBufMixin",
Expand Down

0 comments on commit 545721a

Please sign in to comment.