-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: DeltaTimeManager chore: ServerLifecycleHooks todo: player anim
- Loading branch information
Showing
9 changed files
with
1,361 additions
and
15 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
15 changes: 15 additions & 0 deletions
15
src/main/java/mc/duzo/timeless/client/network/ClientNetwork.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,15 @@ | ||
package mc.duzo.timeless.client.network; | ||
|
||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; | ||
|
||
import mc.duzo.timeless.network.s2c.MarkFiveAnimationS2CPacket; | ||
|
||
public class ClientNetwork { | ||
static { | ||
ClientPlayNetworking.registerGlobalReceiver(MarkFiveAnimationS2CPacket.TYPE, MarkFiveAnimationS2CPacket::handle); | ||
} | ||
|
||
public static void init() { | ||
|
||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
src/main/java/mc/duzo/timeless/network/s2c/MarkFiveAnimationS2CPacket.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,47 @@ | ||
package mc.duzo.timeless.network.s2c; | ||
|
||
import java.util.UUID; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.FabricPacket; | ||
import net.fabricmc.fabric.api.networking.v1.PacketSender; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
|
||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.util.Identifier; | ||
|
||
import mc.duzo.timeless.Timeless; | ||
import mc.duzo.timeless.client.animation.player.PlayerAnimationTracker; | ||
import mc.duzo.timeless.client.animation.player.TimelessPlayerAnimations; | ||
import mc.duzo.timeless.client.animation.player.holder.PlayerAnimationHolder; | ||
import mc.duzo.timeless.suit.client.animation.IronManAnimations; | ||
import mc.duzo.timeless.suit.client.animation.SuitAnimationHolder; | ||
import mc.duzo.timeless.suit.client.animation.SuitAnimationTracker; | ||
|
||
public record MarkFiveAnimationS2CPacket(UUID player, boolean isPuttingOn) implements FabricPacket { | ||
public static final PacketType<MarkFiveAnimationS2CPacket> TYPE = PacketType.create(new Identifier(Timeless.MOD_ID, "mark_five_animation"), MarkFiveAnimationS2CPacket::new); | ||
|
||
public MarkFiveAnimationS2CPacket(PacketByteBuf buf) { | ||
this(buf.readUuid(), buf.readBoolean()); | ||
} | ||
@Override | ||
public void write(PacketByteBuf buf) { | ||
buf.writeUuid(player); | ||
buf.writeBoolean(isPuttingOn); | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return TYPE; | ||
} | ||
|
||
public void handle(ClientPlayerEntity client, PacketSender sender) { | ||
SuitAnimationHolder suit = (isPuttingOn) ? new SuitAnimationHolder(IronManAnimations.MK5_CASE_OPEN, true, false) : new SuitAnimationHolder(IronManAnimations.MK5_CASE_CLOSE, true, false); | ||
SuitAnimationTracker.addAnimation(player, suit); | ||
|
||
if (!isPuttingOn) return; // todo - close anim for player | ||
|
||
PlayerAnimationHolder anim = new PlayerAnimationHolder(TimelessPlayerAnimations.MK5_CASE_OPEN); | ||
PlayerAnimationTracker.addAnimation(player, anim); | ||
} | ||
} |
Oops, something went wrong.