Skip to content

Commit

Permalink
Make Modifier and LazyModifier IdAwareObject
Browse files Browse the repository at this point in the history
Just opens potential to simplify some recipe builders
  • Loading branch information
KnightMiner committed Apr 6, 2024
1 parent 4cce21f commit 2ec93f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import slimeknights.mantle.client.ResourceColorManager;
import slimeknights.mantle.data.registry.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.data.registry.GenericLoaderRegistry.IHaveLoader;
import slimeknights.mantle.registration.object.IdAwareObject;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.modifiers.ModifierManager.ModifierRegistrationEvent;
import slimeknights.tconstruct.library.modifiers.util.ModifierHookMap;
Expand All @@ -44,7 +45,7 @@
* @see #registerHooks(Builder)
*/
@SuppressWarnings("unused")
public class Modifier implements IHaveLoader {
public class Modifier implements IHaveLoader, IdAwareObject {
/** Default loader instance for a modifier with no properties */
public static final IGenericLoader<Modifier> DEFAULT_LOADER = new IGenericLoader<>() {
@Override
Expand Down Expand Up @@ -137,10 +138,7 @@ final void setId(ModifierId name) {
this.id = name;
}

/**
* Gets the modifier ID
* @return Modifier ID
*/
@Override
public ModifierId getId() {
return Objects.requireNonNull(id, "Modifier has null registry name");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.minecraft.tags.TagKey;
import slimeknights.mantle.registration.object.IdAwareObject;
import slimeknights.tconstruct.library.modifiers.Modifier;
import slimeknights.tconstruct.library.modifiers.ModifierId;
import slimeknights.tconstruct.library.modifiers.ModifierManager;
Expand All @@ -12,7 +13,7 @@

/** Supplier that will return a modifier once they are fully registered, typically used with {@link ModifierDeferredRegister} */
@RequiredArgsConstructor
public class LazyModifier implements Supplier<Modifier> {
public class LazyModifier implements Supplier<Modifier>, IdAwareObject {
/** ID of the modifier to fetch */
@Getter
protected final ModifierId id;
Expand Down

0 comments on commit 2ec93f8

Please sign in to comment.