-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic return type to the stat module builder
Forgot that the speciifc modifier module types are needed for the specific hook builder
- Loading branch information
1 parent
f53c803
commit a138802
Showing
14 changed files
with
72 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/slimeknights/tconstruct/library/modifiers/modules/AttributeModuleBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package slimeknights.tconstruct.library.modifiers.modules; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.RequiredArgsConstructor; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.ai.attributes.Attribute; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; | ||
import slimeknights.tconstruct.library.json.LevelingValue; | ||
|
||
/** | ||
* Shared builder logic for {@link slimeknights.tconstruct.library.modifiers.modules.behavior.AttributeModule} and {@link slimeknights.tconstruct.library.modifiers.modules.combat.MeleeAttributeModule} | ||
* @param <T> Builder type | ||
* @param <M> Module return type | ||
*/ | ||
@RequiredArgsConstructor(access = AccessLevel.PROTECTED) | ||
public abstract class AttributeModuleBuilder<T extends AttributeModuleBuilder<T,M>, M> extends ModifierModuleCondition.Builder<T> implements LevelingValue.Builder<M> { | ||
protected final Attribute attribute; | ||
protected final Operation operation; | ||
protected String unique; | ||
|
||
/** | ||
* Sets the unique string directly | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
public T unique(String unique) { | ||
this.unique = unique; | ||
return (T)this; | ||
} | ||
|
||
/** | ||
* Sets the unique string using a resource location | ||
*/ | ||
public T uniqueFrom(ResourceLocation id) { | ||
return unique(id.getNamespace() + ".modifier." + id.getPath()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters