Skip to content

Commit

Permalink
changing name to ToroHUD
Browse files Browse the repository at this point in the history
  • Loading branch information
frodare committed Sep 18, 2018
1 parent c524ebc commit a7fb756
Show file tree
Hide file tree
Showing 30 changed files with 95 additions and 247 deletions.
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@

# ToroHealth Damage Indicators

With ToroHealth Damage Indicators, damage given, received, or mitigated will be displayed as a number that pops off of the entity.

Also, health bars will appear in the top left corner for the entity in the player's crosshairs.

Customization options are available for changing the color of the damage numbers and the display style of the health bar (Compact or Standard). I will soon be adding options to re-position the health bars and may make some visual tweaks to them.

### [Download from here](https://minecraft.curseforge.com/projects/torohealth-damage-indicators)

![Screenshot](https://i.imgur.com/C9oBhZ5.png)
# ToroHUD Damage Indicators


## Development Environment Setup

```
git clone [email protected]:ToroCraft/ToroHealth.git
cd ToroHealth
git clone [email protected]:ToroCraft/ToroHUD.git
cd ToroHUD
gradle setupDecompWorkspace
```

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.12.2-12"
group= "net.torocraft.torohealth"
archivesBaseName = "torohealth"
version = "1.12.2-1"
group= "net.torocraft.torohud"
archivesBaseName = "torohud"

sourceCompatibility = targetCompatibility = '1.8'
compileJava {
Expand Down
90 changes: 0 additions & 90 deletions curse.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.torocraft.torohealth;
package net.torocraft.torohud;

import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.MinecraftForge;
Expand All @@ -12,22 +12,22 @@
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.torocraft.torohealth.config.ConfigurationHandler;
import net.torocraft.torohealth.events.Events;
import net.torocraft.torohud.config.ConfigurationHandler;
import net.torocraft.torohud.proxy.CommonProxy;

@Mod(modid = ToroHealth.MODID, name = ToroHealth.MODNAME, version = ToroHealth.VERSION, guiFactory = "net.torocraft.torohealth.gui.GuiFactoryToroHealth")
@Mod(modid = ToroHUD.MODID, name = ToroHUD.MODNAME, version = ToroHUD.VERSION, guiFactory = "net.torocraft.torohud.gui.GuiFactory")

public class ToroHealth {
public class ToroHUD {

public static final String MODID = "torohealthmod";
public static final String VERSION = "1.12.2-12";
public static final String MODNAME = "ToroHealth";
public static final String MODID = "torohud";
public static final String VERSION = "1.12.2-1";
public static final String MODNAME = "ToroHUD";

@SidedProxy(clientSide = "net.torocraft.torohealth.ClientProxy", serverSide = "net.torocraft.torohealth.ServerProxy")
@SidedProxy(clientSide = "net.torocraft.torohud.proxy.ClientProxy", serverSide = "net.torocraft.torohud.proxy.ServerProxy")
public static CommonProxy PROXY;

@Instance(value = ToroHealth.MODID)
public static ToroHealth INSTANCE;
@Instance(value = ToroHUD.MODID)
public static ToroHUD INSTANCE;

public static SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package net.torocraft.torohealth.config;
package net.torocraft.torohud.config;

import java.io.File;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.torocraft.torohealth.ToroHealth;
import net.torocraft.torohud.ToroHUD;

public class ConfigurationHandler {

public static Configuration config;

public static boolean showEntityModel;
public static boolean showDamageParticles;
public static boolean enableClientSideDamageParticles;
public static String entityStatusDisplay;
public static String statusDisplayPosition;
public static String skin;
Expand Down Expand Up @@ -40,8 +39,6 @@ public static void loadConfiguration() {
statusDisplayY = config.getInt("Health Bar Y", Configuration.CATEGORY_CLIENT, 0, -20000, 20000, "With CUSTOM position, sets Y position of Health Bar");
hideDelay = config.getInt("Hide Delay", Configuration.CATEGORY_CLIENT, 400, 50, 5000, "Delays hiding the dialog for the given number of milliseconds");
showDamageParticles = config.getBoolean("Show Damage Particles", Configuration.CATEGORY_CLIENT, true, "Show Damage Indicators");
enableClientSideDamageParticles = config.getBoolean("Enable Client Side Damage Particles", Configuration.CATEGORY_CLIENT, false,
"Set to true if you would like to see the damage numbers but do not have this mod installed on the server");
healColor = mapColor(config.getString("Heal Color", Configuration.CATEGORY_CLIENT, "GREEN", "Heal Text Color", acceptedColors));
damageColor = mapColor(config.getString("Damage Color", Configuration.CATEGORY_CLIENT, "RED", "Damage Text Color", acceptedColors));
} catch (Exception e) {
Expand Down Expand Up @@ -76,7 +73,7 @@ private static int mapColor(String color) {

@SubscribeEvent
public void onConfigChangeEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.getModID().equalsIgnoreCase(ToroHealth.MODID)) {
if (event.getModID().equalsIgnoreCase(ToroHUD.MODID)) {
loadConfiguration();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package net.torocraft.torohealth.config;
package net.torocraft.torohud.config;

import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.torocraft.torohealth.ToroHealth;
import net.torocraft.torohud.ToroHUD;

public class GuiConfigToroHealth extends GuiConfig {

public GuiConfigToroHealth(GuiScreen parent) {
super(parent, new ConfigElement(ConfigurationHandler.config.getCategory(Configuration.CATEGORY_CLIENT)).getChildElements(),
ToroHealth.MODID,
ToroHUD.MODID,
false,
false,
"ToroHealth");
"ToroHUD");
titleLine2 = ConfigurationHandler.config.getConfigFile().getAbsolutePath();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityGhast;
Expand All @@ -8,7 +8,7 @@
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntitySquid;

public abstract class AbstractHealthDisplay implements ToroHealthDisplay {
public abstract class AbstractEntityDisplay implements IDisplay {

protected EntityLivingBase entity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.torocraft.torohealth.ToroHealth;
import net.torocraft.torohud.ToroHUD;

public class BarDisplay extends AbstractHealthDisplay implements ToroHealthDisplay {
public class BarDisplay extends AbstractEntityDisplay implements IDisplay {

private static final ResourceLocation GUI_BARS_TEXTURES = new ResourceLocation(ToroHealth.MODID, "textures/gui/bars.png");
private static final ResourceLocation GUI_BARS_TEXTURES = new ResourceLocation(ToroHUD.MODID, "textures/gui/bars.png");

private static final int BAR_WIDTH = 92;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
Expand All @@ -11,7 +11,7 @@
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.util.math.MathHelper;

public class EntityDisplay implements ToroHealthDisplay {
public class EntityDisplay implements IDisplay {

private static final int RENDER_HEIGHT = 30;
private static final int RENDER_WIDTH = 18;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.math.MathHelper;
import net.torocraft.torohealth.gui.GuiEntityStatus;
import net.torocraft.torohud.gui.GuiEntityStatus;

public class HeartsDisplay extends AbstractHealthDisplay implements ToroHealthDisplay {
public class HeartsDisplay extends AbstractEntityDisplay implements IDisplay {

private final Minecraft mc;
private final Gui gui;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import net.minecraft.entity.EntityLivingBase;

public interface ToroHealthDisplay {
public interface IDisplay {

void setEntity(EntityLivingBase entity);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.torocraft.torohealth.ToroHealth;
import net.torocraft.torohud.ToroHUD;

public class NumericDisplay implements ToroHealthDisplay {
public class NumericDisplay implements IDisplay {

private static final ResourceLocation TEXTURE = new ResourceLocation(ToroHealth.MODID, "textures/gui/entityStatus.png");
private static final ResourceLocation TEXTURE = new ResourceLocation(ToroHUD.MODID, "textures/gui/entityStatus.png");
private static final int WIDTH = 100;
private static final int HEIGHT = 34;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package net.torocraft.torohealth.display;
package net.torocraft.torohud.display;

import java.util.Collection;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.torocraft.torohealth.gui.GuiEntityStatus;
import net.torocraft.torohealth.network.MessageEntityStatsResponse;
import net.torocraft.torohud.gui.GuiEntityStatus;
import net.torocraft.torohud.network.MessageEntityStatsResponse;

public class PotionDisplay extends AbstractHealthDisplay implements ToroHealthDisplay {
public class PotionDisplay extends AbstractEntityDisplay implements IDisplay {

private final Minecraft mc;
private final Gui gui;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
package net.torocraft.torohealth.events;
package net.torocraft.torohud.events;

import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
import net.torocraft.torohealth.ToroHealth;
import net.torocraft.torohealth.config.ConfigurationHandler;
import net.torocraft.torohealth.network.MessageLivingHurt;
import net.torocraft.torohud.ToroHUD;
import net.torocraft.torohud.network.MessageLivingHurt;

@Mod.EventBusSubscriber()
public class Events {

@SubscribeEvent
public static void displayDamage(LivingUpdateEvent event) {
if (ConfigurationHandler.enableClientSideDamageParticles) {
ToroHealth.PROXY.displayDamageDealt(event.getEntityLiving());
}
}

@SubscribeEvent
public static void displayDamage(LivingHurtEvent event) {
EntityLivingBase e = event.getEntityLiving();
Expand All @@ -30,15 +21,15 @@ public static void displayDamage(LivingHurtEvent event) {
}
TargetPoint around = new TargetPoint(e.dimension, e.posX, e.posY, e.posZ, 100);
MessageLivingHurt message = new MessageLivingHurt(e.getEntityId(), event.getAmount());
ToroHealth.NETWORK.sendToAllAround(message, around);
ToroHUD.NETWORK.sendToAllAround(message, around);
}

@SubscribeEvent
public static void displayEntityStatus(RenderGameOverlayEvent.Pre event) {
if (event.getType() != ElementType.CHAT) {
return;
}
ToroHealth.PROXY.setEntityInCrosshairs();
ToroHUD.PROXY.setEntityInCrosshairs();
}

}
Loading

0 comments on commit a7fb756

Please sign in to comment.