mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-10 22:36:06 +01:00
881ce3639d
# Conflicts: # changelog.txt # gradle.properties # src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java # src/main/java/com/jozufozu/flywheel/config/BooleanConfig.java # src/main/java/com/jozufozu/flywheel/config/SConfigureBooleanPacket.java # src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java # src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java # src/main/java/com/jozufozu/flywheel/util/WorldAttached.java # src/main/resources/flywheel.mixins.json
41 lines
914 B
Java
41 lines
914 B
Java
package com.jozufozu.flywheel.config;
|
|
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraftforge.fmllegacy.network.NetworkEvent;
|
|
|
|
/**
|
|
* Thanks, @zelophed
|
|
*/
|
|
public class SConfigureBooleanPacket {
|
|
|
|
private final BooleanConfig target;
|
|
private final BooleanDirective directive;
|
|
|
|
public SConfigureBooleanPacket(BooleanConfig target, BooleanDirective directive) {
|
|
this.target = target;
|
|
this.directive = directive;
|
|
}
|
|
|
|
public SConfigureBooleanPacket(FriendlyByteBuf buffer) {
|
|
target = BooleanConfig.decode(buffer);
|
|
directive = BooleanDirective.decode(buffer);
|
|
}
|
|
|
|
public void encode(FriendlyByteBuf buffer) {
|
|
target.encode(buffer);
|
|
directive.encode(buffer);
|
|
}
|
|
|
|
public void execute(Supplier<NetworkEvent.Context> ctx) {
|
|
if (directive != null) {
|
|
target.receiver.get()
|
|
.accept(directive);
|
|
}
|
|
ctx.get()
|
|
.setPacketHandled(true);
|
|
}
|
|
|
|
}
|