Commit Graph

91 Commits

Author SHA1 Message Date
Jonas Herzig
a3f4049322 Reduces minimum speed of classic camera controller
Two blocks per second is still quite fast, so this commit reduces the minimum to
a tenth of that, allowing for much finer control.
2022-06-26 12:30:23 +02:00
Jonas Herzig
4f9a730b6d Fix classic camera speed changing way too quickly (fixes #719)
On my system, a single scroll tick results in 120 calls, which is fine for the
vanilla camera controller because it has a range of 2000, but the classic
controller only has a range of 36, making it impossible to select anything but
the extremes.
This commit changes the size of the range to match that of the vanilla controller.
2022-06-26 12:28:07 +02:00
Jonas Herzig
9ce25f711f Port to MC 1.19-pre3 2022-05-27 10:05:50 +02:00
Jonas Herzig
716df74893 Fix first person (cross)bow model animation on 1.9+ (fixes #708) 2022-05-01 21:06:24 +02:00
Jonas Herzig
4aa667fe04 Port to MC 1.18.2 (closes #697) 2022-03-09 07:08:02 +01:00
Jonas Herzig
1b18b5c952 Fix spectator hand jumping when rotating across 0 yaw boundary, take 2
The `yaw` value of non-client-players is constraint to [0; 360), so when that
boundary is crossed, the `renderYaw` starts interpolating to its goal the
incorrect way round (instead of crossing the 360 boundary as well).

To fix that, we now add the difference between the current `renderYaw` and the
desired one, modulo 360 (but with range (-180; 180]), to the current
`renderYaw`. That way we always take the short way round.
Additionally, because for rendering MC looks at the difference without modulo,
afterwards (and when a new `yaw` is set) we wrap the result around such that the
actual difference is always less than 180 and therefore rendered as intended.
2021-12-08 16:04:47 +01:00
Jonas Herzig
51aa07e01e Revert "Fix spectator hand jumping when rotating across 0 yaw boundary" (fixes #601)
This reverts commit 411eaa4ca8.

The given solution does not work in old versions because those did not use
`getYaw` for hand rendering. Even worse, their headYaw does wrap around and it
does it in a different way than their yaw value, giving a worse result than
without this commit.
2021-12-08 16:04:47 +01:00
Jonas Herzig
549996b270 Fix underwater visibility (fixes #572)
Used to always be super short because that method returns 0 when `isSubmergedIn`
returns false.
2021-12-07 13:35:31 +01:00
Jonas Herzig
411eaa4ca8 Fix spectator hand jumping when rotating across 0 yaw boundary
The `yaw` value of non-client-players is constraint to [0; 360), so when that
boundary is crossed, the `renderYaw` starts interpolating to its goal the
incorrect way round (instead of crossing the 360 boundary as well).

Instead we now use the `headYaw` value, which does not wrap around and as such
does not have this issue.
2021-08-21 15:11:55 +02:00
Jonas Herzig
6428416bc4 Fix between-ticks position of hand when spectating (fixes #563) 2021-08-21 15:11:55 +02:00
Jonas Herzig
612a90681e Reset camera inventory when no longer spectating (fixes #546) 2021-08-21 15:11:29 +02:00
Jonas Herzig
1802b1a7d0 Port to 1.17-pre1 2021-06-06 10:42:16 +02:00
Jonas Herzig
cfb9e15b8a Make use of new @Pattern feature to centralize version-aware code
That is, most of the business code should not be aware that it is being compiled
to multiple versions even when it heavily interacts with MC, preprocessor
statements should be an escape hatch, not the norm.
Similarly, code should not be forced to do `MCVer.getWindow(mc)` instead of the
much more intuitive `mc.getWindow()`, and a new preprocessor (technically remap)
feature makes this possible by defining "search and replace"-like patterns (but
smarter in that they are type-aware) in one or more central places (the
"Patterns.java" files) which then are applied all over the code base.

In a way, this is another step in the automatic back-porting process where
preprocessor statements are used when we cannot yet do something automatically.
Previously we "merely" automatically converted between different mapping, this
new feature now also allows us to automatically perform simple refactoring
tasks like changing field access to a getter+setter (e.g. `mc.getWindow()`), or
changing how a method is called (e.g. `BufferBuilder.begin`), or changing a
method call chain (e.g. `dispatcher.camera.getYaw()`), or most other
search-and-replace-like changes and any combination of those.
The only major limitation is that the replacement itself is not smart, so
arguments must be kept in same order (or be temporarily assigned to local
variables which then can be used in any order).
2021-03-14 12:12:51 +01:00
Jonas Herzig
06a46e6f38 Use callback-style events for crosshair and hotbar render events 2021-02-28 09:52:19 +01:00
Jonas Herzig
633bc19650 Use callback-style events throughout all versions
Removes the need for //#if statements on each and every event handler.
Instead we now always use the equivalent Callback and have one central 1.12.2
class which forwards Forge events to the callbacks.
2021-02-23 00:41:22 +01:00
Jonas Herzig
cdb93a1716 Fix spectating via clicking on forge (fixes #432) 2021-02-17 02:55:49 +01:00
Jonas Herzig
ae0b0e3f13 Allow any entity to be spectated on 1.8+ (fixes #382)
Idk why this was restricted in the first place, ask Marius: 163faddd
2021-02-17 01:19:29 +01:00
Jonas Herzig
8f094000fe Fix camera FOV not matching configured FOV
This is because the camera is considered flying which causes MC to increase its
FOV slightly.
2020-11-06 18:54:52 +01:00
Jonas Herzig
9af562957f Merge branch 'stable' into develop 2020-09-27 18:48:54 +02:00
Jonas Herzig
a62100071f Fix camera getting stuck spectating itself (fixes #300)
This bug was introduced when we started to record the login phase because it
contains the UUID of the local player. In the replay case this will be the UUID
of the camera entity but also the one of the recording player, so if the
recording player despawns while it is being spectated (e.g. because of a
backwards jump), then the camera snaps onto itself and gets stuck in place until
one presses Shift.
2020-09-27 14:41:10 +02:00
Jonas Herzig
2c2af8a6a6 Fix outer skin layer when spectating in first person (fixes #363) 2020-09-27 13:11:57 +02:00
Jonas Herzig
3db25abe48 Merge branch 'mc-1.16.3' into develop 2020-09-10 17:34:48 +02:00
Jonas Herzig
efd1cebff3 Update to MC 1.16.3 2020-09-10 17:32:21 +02:00
Jonas Herzig
83690f4024 Refactor key binding registrations to be more easily expandable 2020-09-06 11:45:37 +02:00
Jonas Herzig
c2f51d41fa ./gradlew :1.16.2:setCoreVersion 2020-08-28 14:55:40 +02:00
Jonas Herzig
16c759f1dd Drop lombok, it has been causing too much confusion
Basically the result of the Delombok function, except we use IntelliJ's equals,
hashCode and toString and don't re-organize imports (cause that breaks the
preprocessor) and a bunch of manual cleanup was necessary (and half the classes
weren't even converted).
2020-08-28 14:06:31 +02:00
Jonas Herzig
5bf6773655 Merge remote-tracking branch 'origin/develop' into snapshot 2020-06-28 22:07:49 +02:00
Jonas Herzig
5f284fcd3d Fix spectating when clicking with unlocked cursor (fixes #224)
> If you misclick the add keyframe button or something, you end up specating
instead and you have to find the camera angle again
2020-06-28 21:12:12 +02:00
Jonas Herzig
88be6b3935 Update to 20w22a (minimal mode only) 2020-06-04 13:03:34 +02:00
Jonas Herzig
7c35e1c7d1 Set CameraEntity.noClip depending on spectator state (fixes #136)
This field is used to decide whether or not to render the inside-block overlay,
as such we want it to be set while we're in spectator mode).

This wasn't a problem before 1.15 because we also cancel the renderHand call
while we're in spectator mode and the same method which renders your hand also
renders the overlay, so we were inadvertently canceling that at the same time.
With 1.15, that's still the case except when using OF, which splits the method
apart by adding three boolean arguments indicating which part to execute.
2020-04-16 23:59:00 +02:00
Jonas Herzig
b69cd9fb81 Fix mode of various files
None of these should be executable, I blame Marius.
2020-04-02 00:11:06 +02:00
Jonas Herzig
527562549b Update 1.14.4 yarn 2020-04-02 00:11:02 +02:00
Jonas Herzig
8b7ef8d1e3 1.13 is dead (followup to 8bc0b0a) 2020-03-30 02:52:47 +02:00
Jonas Herzig
af8803d6b5 WIP 1.15 and ReplayStudio v2 update 2020-03-13 14:18:19 +01:00
Jonas Herzig
8bc0b0a4df Update preprocessor and replace 1.13.2 subproject with 1.14.4-forge
The new preprocessor version brings first-party support for fabric, in
particular for automatically fetching mappings loom and for
automatically remapping between MC versions via intermediary mappings.
This will come in handy when updating to 1.15.

It also supports automatic remapping between fabric and forge on the
same MC version (by going mcp<->srg<->mojang<->intermediary<->yarn).
Therefore this commit replaces the previous 1.13.2 (forge) subproject
with a 1.14.4-forge one. Instead of manually providing full mappings for
1.14.4-fabric to 1.13.2-forge and partial (classes) for 1.13.2-forge to
1.12.2-forge, we now only need partial (classes) for 1.12.2-forge to
1.14.4-forge and preprocessor will take care of the forge to fabric
step (in fact, our mapping file for that is currently completely empty).

In an attempt to write an IDE (IntelliJ) plugin for quicker and easier
working with the preprocessor (e.g. immediately mapping single files
from within the IDE, jumping between different versions for the same
file), the preprocessor gradle plugin declaration now requires you to
explicitly specify variables in the common.gradle and the overall
relationship between projects in the build.gradle (latter is required
anyway, so the plugin can know where it should map between forge and
fabric and which subprojects are which versions).
Since that necessitated some changes to the build.gradle file, I took
the opportunity to convert it to Kotlin. As such we now also use
Gradle's newer plugin-block with the pluginManagement-block instead of
manually declaring buildScript (not for the common.gradle though), which
imo is nicer anyway and comes with various advantages (see gradle docs).

There were also some remapping bugs fixed and some new ones
introduced (e.g. manually declared inner class mappings seem to no
longer function properly under certain conditions).
There's also support for remapping Kotlin now. Just saying.
2020-01-12 23:34:10 +01:00
Jonas Herzig
67d7af2dc3 Update to MC 1.14.4 2019-07-19 14:25:42 +02:00
Jonas Herzig
7299ecd0ce Fix main/offhand items of spectated player not being updated 2019-06-30 15:46:52 +02:00
Jonas Herzig
4fe2fee456 Fix constant equip sound when spectating player with head gear in replay 2019-06-30 15:46:09 +02:00
Jonas Herzig
214da6ba59 Update to MC 1.14.3 2019-06-24 18:36:12 +02:00
Jonas Herzig
a840cadfb7 Fix camera event handler staying registered leading to lack of HUD
When unloading the camera without killing it first (e.g. jumping back
in time), the event handler wouldn't ever get unregistered.
2019-06-14 22:09:56 +02:00
Jonas Herzig
560982a14a Fix NPE when replay is closed but camera entity is still being rendered 2019-06-14 14:09:42 +02:00
Jonas Herzig
d89655e69a Remove some more preprocessor statements in favor of remap 2019-05-28 11:25:46 +02:00
Jonas Herzig
05aec482c9 Fix classic camera movement (regression from switching to lwjgl vecs) 2019-05-22 11:04:10 +02:00
Jonas Herzig
e5ee6a3d94 Update to MC 1.14.1
The ReplayStudio update also fixes an issue with reading the
PlayerListEntryPacket leading to NPEs during Quick Mode.
2019-05-20 14:59:31 +02:00
Jonas Herzig
0e086d91a6 Use own event distribution system instead abusing fabric's one 2019-05-20 14:59:13 +02:00
Jonas Herzig
7cbf7f7c94 Switch core to 1.14 (generated via ./gradlew :1.14:setCoreVersion) 2019-05-10 14:09:22 +02:00
Jonas Herzig
2c843f4b45 Fix spectated player hand swinging 2019-05-06 23:31:35 +02:00
Jonas Herzig
bd91d0d3bd Get rid of all the ATs in favor of Mixins 2019-05-06 22:46:21 +02:00
Jonas Herzig
3d009e45c7 Update to MC 1.14 / Fabric 2019-05-04 15:27:03 +02:00
Jonas Herzig
17fe5b345f Replace all ATs with Mixin on 1.13+ in preparation for Fabric 2019-04-26 12:04:33 +02:00