-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
407551b
commit 9b1bdd4
Showing
51 changed files
with
744 additions
and
447 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
10 changes: 0 additions & 10 deletions
10
src/main/java/net/quepierts/simple_animator/core/animation/AnimationState.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/main/java/net/quepierts/simple_animator/core/animation/Interaction.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/java/net/quepierts/simple_animator/core/animation/InteractionHandler.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/java/net/quepierts/simple_animator/core/animation/LerpMode.java
This file was deleted.
Oops, something went wrong.
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
80 changes: 0 additions & 80 deletions
80
src/main/java/net/quepierts/simple_animator/core/client/ClientInteractionHandler.java
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
src/main/java/net/quepierts/simple_animator/core/client/ClientInteractionManager.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,69 @@ | ||
package net.quepierts.simple_animator.core.client; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.phys.Vec3; | ||
import net.quepierts.simple_animator.core.SimpleAnimator; | ||
import net.quepierts.simple_animator.core.common.PlayerUtils; | ||
import net.quepierts.simple_animator.core.common.animation.InteractionManager; | ||
import net.quepierts.simple_animator.core.network.ModNetwork; | ||
import net.quepierts.simple_animator.core.network.packet.InteractAcceptPacket; | ||
import net.quepierts.simple_animator.core.proxy.ClientProxy; | ||
|
||
import java.util.UUID; | ||
|
||
public class ClientInteractionManager extends InteractionManager { | ||
private final ClientProxy client; | ||
|
||
public ClientInteractionManager(ClientProxy clientProxy) { | ||
this.client = clientProxy; | ||
} | ||
|
||
/* | ||
* Receive Invite From Other Player | ||
* */ | ||
@Override | ||
public boolean invite(Player requester, Player receiver, ResourceLocation location) { | ||
return super.invite(requester, receiver, location); | ||
} | ||
|
||
@Override | ||
public boolean accept(Player requester, Player receiver) { | ||
if (receiver == Minecraft.getInstance().player) { | ||
return tryAccept(requester); | ||
} | ||
return super.accept(requester, receiver); | ||
} | ||
|
||
public boolean tryAccept(Player requester) { | ||
SimpleAnimator.LOGGER.info("Try Accept"); | ||
LocalPlayer player = Minecraft.getInstance().player; | ||
assert player != null; | ||
UUID uuid = requester.getUUID(); | ||
|
||
Request request = this.get(uuid); | ||
if (request == null) | ||
return false; | ||
|
||
Vec3 position = PlayerUtils.getRelativePosition(requester, 1, 0); | ||
if (player.distanceToSqr(position) > 0.01) { | ||
client.getNavigator().navigateTo( | ||
requester, 1, 0, | ||
() -> ModNetwork.sendToServer(new InteractAcceptPacket(uuid, Minecraft.getInstance().player.getUUID())) | ||
); | ||
return false; | ||
} | ||
|
||
return super.accept(requester, player); | ||
} | ||
|
||
public boolean requesting() { | ||
return this.exist(Minecraft.getInstance().player.getUUID()); | ||
} | ||
|
||
protected Request getLocalRequest() { | ||
return get(Minecraft.getInstance().player.getUUID()); | ||
} | ||
} |
Oops, something went wrong.