Commit aa74fddfcd090d0c979abee06451ce6d69e34b0c
1 parent
655d8a93
Obtain renderPartialTicks via mixin
Showing
2 changed files
with
7 additions
and
24 deletions
src/client/java/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
| @@ -9,24 +9,9 @@ import org.lwjgl.input.Mouse; | @@ -9,24 +9,9 @@ import org.lwjgl.input.Mouse; | ||
| 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
| 11 | 11 | ||
| 12 | -import com.mumfrey.liteloader.ChatRenderListener; | ||
| 13 | -import com.mumfrey.liteloader.EntityRenderListener; | ||
| 14 | -import com.mumfrey.liteloader.FrameBufferListener; | ||
| 15 | -import com.mumfrey.liteloader.GameLoopListener; | ||
| 16 | -import com.mumfrey.liteloader.HUDRenderListener; | ||
| 17 | -import com.mumfrey.liteloader.InitCompleteListener; | ||
| 18 | -import com.mumfrey.liteloader.OutboundChatFilter; | ||
| 19 | -import com.mumfrey.liteloader.OutboundChatListener; | ||
| 20 | -import com.mumfrey.liteloader.PlayerClickListener; | 12 | +import com.mumfrey.liteloader.*; |
| 21 | import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton; | 13 | import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton; |
| 22 | -import com.mumfrey.liteloader.PostRenderListener; | ||
| 23 | -import com.mumfrey.liteloader.PreRenderListener; | ||
| 24 | -import com.mumfrey.liteloader.RenderListener; | ||
| 25 | -import com.mumfrey.liteloader.ScreenshotListener; | ||
| 26 | -import com.mumfrey.liteloader.Tickable; | ||
| 27 | -import com.mumfrey.liteloader.ViewportListener; | ||
| 28 | import com.mumfrey.liteloader.client.overlays.IEntityRenderer; | 14 | import com.mumfrey.liteloader.client.overlays.IEntityRenderer; |
| 29 | -import com.mumfrey.liteloader.client.overlays.IMinecraft; | ||
| 30 | import com.mumfrey.liteloader.common.LoadingProgress; | 15 | import com.mumfrey.liteloader.common.LoadingProgress; |
| 31 | import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate; | 16 | import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate; |
| 32 | import com.mumfrey.liteloader.core.LiteLoader; | 17 | import com.mumfrey.liteloader.core.LiteLoader; |
| @@ -51,7 +36,6 @@ import net.minecraft.client.shader.Framebuffer; | @@ -51,7 +36,6 @@ import net.minecraft.client.shader.Framebuffer; | ||
| 51 | import net.minecraft.entity.Entity; | 36 | import net.minecraft.entity.Entity; |
| 52 | import net.minecraft.network.play.client.CPacketChatMessage; | 37 | import net.minecraft.network.play.client.CPacketChatMessage; |
| 53 | import net.minecraft.server.integrated.IntegratedServer; | 38 | import net.minecraft.server.integrated.IntegratedServer; |
| 54 | -import net.minecraft.util.Timer; | ||
| 55 | import net.minecraft.util.text.ITextComponent; | 39 | import net.minecraft.util.text.ITextComponent; |
| 56 | 40 | ||
| 57 | public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener | 41 | public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener |
| @@ -427,14 +411,9 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | @@ -427,14 +411,9 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | ||
| 427 | /** | 411 | /** |
| 428 | * Callback from the tick hook, ticks all tickable mods | 412 | * Callback from the tick hook, ticks all tickable mods |
| 429 | */ | 413 | */ |
| 430 | - public void onTick() | 414 | + public void onTick(boolean clock, float partialTicks) |
| 431 | { | 415 | { |
| 432 | this.profiler.endStartSection("litemods"); | 416 | this.profiler.endStartSection("litemods"); |
| 433 | - | ||
| 434 | - Timer minecraftTimer = ((IMinecraft)this.engine.getClient()).getTimer(); | ||
| 435 | - float partialTicks = minecraftTimer.field_194147_b; // TODO propagate | ||
| 436 | - boolean clock = minecraftTimer.elapsedTicks > 0; | ||
| 437 | - | ||
| 438 | Minecraft minecraft = this.engine.getClient(); | 417 | Minecraft minecraft = this.engine.getClient(); |
| 439 | 418 | ||
| 440 | // Flag indicates whether we are in game at the moment | 419 | // Flag indicates whether we are in game at the moment |
src/client/java/com/mumfrey/liteloader/client/mixin/MixinMinecraft.java
| @@ -35,6 +35,8 @@ public abstract class MixinMinecraft implements IMinecraft | @@ -35,6 +35,8 @@ public abstract class MixinMinecraft implements IMinecraft | ||
| 35 | @Shadow @Final private List<IResourcePack> defaultResourcePacks; | 35 | @Shadow @Final private List<IResourcePack> defaultResourcePacks; |
| 36 | @Shadow private String serverName; | 36 | @Shadow private String serverName; |
| 37 | @Shadow private int serverPort; | 37 | @Shadow private int serverPort; |
| 38 | + @Shadow private boolean isGamePaused; | ||
| 39 | + @Shadow private float field_193996_ah; | ||
| 38 | 40 | ||
| 39 | @Shadow abstract void resize(int width, int height); | 41 | @Shadow abstract void resize(int width, int height); |
| 40 | @Shadow private void clickMouse() {} | 42 | @Shadow private void clickMouse() {} |
| @@ -79,7 +81,9 @@ public abstract class MixinMinecraft implements IMinecraft | @@ -79,7 +81,9 @@ public abstract class MixinMinecraft implements IMinecraft | ||
| 79 | )) | 81 | )) |
| 80 | private void onTick(CallbackInfo ci) | 82 | private void onTick(CallbackInfo ci) |
| 81 | { | 83 | { |
| 82 | - this.broker.onTick(); | 84 | + boolean clock = this.timer.elapsedTicks > 0; |
| 85 | + float partialTicks = this.isGamePaused ? this.field_193996_ah : this.timer.field_194147_b; | ||
| 86 | + this.broker.onTick(clock, partialTicks); | ||
| 83 | } | 87 | } |
| 84 | 88 | ||
| 85 | @Redirect(method = "runGameLoop()V", at = @At( | 89 | @Redirect(method = "runGameLoop()V", at = @At( |