Renames EventBus to TimerUtils.

It makes more sense.
This commit is contained in:
Markil3
2021-02-27 09:17:14 -07:00
parent c11bf47f17
commit a54ec64baa
5 changed files with 32 additions and 46 deletions

View File

@@ -54,7 +54,7 @@ import java.util.Optional;
* @author Markil 3 * @author Markil 3
* @version 0.1-1.16.4-fabric * @version 0.1-1.16.4-fabric
*/ */
public class EventBus public class TimerUtils
{ {
/** /**
* The number of ticks that the hand will be onscreen. Every tick is 1/20th * The number of ticks that the hand will be onscreen. Every tick is 1/20th

View File

@@ -17,13 +17,8 @@
package markil3.immersive_hud.mixin; package markil3.immersive_hud.mixin;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.HeldItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -31,11 +26,11 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import markil3.immersive_hud.EventBus; import markil3.immersive_hud.TimerUtils;
/** /**
* This mixin hooks into the client player class to check for when the hands * This mixin hooks into the client player class to check for when the hands
* move. Note that most of the logic can be found in {@link EventBus}. * move. Note 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 0.1-1.16.4-fabric
@@ -54,7 +49,7 @@ public class ClientPlayerHook
@Inject(method = "swingHand", at = @At(value = "TAIL")) @Inject(method = "swingHand", at = @At(value = "TAIL"))
public void swingHand(Hand hand, CallbackInfo callbackInfo) public void swingHand(Hand hand, CallbackInfo callbackInfo)
{ {
EventBus.onClick(hand, hand == null); TimerUtils.onClick(hand, hand == null);
} }
/** /**
@@ -68,7 +63,7 @@ public class ClientPlayerHook
@Inject(method = "setCurrentHand", at = @At(value = "TAIL")) @Inject(method = "setCurrentHand", at = @At(value = "TAIL"))
public void setCurrentHand(Hand hand, CallbackInfo callbackInfo) public void setCurrentHand(Hand hand, CallbackInfo callbackInfo)
{ {
EventBus.onClick(hand, hand == null); TimerUtils.onClick(hand, hand == null);
} }
/** /**
@@ -83,7 +78,7 @@ public class ClientPlayerHook
{ {
if (MinecraftClient.getInstance().cameraEntity instanceof LivingEntity) if (MinecraftClient.getInstance().cameraEntity instanceof LivingEntity)
{ {
EventBus.onClick(((LivingEntity) MinecraftClient.getInstance().cameraEntity) TimerUtils.onClick(((LivingEntity) MinecraftClient.getInstance().cameraEntity)
.getActiveHand(), true); .getActiveHand(), true);
} }
} }

View File

@@ -16,9 +16,6 @@
*/ */
package markil3.immersive_hud.mixin; package markil3.immersive_hud.mixin;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.HeldItemRenderer; import net.minecraft.client.render.item.HeldItemRenderer;
@@ -31,11 +28,11 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import markil3.immersive_hud.EventBus; import markil3.immersive_hud.TimerUtils;
/** /**
* This mixin hooks into the hand renderer to make the hands move in and out of * This mixin hooks into the hand renderer to make the hands move in and out of
* view. Note that most of the logic can be found in {@link EventBus}. * view. Note 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 0.1-1.16.4-fabric
@@ -75,7 +72,7 @@ public class HeldItemHook
int light, int light,
CallbackInfo callbackInfo) CallbackInfo callbackInfo)
{ {
if (EventBus.onRenderHand(hand, matrices)) if (TimerUtils.onRenderHand(hand, matrices))
{ {
callbackInfo.cancel(); callbackInfo.cancel();
} }

View File

@@ -16,22 +16,19 @@
*/ */
package markil3.immersive_hud.mixin; package markil3.immersive_hud.mixin;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.profiler.DummyProfiler;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import markil3.immersive_hud.EventBus; import markil3.immersive_hud.TimerUtils;
/** /**
* This mixin hooks into the HUD class to modify most of the HUD elements. Note * This mixin hooks into the HUD class to modify most of the HUD elements. Note
* that most of the logic can be found in {@link EventBus}. * 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 0.1-1.16.4-fabric
@@ -52,7 +49,7 @@ public class HudHook
cancellable = true) cancellable = true)
public void startCrosshair(MatrixStack stack, CallbackInfo callbackInfo) public void startCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
{ {
if (EventBus.drawCrosshair()) if (TimerUtils.drawCrosshair())
{ {
callbackInfo.cancel(); callbackInfo.cancel();
} }
@@ -73,7 +70,7 @@ public class HudHook
/* /*
* Resets the color so that nothing else is bothered. * Resets the color so that nothing else is bothered.
*/ */
EventBus.resetAlpha(); TimerUtils.resetAlpha();
} }
/** /**
@@ -92,7 +89,7 @@ public class HudHook
int x, int x,
CallbackInfo callbackInfo) CallbackInfo callbackInfo)
{ {
if (EventBus.drawJumpbar()) if (TimerUtils.drawJumpbar())
{ {
callbackInfo.cancel(); callbackInfo.cancel();
} }
@@ -115,7 +112,7 @@ public class HudHook
/* /*
* Resets the color so that nothing else is bothered. * Resets the color so that nothing else is bothered.
*/ */
EventBus.resetAlpha(); TimerUtils.resetAlpha();
} }
/** /**
@@ -133,7 +130,7 @@ public class HudHook
int x, int x,
CallbackInfo callbackInfo) CallbackInfo callbackInfo)
{ {
if (EventBus.drawExperience()) if (TimerUtils.drawExperience())
{ {
callbackInfo.cancel(); callbackInfo.cancel();
} }
@@ -156,7 +153,7 @@ public class HudHook
/* /*
* Resets the color so that nothing else is bothered. * Resets the color so that nothing else is bothered.
*/ */
EventBus.resetAlpha(); TimerUtils.resetAlpha();
} }
/** /**
@@ -173,7 +170,7 @@ public class HudHook
true) true)
public void startMountHealth(MatrixStack stack, CallbackInfo callbackInfo) public void startMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
{ {
if (EventBus.drawMountHealth()) if (TimerUtils.drawMountHealth())
{ {
callbackInfo.cancel(); callbackInfo.cancel();
} }
@@ -194,7 +191,7 @@ public class HudHook
/* /*
* Resets the color so that nothing else is bothered. * Resets the color so that nothing else is bothered.
*/ */
EventBus.resetAlpha(); TimerUtils.resetAlpha();
} }
/** /**
@@ -213,7 +210,7 @@ public class HudHook
MatrixStack matrices, MatrixStack matrices,
CallbackInfo callbackInfo) CallbackInfo callbackInfo)
{ {
if (EventBus.updateHotbar()) if (TimerUtils.updateHotbar())
{ {
callbackInfo.cancel(); callbackInfo.cancel();
} }
@@ -236,7 +233,7 @@ public class HudHook
MatrixStack matrices, MatrixStack matrices,
CallbackInfo callbackInfo) CallbackInfo callbackInfo)
{ {
EventBus.recolorHotbar(); TimerUtils.recolorHotbar();
} }
/** /**
@@ -257,6 +254,6 @@ public class HudHook
/* /*
* Resets the color so that nothing else is bothered. * Resets the color so that nothing else is bothered.
*/ */
EventBus.resetAlpha(); TimerUtils.resetAlpha();
} }
} }

