From 95e4e52a287289d68ebe5ac6d2ce878084b618fc Mon Sep 17 00:00:00 2001 From: LtxPgm Date: Thu, 28 Nov 2024 09:58:54 -0600 Subject: [PATCH] Removed unused TF variant tags, added temporary_only tag, overrides changed:keepForm allowing to escape soft-banning forms. --- .../client/LocalTransfurVariantInstance.java | 2 +- .../changed/init/ChangedTags.java | 6 +----- .../mixin/entity/ServerPlayerMixin.java | 6 ++++++ .../tags/changed/latex_variant/cat_like.json | 7 ------- .../changed/latex_variant/leopard_like.json | 9 -------- .../changed/latex_variant/shark_like.json | 12 ----------- .../changed/latex_variant/temporary_only.json | 6 ++++++ .../tags/changed/latex_variant/wolf_like.json | 21 ------------------- 8 files changed, 14 insertions(+), 55 deletions(-) delete mode 100644 src/main/resources/data/changed/tags/changed/latex_variant/cat_like.json delete mode 100644 src/main/resources/data/changed/tags/changed/latex_variant/leopard_like.json delete mode 100644 src/main/resources/data/changed/tags/changed/latex_variant/shark_like.json create mode 100644 src/main/resources/data/changed/tags/changed/latex_variant/temporary_only.json delete mode 100644 src/main/resources/data/changed/tags/changed/latex_variant/wolf_like.json diff --git a/src/main/java/net/ltxprogrammer/changed/client/LocalTransfurVariantInstance.java b/src/main/java/net/ltxprogrammer/changed/client/LocalTransfurVariantInstance.java index 4c2d1c743..1cc26a77f 100644 --- a/src/main/java/net/ltxprogrammer/changed/client/LocalTransfurVariantInstance.java +++ b/src/main/java/net/ltxprogrammer/changed/client/LocalTransfurVariantInstance.java @@ -19,7 +19,7 @@ public LocalTransfurVariantInstance(TransfurVariant parent, LocalPlayer host) protected void tickTransfurProgress() { super.tickTransfurProgress(); - if (transfurProgression < 1f || this.ageAsVariant < 30) { + if (transfurProgression < 1f || this.ageAsVariant < 30 || !this.getItemUseMode().holdMainHand) { ((LocalPlayerAccessor)host).setHandsBusy(true); } else if (host.getVehicle() == null && host.isHandsBusy()) { ((LocalPlayerAccessor)host).setHandsBusy(false); diff --git a/src/main/java/net/ltxprogrammer/changed/init/ChangedTags.java b/src/main/java/net/ltxprogrammer/changed/init/ChangedTags.java index 1a0f227ba..82e7d7f4f 100644 --- a/src/main/java/net/ltxprogrammer/changed/init/ChangedTags.java +++ b/src/main/java/net/ltxprogrammer/changed/init/ChangedTags.java @@ -78,13 +78,9 @@ private static TagKey create(String name) { } public static class TransfurVariants { - public static final TagKey> WOLF_LIKE = create("wolf_like"); - public static final TagKey> SHARK_LIKE = create("shark_like"); - public static final TagKey> CAT_LIKE = create("cat_like"); - public static final TagKey> LEOPARD_LIKE = create("leopard_like"); - public static final TagKey> CAN_SLEEP_ON_PILLOWS = create("can_sleep_on_pillows"); public static final TagKey> BREAK_ITEMS_ON_TF = create("break_items_on_tf"); + public static final TagKey> TEMPORARY_ONLY = create("temporary_only"); private static TagKey> create(String name) { return TagKey.create(ChangedRegistry.TRANSFUR_VARIANT.key, Changed.modResource(name)); diff --git a/src/main/java/net/ltxprogrammer/changed/mixin/entity/ServerPlayerMixin.java b/src/main/java/net/ltxprogrammer/changed/mixin/entity/ServerPlayerMixin.java index 4049261c2..addb81c11 100644 --- a/src/main/java/net/ltxprogrammer/changed/mixin/entity/ServerPlayerMixin.java +++ b/src/main/java/net/ltxprogrammer/changed/mixin/entity/ServerPlayerMixin.java @@ -4,10 +4,12 @@ import net.ltxprogrammer.changed.Changed; import net.ltxprogrammer.changed.entity.PlayerDataExtension; import net.ltxprogrammer.changed.entity.TransfurCause; +import net.ltxprogrammer.changed.entity.UseItemMode; import net.ltxprogrammer.changed.entity.variant.TransfurVariant; import net.ltxprogrammer.changed.entity.variant.TransfurVariantInstance; import net.ltxprogrammer.changed.init.ChangedGameRules; import net.ltxprogrammer.changed.init.ChangedRegistry; +import net.ltxprogrammer.changed.init.ChangedTags; import net.ltxprogrammer.changed.init.ChangedTransfurVariants; import net.ltxprogrammer.changed.network.packet.MountTransfurPacket; import net.ltxprogrammer.changed.process.Pale; @@ -49,8 +51,12 @@ public void restoreFrom(ServerPlayer player, boolean restore, CallbackInfo callb ProcessTransfur.ifPlayerTransfurred(player, oldVariant -> { if (!oldVariant.willSurviveTransfur) return; + if (!restore && oldVariant.getParent().is(ChangedTags.TransfurVariants.TEMPORARY_ONLY)) + return; // Exception to keepForm gamerule var newVariant = ProcessTransfur.setPlayerTransfurVariant(self, oldVariant.getParent(), oldVariant.transfurContext, oldVariant.transfurProgression); + if (newVariant == null) + return; newVariant.load(oldVariant.save()); newVariant.getChangedEntity().readPlayerVariantData(oldVariant.getChangedEntity().savePlayerVariantData()); newVariant.handleRespawn(); diff --git a/src/main/resources/data/changed/tags/changed/latex_variant/cat_like.json b/src/main/resources/data/changed/tags/changed/latex_variant/cat_like.json deleted file mode 100644 index 9edc3ca53..000000000 --- a/src/main/resources/data/changed/tags/changed/latex_variant/cat_like.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "replace": false, - "values": [ - "changed:form_latex_hypno_cat", - "changed:form_latex_watermelon_cat" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/changed/tags/changed/latex_variant/leopard_like.json b/src/main/resources/data/changed/tags/changed/latex_variant/leopard_like.json deleted file mode 100644 index 58db8051e..000000000 --- a/src/main/resources/data/changed/tags/changed/latex_variant/leopard_like.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "replace": false, - "values": [ - "changed:form_latex_snow_leopard/male", - "changed:form_latex_snow_leopard/female", - "changed:form_latex_raccoon", - "changed:form_latex_red_panda" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/changed/tags/changed/latex_variant/shark_like.json b/src/main/resources/data/changed/tags/changed/latex_variant/shark_like.json deleted file mode 100644 index 3748c160a..000000000 --- a/src/main/resources/data/changed/tags/changed/latex_variant/shark_like.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "replace": false, - "values": [ - "changed:form_latex_shark", - "changed:form_latex_shark/male", - "changed:form_latex_shark/female", - "changed:form_latex_tiger_shark", - "changed:form_latex_orca", - "changed:form_latex_manta_ray/male", - "changed:form_latex_manta_ray/female" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/changed/tags/changed/latex_variant/temporary_only.json b/src/main/resources/data/changed/tags/changed/latex_variant/temporary_only.json new file mode 100644 index 000000000..06b4df67a --- /dev/null +++ b/src/main/resources/data/changed/tags/changed/latex_variant/temporary_only.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "changed:form_latex_benign_wolf" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/changed/tags/changed/latex_variant/wolf_like.json b/src/main/resources/data/changed/tags/changed/latex_variant/wolf_like.json deleted file mode 100644 index 3ff90c0d2..000000000 --- a/src/main/resources/data/changed/tags/changed/latex_variant/wolf_like.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "replace": false, - "values": [ - "changed:form_latex_keon_wolf", - "changed:form_dark_latex_wolf/male", - "changed:form_dark_latex_wolf/female", - "changed:form_white_latex_wolf/male", - "changed:form_white_latex_wolf/female", - "changed:form_latex_blue_wolf", - "changed:form_gas_wolf", - "changed:form_latex_purple_fox", - "changed:form_crystal_wolf", - "changed:form_crystal_wolf_horned", - "changed:form_sniper_dog", - "changed:form_latex_squid_dog/male", - "changed:form_latex_squid_dog/female", - "changed:form_latex_benign_wolf", - "changed:form_white_wolf/male", - "changed:form_white_wolf/female" - ] -} \ No newline at end of file