Compare commits

...

9 Commits

Author SHA1 Message Date
Markil3
4ef56f548c Fixes a crash on some computers where the configuration file can't always be made. 2021-04-01 18:17:46 -06:00
Markil3
f972d5fe42 Gets ready for 1.1 release 2021-04-01 13:11:59 -06:00
Markil3
4d069b15a2 Adds the ability to always show hands and crosshairs.
Apparently, @rflambert doesn't want the hands to fade. It seemed like a good idea, so I added a configurable option to the main repo.
2021-03-26 10:54:39 -06:00
Markil3
b4ebd7d6a2 Catches any errors that occur when triggering events.
It is pretty annoying for the game to crash because of a GUI mod. This should reduce that.
2021-03-26 09:25:55 -06:00
Markil3
a94b7f2929 Fixes a ClassCastException (#1) 2021-03-25 17:22:27 -06:00
Markil3
db9225a6ca Updates for 1.15.2. 2021-03-02 18:16:43 -07:00
Markil3
c0da30efae Fixes the hand not moving correctly. 2021-03-02 18:04:39 -07:00
Markil3
bb9998a59b Locks this build out of 1.15.2
There is at least one change that doesn't work in 1.15.2. A new branch will be needed for this.
2021-03-02 18:04:15 -07:00
Markil3
656a548074 Prepares the mod for 1.15 2021-03-02 17:49:11 -07:00
11 changed files with 459 additions and 586 deletions

View File

@@ -100,7 +100,7 @@ dependencies {
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
compile(fg.deobf("me.shedaniel.cloth:cloth-config-forge:${project.cloth_version}"))
// compile(fg.deobf("me.shedaniel.cloth:cloth-config-forge:${project.cloth_version}"))
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"

View File

@@ -4,13 +4,12 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Forge Properties
minecraft_version=1.16.4
mappings=20201028-1.16.3
forge_version=35.1.37
minecraft_version=1.15.2
mappings=20200514-1.15.1
forge_version=31.2.0
cloth_version=4.11.14
# Mod Properties
mod_version = 1.0
mod_version = 1.1.1
maven_group = markil3
archives_base_name = immersive_hud
archives_base_name = immersive_hud

View File

@@ -3,6 +3,7 @@ package markil3.immersive_hud;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.electronwill.nightconfig.core.io.WritingMode;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.common.Mod;
@@ -50,7 +51,7 @@ public class ConfigManager
new ForgeConfigSpec.Builder().configure(ConfigManager::new);
INSTANCE = specPair.getLeft();
SPEC = specPair.getRight();
CommentedFileConfig config = CommentedFileConfig.builder(CONFIG_PATH)
CommentedFileConfig config = CommentedFileConfig.builder(Minecraft.getInstance().gameDir.toPath().toAbsolutePath().resolve(CONFIG_PATH))
.sync()
.autoreload()
.writingMode(WritingMode.REPLACE)
@@ -155,7 +156,9 @@ public class ConfigManager
private final TimeValues hungerTime;
private final TimeValues effectTime;
private final ForgeConfigSpec.IntValue crosshairTime;
private final ForgeConfigSpec.BooleanValue hideCrosshair;
private final ForgeConfigSpec.IntValue handTime;
private final ForgeConfigSpec.BooleanValue hideHands;
private final ForgeConfigSpec.BooleanValue showArmor;
private final ForgeConfigSpec.DoubleValue minHealth;
private final ForgeConfigSpec.IntValue minHunger;
@@ -182,6 +185,10 @@ public class ConfigManager
6 * TICKS_PER_SECOND,
0,
10 * 60 * TICKS_PER_SECOND);
this.hideCrosshair =
configSpecBuilder.translation(
"immersive_hud.configGui.hideCrosshair.title")
.define("hideCrosshair", true);
this.handTime =
configSpecBuilder.translation(
"immersive_hud.configGui.handTime.title")
@@ -189,6 +196,10 @@ public class ConfigManager
30 * TICKS_PER_SECOND,
0,
10 * 60 * TICKS_PER_SECOND);
this.hideHands =
configSpecBuilder.translation(
"immersive_hud.configGui.hideHands.title")
.define("hideHands", true);
this.showArmor = configSpecBuilder.translation(
"immersive_hud.configGui.showArmor.title")
.define("showArmor", true);
@@ -282,6 +293,16 @@ public class ConfigManager
return this.crosshairTime.get();
}
/**
* Checks whether the crosshairs should be hidden after a period of time.
*
* @return - Whether or not crosshairs will be hidden.
*/
public boolean hideCrosshair()
{
return this.hideCrosshair.get();
}
/**
* Obtains the time that the hands are allowed to display.
*
@@ -292,6 +313,16 @@ public class ConfigManager
return this.handTime.get();
}
/**
* Checks whether hands should be hidden after a period of time.
*
* @return - Whether or not hands will be hidden.
*/
public boolean hideHands()
{
return this.hideHands.get();
}
/**
* Checks whether the armor bar should render.
*
@@ -334,6 +365,16 @@ public class ConfigManager
this.crosshairTime.set(time);
}
/**
* Sets whether the crosshairs should be hidden after a period of time.
*
* @param hide - Whether or not crosshairs will be hidden.
*/
public void hideCrosshair(boolean hide)
{
this.hideCrosshair.set(hide);
}
/**
* Sets the time that the hands are allowed to display.
*
@@ -344,6 +385,16 @@ public class ConfigManager
this.handTime.set(time);
}
/**
* Sets whether hands should be hidden after a period of time.
*
* @param hide - Whether or not hands will be hidden.
*/
public void hideHands(boolean hide)
{
this.hideHands.set(hide);
}
/**
* Determines whether the armor bar should render.
*

View File

@@ -16,6 +16,8 @@
*/
package markil3.immersive_hud;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -59,19 +61,24 @@ public class EventBus
@SubscribeEvent
public static void onClick(final PlayerInteractEvent event)
{
DistExecutor.safeRunWhenOn(Dist.CLIENT,
(DistExecutor.SafeSupplier<DistExecutor.SafeRunnable>) () -> new DistExecutor.SafeRunnable()
{
@Override
public void run()
{
Item item =
Optional.ofNullable(event.getItemStack())
.map(ItemStack::getItem)
.orElse(null);
TimerUtils.onClick(event.getHand(), item);
}
});
try
{
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
{
Item item =
Optional.ofNullable(event.getItemStack())
.map(ItemStack::getItem)
.orElse(null);
TimerUtils.onClick(event.getHand(), item);
});
}
catch (Exception e)
{
LOGGER.error(
"Error in running markil3.immersive_hud.EventBus#onClick " +
"event",
e);
}
}
/**
@@ -86,15 +93,20 @@ public class EventBus
@SubscribeEvent
public static void onMount(final EntityMountEvent event)
{
DistExecutor.safeRunWhenOn(Dist.CLIENT,
(DistExecutor.SafeSupplier<DistExecutor.SafeRunnable>) () -> new DistExecutor.SafeRunnable()
{
@Override
public void run()
{
TimerUtils.resetMountHealth();
}
});
try
{
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
{
TimerUtils.resetMountHealth();
});
}
catch (Exception e)
{
LOGGER.error(
"Error in running markil3.immersive_hud.EventBus#onMount " +
"event",
e);
}
}
/**
@@ -106,9 +118,21 @@ public class EventBus
@SubscribeEvent
public static void onRenderHand(final RenderHandEvent event)
{
if (TimerUtils.onRenderHand(event.getHand(), event.getMatrixStack(), event.getPartialTicks()))
try
{
event.setCanceled(true);
if (TimerUtils.onRenderHand(event.getHand(),
event.getMatrixStack(),
event.getPartialTicks()))
{
event.setCanceled(true);
}
}
catch (Exception e)
{
LOGGER.error(
"Error in running markil3.immersive_hud" +
".EventBus#onRenderHand event",
e);
}
}
@@ -121,151 +145,162 @@ public class EventBus
@SubscribeEvent
public static void onGUIDraw(final RenderGameOverlayEvent event)
{
Minecraft mc = Minecraft.getInstance();
boolean fadeIn = false;
switch (event.getType())
try
{
case CROSSHAIRS:
if (event instanceof RenderGameOverlayEvent.Pre)
Minecraft mc = Minecraft.getInstance();
boolean fadeIn = false;
switch (event.getType())
{
if (TimerUtils.drawCrosshair(event.getPartialTicks()))
case CROSSHAIRS:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawCrosshair(event.getPartialTicks()))
{
event.setCanceled(true);
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
resetAlpha();
}
break;
case POTION_ICONS:
if (event instanceof RenderGameOverlayEvent.Pre)
{
TimerUtils.updatePotions(mc.player);
event.setCanceled(true);
RenderUtils.renderPotionIcons(mc,
mc.ingameGUI, event.getPartialTicks());
resetAlpha();
}
break;
case HOTBAR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
event.setCanceled(true);
if (!TimerUtils.drawHotbar(event.getPartialTicks()))
{
RenderUtils.renderHotbar(mc, mc.ingameGUI,
event.getPartialTicks(), TimerUtils.hotbarTime);
}
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
resetAlpha();
}
break;
case POTION_ICONS:
if (event instanceof RenderGameOverlayEvent.Pre)
{
TimerUtils.updatePotions(mc.player);
event.setCanceled(true);
RenderUtils.renderPotionIcons(mc,
mc.ingameGUI,
event.getMatrixStack(), event.getPartialTicks());
resetAlpha();
}
break;
case HOTBAR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
event.setCanceled(true);
if (!TimerUtils.drawHotbar(event.getPartialTicks()))
break;
case HEALTH:
if (event instanceof RenderGameOverlayEvent.Pre)
{
RenderUtils.renderHotbar(mc, mc.ingameGUI,
event.getMatrixStack(),
event.getPartialTicks(), TimerUtils.hotbarTime);
if (TimerUtils.drawHealth(event.getPartialTicks()))
{
event.setCanceled(true);
}
}
}
break;
case HEALTH:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawHealth(event.getMatrixStack(), event.getPartialTicks()))
else if (event instanceof RenderGameOverlayEvent.Post)
{
RenderSystem.popMatrix();
resetAlpha();
}
break;
case FOOD:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawHunger(event.getPartialTicks()))
{
event.setCanceled(true);
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
RenderSystem.popMatrix();
resetAlpha();
}
break;
case ARMOR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawArmor(event.getPartialTicks()))
{
event.setCanceled(true);
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
RenderSystem.popMatrix();
resetAlpha();
}
break;
case AIR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawAir(event.getPartialTicks()))
{
event.setCanceled(true);
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
RenderSystem.popMatrix();
resetAlpha();
}
break;
case HEALTHMOUNT:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawMountHealth(event.getPartialTicks()))
{
event.setCanceled(true);
}
}
else if (event instanceof RenderGameOverlayEvent.Post)
{
RenderSystem.popMatrix();
resetAlpha();
}
break;
case JUMPBAR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
event.setCanceled(true);
if (!TimerUtils.drawJumpbar(event.getPartialTicks()))
{
RenderUtils.renderHorseJumpBar(mc,
mc.ingameGUI,
event.getPartialTicks(),
TimerUtils.jumpTime);
}
}
}
else if (event instanceof RenderGameOverlayEvent.Post)
{
event.getMatrixStack().pop();
resetAlpha();
}
break;
case FOOD:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawHunger(event.getMatrixStack(), event.getPartialTicks()))
break;
case EXPERIENCE:
if (event instanceof RenderGameOverlayEvent.Pre)
{
event.setCanceled(true);
if (!TimerUtils.drawExperience(event.getPartialTicks()))
{
RenderUtils.renderExperience(mc,
mc.ingameGUI,
event.getPartialTicks(),
TimerUtils.experienceTime);
}
}
break;
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
event.getMatrixStack().pop();
resetAlpha();
}
break;
case ARMOR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawArmor(event.getMatrixStack(), event.getPartialTicks()))
{
event.setCanceled(true);
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
event.getMatrixStack().pop();
resetAlpha();
}
break;
case AIR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawAir(event.getMatrixStack(), event.getPartialTicks()))
{
event.setCanceled(true);
}
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
event.getMatrixStack().pop();
resetAlpha();
}
break;
case HEALTHMOUNT:
if (event instanceof RenderGameOverlayEvent.Pre)
{
if (TimerUtils.drawMountHealth(event.getMatrixStack(), event.getPartialTicks()))
{
event.setCanceled(true);
}
}
else if (event instanceof RenderGameOverlayEvent.Post)
{
event.getMatrixStack().pop();
resetAlpha();
}
break;
case JUMPBAR:
if (event instanceof RenderGameOverlayEvent.Pre)
{
event.setCanceled(true);
if (!TimerUtils.drawJumpbar(event.getPartialTicks()))
{
RenderUtils.renderHorseJumpBar(mc, mc.ingameGUI,
event.getMatrixStack(), event.getPartialTicks(), TimerUtils.jumpTime);
}
}
break;
case EXPERIENCE:
if (event instanceof RenderGameOverlayEvent.Pre)
{
event.setCanceled(true);
if (!TimerUtils.drawExperience(event.getPartialTicks()))
{
RenderUtils.renderExperience(mc, mc.ingameGUI,
event.getMatrixStack(), event.getPartialTicks(), TimerUtils.experienceTime);
}
}
break;
}
catch (Exception e)
{
LOGGER.error(
"Error in running markil3.immersive_hud.EventBus#onGUIDraw event",
e);
}
}
}

View File

@@ -17,11 +17,8 @@
*/
package markil3.immersive_hud;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@@ -56,7 +53,7 @@ public class Main
{
if (Class.forName("me.shedaniel.clothconfig2.api.ConfigBuilder") != null)
{
ModMenu.setupScreen();
// ModMenu.setupScreen();
}
}
catch (ClassNotFoundException e)

