-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
28 additions
and
2 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
14 changes: 14 additions & 0 deletions
14
src/main/java/elocindev/shield_overhaul/networking/ShieldBashAnimationS2CPacket.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,14 @@ | ||
package elocindev.shield_overhaul.networking; | ||
|
||
import elocindev.shield_overhaul.util.ShieldAnimationUtils; | ||
import net.fabricmc.fabric.api.networking.v1.PacketSender; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.network.ClientPlayNetworkHandler; | ||
import net.minecraft.network.PacketByteBuf; | ||
|
||
public class ShieldBashAnimationS2CPacket { | ||
public static void receive(MinecraftClient client, ClientPlayNetworkHandler handler, | ||
PacketByteBuf buf, PacketSender responseSender) { | ||
ShieldAnimationUtils.playShieldBashAnimation(client.player); | ||
} | ||
} |
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
9 changes: 8 additions & 1 deletion
9
src/main/java/elocindev/shield_overhaul/registry/PacketRegistry.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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
package elocindev.shield_overhaul.registry; | ||
|
||
import elocindev.shield_overhaul.ShieldOverhaul; | ||
import elocindev.shield_overhaul.networking.ShieldBashAnimationS2CPacket; | ||
import elocindev.shield_overhaul.networking.ShieldBashC2SPacket; | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; | ||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class PacketRegistry { | ||
public static final Identifier SHIELD_BASH_PACKET = new Identifier(ShieldOverhaul.MODID, ""); | ||
public static final Identifier SHIELD_BASH_PACKET = new Identifier(ShieldOverhaul.MODID, "shield_bash_packet"); | ||
public static final Identifier SHIELD_BASH_ANIMATION_PACKET = new Identifier(ShieldOverhaul.MODID, "shield_bash_animation_packet"); | ||
|
||
public static void registerC2SPackets() { | ||
ServerPlayNetworking.registerGlobalReceiver(SHIELD_BASH_PACKET, ShieldBashC2SPacket::receive); | ||
} | ||
|
||
public static void registerS2CPackets() { | ||
ClientPlayNetworking.registerGlobalReceiver(SHIELD_BASH_ANIMATION_PACKET, ShieldBashAnimationS2CPacket::receive); | ||
} | ||
} |