Class MappableElement

java.lang.Object
net.mcreator.generator.mapping.MappableElement
All Implemented Interfaces:
IWorkspaceDependent
Direct Known Subclasses:
AchievementEntry, Animation, AttributeEntry, BiomeEntry, ConfiguredFeatureEntry, DamageTypeEntry, EffectEntry, Enchantment, EntityEntry, Fluid, Material, MItemBlock, NonMappableElement, Particle, ProfessionEntry, ProjectileEntry, Sound, StepSound, TabEntry, UniquelyMappedElement

public abstract class MappableElement extends Object implements IWorkspaceDependent
  • Field Details

    • mapper

      protected final transient NameMapper mapper
  • Constructor Details

    • MappableElement

      public MappableElement(NameMapper mapper)
    • MappableElement

      public MappableElement(NameMapper mapper, String value)
  • Method Details

    • toString

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

      public boolean isEmpty()
    • getMappedValue

      public String getMappedValue()
    • getMappedValue

      public String getMappedValue(int mappingTable)
    • getUnmappedValue

      public String getUnmappedValue()
    • isValidReference

      public boolean isValidReference()
      Returns:
      true if the value exists in the workspace. Always returns true for vanilla elements, even if they are not supported in the selected Minecraft version. Returns false if the element is empty.
    • validateReference

      public static boolean validateReference(@Nonnull String value, @Nonnull Workspace workspace)
      Returns:
      true if the value exists in the workspace. Always returns true for vanilla elements, even if they are not supported in the selected Minecraft version.
    • getDataListEntry

      public Optional<DataListEntry> getDataListEntry()
    • getDataListEntryType

      public String getDataListEntryType()
    • setManaged

      public void setManaged(boolean managed)
      Call this to mark the current mappable element as managed - meaning it was not generated by a direct user input. Can be used to filter out elements that were not generated by the user in UI components, for example.
      Parameters:
      managed - true if the element is managed
    • isManaged

      public boolean isManaged()
      Returns:
      true if the element was marked as managed
      See Also:
    • setWorkspace

      public void setWorkspace(@Nullable Workspace workspace)
      Specified by:
      setWorkspace in interface IWorkspaceDependent
    • getWorkspace

      @Nullable public Workspace getWorkspace()
      Specified by:
      getWorkspace in interface IWorkspaceDependent
    • hashCode

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

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