Compare commits
2 Commits
v1.2-1.16.
...
v1.1.1-1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1cf0d9e2 | ||
|
|
3b73bf6cb8 |
0
.github/workflows/build.yml
vendored
Normal file → Executable file
2
.gitignore
vendored
Normal file → Executable file
@@ -32,3 +32,5 @@ bin/
|
|||||||
|
|
||||||
run/
|
run/
|
||||||
/logs/
|
/logs/
|
||||||
|
local.properties
|
||||||
|
remappedSrc/
|
||||||
|
|||||||
15
build.gradle
Normal file → Executable file
@@ -1,10 +1,10 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
id 'fabric-loom' version '0.8-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_16
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_16
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version + "-" + project.minecraft_version + "-fabric"
|
version = project.mod_version + "-" + project.minecraft_version + "-fabric"
|
||||||
@@ -43,13 +43,8 @@ tasks.withType(JavaCompile).configureEach {
|
|||||||
// If Javadoc is generated, this must be specified in that task too.
|
// If Javadoc is generated, this must be specified in that task too.
|
||||||
it.options.encoding = "UTF-8"
|
it.options.encoding = "UTF-8"
|
||||||
|
|
||||||
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
// Minecraft 1.17 (21w19a) upwards uses Java 16.
|
||||||
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
it.options.release = 16
|
||||||
// We'll use that if it's available, but otherwise we'll use the older option.
|
|
||||||
def targetVersion = 8
|
|
||||||
if (JavaVersion.current().isJava9Compatible()) {
|
|
||||||
it.options.release = targetVersion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|||||||
0
demo.gif
Normal file → Executable file
|
Before Width: | Height: | Size: 37 MiB After Width: | Height: | Size: 37 MiB |
12
gradle.properties
Normal file → Executable file
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.16.4
|
minecraft_version=1.17
|
||||||
yarn_mappings=1.16.4+build.9
|
yarn_mappings=1.17+build.1
|
||||||
loader_version=0.11.1
|
loader_version=0.11.3
|
||||||
|
|
||||||
cloth_version=4.11.14
|
cloth_version=5.0.34
|
||||||
modmenu_version=1.16.8
|
modmenu_version=2.0.2
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2
|
mod_version = 1.1.1
|
||||||
maven_group = markil3
|
maven_group = markil3
|
||||||
archives_base_name = immersive_hud
|
archives_base_name = immersive_hud
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
0
screenshot1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
0
screenshot2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 767 KiB |
0
screenshot3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
0
screenshot4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 983 KiB After Width: | Height: | Size: 983 KiB |
0
screenshot5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 405 KiB After Width: | Height: | Size: 405 KiB |
0
settings.gradle
Normal file → Executable file
49
src/main/java/markil3/immersive_hud/ConfigManager.java
Normal file → Executable file
@@ -1,19 +1,11 @@
|
|||||||
package markil3.immersive_hud;
|
package markil3.immersive_hud;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
|
|
||||||
import me.shedaniel.autoconfig.AutoConfig;
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
|
|
||||||
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
|
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration manager of this mod, which reads from and writes to this mod's
|
* Configuration manager of this mod, which reads from and writes to this mod's
|
||||||
* configuration file.
|
* configuration file.
|
||||||
@@ -96,7 +88,6 @@ public class ConfigManager
|
|||||||
private boolean showArmor = true;
|
private boolean showArmor = true;
|
||||||
private double minHealth = 0.5;
|
private double minHealth = 0.5;
|
||||||
private int minHunger = 17;
|
private int minHunger = 17;
|
||||||
private Identifier[] ignoredItems = new Identifier[]{Registry.ITEM.getId(Items.FIREWORK_ROCKET)};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the instance of this class.
|
* Returns the instance of this class.
|
||||||
@@ -256,26 +247,6 @@ public class ConfigManager
|
|||||||
return this.minHunger;
|
return this.minHunger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtains a collection of items that won't cause hands and crosshairs to show when used.
|
|
||||||
*
|
|
||||||
* @return A set of ignored items.
|
|
||||||
*/
|
|
||||||
public Set<Item> getIgnoredItems()
|
|
||||||
{
|
|
||||||
return Arrays.stream(ignoredItems).map(Registry.ITEM::get).collect(Collectors.toSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtains a collection of items that won't cause hands and crosshairs to show when used.
|
|
||||||
*
|
|
||||||
* @return An array of identifiers.
|
|
||||||
*/
|
|
||||||
public Identifier[] getIgnoredIdentifiers()
|
|
||||||
{
|
|
||||||
return this.ignoredItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the time that the hands are allowed to display.
|
* Sets the time that the hands are allowed to display.
|
||||||
*
|
*
|
||||||
@@ -347,26 +318,6 @@ public class ConfigManager
|
|||||||
{
|
{
|
||||||
this.minHunger = MathHelper.clamp(boundary, 0, 20);
|
this.minHunger = MathHelper.clamp(boundary, 0, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets which items won't cause the hands and crosshairs to show when used.
|
|
||||||
*
|
|
||||||
* @param items - A set of ignored items.
|
|
||||||
*/
|
|
||||||
public void setIgnoredItems(Item... items)
|
|
||||||
{
|
|
||||||
this.ignoredItems = Arrays.stream(items).map(Registry.ITEM::getId).toArray(Identifier[]::new);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets which items won't cause the hands and crosshairs to show when used.
|
|
||||||
*
|
|
||||||
* @param items - A set of ignored items.
|
|
||||||
*/
|
|
||||||
public void setIgnoredItems(String... items)
|
|
||||||
{
|
|
||||||
this.ignoredItems = Arrays.stream(items).map(Identifier::new).filter(i -> Registry.ITEM.getOrEmpty(i).isPresent()).toArray(Identifier[]::new);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Saves changes to this mod's configuration.
|
* Saves changes to this mod's configuration.
|
||||||
*/
|
*/
|
||||||
|
|||||||
0
src/main/java/markil3/immersive_hud/ConfigManagerCloth.java
Normal file → Executable file
0
src/main/java/markil3/immersive_hud/Main.java
Normal file → Executable file
55
src/main/java/markil3/immersive_hud/ModMenu.java
Normal file → Executable file
@@ -3,11 +3,7 @@ package markil3.immersive_hud;
|
|||||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||||
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.InvalidIdentifierException;
|
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
|
|
||||||
import me.shedaniel.autoconfig.AutoConfig;
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
import me.shedaniel.clothconfig2.api.ConfigBuilder;
|
import me.shedaniel.clothconfig2.api.ConfigBuilder;
|
||||||
@@ -17,11 +13,6 @@ import me.shedaniel.clothconfig2.gui.entries.DoubleListEntry;
|
|||||||
|
|
||||||
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
|
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class ModMenu implements ModMenuApi
|
public class ModMenu implements ModMenuApi
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -44,8 +35,7 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setTooltip(new TranslatableText(
|
.setTooltip(new TranslatableText(
|
||||||
"tooltip.immersive_hud." + name +
|
"tooltip.immersive_hud." + name +
|
||||||
"MaxTime"))
|
"MaxTime"))
|
||||||
.setSaveConsumer(val -> value
|
.setSaveConsumer(val -> value.setMaxTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.setMaxTime((int) (val * TICKS_PER_SECOND)))
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
DoubleListEntry fadeIn =
|
DoubleListEntry fadeIn =
|
||||||
@@ -59,8 +49,7 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setTooltip(new TranslatableText(
|
.setTooltip(new TranslatableText(
|
||||||
"tooltip.immersive_hud." + name +
|
"tooltip.immersive_hud." + name +
|
||||||
"FadeIn"))
|
"FadeIn"))
|
||||||
.setSaveConsumer(val -> value
|
.setSaveConsumer(val -> value.setFadeInTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.setFadeInTime((int) (val * TICKS_PER_SECOND)))
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
DoubleListEntry fadeOut =
|
DoubleListEntry fadeOut =
|
||||||
@@ -74,8 +63,7 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setTooltip(new TranslatableText(
|
.setTooltip(new TranslatableText(
|
||||||
"tooltip.immersive_hud." + name +
|
"tooltip.immersive_hud." + name +
|
||||||
"FadeOut"))
|
"FadeOut"))
|
||||||
.setSaveConsumer(val -> value
|
.setSaveConsumer(val -> value.setFadeOutTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.setFadeOutTime((int) (val * TICKS_PER_SECOND)))
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
cat.addEntry(maxTime);
|
cat.addEntry(maxTime);
|
||||||
@@ -97,11 +85,9 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setSavingRunnable(() -> {
|
.setSavingRunnable(() -> {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Class
|
if (Class.forName("me.shedaniel.autoconfig.AutoConfig") != null)
|
||||||
.forName("me.shedaniel.autoconfig.AutoConfig") != null)
|
|
||||||
{
|
{
|
||||||
AutoConfig
|
AutoConfig.getConfigHolder(ConfigManagerCloth.class)
|
||||||
.getConfigHolder(ConfigManagerCloth.class)
|
|
||||||
.save();
|
.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,8 +128,7 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setTooltip(new TranslatableText(
|
.setTooltip(new TranslatableText(
|
||||||
"tooltip.immersive_hud" +
|
"tooltip.immersive_hud" +
|
||||||
".crosshairTime"))
|
".crosshairTime"))
|
||||||
.setSaveConsumer(val -> instance
|
.setSaveConsumer(val -> instance.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
|
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
|
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
|
||||||
@@ -161,8 +146,7 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setDefaultValue(30)
|
.setDefaultValue(30)
|
||||||
.setTooltip(new TranslatableText(
|
.setTooltip(new TranslatableText(
|
||||||
"tooltip.immersive_hud.handTime"))
|
"tooltip.immersive_hud.handTime"))
|
||||||
.setSaveConsumer(val -> instance
|
.setSaveConsumer(val -> instance.setHandTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.setHandTime((int) (val * TICKS_PER_SECOND)))
|
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
|
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
|
||||||
@@ -201,31 +185,6 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setSaveConsumer(val -> instance.shouldShowArmor(val))
|
.setSaveConsumer(val -> instance.shouldShowArmor(val))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
general.addEntry(entryBuilder
|
|
||||||
.startStrList(new TranslatableText("option.immersive_hud.ignoreList"), Arrays
|
|
||||||
.asList(instance
|
|
||||||
.getIgnoredIdentifiers()).stream().map(Identifier::toString)
|
|
||||||
.collect(Collectors.toList()))
|
|
||||||
.setDefaultValue(Arrays
|
|
||||||
.asList(Registry.ITEM.getId(Items.FIREWORK_ROCKET).toString()))
|
|
||||||
.setTooltip(new TranslatableText("tooltip.immersive_hud.ignoreList"))
|
|
||||||
.setSaveConsumer(val -> instance.setIgnoredItems(val.toArray(new String[0]))).setErrorSupplier(val -> {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Optional<String> item = val.stream().filter(i -> !Registry.ITEM.getOrEmpty(new Identifier(i)).isPresent()).findFirst();
|
|
||||||
if (item.isPresent())
|
|
||||||
{
|
|
||||||
return Optional.of(new TranslatableText("error.immersive_hud.ignoreList.unknownItem"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (InvalidIdentifierException e)
|
|
||||||
{
|
|
||||||
return Optional.of(new TranslatableText("error.immersive_hud.ignoreList.illegalId"));
|
|
||||||
}
|
|
||||||
return Optional.empty();
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
65
src/main/java/markil3/immersive_hud/TimerUtils.java
Normal file → Executable file
@@ -49,13 +49,12 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the logic for changing the HUD.
|
* Contains the logic for changing the HUD.
|
||||||
*
|
*
|
||||||
* @author Markil 3
|
* @author Markil 3
|
||||||
* @version 0.1-1.16.4-fabric
|
* @version 1.1.1-1.17-fabric
|
||||||
*/
|
*/
|
||||||
public class TimerUtils
|
public class TimerUtils
|
||||||
{
|
{
|
||||||
@@ -174,7 +173,7 @@ public class TimerUtils
|
|||||||
*/
|
*/
|
||||||
public static void setAlpha(float alpha)
|
public static void setAlpha(float alpha)
|
||||||
{
|
{
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, alpha);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,8 +250,6 @@ public class TimerUtils
|
|||||||
ConfigManager.getInstance().getExperienceTime();
|
ConfigManager.getInstance().getExperienceTime();
|
||||||
ConfigManager.TimeValues jump =
|
ConfigManager.TimeValues jump =
|
||||||
ConfigManager.getInstance().getJumpTime();
|
ConfigManager.getInstance().getJumpTime();
|
||||||
ConfigManager.TimeValues healthTimes = ConfigManager.getInstance().getHealthTime();
|
|
||||||
ConfigManager.TimeValues hungerTimes = ConfigManager.getInstance().getHungerTime();
|
|
||||||
|
|
||||||
float hotbarAlpha = Main.getAlpha(hotbarTime,
|
float hotbarAlpha = Main.getAlpha(hotbarTime,
|
||||||
hotbar.getMaxTime(),
|
hotbar.getMaxTime(),
|
||||||
@@ -266,21 +263,8 @@ public class TimerUtils
|
|||||||
jump.getMaxTime(),
|
jump.getMaxTime(),
|
||||||
jump.getFadeInTime(),
|
jump.getFadeInTime(),
|
||||||
jump.getFadeOutTime());
|
jump.getFadeOutTime());
|
||||||
float statusAlpha = Main.getAlpha(healthTime,
|
|
||||||
healthTimes.getMaxTime(),
|
|
||||||
healthTimes.getFadeInTime(),
|
|
||||||
healthTimes.getFadeOutTime());
|
|
||||||
statusAlpha = Math.max(statusAlpha, Main.getAlpha(hungerTime,
|
|
||||||
hungerTimes.getMaxTime(),
|
|
||||||
hungerTimes.getFadeInTime(),
|
|
||||||
hungerTimes.getFadeOutTime()));
|
|
||||||
/*
|
|
||||||
* Draw it in its standard location until it is completely transparent, then move it
|
|
||||||
* instantly.
|
|
||||||
*/
|
|
||||||
statusAlpha = (float) Math.ceil(statusAlpha);
|
|
||||||
return 7 * (1 - Math.max(experienceAlpha,
|
return 7 * (1 - Math.max(experienceAlpha,
|
||||||
jumpAlpha)) + 22 * (1 - hotbarAlpha) + 42 * (1 - statusAlpha);
|
jumpAlpha)) + 22 * (1 - hotbarAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -290,6 +274,7 @@ public class TimerUtils
|
|||||||
*
|
*
|
||||||
* @param hand - The hand being triggered
|
* @param hand - The hand being triggered
|
||||||
* @param clear - Whether the hand it being enabled or disabled.
|
* @param clear - Whether the hand it being enabled or disabled.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static void onClick(Hand hand, boolean clear)
|
public static void onClick(Hand hand, boolean clear)
|
||||||
@@ -304,7 +289,6 @@ public class TimerUtils
|
|||||||
LivingEntity entity;
|
LivingEntity entity;
|
||||||
Item item;
|
Item item;
|
||||||
Iterator<ItemStack> hands;
|
Iterator<ItemStack> hands;
|
||||||
Set<Item> ignored;
|
|
||||||
if (mc.getCameraEntity() instanceof LivingEntity)
|
if (mc.getCameraEntity() instanceof LivingEntity)
|
||||||
{
|
{
|
||||||
entity = (LivingEntity) mc.getCameraEntity();
|
entity = (LivingEntity) mc.getCameraEntity();
|
||||||
@@ -330,14 +314,6 @@ public class TimerUtils
|
|||||||
.map(ItemStack::getItem)
|
.map(ItemStack::getItem)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
ignored = ConfigManager.getInstance().getIgnoredItems();
|
|
||||||
if (ignored.contains(item))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
crosshairTime = ConfigManager.getInstance().getCrosshairTime();
|
crosshairTime = ConfigManager.getInstance().getCrosshairTime();
|
||||||
if (hand == Hand.MAIN_HAND)
|
if (hand == Hand.MAIN_HAND)
|
||||||
{
|
{
|
||||||
@@ -373,7 +349,9 @@ public class TimerUtils
|
|||||||
*
|
*
|
||||||
* @param hand - The hand being rendered.
|
* @param hand - The hand being rendered.
|
||||||
* @param matrixStack - The rendering stack.
|
* @param matrixStack - The rendering stack.
|
||||||
|
*
|
||||||
* @return If true, then don't render this hand at all.
|
* @return If true, then don't render this hand at all.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean onRenderHand(Hand hand,
|
public static boolean onRenderHand(Hand hand,
|
||||||
@@ -439,6 +417,7 @@ public class TimerUtils
|
|||||||
* needed.
|
* needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the crosshair.
|
* @return If true, then cancel drawing the crosshair.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawCrosshair(float ticks)
|
public static boolean drawCrosshair(float ticks)
|
||||||
@@ -495,6 +474,7 @@ public class TimerUtils
|
|||||||
* as needed.
|
* as needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the mount health bar.
|
* @return If true, then cancel drawing the mount health bar.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawMountHealth(MatrixStack stack, float ticks)
|
public static boolean drawMountHealth(MatrixStack stack, float ticks)
|
||||||
@@ -626,6 +606,7 @@ public class TimerUtils
|
|||||||
* Obtains how transparent
|
* Obtains how transparent
|
||||||
*
|
*
|
||||||
* @param effectinstance
|
* @param effectinstance
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static float getPotionAlpha(StatusEffectInstance effectinstance)
|
public static float getPotionAlpha(StatusEffectInstance effectinstance)
|
||||||
@@ -637,8 +618,7 @@ public class TimerUtils
|
|||||||
if (effectinstance.getDuration() <= BLINK_TIME)
|
if (effectinstance.getDuration() <= BLINK_TIME)
|
||||||
{
|
{
|
||||||
effectAlpha =
|
effectAlpha =
|
||||||
MathHelper.sin(7000F / (effectinstance
|
MathHelper.sin(7000F / (effectinstance.getDuration() + 16F * (float) Math.PI)) * 50F / (effectinstance
|
||||||
.getDuration() + 16F * (float) Math.PI)) * 50F / (effectinstance
|
|
||||||
.getDuration() + 100F) + 0.5F;
|
.getDuration() + 100F) + 0.5F;
|
||||||
}
|
}
|
||||||
else if (effectinstance.getDuration() <= BLINK_TIME + potion.getFadeInTime())
|
else if (effectinstance.getDuration() <= BLINK_TIME + potion.getFadeInTime())
|
||||||
@@ -663,6 +643,7 @@ public class TimerUtils
|
|||||||
* needed.
|
* needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the armor bar.
|
* @return If true, then cancel drawing the armor bar.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawArmor()
|
public static boolean drawArmor()
|
||||||
@@ -690,6 +671,7 @@ public class TimerUtils
|
|||||||
* needed.
|
* needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the health.
|
* @return If true, then cancel drawing the health.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawHealth(float ticks)
|
public static boolean drawHealth(float ticks)
|
||||||
@@ -765,6 +747,7 @@ public class TimerUtils
|
|||||||
* needed.
|
* needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the hunger bar.
|
* @return If true, then cancel drawing the hunger bar.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawHunger(float ticks)
|
public static boolean drawHunger(float ticks)
|
||||||
@@ -843,7 +826,9 @@ public class TimerUtils
|
|||||||
* as needed.
|
* as needed.
|
||||||
*
|
*
|
||||||
* @param stack
|
* @param stack
|
||||||
|
*
|
||||||
* @return If true, then cancel drawing the jump bar.
|
* @return If true, then cancel drawing the jump bar.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawJumpbar(MatrixStack stack, float ticks)
|
public static boolean drawJumpbar(MatrixStack stack, float ticks)
|
||||||
@@ -862,7 +847,7 @@ public class TimerUtils
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.method_3151() > 0)
|
if (entity.getMountJumpStrength() > 0)
|
||||||
{
|
{
|
||||||
jumpTime = jump.getMaxTime() - (jumpTime > 0 ?
|
jumpTime = jump.getMaxTime() - (jumpTime > 0 ?
|
||||||
jump.getFadeInTime() :
|
jump.getFadeInTime() :
|
||||||
@@ -890,6 +875,7 @@ public class TimerUtils
|
|||||||
* as needed.
|
* as needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the experience bar.
|
* @return If true, then cancel drawing the experience bar.
|
||||||
|
*
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static boolean drawExperience(MatrixStack stack, float ticks)
|
public static boolean drawExperience(MatrixStack stack, float ticks)
|
||||||
@@ -944,6 +930,7 @@ public class TimerUtils
|
|||||||
* or not to draw it.
|
* or not to draw it.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the hotbar.
|
* @return If true, then cancel drawing the hotbar.
|
||||||
|
*
|
||||||
* @see #recolorHotbar(MatrixStack)
|
* @see #recolorHotbar(MatrixStack)
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
@@ -1138,9 +1125,9 @@ public class TimerUtils
|
|||||||
/*
|
/*
|
||||||
* Checks for a change in what slot is used.
|
* Checks for a change in what slot is used.
|
||||||
*/
|
*/
|
||||||
if (selectedHotbarSlot != entity.inventory.selectedSlot)
|
if (selectedHotbarSlot != entity.getInventory().selectedSlot)
|
||||||
{
|
{
|
||||||
selectedHotbarSlot = entity.inventory.selectedSlot;
|
selectedHotbarSlot = entity.getInventory().selectedSlot;
|
||||||
mainHandTime = handTime;
|
mainHandTime = handTime;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -1163,19 +1150,25 @@ public class TimerUtils
|
|||||||
* Determines whether or not to draw the crosshair, adjusting the alpha as
|
* Determines whether or not to draw the crosshair, adjusting the alpha as
|
||||||
* needed.
|
* needed.
|
||||||
*
|
*
|
||||||
* @return If true, then cancel drawing the crosshair.
|
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
public static void recolorHotbar(MatrixStack stack)
|
public static void recolorHotbar(MatrixStack stack)
|
||||||
{
|
{
|
||||||
ConfigManager.TimeValues hotbar =
|
ConfigManager.TimeValues hotbar =
|
||||||
ConfigManager.getInstance().getHotbarTime();
|
ConfigManager.getInstance().getHotbarTime();
|
||||||
RenderSystem.pushMatrix();
|
// RenderSystem.pushMatrix();
|
||||||
stack.push();
|
stack.push();
|
||||||
RenderSystem.translatef(0F, TimerUtils.getHotbarTranslation(), 0F);
|
stack.translate(0F, TimerUtils.getHotbarTranslation(), 0F);
|
||||||
setAlpha(Main.getAlpha(hotbarTime,
|
setAlpha(Main.getAlpha(hotbarTime,
|
||||||
hotbar.getMaxTime(),
|
hotbar.getMaxTime(),
|
||||||
hotbar.getFadeInTime(),
|
hotbar.getFadeInTime(),
|
||||||
hotbar.getFadeOutTime()));
|
hotbar.getFadeOutTime()));
|
||||||
|
/*
|
||||||
|
* Update the hotbar item matrix
|
||||||
|
*/
|
||||||
|
stack = RenderSystem.getModelViewStack();
|
||||||
|
stack.push();
|
||||||
|
stack.translate(0F, TimerUtils.getHotbarTranslation(), 0F);
|
||||||
|
RenderSystem.applyModelViewMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
src/main/java/markil3/immersive_hud/mixin/ClientPlayerHook.java
Normal file → Executable file
0
src/main/java/markil3/immersive_hud/mixin/HeldItemHook.java
Normal file → Executable file
12
src/main/java/markil3/immersive_hud/mixin/HudHook.java
Normal file → Executable file
@@ -40,7 +40,7 @@ import markil3.immersive_hud.TimerUtils;
|
|||||||
* that most of the logic can be found in {@link TimerUtils}.
|
* that most of the logic can be found in {@link TimerUtils}.
|
||||||
*
|
*
|
||||||
* @author Markil 3
|
* @author Markil 3
|
||||||
* @version 0.1-1.16.4-fabric
|
* @version 1.1.1-1.17-fabric
|
||||||
*/
|
*/
|
||||||
@Mixin(InGameHud.class)
|
@Mixin(InGameHud.class)
|
||||||
public class HudHook
|
public class HudHook
|
||||||
@@ -338,7 +338,7 @@ public class HudHook
|
|||||||
@Inject(method = "renderStatusBars(Lnet/minecraft/client/util" +
|
@Inject(method = "renderStatusBars(Lnet/minecraft/client/util" +
|
||||||
"/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" +
|
"/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" +
|
||||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||||
ordinal = 1, shift = At.Shift.BY, by = 3))
|
ordinal = 1))
|
||||||
public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo)
|
public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -634,7 +634,7 @@ public class HudHook
|
|||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
@Inject(method = "renderHotbar", at = @At(value = "INVOKE", target =
|
@Inject(method = "renderHotbar", at = @At(value = "INVOKE", target =
|
||||||
"Lcom/mojang/blaze3d/systems/RenderSystem;color4f(FFFF)V", shift
|
"Lcom/mojang/blaze3d/systems/RenderSystem;setShaderColor(FFFF)V", shift
|
||||||
= At.Shift.AFTER))
|
= At.Shift.AFTER))
|
||||||
public void adjustHotbar(float tickDelta,
|
public void adjustHotbar(float tickDelta,
|
||||||
MatrixStack matrices,
|
MatrixStack matrices,
|
||||||
@@ -661,7 +661,7 @@ public class HudHook
|
|||||||
* @param stack - The matrix drawing stack.
|
* @param stack - The matrix drawing stack.
|
||||||
* @param callbackInfo
|
* @param callbackInfo
|
||||||
*
|
*
|
||||||
* @version 0.2-1.16.4-fabric
|
* @version 1.1.1-1.17-fabric
|
||||||
* @since 0.1-1.16.4-fabric
|
* @since 0.1-1.16.4-fabric
|
||||||
*/
|
*/
|
||||||
@Inject(method = "renderHotbar", at = @At(value = "TAIL"))
|
@Inject(method = "renderHotbar", at = @At(value = "TAIL"))
|
||||||
@@ -671,8 +671,10 @@ public class HudHook
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RenderSystem.popMatrix();
|
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
stack = RenderSystem.getModelViewStack();
|
||||||
|
stack.pop();
|
||||||
|
RenderSystem.applyModelViewMatrix();
|
||||||
/*
|
/*
|
||||||
* Resets the color so that nothing else is bothered.
|
* Resets the color so that nothing else is bothered.
|
||||||
*/
|
*/
|
||||||
|
|||||||
0
src/main/resources/assets/immersive_hud/icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 380 KiB |
6
src/main/resources/assets/immersive_hud/lang/en_us.json
Normal file → Executable file
@@ -25,7 +25,6 @@
|
|||||||
"option.immersive_hud.minHealth": "Minimum Health Fade",
|
"option.immersive_hud.minHealth": "Minimum Health Fade",
|
||||||
"option.immersive_hud.minHunger": "Minimum Hunger Fade",
|
"option.immersive_hud.minHunger": "Minimum Hunger Fade",
|
||||||
"option.immersive_hud.showArmor": "Show Armor",
|
"option.immersive_hud.showArmor": "Show Armor",
|
||||||
"option.immersive_hud.ignoreList": "Ignored Items",
|
|
||||||
"tooltip.immersive_hud.hotbarMaxTime": "How long the hotbar can be displayed on screen in seconds",
|
"tooltip.immersive_hud.hotbarMaxTime": "How long the hotbar can be displayed on screen in seconds",
|
||||||
"tooltip.immersive_hud.hotbarFadeIn": "How many seconds it takes for the hotbar to fade in",
|
"tooltip.immersive_hud.hotbarFadeIn": "How many seconds it takes for the hotbar to fade in",
|
||||||
"tooltip.immersive_hud.hotbarFadeOut": "How many seconds it takes for the hotbar to move out",
|
"tooltip.immersive_hud.hotbarFadeOut": "How many seconds it takes for the hotbar to move out",
|
||||||
@@ -50,8 +49,5 @@
|
|||||||
"tooltip.immersive_hud.hideHands": "Whether or not hands should be hidden after a period of time",
|
"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.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.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",
|
"tooltip.immersive_hud.showArmor": "Whether or not the armor bar should display on the HUD"
|
||||||
"tooltip.immersive_hud.ignoreList": "Which items will not trigger the arm and crosshairs when used",
|
|
||||||
"error.immersive_hud.ignoreList.unknownItem": "Unknown item %s",
|
|
||||||
"error.immersive_hud.ignoreList.illegalId": "%s is not a legal item identifier"
|
|
||||||
}
|
}
|
||||||
@@ -34,8 +34,9 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.11.3",
|
||||||
"minecraft": "1.16.x"
|
"minecraft": "1.17.x",
|
||||||
|
"java": ">=16"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"modmenu": "*",
|
"modmenu": "*",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "markil3.immersive_hud.mixin",
|
"package": "markil3.immersive_hud.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_16",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
|
|||||||