-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implementing builders into pose samplers
- Loading branch information
1 parent
83725fb
commit ab9504d
Showing
13 changed files
with
302 additions
and
82 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
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
58 changes: 58 additions & 0 deletions
58
src/main/java/com/trainguy9512/animationoverhaul/animation/data/PoseSamplerKey.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,58 @@ | ||
package com.trainguy9512.animationoverhaul.animation.data; | ||
|
||
import com.trainguy9512.animationoverhaul.animation.pose.sample.PoseSampler; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class PoseSamplerKey<P extends PoseSampler> { | ||
|
||
private final Supplier<P> defaultValue; | ||
private final String debugIdentifier; | ||
|
||
private PoseSamplerKey(Builder<P> builder) { | ||
this.defaultValue = builder.defaultValue; | ||
this.debugIdentifier = builder.debugIdentifier; | ||
} | ||
|
||
/** | ||
* Creates a builder for a key | ||
* | ||
* @param defaultValue The default value of the animation variable | ||
*/ | ||
public static <P extends PoseSampler> Builder<P> of(Supplier<P> defaultValue){ | ||
return new Builder<>(defaultValue); | ||
} | ||
|
||
public String getDebugIdentifier() { | ||
return debugIdentifier; | ||
} | ||
|
||
public Supplier<P> getDefaultValue(){ | ||
return this.defaultValue; | ||
} | ||
|
||
public static class Builder<P extends PoseSampler> { | ||
|
||
private final Supplier<P> defaultValue; | ||
private String debugIdentifier = "null"; | ||
|
||
|
||
private Builder(Supplier<P> defaultValue) { | ||
this.defaultValue = defaultValue; | ||
} | ||
|
||
/** | ||
* Sets the debug identifier for the key builder. This is used in in-game value debugging for identifying pose samplers and printing them to the screen. | ||
* | ||
* @param debugIdentifier The string name used in the identifier | ||
*/ | ||
public Builder<P> setDebugIdentifier(String debugIdentifier){ | ||
this.debugIdentifier = debugIdentifier; | ||
return this; | ||
} | ||
|
||
public PoseSamplerKey<P> build(){ | ||
return new PoseSamplerKey<>(this); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.