Compare commits

..

7 Commits

Author SHA1 Message Date
Markil3
02dddb3257 Update gradle.properties 2021-08-30 22:30:24 -06:00
Markil3
59d2a3934c Allows some items to not trigger a hand/crosshair update.
This is helpful if one is using Firework rockets to fly around the landscape.
2021-08-30 22:23:13 -06:00
Markil3
c4fe9992b0 Changes how the mod handles status bars slightly.
This should somewhat increase compatibility with the AppleSkin mod.
2021-07-22 13:37:28 -06:00
Markil3
8646ac8ec8 Update build.yml 2021-06-18 09:32:53 -06:00
Markil3
241b8c8357 Update build.yml for 1.17 workflows 2021-06-18 09:29:19 -06:00
Markil3
4d1cf0d9e2 Fixes the inventory items not moving properly. 2021-06-18 08:46:06 -06:00
Markil3
3b73bf6cb8 Updates for Minecraft 1.17
Still needs a bit of tweaking
2021-06-18 08:27:59 -06:00
26 changed files with 160 additions and 150 deletions

6
.github/workflows/build.yml vendored Normal file → Executable file
View File

@@ -12,9 +12,9 @@ jobs:
matrix:
# Use these Java versions
java: [
1.8, # Minimum supported by Minecraft
11, # Current Java LTS
15 # Latest version
1.16, # Minimum supported by Minecraft
16, # Current Java LTS
16 # Latest version
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest]

2
.gitignore vendored Normal file → Executable file
View File

@@ -32,3 +32,5 @@ bin/
run/
/logs/
local.properties
remappedSrc/

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

15
build.gradle Normal file → Executable file
View File

