-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend BlockWithElementHolder's api, add support for new Fabric APIs …
…networking stuff
- Loading branch information
Showing
16 changed files
with
144 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...n/java/eu/pb4/polymer/core/mixin/compat/fabric/fabricNetworking_ServerPlayNetworking.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package eu.pb4.polymer.core.mixin.compat.fabric; | ||
|
||
import eu.pb4.polymer.common.impl.CommonImplUtils; | ||
import net.fabricmc.fabric.api.networking.v1.FabricPacket; | ||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Coerce; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Pseudo | ||
@Mixin(ServerPlayNetworking.class) | ||
public class fabricNetworking_ServerPlayNetworking { | ||
@Inject( | ||
method = "send(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/fabricmc/fabric/api/networking/v1/FabricPacket;)V", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/fabricmc/fabric/api/networking/v1/FabricPacket;write(Lnet/minecraft/network/PacketByteBuf;)V", | ||
shift = At.Shift.BEFORE | ||
), require = 0 | ||
) | ||
private static void polymerCore$addPlayerContext(ServerPlayerEntity player, @Coerce Object packet, CallbackInfo ci) { | ||
CommonImplUtils.setPlayer(player); | ||
} | ||
|
||
@Inject( | ||
method = "send(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/fabricmc/fabric/api/networking/v1/FabricPacket;)V", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/fabricmc/fabric/api/networking/v1/FabricPacket;write(Lnet/minecraft/network/PacketByteBuf;)V", | ||
shift = At.Shift.AFTER | ||
), require = 0 | ||
) | ||
private static void polymerCore$removePlayerContext(ServerPlayerEntity player, @Coerce Object packet, CallbackInfo ci) { | ||
CommonImplUtils.setPlayer(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 19 additions & 1 deletion
20
...virtual-entity/src/main/java/eu/pb4/polymer/virtualentity/api/BlockWithElementHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
polymer-virtual-entity/src/main/java/eu/pb4/polymer/virtualentity/impl/SimpleUpdateType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package eu.pb4.polymer.virtualentity.impl; | ||
|
||
import eu.pb4.polymer.virtualentity.api.attachment.HolderAttachment; | ||
|
||
public record SimpleUpdateType(String value) implements HolderAttachment.UpdateType { | ||
} |
10 changes: 10 additions & 0 deletions
10
polymer-virtual-entity/src/main/java/eu/pb4/polymer/virtualentity/impl/VoidUpdateType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package eu.pb4.polymer.virtualentity.impl; | ||
|
||
import eu.pb4.polymer.virtualentity.api.attachment.HolderAttachment; | ||
|
||
public record VoidUpdateType() implements HolderAttachment.UpdateType { | ||
@Override | ||
public boolean equals(Object obj) { | ||
return this == obj; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters