generated from Qalcyo-Archive/ForgeModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial release.
- Loading branch information
Showing
12 changed files
with
228 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<div align="center"> | ||
|
||
# Template | ||
# Damage Tint | ||
|
||
</div> | ||
|
||
## About | ||
Placeholder. | ||
A mod which changes the color of entities that are hurt. | ||
|
||
## How to install | ||
Placeholder | ||
## Examples | ||
TODO: add images here lol |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
org.gradle.jvmargs=-Xmx4G | ||
|
||
mod_name=ForgeTemplate | ||
mod_id=forgetemplate | ||
mod_ver=1.0.0 | ||
mod_name=DamageTint | ||
mod_id=damagetint | ||
mod_ver=3.0.0 |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/xyz/qalcyo/damagetint/command/DamageTintCommand.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,17 @@ | ||
package xyz.qalcyo.damagetint.command; | ||
|
||
import gg.essential.api.EssentialAPI; | ||
import gg.essential.api.commands.Command; | ||
import gg.essential.api.commands.DefaultHandler; | ||
import xyz.qalcyo.damagetint.DamageTint; | ||
|
||
public class DamageTintCommand extends Command { | ||
public DamageTintCommand() { | ||
super("damagetint", true); | ||
} | ||
|
||
@DefaultHandler | ||
public void handle() { | ||
EssentialAPI.getGuiUtil().openScreen(DamageTint.config.gui()); | ||
} | ||
} |
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,56 @@ | ||
package xyz.qalcyo.damagetint.config; | ||
|
||
import gg.essential.api.EssentialAPI; | ||
import gg.essential.vigilance.Vigilant; | ||
import gg.essential.vigilance.data.Property; | ||
import gg.essential.vigilance.data.PropertyType; | ||
import net.minecraft.client.Minecraft; | ||
import xyz.qalcyo.damagetint.DamageTint; | ||
import xyz.qalcyo.damagetint.gui.DownloadConfirmGui; | ||
import xyz.qalcyo.damagetint.utils.Updater; | ||
|
||
import java.awt.*; | ||
import java.io.File; | ||
|
||
public class Config extends Vigilant { | ||
@Property( | ||
type = PropertyType.SWITCH, | ||
name = "Toggle Mod", | ||
description = "Toggle the mod's functionality.", | ||
category = "General" | ||
) | ||
public static boolean toggle = true; | ||
|
||
@Property( | ||
type = PropertyType.COLOR, | ||
name = "Damage Tint Colour", | ||
description = "Modify the damage tint when mobs take damage.", | ||
category = "General", | ||
allowAlpha = false | ||
) | ||
public static Color color = Color.RED; | ||
|
||
@Property( | ||
type = PropertyType.SWITCH, | ||
name = "Show Update Notification", | ||
description = "Show a notification when you start Minecraft informing you of new updates.", | ||
category = "Updater" | ||
) | ||
public static boolean showUpdate = true; | ||
|
||
@Property( | ||
type = PropertyType.BUTTON, | ||
name = "Update Now", | ||
description = "Update by clicking the button.", | ||
category = "Updater" | ||
) | ||
public void update() { | ||
if (Updater.shouldUpdate) EssentialAPI.getGuiUtil() | ||
.openScreen(new DownloadConfirmGui(Minecraft.getMinecraft().currentScreen)); else EssentialAPI.getNotifications() | ||
.push("Damage Tint", "No update had been detected at startup, and thus the update GUI has not been shown."); | ||
} | ||
|
||
public Config() { | ||
super(new File(DamageTint.modDir, "damagetint.toml"), "Damage Tint"); | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/xyz/qalcyo/damagetint/mixin/RendererLivingEntityMixin.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,40 @@ | ||
package xyz.qalcyo.damagetint.mixin; | ||
|
||
import net.minecraft.client.renderer.entity.RendererLivingEntity; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.ModifyArgs; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args; | ||
import xyz.qalcyo.damagetint.config.Config; | ||
|
||
@Mixin(RendererLivingEntity.class) | ||
public class RendererLivingEntityMixin { | ||
private boolean flag = false; | ||
private int count; | ||
@Inject(method = "setBrightness", at = @At("HEAD")) | ||
private void set(EntityLivingBase entitylivingbaseIn, float partialTicks, boolean combineTextures, CallbackInfoReturnable<Boolean> cir) { | ||
flag = (entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0) && Config.toggle; | ||
count = 0; | ||
} | ||
@ModifyArgs(method = "setBrightness", at = @At(value = "INVOKE", target = "Ljava/nio/FloatBuffer;put(F)Ljava/nio/FloatBuffer;")) | ||
private void returnColor(Args args) { | ||
if (flag) { | ||
float arg = args.get(0); | ||
if (arg == 1.0F) { | ||
//red | ||
args.set(0, ((float) Config.color.getRed()) / 255); | ||
} else if (arg == 0.0F) { | ||
//blue / green | ||
++count; | ||
if (count == 1) { | ||
args.set(0, ((float) Config.color.getGreen()) / 255); | ||
} else { | ||
args.set(0, ((float) Config.color.getBlue()) / 255); | ||
} | ||
} | ||
} | ||
} | ||
} |
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.