From 5591a7d71210fa51c1610107e16fd243ccc6a493 Mon Sep 17 00:00:00 2001 From: Pug <81167232+MerchantPug@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:51:34 +1100 Subject: [PATCH] Apoli: Fix EdwinMindcraft/origins-architectury#391 --- .../action/bientity/SimpleBiEntityAction.java | 9 +++--- .../data/apoliforge/powers/dismount.json | 32 +++++++++++++++++++ .../data/apoliforge/powers/pick_up.json | 19 +++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 src/test/resources/data/apoliforge/powers/dismount.json create mode 100644 src/test/resources/data/apoliforge/powers/pick_up.json diff --git a/src/main/java/io/github/edwinmindcraft/apoli/common/action/bientity/SimpleBiEntityAction.java b/src/main/java/io/github/edwinmindcraft/apoli/common/action/bientity/SimpleBiEntityAction.java index c02e71ebf..be921fa24 100644 --- a/src/main/java/io/github/edwinmindcraft/apoli/common/action/bientity/SimpleBiEntityAction.java +++ b/src/main/java/io/github/edwinmindcraft/apoli/common/action/bientity/SimpleBiEntityAction.java @@ -2,14 +2,10 @@ import io.github.edwinmindcraft.apoli.api.configuration.NoConfiguration; import io.github.edwinmindcraft.apoli.api.power.factory.BiEntityAction; -import io.github.edwinmindcraft.apoli.common.ApoliCommon; -import io.github.edwinmindcraft.apoli.common.network.S2CPlayerMount; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.TamableAnimal; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; -import net.minecraftforge.network.PacketDistributor; import java.util.function.BiConsumer; @@ -17,9 +13,12 @@ public class SimpleBiEntityAction extends BiEntityAction { public static void mount(Entity actor, Entity target) { actor.startRiding(target, true); - if (!actor.level.isClientSide() && target instanceof ServerPlayer player) { + // The below is unnecessary as the client will execute the above before the server. + /* + if (!actor.level().isClientSide() && target instanceof ServerPlayer player) { ApoliCommon.CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), new S2CPlayerMount(actor.getId(), target.getId())); } + */ } public static void setInLove(Entity actor, Entity target) { diff --git a/src/test/resources/data/apoliforge/powers/dismount.json b/src/test/resources/data/apoliforge/powers/dismount.json new file mode 100644 index 000000000..b26200fc0 --- /dev/null +++ b/src/test/resources/data/apoliforge/powers/dismount.json @@ -0,0 +1,32 @@ +{ + "type": "apoli:active_self", + "cooldown": 1, + "key": { + "key": "key.use", + "continuous": false + }, + "entity_action": { + "type": "apoli:passenger_action", + "bientity_action": { + "type": "apoli:and", + "actions": [ + { + "type": "apoli:actor_action", + "action": { + "type": "apoli:dismount" + } + }, + { + "type": "apoli:target_action", + "action": { + "type": "apoli:swing_hand", + "hand": "MAIN_HAND" + } + } + ] + } + }, + "condition": { + "type": "apoli:sneaking" + } +} \ No newline at end of file diff --git a/src/test/resources/data/apoliforge/powers/pick_up.json b/src/test/resources/data/apoliforge/powers/pick_up.json new file mode 100644 index 000000000..ba00c9b81 --- /dev/null +++ b/src/test/resources/data/apoliforge/powers/pick_up.json @@ -0,0 +1,19 @@ +{ + "type": "apoli:action_on_entity_use", + "bientity_action": { + "type": "apoli:invert", + "action": { + "type": "apoli:mount" + } + }, + "item_condition": { + "type": "apoli:empty" + }, + "hands": [ + "main_hand" + ], + "condition": { + "type": "apoli:sneaking", + "inverted": true + } +} \ No newline at end of file