Skip to content

Commit

Permalink
feat: dynamic health type
Browse files Browse the repository at this point in the history
  • Loading branch information
AdyTech99 committed Aug 14, 2024
1 parent 4a53090 commit 809e534
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static void tick(){
}

RenderTracker.tick(client);
//HeartJumpData.tick(client);
}

public static void openConfig(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

public enum HealthDisplayTypeEnum implements NameableEnum {
NUMBER("Number"),
HEARTS("Hearts");
HEARTS("Hearts"),
DYNAMIC("Dynamic");

private final String displayName;
HealthDisplayTypeEnum(String displayName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public void render(T livingEntity, float yaw, float tickDelta, MatrixStack matri
renderHearts(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light);
else if (ModConfig.HANDLER.instance().indicator_type == HealthDisplayTypeEnum.NUMBER)
renderNumber(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light);
else if (ModConfig.HANDLER.instance().indicator_type == HealthDisplayTypeEnum.DYNAMIC) {
if(livingEntity.getMaxHealth() > 50) renderNumber(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light);
else renderHearts(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light);
}
}
if(Config.getArmorRenderingEnabled() || Config.getOverrideAllFiltersEnabled()) renderArmorPoints(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light);
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ enabled_platforms = fabric,neoforge

# Minecraft properties
minecraft_version = 1.21
yarn_mappings = 1.21+build.1
yarn_mappings = 1.21+build.4

# Dependencies
architectury_api_version = 13.0.2
fabric_loader_version = 0.15.11
fabric_api_version = 0.100.4+1.21
neoforge_version = 21.0.110-beta
fabric_api_version = 0.102.0+1.21
neoforge_version = 21.0.150
yarn_mappings_patch_neoforge_version = 1.21+build.4
yacl_fabric=3.5.0+1.21-fabric
yacl_neoforge=3.5.0+1.21-neoforge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Mod(HealthIndicatorsCommon.MOD_ID)
@EventBusSubscriber(value = Dist.CLIENT, modid = HealthIndicatorsCommon.MOD_ID, bus = EventBusSubscriber.Bus.MOD)
public final class HealthIndicatorsMod {
public final class HealthIndicatorsNeoForge {

public static MinecraftClient client = MinecraftClient.getInstance();

Expand Down Expand Up @@ -64,7 +64,7 @@ public final class HealthIndicatorsMod {



public HealthIndicatorsMod() {
public HealthIndicatorsNeoForge() {
HealthIndicatorsCommon.init();
if(ModConfig.HANDLER.instance().enable_commands) NeoForge.EVENT_BUS.addListener(ModCommands::onRegisterCommands);
NeoForge.EVENT_BUS.addListener(this::onClientTick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@
import com.mojang.brigadier.arguments.StringArgumentType;
import io.github.adytech99.healthindicators.HealthIndicatorsCommon;
import io.github.adytech99.healthindicators.enums.HealthDisplayTypeEnum;
import io.github.adytech99.healthindicators.neoforge.HealthIndicatorsMod;
import io.github.adytech99.healthindicators.config.ModConfig;
import io.github.adytech99.healthindicators.util.ConfigUtils;
import io.github.adytech99.healthindicators.util.Maths;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.command.suggestion.SuggestionProviders;
import net.minecraft.entity.LivingEntity;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Text;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.client.ClientCommandHandler;
import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent;

public class ModCommands {
Expand Down

0 comments on commit 809e534

Please sign in to comment.