| 1 | package com.tangykiwi.kiwiclient.module.other;
|
| 2 |
|
| 3 | import com.tangykiwi.kiwiclient.module.Category;
|
| 4 | import com.tangykiwi.kiwiclient.module.Module;
|
| 5 | import com.tangykiwi.kiwiclient.module.setting.ModeSetting;
|
| 6 | import com.tangykiwi.kiwiclient.module.setting.ToggleSetting;
|
| 7 | import com.tangykiwi.kiwiclient.util.Textures;
|
| 8 |
|
| 9 | import net.minecraft.resources.Identifier;
|
| 10 |
|
| 11 | public class Cape extends Module {
|
| 12 | private long lastFrameTime = 0L;
|
| 13 | private int lastFrame = 1;
|
| 14 | private int capeInterval = 100;
|
| 15 |
|
| 16 | public Cape() {
|
| 17 | super("Cape", "Custom cape", Category.OTHER,
|
| 18 | new ModeSetting("Style", "Cape to display", "Default", "Animated", "Gura", "AhriR34"),
|
| 19 | new ToggleSetting("Glint", "Enchanted cape effect", true));
|
| 20 | }
|
| 21 |
|
| 22 | public Identifier getCape() {
|
| 23 | if (getSetting(0).asMode().getValue() == 0) {
|
| 24 | return Textures.CAPE;
|
| 25 | } else if (getSetting(0).asMode().getValue() == 1) {
|
| 26 | return getFrame();
|
| 27 | } else if (getSetting(0).asMode().getValue() == 2) {
|
| 28 | return Textures.CAPE2;
|
| 29 | }
|
| 30 | return Textures.CAPE3;
|
| 31 | }
|
| 32 |
|
| 33 | private Identifier getFrame() {
|
| 34 | long time = System.currentTimeMillis();
|
| 35 | if (time > this.lastFrameTime + (long)this.capeInterval) {
|
| 36 | int currentFrameNo = this.lastFrame + 1 > 32 ? 1 : this.lastFrame + 1;
|
| 37 | this.lastFrame = currentFrameNo;
|
| 38 | this.lastFrameTime = time;
|
| 39 | return Identifier.parse(String.format("kiwiclient:textures/cosmetic/cape/gif/cape%d.png", currentFrameNo));
|
| 40 | } else {
|
| 41 | return Identifier.parse(String.format("kiwiclient:textures/cosmetic/cape/gif/cape%d.png", this.lastFrame));
|
| 42 | }
|
| 43 | }
|
| 44 |
|
| 45 | // handling done in CapeFeatureRendererMixin
|
| 46 | }
|
| 47 |
|