File tree Expand file tree Collapse file tree 4 files changed +47
-10
lines changed
java/com/ishland/c2me/base Expand file tree Collapse file tree 4 files changed +47
-10
lines changed Original file line number Diff line number Diff line change 1+ package com .ishland .c2me .base .common .theinterface ;
2+
3+ public interface PlayerEntityExtension {
4+
5+ void c2me$onForcedLoaded ();
6+
7+ }
Original file line number Diff line number Diff line change 11package com .ishland .c2me .base .mixin .client_movement ;
22
3- import com .ishland .c2me .base .mixin .access .IPlayerEntity ;
4- import com .mojang .authlib .GameProfile ;
5- import net .minecraft .client .network .AbstractClientPlayerEntity ;
3+ import com .ishland .c2me .base .common .theinterface .PlayerEntityExtension ;
4+ import net .minecraft .client .network .ClientPlayNetworkHandler ;
65import net .minecraft .client .network .ClientPlayerEntity ;
7- import net .minecraft .client .world .ClientWorld ;
6+ import net .minecraft .network .packet .c2s .play .PlayerLoadedC2SPacket ;
7+ import org .spongepowered .asm .mixin .Final ;
88import org .spongepowered .asm .mixin .Mixin ;
9+ import org .spongepowered .asm .mixin .Shadow ;
910
1011@ Mixin (ClientPlayerEntity .class )
11- public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity {
12+ public class MixinClientPlayerEntity implements PlayerEntityExtension {
1213
13- public MixinClientPlayerEntity (ClientWorld world , GameProfile profile ) {
14- super (world , profile );
15- }
14+ @ Shadow @ Final public ClientPlayNetworkHandler networkHandler ;
1615
1716 @ Override
18- public boolean isLoaded () {
19- return (( IPlayerEntity ) this ). getLoaded ( );
17+ public void c2me$onForcedLoaded () {
18+ this . networkHandler . sendPacket ( new PlayerLoadedC2SPacket () );
2019 }
2120
2221}
Original file line number Diff line number Diff line change 1+ package com .ishland .c2me .base .mixin .client_movement ;
2+
3+ import com .ishland .c2me .base .common .theinterface .PlayerEntityExtension ;
4+ import net .minecraft .entity .player .PlayerEntity ;
5+ import org .spongepowered .asm .mixin .Mixin ;
6+ import org .spongepowered .asm .mixin .Shadow ;
7+ import org .spongepowered .asm .mixin .injection .At ;
8+ import org .spongepowered .asm .mixin .injection .Inject ;
9+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
10+
11+ @ Mixin (PlayerEntity .class )
12+ public class MixinPlayerEntity implements PlayerEntityExtension {
13+
14+ @ Shadow private boolean loaded ;
15+
16+ @ Shadow protected int remainingLoadTicks ;
17+
18+ @ Override
19+ public void c2me$onForcedLoaded () {
20+ // no-op, intended to be overridden
21+ }
22+
23+ @ Inject (method = "tickLoaded" , at = @ At ("RETURN" ))
24+ private void onForcedLoaded (CallbackInfo ci ) {
25+ if (!this .loaded && this .remainingLoadTicks == 0 ) {
26+ this .c2me$onForcedLoaded ();
27+ }
28+ }
29+
30+ }
Original file line number Diff line number Diff line change 5656 " access.IXoroshiro128PlusPlusRandomDeriver" ,
5757 " access.IXoroshiro128PlusPlusRandomImpl" ,
5858 " access.fapi.IArrayBackedEvent" ,
59+ " client_movement.MixinPlayerEntity" ,
5960 " instrumentation.MixinServerChunkManager" ,
6061 " report.MixinDedicatedServerWatchdog" ,
6162 " scheduler.MixinServerChunkManager" ,
You can’t perform that action at this time.
0 commit comments