View File

@@ -1,176 +0,0 @@
package markil3.immersive_hud;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import me.shedaniel.clothconfig2.gui.entries.DoubleListEntry;
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
public class ModMenu
{
static void startTimeField(ConfigEntryBuilder entryBuilder,
ConfigCategory cat,
ConfigManager.TimeValues value)
{
final float SHOW_TIME = 6;
final float FADE_IN = 0.25F;
final float FADE_OUT = 0.5F;
DoubleListEntry maxTime =
entryBuilder.startDoubleField(new TranslationTextComponent(
"option.immersive_hud." + value.getName() +
"MaxTime"),
(float) value.getMaxTime() / TICKS_PER_SECOND)
.setDefaultValue(SHOW_TIME)
.setMin(0)
.setMax(10 * 60 * TICKS_PER_SECOND) // 10 Minutes
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud." + value.getName() +
"MaxTime"))
.setSaveConsumer(val -> value.setMaxTime((int) (val * TICKS_PER_SECOND)))
.build();
DoubleListEntry fadeIn =
entryBuilder.startDoubleField(new TranslationTextComponent(
"option.immersive_hud." + value.getName() +
"FadeIn"),
(float) value.getFadeInTime() / TICKS_PER_SECOND)
.setDefaultValue(FADE_IN).setMin(0).setMax(10 * 60 * TICKS_PER_SECOND)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud." + value.getName() +
"FadeIn"))
.setSaveConsumer(val -> value.setFadeInTime((int) (val * TICKS_PER_SECOND)))
.build();
DoubleListEntry fadeOut =
entryBuilder.startDoubleField(new TranslationTextComponent(
"option.immersive_hud." + value.getName() +
"FadeOut"),
(float) value.getFadeOutTime() / TICKS_PER_SECOND)
.setDefaultValue(FADE_OUT)
.setMin(0)
.setMax(10 * 60 * TICKS_PER_SECOND)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud." + value.getName() +
"FadeOut"))
.setSaveConsumer(val -> value.setFadeOutTime((int) (val * TICKS_PER_SECOND)))
.build();
cat.addEntry(maxTime);
cat.addEntry(fadeIn);
cat.addEntry(fadeOut);
}
static void setupScreen()
{
ModLoadingContext.get()
.registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
() -> (mc, screen) -> {
ConfigCategory general;
ConfigEntryBuilder entryBuilder;
final ConfigBuilder builder = ConfigBuilder.create()
.setParentScreen(screen)
.setTitle(new TranslationTextComponent(
"immersive_hud.configGui.title"))
.setSavingRunnable(() -> {
ConfigManager.getInstance().save();
});
general =
builder.getOrCreateCategory(new TranslationTextComponent(
"category.immersive_hud.general"));
entryBuilder = builder.entryBuilder();
startTimeField(entryBuilder,
general,
ConfigManager.getInstance()
.getHotbarTime());
startTimeField(entryBuilder,
general,
ConfigManager.getInstance()
.getExperenceTime());
startTimeField(entryBuilder,
general,
ConfigManager.getInstance().getJumpTime());
startTimeField(entryBuilder,
general,
ConfigManager.getInstance()
.getHealthTime());
startTimeField(entryBuilder,
general,
ConfigManager.getInstance()
.getHungerTime());
startTimeField(entryBuilder,
general,
ConfigManager.getInstance()
.getPotionTime());
general.addEntry(entryBuilder.startDoubleField(new TranslationTextComponent(
"option.immersive_hud" +
".crosshairTime"),
(float) ConfigManager.getInstance()
.getCrosshairTime() / TICKS_PER_SECOND)
.setDefaultValue(6)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud" +
".crosshairTime"))
.setSaveConsumer(val -> ConfigManager.getInstance()
.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
.build());
general.addEntry(entryBuilder.startDoubleField(new TranslationTextComponent(
"option.immersive_hud.handTime"),
(float) ConfigManager.getInstance()
.getHandTime() / TICKS_PER_SECOND)
.setDefaultValue(30)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud.handTime"))
.setSaveConsumer(val -> ConfigManager.getInstance()
.setHandTime((int) (val * TICKS_PER_SECOND)))
.build());
general.addEntry(entryBuilder.startDoubleField(new TranslationTextComponent(
"option.immersive_hud.minHealth"),
ConfigManager.getInstance()
.getMinHealth())
.setDefaultValue(0.5)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud.minHealth"))
.setSaveConsumer(val -> ConfigManager.getInstance()
.setMinHealth(
val))
.build());
general.addEntry(entryBuilder.startIntField(new TranslationTextComponent(
"option.immersive_hud.minHunger"),
ConfigManager.getInstance()
.getMinHunger())
.setDefaultValue(17)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud.minHunger"))
.setSaveConsumer(val -> ConfigManager.getInstance()
.setMinHunger(
val))
.build());
general.addEntry(entryBuilder.startBooleanToggle(new TranslationTextComponent(
"option.immersive_hud.showArmor"),
ConfigManager.getInstance()
.shouldShowArmor())
.setDefaultValue(true)
.setTooltip(new TranslationTextComponent(
"tooltip.immersive_hud.showArmor"))
.setSaveConsumer(val -> ConfigManager.getInstance()
.shouldShowArmor(
val))
.build());
return builder.build();
});
}
}

