Skip to content

Commit 69ab9ab

Browse files
committed
actually make blackbar animation not fps dependant
1 parent 5579882 commit 69ab9ab

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/main/java/net/wyvest/redaction/mixin/GuiIngameMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ private void cancel(ScaledResolution res, float partialTicks, CallbackInfo ci) {
2525
if (RedactionConfig.INSTANCE.getBlackbar()) {
2626
ci.cancel();
2727
if (Minecraft.getMinecraft().getRenderViewEntity() instanceof EntityPlayer) {
28-
BlackBar.INSTANCE.render(res, partialTicks);
28+
BlackBar.INSTANCE.render(res);
2929
GlStateManager.enableRescaleNormal();
3030
GlStateManager.enableBlend();
3131
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
32-
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
32+
RenderHelper.enableGUIStandardItemLighting();
3333
for (int j = 0; j < 9; ++j) {
3434
int k = res.getScaledWidth() / 2 - 90 + j * 20 + 2;
3535
int l = res.getScaledHeight() - 16 - 3;

src/main/kotlin/net/wyvest/redaction/features/BlackBar.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,28 @@ object BlackBar {
1818

1919
private var data: BlackBarData? = null
2020
private var scaledResolution: ScaledResolution? = null
21-
private var partialTicks: Float? = null
2221
private val texPath = ResourceLocation("textures/gui/widgets.png")
2322
private var firstTime = true
2423
private var entityplayer: EntityPlayer? = null
2524
private var timer: Timer? = null
2625

2726
private val timerTask: ActionListener = ActionListener {
28-
if (entityplayer != null && mc.thePlayer != null && mc.theWorld != null && scaledResolution != null && partialTicks != null) {
27+
if (entityplayer != null && mc.thePlayer != null && mc.theWorld != null && scaledResolution != null) {
2928
data?.let {
3029
val scaledHeight = scaledResolution!!.scaledHeight
3130
val scaledWidth = scaledResolution!!.scaledWidth
3231
it.hiding = Minecraft.getMinecraft().currentScreen is GuiChat
3332
if (it.hiding) {
34-
it.y = MathUtil.lerp(it.y.toFloat(), scaledHeight.toFloat() + 2, partialTicks!! / 4).toInt()
33+
it.y = MathUtil.lerp(it.y.toFloat(), scaledHeight.toFloat() + 2, mc.timer.renderPartialTicks / 4).toInt()
3534
} else if (it.y != scaledHeight - 21) {
36-
it.y = MathUtil.lerp(it.y.toFloat(), scaledHeight.toFloat() - 22, partialTicks!! / 4).toInt()
35+
it.y = MathUtil.lerp(it.y.toFloat(), scaledHeight.toFloat() - 22, mc.timer.renderPartialTicks / 4).toInt()
3736
}
3837
if (it.lastSlot != entityplayer!!.inventory.currentItem) {
3938
if (scaledWidth / 2 - 91F + entityplayer!!.inventory.currentItem * 20 != it.x) {
4039
it.x = MathUtil.lerp(
4140
it.x,
4241
scaledWidth / 2 - 91F + entityplayer!!.inventory.currentItem * 20,
43-
partialTicks!! / 4
42+
mc.timer.renderPartialTicks / 4
4443
)
4544
} else {
4645
it.lastSlot = entityplayer!!.inventory.currentItem
@@ -69,12 +68,10 @@ object BlackBar {
6968
}
7069

7170
fun render(
72-
res: ScaledResolution,
73-
partialTicks: Float
71+
res: ScaledResolution
7472
) {
7573
data?.let {
7674
scaledResolution = res
77-
BlackBar.partialTicks = partialTicks
7875
entityplayer = mc.renderViewEntity as EntityPlayer
7976
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f)
8077
mc.textureManager.bindTexture(texPath)
@@ -104,6 +101,4 @@ private class BlackBarData @JvmOverloads constructor(
104101
var y: Int,
105102
var hiding: Boolean = false,
106103
var lastSlot: Int = 10
107-
) {
108-
109-
}
104+
)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
public net.minecraft.client.gui.ServerListEntryNormal <init>(Lnet/minecraft/client/gui/GuiMultiplayer;Lnet/minecraft/client/multiplayer/ServerData;)V # constructor
1+
public net.minecraft.client.gui.ServerListEntryNormal <init>(Lnet/minecraft/client/gui/GuiMultiplayer;Lnet/minecraft/client/multiplayer/ServerData;)V # constructor
2+
public net.minecraft.client.Minecraft field_71428_T

0 commit comments

Comments
 (0)