Class ModElement

java.lang.Object
net.mcreator.workspace.elements.ModElement
All Implemented Interfaces:
Serializable, IGeneratorProvider, IElement, IWorkspaceProvider

public class ModElement extends Object implements Serializable, IWorkspaceProvider, IGeneratorProvider, IElement
See Also:
  • Constructor Details

    • ModElement

      public ModElement(@Nonnull Workspace workspace, @Nonnull String name, ModElementType<?> type)
    • ModElement

      public ModElement(@Nonnull Workspace workspace, @Nonnull ModElement mu, String duplicateName)
      Duplicates given mod element, but does not duplicate registry name, lock status, compiles status and ID map
      Parameters:
      mu - Mod element to be duplicated
      duplicateName - Name of the duplicate
  • Method Details

    • getGeneratableElement

      @Nullable public GeneratableElement getGeneratableElement()
      Warning: this method uses ModElementManager and is thus not thread safe
      Returns:
      GeneratableElement or null if load failed
    • reinit

      public void reinit(Workspace workspace)
      Call this method to reinit ME icon, mcItems cache or update associated workspace
      Parameters:
      workspace - Workspace this ME belongs to
    • reloadElementIcon

      public void reloadElementIcon()
    • getWorkspace

      @Nonnull public Workspace getWorkspace()
      Specified by:
      getWorkspace in interface IWorkspaceProvider
    • setWorkspace

      public void setWorkspace(Workspace workspace)
    • getElementIcon

      public ImageIcon getElementIcon()
    • putMetadata

      public ModElement putMetadata(String key, Object data)
    • clearMetadata

      public ModElement clearMetadata()
    • getMetadata

      public Object getMetadata(String key)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object element)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • doesCompile

      public boolean doesCompile()
    • setCompiles

      public void setCompiles(boolean compiles)
    • getName

      public String getName()
      Specified by:
      getName in interface IElement
    • getType

      public ModElementType<?> getType()
    • getTypeString

      public String getTypeString()
    • isCodeLocked

      public boolean isCodeLocked()
    • setCodeLock

      public void setCodeLock(boolean codeLock)
    • getMCItems

      @Nonnull public List<MCItem> getMCItems()
      Warning: this method relies on getGeneratableElement that is not thread safe, so this method is also not thread safe
    • getRegistryName

      public String getRegistryName()
    • getRegistryNameUpper

      public String getRegistryNameUpper()
    • setRegistryName

      public void setRegistryName(String registry_name)
    • getFolderPath

      @Nullable public String getFolderPath()
    • setParentFolder

      public void setParentFolder(@Nullable FolderElement parent)
    • getBaseTypesProvided

      public Collection<BaseType> getBaseTypesProvided()
      Warning: this method relies on getGeneratableElement that is not thread safe, so this method is also not thread safe
    • loadDataFrom

      public void loadDataFrom(ModElement other)
      Parameters:
      other - The mod element to copy settings from.