View File

@@ -16,8 +16,6 @@
*/ */
package markil3.immersive_hud.mixin; package markil3.immersive_hud.mixin;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.util.profiler.DummyProfiler; import net.minecraft.util.profiler.DummyProfiler;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -25,8 +23,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import markil3.immersive_hud.EventBus; import markil3.immersive_hud.TimerUtils;
import markil3.immersive_hud.Main;
/** /**
* This class hooks into the profiler to trigger color changes for the status * This class hooks into the profiler to trigger color changes for the status
@@ -51,9 +48,9 @@ public class ProfilerHook
{ {
if (section.equals("armor")) if (section.equals("armor"))
{ {
if (EventBus.drawArmor()) if (TimerUtils.drawArmor())
{ {
EventBus.setAlpha(0F); TimerUtils.setAlpha(0F);
} }
} }
} }
@@ -76,27 +73,27 @@ public class ProfilerHook
/* /*
* Resets the transparency from the previous call. * Resets the transparency from the previous call.
*/ */
EventBus.setAlpha(1F); TimerUtils.setAlpha(1F);
if (EventBus.drawHealth()) if (TimerUtils.drawHealth())
{ {
EventBus.setAlpha(0F); TimerUtils.setAlpha(0F);
} }
break; break;
case "food": case "food":
/* /*
* Resets the transparency from the previous call. * Resets the transparency from the previous call.
*/ */
EventBus.setAlpha(1F); TimerUtils.setAlpha(1F);
if (EventBus.drawHunger()) if (TimerUtils.drawHunger())
{ {
EventBus.setAlpha(0F); TimerUtils.setAlpha(0F);
} }
break; break;
case "air": case "air":
/* /*
* Resets the color so that nothing else is bothered. * Resets the color so that nothing else is bothered.
*/ */
EventBus.setAlpha(1F); TimerUtils.setAlpha(1F);
break; break;
} }
} }