public class PersistentStateManager extends Object
Modifier and Type | Field and Description |
---|---|
private com.mojang.datafixers.DataFixer |
dataFixer |
private File |
directory |
private Map<String,PersistentState> |
loadedStates |
private static Logger |
LOGGER |
Constructor and Description |
---|
PersistentStateManager(File directory,
com.mojang.datafixers.DataFixer dataFixer) |
Modifier and Type | Method and Description |
---|---|
<T extends PersistentState> |
get(Supplier<T> factory,
String id) |
private File |
getFile(String id) |
<T extends PersistentState> |
getOrCreate(Supplier<T> factory,
String id) |
private boolean |
isCompressed(PushbackInputStream pushbackInputStream) |
private <T extends PersistentState> |
readFromFile(Supplier<T> factory,
String id) |
CompoundTag |
readTag(String id,
int dataVersion) |
void |
save() |
void |
set(PersistentState state) |
private static final Logger LOGGER
private final Map<String,PersistentState> loadedStates
private final com.mojang.datafixers.DataFixer dataFixer
private final File directory
public PersistentStateManager(File directory, com.mojang.datafixers.DataFixer dataFixer)
public <T extends PersistentState> T getOrCreate(Supplier<T> factory, String id)
@Nullable public <T extends PersistentState> T get(Supplier<T> factory, String id)
@Nullable private <T extends PersistentState> T readFromFile(Supplier<T> factory, String id)
public void set(PersistentState state)
public CompoundTag readTag(String id, int dataVersion) throws IOException
IOException
private boolean isCompressed(PushbackInputStream pushbackInputStream) throws IOException
IOException
public void save()