-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patched lazy colors on BossDisplayAdapter and added CraftTweaker(Mine…
…Tweaker) support.
- Loading branch information
Showing
8 changed files
with
121 additions
and
10 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
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
70 changes: 70 additions & 0 deletions
70
...io/github/cruciblemc/necrotempus/modules/features/bossbar/compat/CraftTweakerBossBar.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,70 @@ | ||
package io.github.cruciblemc.necrotempus.modules.features.bossbar.compat; | ||
|
||
import cpw.mods.fml.common.FMLCommonHandler; | ||
import io.github.cruciblemc.necrotempus.api.bossbar.BossBarColor; | ||
import io.github.cruciblemc.necrotempus.api.bossbar.BossBarType; | ||
import io.github.cruciblemc.necrotempus.modules.features.bossbar.client.render.BossDisplayAdapterListener; | ||
import io.github.cruciblemc.necrotempus.modules.features.bossbar.component.BossDisplayAdapter; | ||
import minetweaker.IUndoableAction; | ||
import minetweaker.MineTweakerAPI; | ||
import stanhebben.zenscript.annotations.ZenClass; | ||
import stanhebben.zenscript.annotations.ZenMethod; | ||
|
||
@ZenClass(value = "mods.necrotempus.BossBar") | ||
public class CraftTweakerBossBar { | ||
|
||
@ZenMethod | ||
public static void customize(String entity, int color, String type){ | ||
MineTweakerAPI.apply(new BossBarCustomizeAction(entity, color, type)); | ||
} | ||
|
||
public static class BossBarCustomizeAction implements IUndoableAction{ | ||
|
||
private final String entity; | ||
private final BossBarColor color; | ||
private final BossBarType type; | ||
|
||
public BossBarCustomizeAction(String entity, int color, String type) { | ||
this.entity = entity; | ||
this.color = BossBarColor.valueOfString("$" + color); | ||
this.type = BossBarType.valueOfString(type); | ||
} | ||
|
||
@Override | ||
public boolean canUndo() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void apply() { | ||
if(FMLCommonHandler.instance().getEffectiveSide().isClient()){ | ||
BossDisplayAdapter bossDisplayAdapter = new BossDisplayAdapter(entity, color, type); | ||
BossDisplayAdapterListener.getCustomAdapters().add(bossDisplayAdapter); | ||
} | ||
} | ||
|
||
@Override | ||
public void undo() { | ||
if(FMLCommonHandler.instance().getEffectiveSide().isClient()){ | ||
BossDisplayAdapterListener.getCustomAdapters().removeIf( el -> el.getTargetClass().equalsIgnoreCase(entity) ); | ||
} | ||
} | ||
|
||
@Override | ||
public String describe() { | ||
return String.format("Registering CustomBossBarAdapter for entity %s. (Color: RGB(%s), Type: %s)", entity, color.intValue(), type.getType()); | ||
} | ||
|
||
@Override | ||
public String describeUndo() { | ||
return String.format("Removing CustomBossBarAdapter for entity %s. (Color: RGB(%s), Type: %s)", entity, color.intValue(), type.getType()); | ||
} | ||
|
||
@Override | ||
public Object getOverrideKey() { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...in/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/compat/ZenRegister.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,9 @@ | ||
package io.github.cruciblemc.necrotempus.modules.features.bossbar.compat; | ||
|
||
import minetweaker.MineTweakerAPI; | ||
|
||
public class ZenRegister { | ||
public static void register() { | ||
MineTweakerAPI.registerClass(CraftTweakerBossBar.class); | ||
} | ||
} |
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