mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-05-19 20:13:53 +02:00
28 lines
769 B
Java
28 lines
769 B
Java
package com.simibubi.create.infrastructure.debugInfo.element;
|
|
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraft.world.entity.player.Player;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import java.util.function.Consumer;
|
|
|
|
public sealed interface InfoElement permits DebugInfoSection, InfoEntry {
|
|
void write(Player player, FriendlyByteBuf buffer);
|
|
|
|
void print(int depth, @Nullable Player player, Consumer<String> lineConsumer);
|
|
|
|
default void print(@Nullable Player player, Consumer<String> lineConsumer) {
|
|
print(0, player, lineConsumer);
|
|
}
|
|
|
|
static InfoElement read(FriendlyByteBuf buffer) {
|
|
boolean section = buffer.readBoolean();
|
|
if (section) {
|
|
return DebugInfoSection.read(buffer);
|
|
} else {
|
|
return InfoEntry.read(buffer);
|
|
}
|
|
}
|
|
}
|