generated from cocona20xx/quilt-template-mod-gradle_properties
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
101 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package arathain.vigorem.api.frametag; | ||
|
||
public class FrameTag { | ||
protected final String id; | ||
|
||
public FrameTag(String type, String namespace, String name, String subname) { | ||
String add = subname != null && !subname.isEmpty() ? "$" + subname : ""; | ||
this.id = type + "/" + namespace + ":" + name + add; | ||
} | ||
|
||
public static FrameTag regularTag(String namespace, String name) { | ||
return new FrameTag("stat", namespace, name, null); | ||
} | ||
public static FrameTag customTag(String type, String namespace, String name) { | ||
return new FrameTag(type, namespace, name, null); | ||
} | ||
|
||
|
||
public String getId() { | ||
return id; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/arathain/vigorem/api/frametag/FrameTagData.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,27 @@ | ||
package arathain.vigorem.api.frametag; | ||
|
||
public class FrameTagData { | ||
protected final FrameTag frameTag; | ||
protected final float[] frametimes; | ||
|
||
public FrameTagData(FrameTag frameTag, float[] frametimes) { | ||
this.frameTag = frameTag; | ||
this.frametimes = frametimes; | ||
} | ||
|
||
public boolean isActive(float frame) { | ||
int i = 1; | ||
for(float f : frametimes) { | ||
if(f < frame ) { | ||
i++; | ||
} else { | ||
break; | ||
} | ||
} | ||
return i % 2 == 0; | ||
} | ||
|
||
public FrameTag getFrameTag() { | ||
return frameTag; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package arathain.vigorem.api.init; | ||
|
||
import arathain.vigorem.api.anim.Animation; | ||
import arathain.vigorem.api.frametag.FrameTag; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
|
||
public interface FrameTags { | ||
Map<String, FrameTag> FRAME_TAGS = new HashMap<>(); | ||
|
||
FrameTag INVULNERABILITY = put(FrameTag.regularTag("vigorem", "iframe")); | ||
|
||
static <T extends FrameTag> T put(T tag) { | ||
FRAME_TAGS.put(tag.getId(), tag); | ||
return tag; | ||
} | ||
} |
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