Possible fix(es) for accessor crash

- Haven't been able to reproduce
 - Try forcing PausedPartialTickAccessor to load early
 - Try renaming the method
This commit is contained in:
Jozufozu 2021-12-15 15:13:42 -08:00
parent cd4d5d1b72
commit 15ea38ede7
3 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import com.jozufozu.flywheel.core.Contexts;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.StitchedSprite;
import com.jozufozu.flywheel.mixin.PausedPartialTickAccessor;
import com.jozufozu.flywheel.vanilla.VanillaInstances;
import net.minecraftforge.eventbus.api.IEventBus;
@ -26,5 +27,12 @@ public class FlywheelClient {
modEventBus.addListener(StitchedSprite::onTextureStitchPost);
VanillaInstances.init();
// https://github.com/Jozufozu/Flywheel/issues/69
// Weird issue with accessor loading.
// Only thing I've seen that's close to a fix is to force the class to load before trying to use it.
// From the SpongePowered discord:
// https://discord.com/channels/142425412096491520/626802111455297538/675007581168599041
Flywheel.log.info("Successfully loaded {}", PausedPartialTickAccessor.class.getName());
}
}

View File

@ -9,5 +9,5 @@ import net.minecraft.client.Minecraft;
public interface PausedPartialTickAccessor {
@Accessor("pausePartialTick")
float getPausePartialTick();
float flywheel$getPartialTicksPaused();
}

View File

@ -37,6 +37,6 @@ public class AnimationTickHolder {
public static float getPartialTicks() {
Minecraft mc = Minecraft.getInstance();
return (mc.isPaused() ? ((PausedPartialTickAccessor) mc).getPausePartialTick() : mc.getFrameTime());
return (mc.isPaused() ? ((PausedPartialTickAccessor) mc).flywheel$getPartialTicksPaused() : mc.getFrameTime());
}
}