This commit is contained in:
40
src/main/java/com/aranroig/editor/EditorFile.java
Normal file
40
src/main/java/com/aranroig/editor/EditorFile.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.aranroig.editor;
|
||||
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
|
||||
public class EditorFile {
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, EditorFile> CODEC =
|
||||
StreamCodec.composite(
|
||||
ByteBufCodecs.STRING_UTF8,
|
||||
EditorFile::getName,
|
||||
|
||||
ByteBufCodecs.STRING_UTF8,
|
||||
EditorFile::getText,
|
||||
|
||||
EditorFile::new
|
||||
);
|
||||
|
||||
// Class with file info
|
||||
private String name;
|
||||
private String text;
|
||||
|
||||
public EditorFile(String name, String text) {
|
||||
this.name = name;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user