Package foundry.veil.api.resource.editor
Interface ResourceFileEditor<T extends VeilResource<?>>
- Type Parameters:
T
- The type of resource this editor handles
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
BlockModelInspector
,FramebufferFileEditor
,ResourceOverrideEditor
,TextFileEditor
Defines an editor type that can interact with one or more resources.
- Since:
- 1.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
ResourceFileEditor.Factory<T extends VeilResource<?>>
Factory for creating a new resource file editor. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
boolean
isClosed()
void
Called to update the editor status from disk.void
render()
Renders this editor to the screen.default CompletableFuture
<?> save
(byte[] data, VeilResourceManager resourceManager, VeilResource<?> resource) Saves the specified data to the specified resource and hot reloads it.default CompletableFuture
<?> save
(com.google.gson.JsonElement element, VeilResourceManager resourceManager, VeilResource<?> resource) Saves the specified json element to the specified resource and hot reloads it.
-
Method Details
-
render
void render()Renders this editor to the screen. -
loadFromDisk
void loadFromDisk()Called to update the editor status from disk. -
isClosed
boolean isClosed()- Returns:
- Whether this editor is closed
-
getResource
T getResource()- Returns:
- The resource being edited
-
close
default void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
save
default CompletableFuture<?> save(com.google.gson.JsonElement element, VeilResourceManager resourceManager, VeilResource<?> resource) throws IOException Saves the specified json element to the specified resource and hot reloads it.- Parameters:
element
- The json to write to the resource fileresourceManager
- The resource manager to write the file toresource
- The resource to write to- Returns:
- A future for when the task is complete
- Throws:
IOException
-
save
default CompletableFuture<?> save(byte[] data, VeilResourceManager resourceManager, VeilResource<?> resource) Saves the specified data to the specified resource and hot reloads it.- Parameters:
data
- The data to write to the resource fileresourceManager
- The resource manager to write the file toresource
- The resource to write to- Returns:
- A future for when the task is complete
-