View File

@@ -17,6 +17,7 @@ package markil3.immersive_hud;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
@@ -38,7 +39,9 @@ import net.minecraft.crash.CrashReportCategory;
import net.minecraft.crash.ReportedException;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.HandSide;
@@ -62,7 +65,7 @@ public class RenderUtils
{
public static void renderPotionIcons(Minecraft mc,
IngameGui gui,
MatrixStack matrixStack, float ticks)
float ticks)
{
int scaledWidth = mc.getMainWindow().getScaledWidth();
int scaledHeight = mc.getMainWindow().getScaledHeight();
@@ -86,7 +89,9 @@ public class RenderUtils
.sortedCopy(collection))
{
Effect effect = effectinstance.getPotion();
float effectAlpha = TimerUtils.getPotionAlpha(mc.player, effectinstance, ticks);
float effectAlpha = TimerUtils.getPotionAlpha(mc.player,
effectinstance,
ticks);
if (!effectinstance.shouldRenderHUD() || effectAlpha < 0.01F)
{
continue;
@@ -118,11 +123,11 @@ public class RenderUtils
RenderSystem.color4f(1.0F, 1.0F, 1.0F, effectAlpha);
if (effectinstance.isAmbient())
{
gui.blit(matrixStack, k, l, 165, 166, 24, 24);
gui.blit(k, l, 165, 166, 24, 24);
}
else
{
gui.blit(matrixStack, k, l, 141, 166, 24, 24);
gui.blit(k, l, 141, 166, 24, 24);
}
TextureAtlasSprite textureatlassprite =
@@ -135,8 +140,7 @@ public class RenderUtils
.bindTexture(textureatlassprite.getAtlasTexture()
.getTextureLocation());
RenderSystem.color4f(1.0F, 1.0F, 1.0F, f1);
gui.blit(matrixStack,
j1 + 3,
gui.blit(j1 + 3,
k1 + 3,
gui.getBlitOffset(),
18,
@@ -144,7 +148,6 @@ public class RenderUtils
textureatlassprite);
});
effectinstance.renderHUDEffect(gui,
matrixStack,
k,
l,
gui.getBlitOffset(),
@@ -161,7 +164,6 @@ public class RenderUtils
*
* @param mc - A Minecraft instance.
* @param gui - The GUI.
* @param matrixStack - The rendering transformation matrix stack.
* @param ticks
* @param renderTime - How much time before this element becomes fully
* transparent.
@@ -170,16 +172,19 @@ public class RenderUtils
*/
public static void renderHorseJumpBar(Minecraft mc,
IngameGui gui,
MatrixStack matrixStack,
float ticks, double renderTime)
{
ConfigManager.TimeValues jump = ConfigManager.getInstance().getJumpTime();
ConfigManager.TimeValues jump =
ConfigManager.getInstance().getJumpTime();
if (renderTime <= 0)
{
return;
}
float alpha = Main.getAlpha(renderTime, jump.getMaxTime(), jump.getFadeInTime(), jump.getFadeOutTime());
float alpha = Main.getAlpha(renderTime,
jump.getMaxTime(),
jump.getFadeInTime(),
jump.getFadeOutTime());
int scaledWidth = mc.getMainWindow().getScaledWidth();
int scaledHeight = mc.getMainWindow().getScaledHeight();
int xPosition = scaledWidth / 2 - 91;
@@ -192,10 +197,10 @@ public class RenderUtils
int i = 182;
int j = (int) (f * 183.0F);
int k = scaledHeight - TimerUtils.getJumpTranslation();
gui.blit(matrixStack, xPosition, k, 0, 84, 182, 5);
gui.blit(xPosition, k, 0, 84, 182, 5);
if (j > 0)
{
gui.blit(matrixStack, xPosition, k, 0, 89, j, 5);
gui.blit(xPosition, k, 0, 89, j, 5);
}
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -208,7 +213,6 @@ public class RenderUtils
*
* @param mc - A Minecraft instance.
* @param gui - The GUI.
* @param matrixStack - The rendering transformation matrix stack.
* @param ticks
* @param renderTime - How much time before this element becomes fully
* transparent.
@@ -217,17 +221,21 @@ public class RenderUtils
*/
public static void renderExperience(Minecraft mc,
IngameGui gui,
MatrixStack matrixStack,
float ticks, double renderTime)
{
ConfigManager.TimeValues experience = ConfigManager.getInstance().getHealthTime();
ConfigManager.TimeValues hotbar = ConfigManager.getInstance().getHotbarTime();
ConfigManager.TimeValues experience =
ConfigManager.getInstance().getHealthTime();
ConfigManager.TimeValues hotbar =
ConfigManager.getInstance().getHotbarTime();
if (renderTime <= 0)
{
return;
}
float alpha = Main.getAlpha(renderTime, experience.getMaxTime(), experience.getFadeInTime(), experience.getFadeOutTime());
float alpha = Main.getAlpha(renderTime,
experience.getMaxTime(),
experience.getFadeInTime(),
experience.getFadeOutTime());
RenderSystem.color4f(1.0F, 1.0F, 1.0F, alpha);
if (mc.playerController.gameIsSurvivalOrAdventure())
@@ -245,10 +253,10 @@ public class RenderUtils
int j = 182;
int k = (int) (mc.player.experience * 183.0F);
int l = scaledHeight - TimerUtils.getExperienceTranslation();
gui.blit(matrixStack, x, l, 0, 64, 182, 5);
gui.blit(x, l, 0, 64, 182, 5);
if (k > 0)
{
gui.blit(matrixStack, x, l, 0, 69, k, 5);
gui.blit(x, l, 0, 69, k, 5);
}
}
@@ -261,34 +269,33 @@ public class RenderUtils
String s = "" + mc.player.experienceLevel;
int i1 = (scaledWidth - gui.getFontRenderer()
.getStringWidth(s)) / 2;
int j1 = scaledHeight - (int) ((22F * Main.getAlpha(TimerUtils.hotbarTime, hotbar.getMaxTime(), hotbar.getFadeInTime(), hotbar.getFadeOutTime()) + 9F) * alpha) - (int) (4F * alpha);
int j1 =
scaledHeight - (int) ((22F * Main.getAlpha(TimerUtils.hotbarTime,
hotbar.getMaxTime(),
hotbar.getFadeInTime(),
hotbar.getFadeOutTime()) + 9F) * alpha) - (int) (4F * alpha);
gui.getFontRenderer()
.drawString(matrixStack,
s,
.drawString(s,
(float) (i1 + 1),
(float) j1,
0);
gui.getFontRenderer()
.drawString(matrixStack,
s,
.drawString(s,
(float) (i1 - 1),
(float) j1,
0);
gui.getFontRenderer()
.drawString(matrixStack,
s,
.drawString(s,
(float) i1,
(float) (j1 + 1),
0);
gui.getFontRenderer()
.drawString(matrixStack,
s,
.drawString(s,
(float) i1,
(float) (j1 - 1),
0);
gui.getFontRenderer()
.drawString(matrixStack,
s,
.drawString(s,
(float) i1,
(float) j1,
8453920);
@@ -305,20 +312,19 @@ public class RenderUtils
*
* @param mc - A Minecraft instance.
* @param gui - The GUI.
* @param matrixStack - The rendering transformation matrix stack.
* @param partialTicks
* @param renderTime - How much time before this element becomes fully
* transparent.
*
* @see IngameGui#renderHotbar(float, MatrixStack)
* @see IngameGui#renderHotbar(float)
*/
public static void renderHotbar(Minecraft mc,
IngameGui gui,
MatrixStack matrixStack,
float partialTicks,
double renderTime)
{
ConfigManager.TimeValues hotbar = ConfigManager.getInstance().getHotbarTime();
ConfigManager.TimeValues hotbar =
ConfigManager.getInstance().getHotbarTime();
final ResourceLocation WIDGETS_TEX_PATH =
new ResourceLocation("textures/gui/widgets.png");
PlayerEntity playerentity = mc.player;
@@ -328,7 +334,10 @@ public class RenderUtils
return;
}
float alpha = Main.getAlpha(renderTime, hotbar.getMaxTime(), hotbar.getFadeInTime(), hotbar.getFadeOutTime());
float alpha = Main.getAlpha(renderTime,
hotbar.getMaxTime(),
hotbar.getFadeInTime(),
hotbar.getFadeOutTime());
int scaledWidth = mc.getMainWindow().getScaledWidth();
int scaledHeight = mc.getMainWindow().getScaledHeight();
@@ -343,9 +352,13 @@ public class RenderUtils
int k = 182;
int l = 91;
gui.setBlitOffset(-90);
gui.blit(matrixStack, i - 91, scaledHeight - TimerUtils.getHotbarTranslation(), 0, 0, 182, 22);
gui.blit(matrixStack,
i - 91 - 1 + playerentity.inventory.currentItem * 20,
gui.blit(i - 91,
scaledHeight - TimerUtils.getHotbarTranslation(),
0,
0,
182,
22);
gui.blit(i - 91 - 1 + playerentity.inventory.currentItem * 20,
scaledHeight - (int) (22F * alpha) - 1,
0,
22,
@@ -355,8 +368,7 @@ public class RenderUtils
{
if (handside == HandSide.LEFT)
{
gui.blit(matrixStack,
i - 91 - 29,
gui.blit(i - 91 - 29,
scaledHeight - (int) (23F * alpha),
24,
22,
@@ -365,8 +377,7 @@ public class RenderUtils
}
else
{
gui.blit(matrixStack,
i + 91,
gui.blit(i + 91,
scaledHeight - (int) (23F * alpha),
53,
22,
@@ -428,9 +439,8 @@ public class RenderUtils
.bindTexture(AbstractGui.GUI_ICONS_LOCATION);
int l1 = (int) (f * 19.0F);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, alpha);
gui.blit(matrixStack, k2, j2, 0, 94, 18, 18);
gui.blit(matrixStack,
k2,
gui.blit(k2, j2, 0, 94, 18, 18);
gui.blit(k2,
j2 + 18 - l1,
18,
112 - l1,
@@ -463,132 +473,79 @@ public class RenderUtils
PlayerEntity player,
ItemStack stack)
{
if (!stack.isEmpty())
{
float f = (float) stack.getAnimationsToGo() - partialTicks;
RenderSystem.pushMatrix();
if (!stack.isEmpty()) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, alpha);
if (f > 0.0F)
{
float f = (float)stack.getAnimationsToGo() - partialTicks;
if (f > 0.0F) {
RenderSystem.pushMatrix();
float f1 = 1.0F + f / 5.0F;
RenderSystem.translatef((float) (x + 8),
(float) (y + 12),
0.0F);
RenderSystem.translatef((float)(x + 8), (float)(y + 12), 0.0F);
RenderSystem.scalef(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F);
RenderSystem.translatef((float) (-(x + 8)),
(float) (-(y + 12)),
0.0F);
RenderSystem.translatef((float)(-(x + 8)), (float)(-(y + 12)), 0.0F);
}
renderItemAndEffectIntoGUI(mc, alpha, player, stack, x, y);
if (f > 0.0F)
{
renderItemAndEffectIntoGUI(mc, player, stack, x, y, alpha);
if (f > 0.0F) {
RenderSystem.popMatrix();
}
RenderSystem.popMatrix();
mc.getItemRenderer()
.renderItemOverlays(mc.fontRenderer, stack, x, y);
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, stack, x, y);
}
}
/**
* Renders a single item on the HUD.
*
* @param mc - A Minecraft instance.
* @param alpha - How transparent the item should be, on a scale from 0 to
* 1.
* @param ent - The player that the item is from.
* @param stack - The item to render.
* @param x - The x position of the item on the screen.
* @param y - The y position of the item on the screen
*
* @see net.minecraft.client.renderer.ItemRenderer#renderItemIntoGUI(LivingEntity,
* ItemStack, int, int)
*/
static void renderItemAndEffectIntoGUI(Minecraft mc,
float alpha,
PlayerEntity ent,
ItemStack stack,
int x,
int y)
private static void renderItemAndEffectIntoGUI(Minecraft mc, LivingEntity entityIn, ItemStack itemIn, int x, int y, float alpha)
{
TextureManager textureManager = mc.textureManager;
IBakedModel bakedmodel = mc.getItemRenderer()
.getItemModelWithOverrides(stack,
(World) null,
(LivingEntity) null);
if (!stack.isEmpty())
{
try
{
if (!itemIn.isEmpty()) {
float zLevel = 50.0F;
try {
IBakedModel bakedmodel = mc.getItemRenderer().getItemModelWithOverrides(itemIn, (World)null, entityIn);
RenderSystem.pushMatrix();
textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE)
.setBlurMipmapDirect(false, false);
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).setBlurMipmapDirect(false, false);
RenderSystem.enableRescaleNormal();
// RenderSystem.enableAlphaTest();
// RenderSystem.defaultAlphaFunc();
// RenderSystem.enableBlend();
// RenderSystem.blendFunc(GlStateManager.SourceFactor
// .SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, alpha);
RenderSystem.translatef((float) x, (float) y, 100.0F + 50F);
RenderSystem.enableAlphaTest();
RenderSystem.defaultAlphaFunc();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.translatef((float)x, (float)y, 100.0F + zLevel);
RenderSystem.translatef(8.0F, 8.0F, 0.0F);
RenderSystem.scalef(1.0F, -1.0F, 1.0F);
RenderSystem.scalef(16.0F, 16.0F, 16.0F);
MatrixStack matrixstack = new MatrixStack();
IRenderTypeBuffer.Impl irendertypebuffer$impl =
Minecraft.getInstance()
.getRenderTypeBuffers()
.getBufferSource();
boolean flag = !bakedmodel.isSideLit();
if (flag)
{
IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
Item item = itemIn.getItem();
boolean flag = !bakedmodel.isGui3d() || item == Items.SHIELD || item == Items.TRIDENT;
if (flag) {
RenderHelper.setupGuiFlatDiffuseLighting();
}
mc.getItemRenderer()
.renderItem(stack,
ItemCameraTransforms.TransformType.GUI,
false,
matrixstack,
irendertypebuffer$impl,
15728880,
OverlayTexture.NO_OVERLAY,
bakedmodel);
mc.getItemRenderer().renderItem(itemIn, ItemCameraTransforms.TransformType.GUI, false, matrixstack, irendertypebuffer$impl, 15728880, OverlayTexture.NO_OVERLAY, bakedmodel);
irendertypebuffer$impl.finish();
RenderSystem.enableDepthTest();
if (flag)
{
if (flag) {
RenderHelper.setupGui3DDiffuseLighting();
}
// RenderSystem.disableAlphaTest();
RenderSystem.disableAlphaTest();
RenderSystem.disableRescaleNormal();
RenderSystem.popMatrix();
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable,
"Rendering item");
CrashReportCategory crashreportcategory =
crashreport.makeCategory("Item being rendered");
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering item");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being rendered");
crashreportcategory.addDetail("Item Type", () -> {
return String.valueOf((Object) stack.getItem());
return String.valueOf((Object)itemIn.getItem());
});
crashreportcategory.addDetail("Registry Name",
() -> String.valueOf(stack.getItem()
.getRegistryName()));
crashreportcategory.addDetail("Registry Name", () -> String.valueOf(itemIn.getItem().getRegistryName()));
crashreportcategory.addDetail("Item Damage", () -> {
return String.valueOf(stack.getDamage());
return String.valueOf(itemIn.getDamage());
});
crashreportcategory.addDetail("Item NBT", () -> {
return String.valueOf((Object) stack.getTag());
return String.valueOf((Object)itemIn.getTag());
});
crashreportcategory.addDetail("Item Foil", () -> {
return String.valueOf(stack.hasEffect());
return String.valueOf(itemIn.hasEffect());
});
throw new ReportedException(crashreport);
}

View File

@@ -24,7 +24,6 @@ import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
@@ -270,11 +269,11 @@ public class TimerUtils
if (item.isFood())
{
healthTime = health.getMaxTime() - (healthTime > 0 ?
health.getFadeInTime() :
0);
health.getFadeInTime() :
0);
hungerTime = hunger.getMaxTime() - (hungerTime > 0 ?
hunger.getFadeInTime() :
0);
hunger.getFadeInTime() :
0);
}
}
}
@@ -295,60 +294,64 @@ public class TimerUtils
MatrixStack matrixStack,
float ticks)
{
float HAND_UP_TIME = 1F;
float HAND_UP_TIME = 20F;
switch (hand)
boolean hideHands =
ConfigManager.getInstance().hideHands();
if (hideHands)
{
case OFF_HAND:
if (mainHandTime > 0 && mainHandTime < HAND_UP_TIME)
switch (hand)
{
/*
* Undo the transformation of the previous hand
*/
matrixStack
.translate(0,
1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME,
0);
}
if (offHandTime == 0 && !offHandLock)
{
return true;
}
else if (!offHandLock && (mapLock & 0b01) == 0)
{
if (offHandTime > 0)
case OFF_HAND:
if (mainHandTime > 0 && mainHandTime < HAND_UP_TIME)
{
offHandTime -= ticks;
/*
* Undo the transformation of the previous hand
*/
matrixStack.translate(0,
(float) (1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME),
0);
}
if (offHandTime < HAND_UP_TIME)
if (offHandTime == 0 && !offHandLock)
{
matrixStack
.translate(0,
-1.0F * (HAND_UP_TIME - offHandTime) / HAND_UP_TIME,
0);
return true;
}
}
break;
case MAIN_HAND:
if (mainHandTime == 0 && !mainHandLock)
{
return true;
}
else if (!mainHandLock && (mapLock & 0b10) == 0)
{
if (mainHandTime > 0)
else if (!offHandLock && (mapLock & 0b01) == 0)
{
mainHandTime -= ticks;
if (offHandTime > 0)
{
offHandTime -= ticks;
}
if (offHandTime < HAND_UP_TIME)
{
matrixStack
.translate(0,
(float) (-1.0F * (HAND_UP_TIME - offHandTime) / HAND_UP_TIME),
0);
}
}
if (mainHandTime < HAND_UP_TIME)
break;
case MAIN_HAND:
if (mainHandTime == 0 && !mainHandLock)
{
matrixStack
.translate(0,
-1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME,
0);
return true;
}
else if (!mainHandLock && (mapLock & 0b10) == 0)
{
if (mainHandTime > 0)
{
mainHandTime -= ticks;
}
if (mainHandTime < HAND_UP_TIME)
{
matrixStack
.translate(0,
(float) (-1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME),
0);
}
}
break;
}
break;
}
return false;
}
@@ -361,8 +364,8 @@ public class TimerUtils
ConfigManager.TimeValues health =
ConfigManager.getInstance().getHealthTime();
mountTime = health.getMaxTime() - (mountTime > 0 ?
health.getFadeInTime() :
0);
health.getFadeInTime() :
0);
jumpTime = 0;
}
@@ -384,34 +387,39 @@ public class TimerUtils
boolean changed = false;
boolean canceled = false;
if (mc.objectMouseOver != null && mc.objectMouseOver.getType() != RayTraceResult.Type.MISS)
boolean hideCrosshair =
ConfigManager.getInstance().hideCrosshair();
if (hideCrosshair)
{
if (mc.objectMouseOver.getType() == RayTraceResult.Type.ENTITY)
if (mc.objectMouseOver != null && mc.objectMouseOver.getType() != RayTraceResult.Type.MISS)
{
if (mc.objectMouseOver.hitInfo == null || mc.objectMouseOver.hitInfo != mc.player
.getRidingEntity())
if (mc.objectMouseOver.getType() == RayTraceResult.Type.ENTITY)
{
if (mc.objectMouseOver.hitInfo == null || mc.objectMouseOver.hitInfo != mc.player
.getRidingEntity())
{
changed = true;
}
}
else
{
changed = true;
}
}
if (changed || mainHandLock || offHandLock || crosshairTime > 0)
{
setAlpha(Main.getAlpha(crosshairTime > 0 ?
crosshairTime :
CROSSHAIR_TIME, CROSSHAIR_TIME, 0, 0));
}
else
{
changed = true;
canceled = true;
}
if (crosshairTime > 0)
{
crosshairTime -= ticks;
}
}
if (changed || mainHandLock || offHandLock || crosshairTime > 0)
{
setAlpha(Main.getAlpha(crosshairTime > 0 ?
crosshairTime :
CROSSHAIR_TIME, CROSSHAIR_TIME, 0, 0));
}
else
{
canceled = true;
}
if (crosshairTime > 0)
{
crosshairTime -= ticks;
}
return canceled;
@@ -475,7 +483,8 @@ public class TimerUtils
}
else if (effectinstance.getDuration() <= BLINK_TIME + potion.getFadeInTime())
{
effectAlpha = -(effectinstance.getDuration() - BLINK_TIME) / 22F + 0.454F;
effectAlpha =
-(effectinstance.getDuration() - BLINK_TIME) / 22F + 0.454F;
}
else
{
@@ -646,11 +655,11 @@ public class TimerUtils
if (item.isFood())
{
healthTime = health.getMaxTime() - (healthTime > 0 ?
health.getFadeInTime() :
0);
health.getFadeInTime() :
0);
hungerTime = hunger.getMaxTime() - (hungerTime > 0 ?
hunger.getFadeInTime() :
0);
hunger.getFadeInTime() :
0);
}
if (i == 0)
{
@@ -717,7 +726,7 @@ public class TimerUtils
*
* @since 0.2-1.16.4-forge
*/
public static boolean drawHealth(MatrixStack stack, float ticks)
public static boolean drawHealth(float ticks)
{
/*
* When the health percentage falls to this level or below, the
@@ -758,12 +767,13 @@ public class TimerUtils
* Only makes a change if the player is healthy. Otherwise,
* the bar is shown.
*/
if (health / maxHealth > HEALTH_BOUNDARY && !mc.player.isPotionActive(Effects.WITHER) && !mc.player.isPotionActive(Effects.POISON))
if (health / maxHealth > HEALTH_BOUNDARY && !mc.player.isPotionActive(
Effects.WITHER) && !mc.player.isPotionActive(Effects.POISON))
{
if (healthTime > 0)
{
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
setAlpha(Main.getAlpha(healthTime,
@@ -774,8 +784,8 @@ public class TimerUtils
}
return true;
}
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
return false;
@@ -789,7 +799,7 @@ public class TimerUtils
*
* @since 0.2-1.16.4-forge
*/
public static boolean drawHunger(MatrixStack stack, float ticks)
public static boolean drawHunger(float ticks)
{
/*
* When hunger falls to this level or below, the hunger bar won't
@@ -817,8 +827,8 @@ public class TimerUtils
if (changed || hunger <= HUNGER_BOUNDARY)
{
hungerTime = hungerTimes.getMaxTime() - (hungerTime > 0 ?
hungerTimes.getFadeInTime() :
0);
hungerTimes.getFadeInTime() :
0);
}
else if (hungerTime > 0)
{
@@ -836,16 +846,16 @@ public class TimerUtils
hungerTimes.getMaxTime(),
hungerTimes.getFadeInTime(),
hungerTimes.getFadeOutTime()));
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
return false;
}
return true;
}
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
return false;
@@ -855,14 +865,13 @@ public class TimerUtils
* Determines whether or not to draw the armor bar, adjusting the alpha as
* needed.
*
* @param stack
* @param ticks
*
* @return If true, then cancel drawing the armor bar.
*
* @since 0.2-1.16.4-forge
*/
public static boolean drawArmor(MatrixStack stack, float ticks)
public static boolean drawArmor(float ticks)
{
ConfigManager.TimeValues healthTimes;
/*
@@ -875,8 +884,8 @@ public class TimerUtils
healthTimes.getMaxTime(),
healthTimes.getFadeInTime(),
healthTimes.getFadeOutTime()));
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
return false;
@@ -887,17 +896,16 @@ public class TimerUtils
/**
* Repositions the oxygen bar.
*
* @param stack
* @param ticks
*
* @return If true, then cancel drawing the oxygen bar.
*
* @since 0.2-1.16.4-forge
*/
public static boolean drawAir(MatrixStack stack, float ticks)
public static boolean drawAir(float ticks)
{
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
return false;
@@ -907,14 +915,13 @@ public class TimerUtils
* Determines whether or not to draw the mount's health, adjusting the alpha
* as needed.
*
* @param stack
* @param ticks
*
* @return If true, then cancel drawing the mount health bar.
*
* @since 0.2-1.16.4-forge
*/
public static boolean drawMountHealth(MatrixStack stack, float ticks)
public static boolean drawMountHealth(float ticks)
{
/*
* When the health percentage falls to this level or below, the
@@ -930,7 +937,7 @@ public class TimerUtils
Entity tmp = mc.player.getRidingEntity();
boolean changed = false;
if (tmp == null)
if (tmp == null || !(tmp instanceof LivingEntity))
{
mountHealth = -1;
mountMaxHealth = -1;
@@ -969,8 +976,8 @@ public class TimerUtils
{
if (mountTime > 0)
{
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
setAlpha(Main.getAlpha(mountTime,
@@ -981,8 +988,8 @@ public class TimerUtils
}
return true;
}
stack.push();
stack.translate(0F,
RenderSystem.pushMatrix();
RenderSystem.translatef(0F,
getHealthTranslation(),
0F);
return false;

View File

@@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[35,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="GPL-3.0-only"
@@ -57,7 +57,7 @@ The following elements will only show up under certain conditions:
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[35,)" #mandatory
versionRange="[31,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@@ -78,7 +78,6 @@ The following elements will only show up under certain conditions:
[[dependencies.immersive_hud]]
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.16.4,1.17)"
versionRange="[1.15.2,1.16)"
ordering="NONE"
side="CLIENT"

View File

@@ -19,7 +19,9 @@
"option.immersive_hud.effectFadeIn": "Potion Fade In Time",
"option.immersive_hud.effectFadeOut": "Potion Fade Out Time",
"option.immersive_hud.crosshairTime": "Crosshair Display Time",
"option.immersive_hud.hideCrosshair": "Hide Crosshair",
"option.immersive_hud.handTime": "Hand Display Time",
"option.immersive_hud.hideHands": "Hide Hands",
"option.immersive_hud.minHealth": "Minimum Health Fade",
"option.immersive_hud.minHunger": "Minimum Hunger Fade",
"option.immersive_hud.showArmor": "Show Armor",
@@ -42,7 +44,9 @@
"tooltip.immersive_hud.effectFadeIn": "How many seconds it takes for potion icons to fade in",
"tooltip.immersive_hud.effectFadeOut": "How many seconds it takes for potion icons to fade out",
"tooltip.immersive_hud.crosshairTime": "How many seconds the crosshairs can be on screen",
"tooltip.immersive_hud.hideCrosshair": "Whether or not the crosshairs should be hidden after a period of time",
"tooltip.immersive_hud.handTime": "How many seconds the hands can be on screen",
"tooltip.immersive_hud.hideHands": "Whether or not hands should be hidden after a period of time",
"tooltip.immersive_hud.minHealth": "When the percentage of health goes below this level, the health bar won't fade away",
"tooltip.immersive_hud.minHunger": "When the hunger level goes below this level, the hunger bar won't fade away",
"tooltip.immersive_hud.showArmor": "Whether or not the armor bar should display on the HUD"

View File

@@ -1,7 +1,7 @@
{
"pack": {
"description": "immersive_hud resources",
"pack_format": 6,
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
"pack_format": 4,
"_comment": "A pack_format of 4 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
}
}