Renames EventBus to TimerUtils.
It makes more sense.
This commit is contained in:
@@ -54,7 +54,7 @@ import java.util.Optional;
|
||||
* @author Markil 3
|
||||
* @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
|
||||
@@ -17,13 +17,8 @@
|
||||
package markil3.immersive_hud.mixin;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
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.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
|
||||
* 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
|
||||
* @version 0.1-1.16.4-fabric
|
||||
@@ -54,7 +49,7 @@ public class ClientPlayerHook
|
||||
@Inject(method = "swingHand", at = @At(value = "TAIL"))
|
||||
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"))
|
||||
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)
|
||||
{
|
||||
EventBus.onClick(((LivingEntity) MinecraftClient.getInstance().cameraEntity)
|
||||
TimerUtils.onClick(((LivingEntity) MinecraftClient.getInstance().cameraEntity)
|
||||
.getActiveHand(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
*/
|
||||
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.render.VertexConsumerProvider;
|
||||
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.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
|
||||
* 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
|
||||
* @version 0.1-1.16.4-fabric
|
||||
@@ -75,7 +72,7 @@ public class HeldItemHook
|
||||
int light,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (EventBus.onRenderHand(hand, matrices))
|
||||
if (TimerUtils.onRenderHand(hand, matrices))
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
|
||||
@@ -16,22 +16,19 @@
|
||||
*/
|
||||
package markil3.immersive_hud.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.profiler.DummyProfiler;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
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
|
||||
* 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
|
||||
* @version 0.1-1.16.4-fabric
|
||||
@@ -52,7 +49,7 @@ public class HudHook
|
||||
cancellable = true)
|
||||
public void startCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
||||
{
|
||||
if (EventBus.drawCrosshair())
|
||||
if (TimerUtils.drawCrosshair())
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
@@ -73,7 +70,7 @@ public class HudHook
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
EventBus.resetAlpha();
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +89,7 @@ public class HudHook
|
||||
int x,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (EventBus.drawJumpbar())
|
||||
if (TimerUtils.drawJumpbar())
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
@@ -115,7 +112,7 @@ public class HudHook
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
EventBus.resetAlpha();
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +130,7 @@ public class HudHook
|
||||
int x,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (EventBus.drawExperience())
|
||||
if (TimerUtils.drawExperience())
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
@@ -156,7 +153,7 @@ public class HudHook
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
EventBus.resetAlpha();
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,7 +170,7 @@ public class HudHook
|
||||
true)
|
||||
public void startMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
||||
{
|
||||
if (EventBus.drawMountHealth())
|
||||
if (TimerUtils.drawMountHealth())
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
@@ -194,7 +191,7 @@ public class HudHook
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
EventBus.resetAlpha();
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +210,7 @@ public class HudHook
|
||||
MatrixStack matrices,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (EventBus.updateHotbar())
|
||||
if (TimerUtils.updateHotbar())
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
@@ -236,7 +233,7 @@ public class HudHook
|
||||
MatrixStack matrices,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
EventBus.recolorHotbar();
|
||||
TimerUtils.recolorHotbar();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,6 +254,6 @@ public class HudHook
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
EventBus.resetAlpha();
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
package markil3.immersive_hud.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.util.profiler.DummyProfiler;
|
||||
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
import markil3.immersive_hud.EventBus;
|
||||
import markil3.immersive_hud.Main;
|
||||
import markil3.immersive_hud.TimerUtils;
|
||||
|
||||
/**
|
||||
* 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 (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.
|
||||
*/
|
||||
EventBus.setAlpha(1F);
|
||||
if (EventBus.drawHealth())
|
||||
TimerUtils.setAlpha(1F);
|
||||
if (TimerUtils.drawHealth())
|
||||
{
|
||||
EventBus.setAlpha(0F);
|
||||
TimerUtils.setAlpha(0F);
|
||||
}
|
||||
break;
|
||||
case "food":
|
||||
/*
|
||||
* Resets the transparency from the previous call.
|
||||
*/
|
||||
EventBus.setAlpha(1F);
|
||||
if (EventBus.drawHunger())
|
||||
TimerUtils.setAlpha(1F);
|
||||
if (TimerUtils.drawHunger())
|
||||
{
|
||||
EventBus.setAlpha(0F);
|
||||
TimerUtils.setAlpha(0F);
|
||||
}
|
||||
break;
|
||||
case "air":
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
EventBus.setAlpha(1F);
|
||||
TimerUtils.setAlpha(1F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user