@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name
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.
it.options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// 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
}
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
}
java {

0
demo.gif Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 37 MiB

After

Width:  |  Height:  |  Size: 37 MiB

10
gradle.properties Normal file → Executable file
View File

@@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.9
loader_version=0.11.1
minecraft_version=1.17
yarn_mappings=1.17+build.1
loader_version=0.11.3
cloth_version=4.11.14
modmenu_version=1.16.8
cloth_version=5.0.34
modmenu_version=2.0.2
# Mod Properties
mod_version = 1.2

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

0
screenshot1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

0
screenshot2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 767 KiB

After

Width:  |  Height:  |  Size: 767 KiB

0
screenshot3.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

0
screenshot4.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 983 KiB

After

Width:  |  Height:  |  Size: 983 KiB

0
screenshot5.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 405 KiB

After

Width:  |  Height:  |  Size: 405 KiB

0
settings.gradle Normal file → Executable file
View File

8
src/main/java/markil3/immersive_hud/ConfigManager.java Normal file → Executable file
View File

@@ -1,19 +1,19 @@
package markil3.immersive_hud;
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
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.registry.Registry;
import me.shedaniel.autoconfig.AutoConfig;
import static markil3.immersive_hud.Main.TICKS_PER_SECOND;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import me.shedaniel.autoconfig.AutoConfig;
/**
* Configuration manager of this mod, which reads from and writes to this mod's
* configuration file.

View File

0
src/main/java/markil3/immersive_hud/Main.java Normal file → Executable file
View File

22
src/main/java/markil3/immersive_hud/ModMenu.java Normal file → Executable file
View File

@@ -17,7 +17,6 @@ import me.shedaniel.clothconfig2.gui.entries.DoubleListEntry;
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;
@@ -44,8 +43,7 @@ public class ModMenu implements ModMenuApi
.setTooltip(new TranslatableText(
"tooltip.immersive_hud." + name +
"MaxTime"))
.setSaveConsumer(val -> value
.setMaxTime((int) (val * TICKS_PER_SECOND)))
.setSaveConsumer(val -> value.setMaxTime((int) (val * TICKS_PER_SECOND)))
.build();
DoubleListEntry fadeIn =
@@ -59,8 +57,7 @@ public class ModMenu implements ModMenuApi
.setTooltip(new TranslatableText(
"tooltip.immersive_hud." + name +
"FadeIn"))
.setSaveConsumer(val -> value
.setFadeInTime((int) (val * TICKS_PER_SECOND)))
.setSaveConsumer(val -> value.setFadeInTime((int) (val * TICKS_PER_SECOND)))
.build();
DoubleListEntry fadeOut =
@@ -74,8 +71,7 @@ public class ModMenu implements ModMenuApi
.setTooltip(new TranslatableText(
"tooltip.immersive_hud." + name +
"FadeOut"))
.setSaveConsumer(val -> value
.setFadeOutTime((int) (val * TICKS_PER_SECOND)))
.setSaveConsumer(val -> value.setFadeOutTime((int) (val * TICKS_PER_SECOND)))
.build();
cat.addEntry(maxTime);
@@ -97,11 +93,9 @@ public class ModMenu implements ModMenuApi
.setSavingRunnable(() -> {
try
{
if (Class
.forName("me.shedaniel.autoconfig.AutoConfig") != null)
if (Class.forName("me.shedaniel.autoconfig.AutoConfig") != null)
{
AutoConfig
.getConfigHolder(ConfigManagerCloth.class)
AutoConfig.getConfigHolder(ConfigManagerCloth.class)
.save();
}
}
@@ -142,8 +136,7 @@ public class ModMenu implements ModMenuApi
.setTooltip(new TranslatableText(
"tooltip.immersive_hud" +
".crosshairTime"))
.setSaveConsumer(val -> instance
.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
.setSaveConsumer(val -> instance.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
.build());
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
@@ -161,8 +154,7 @@ public class ModMenu implements ModMenuApi
.setDefaultValue(30)
.setTooltip(new TranslatableText(
"tooltip.immersive_hud.handTime"))
.setSaveConsumer(val -> instance
.setHandTime((int) (val * TICKS_PER_SECOND)))
.setSaveConsumer(val -> instance.setHandTime((int) (val * TICKS_PER_SECOND)))
.build());
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(

38
src/main/java/markil3/immersive_hud/TimerUtils.java Normal file → Executable file
View File

@@ -55,7 +55,7 @@ import java.util.Set;
* Contains the logic for changing the HUD.
*
* @author Markil 3
* @version 0.1-1.16.4-fabric
* @version 1.1.1-1.17-fabric
*/
public class TimerUtils
{
@@ -174,7 +174,7 @@ public class TimerUtils
*/
public static void setAlpha(float alpha)
{
RenderSystem.color4f(1.0F, 1.0F, 1.0F, alpha);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, alpha);
}
/**
@@ -290,6 +290,7 @@ public class TimerUtils
*
* @param hand - The hand being triggered
* @param clear - Whether the hand it being enabled or disabled.
*
* @since 0.1-1.16.4-fabric
*/
public static void onClick(Hand hand, boolean clear)
@@ -373,7 +374,9 @@ public class TimerUtils
*
* @param hand - The hand being rendered.
* @param matrixStack - The rendering stack.
*
* @return If true, then don't render this hand at all.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean onRenderHand(Hand hand,
@@ -439,6 +442,7 @@ public class TimerUtils
* needed.
*
* @return If true, then cancel drawing the crosshair.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawCrosshair(float ticks)
@@ -495,6 +499,7 @@ public class TimerUtils
* as needed.
*
* @return If true, then cancel drawing the mount health bar.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawMountHealth(MatrixStack stack, float ticks)
@@ -626,6 +631,7 @@ public class TimerUtils
* Obtains how transparent
*
* @param effectinstance
*
* @return
*/
public static float getPotionAlpha(StatusEffectInstance effectinstance)
@@ -637,8 +643,7 @@ public class TimerUtils
if (effectinstance.getDuration() <= BLINK_TIME)
{
effectAlpha =
MathHelper.sin(7000F / (effectinstance
.getDuration() + 16F * (float) Math.PI)) * 50F / (effectinstance
MathHelper.sin(7000F / (effectinstance.getDuration() + 16F * (float) Math.PI)) * 50F / (effectinstance
.getDuration() + 100F) + 0.5F;
}
else if (effectinstance.getDuration() <= BLINK_TIME + potion.getFadeInTime())
@@ -663,6 +668,7 @@ public class TimerUtils
* needed.
*
* @return If true, then cancel drawing the armor bar.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawArmor()
@@ -690,6 +696,7 @@ public class TimerUtils
* needed.
*
* @return If true, then cancel drawing the health.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawHealth(float ticks)
@@ -765,6 +772,7 @@ public class TimerUtils
* needed.
*
* @return If true, then cancel drawing the hunger bar.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawHunger(float ticks)
@@ -843,7 +851,9 @@ public class TimerUtils
* as needed.
*
* @param stack
*
* @return If true, then cancel drawing the jump bar.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawJumpbar(MatrixStack stack, float ticks)
@@ -862,7 +872,7 @@ public class TimerUtils
return true;
}
if (entity.method_3151() > 0)
if (entity.getMountJumpStrength() > 0)
{
jumpTime = jump.getMaxTime() - (jumpTime > 0 ?
jump.getFadeInTime() :
@@ -890,6 +900,7 @@ public class TimerUtils
* as needed.
*
* @return If true, then cancel drawing the experience bar.
*
* @since 0.1-1.16.4-fabric
*/
public static boolean drawExperience(MatrixStack stack, float ticks)
@@ -944,6 +955,7 @@ public class TimerUtils
* or not to draw it.
*
* @return If true, then cancel drawing the hotbar.
*
* @see #recolorHotbar(MatrixStack)
* @since 0.1-1.16.4-fabric
*/
@@ -1138,9 +1150,9 @@ public class TimerUtils
/*
* 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;
changed = true;
}
@@ -1163,19 +1175,25 @@ public class TimerUtils
* Determines whether or not to draw the crosshair, adjusting the alpha as
* needed.
*
* @return If true, then cancel drawing the crosshair.
* @since 0.1-1.16.4-fabric
*/
public static void recolorHotbar(MatrixStack stack)
{
ConfigManager.TimeValues hotbar =
ConfigManager.getInstance().getHotbarTime();
RenderSystem.pushMatrix();
// RenderSystem.pushMatrix();
stack.push();
RenderSystem.translatef(0F, TimerUtils.getHotbarTranslation(), 0F);
stack.translate(0F, TimerUtils.getHotbarTranslation(), 0F);
setAlpha(Main.getAlpha(hotbarTime,
hotbar.getMaxTime(),
hotbar.getFadeInTime(),
hotbar.getFadeOutTime()));
/*
* Update the hotbar item matrix
*/
stack = RenderSystem.getModelViewStack();
stack.push();
stack.translate(0F, TimerUtils.getHotbarTranslation(), 0F);
RenderSystem.applyModelViewMatrix();
}
}

View File

View File

10
src/main/java/markil3/immersive_hud/mixin/HudHook.java Normal file → Executable file
View File

@@ -40,7 +40,7 @@ import markil3.immersive_hud.TimerUtils;
* that most of the logic can be found in {@link TimerUtils}.
*
* @author Markil 3
* @version 0.1-1.16.4-fabric
* @version 1.1.1-1.17-fabric
*/
@Mixin(InGameHud.class)
public class HudHook
@@ -634,7 +634,7 @@ public class HudHook
* @since 0.1-1.16.4-fabric
*/
@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))
public void adjustHotbar(float tickDelta,
MatrixStack matrices,
@@ -661,7 +661,7 @@ public class HudHook
* @param stack - The matrix drawing stack.
* @param callbackInfo
*
* @version 0.2-1.16.4-fabric
* @version 1.1.1-1.17-fabric
* @since 0.1-1.16.4-fabric
*/
@Inject(method = "renderHotbar", at = @At(value = "TAIL"))
@@ -671,8 +671,10 @@ public class HudHook
{
try
{
RenderSystem.popMatrix();
stack.pop();
stack = RenderSystem.getModelViewStack();
stack.pop();
RenderSystem.applyModelViewMatrix();
/*
* Resets the color so that nothing else is bothered.
*/

0
src/main/resources/assets/immersive_hud/icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 380 KiB

After

Width:  |  Height:  |  Size: 380 KiB

View File

View File

@@ -34,8 +34,9 @@
],
"depends": {
"fabricloader": ">=0.7.4",
"minecraft": "1.16.x"
"fabricloader": ">=0.11.3",
"minecraft": "1.17.x",
"java": ">=16"
},
"suggests": {
"modmenu": "*",

View File

@@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "markil3.immersive_hud.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_16",
"mixins": [
],
"client": [