Skip to content

Commit 38f1370

Browse files
committed
Do not register smart ingredient sync channel if option is off
Related: #570
1 parent 213e0ce commit 38f1370

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

forge/src/main/java/org/embeddedt/modernfix/forge/packet/PacketHandler.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,25 @@
88
import net.minecraftforge.fml.DistExecutor;
99
import org.embeddedt.modernfix.ModernFix;
1010
import org.embeddedt.modernfix.ModernFixClient;
11+
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
1112
import org.embeddedt.modernfix.packet.EntityIDSyncPacket;
1213

1314
import java.util.function.Supplier;
1415

1516
public class PacketHandler {
1617
public static final SimpleChannel INSTANCE = buildChannel("main", "1");
17-
public static final SimpleChannel INGREDIENT_SYNC = buildChannel("ingredient_sync", "1");
18+
public static final SimpleChannel INGREDIENT_SYNC;
19+
20+
static {
21+
SimpleChannel ingredientChannel;
22+
if (ModernFixMixinPlugin.instance.isOptionEnabled("perf.smart_ingredient_sync.Channel")) {
23+
ingredientChannel = buildChannel("ingredient_sync", "1");
24+
} else {
25+
ingredientChannel = null;
26+
}
27+
INGREDIENT_SYNC = ingredientChannel;
28+
}
29+
1830
public static final ThreadLocal<Boolean> CLIENT_HAS_SMART_INGREDIENT_SYNC = ThreadLocal.withInitial(() -> false);
1931

2032
private static SimpleChannel buildChannel(String name, String version) {

0 commit comments

Comments
 (0)