diff --git a/build.gradle b/build.gradle index e4e5fa747..a09f22208 100644 --- a/build.gradle +++ b/build.gradle @@ -203,8 +203,9 @@ dependencies { modCompileOnly (compatLibs.bumblezone) { transitive = false } // modLocalRuntime compatLibs.bumblezone modCompileOnly (compatLibs.bewitchment) { transitive = false } - modLocalRuntime (compatLibs.bundles.bewitchment) { transitive = false } +// modLocalRuntime (compatLibs.bundles.bewitchment) { transitive = false } // modApi("com.github.Virtuoel:Pehkui:${compatLibs.pehkui}") + modCompileOnly (compatLibs.malum) { transitive = false } modLocalImplementation (compatLibs.trinkets) { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" diff --git a/gradle/compat-libs.versions.toml b/gradle/compat-libs.versions.toml index 929f8738f..63061d180 100644 --- a/gradle/compat-libs.versions.toml +++ b/gradle/compat-libs.versions.toml @@ -17,6 +17,7 @@ flk = "1.6.0+kotlin.1.5.0" golemsGalore = "3328376" # v1.0.0+mc1.17 kano="0.4.1" libgui = "3.3.5+1.16.5" +malum="5441759" midnightlib="1.4.1-fabric" mobz = "3498091" omegaConfig = "1.2.1-1.18.1" @@ -44,6 +45,7 @@ eldritchMobs = { group = "maven.modrinth", name = "eldritch-mobs", version.re flk = { group = "net.fabricmc", name = "fabric-language-kotlin", version.ref = "flk" } golemsGalore = { group = "curse.maven", name = "golems-galore-387197", version.ref = "golemsGalore" } libgui = { group = "io.github.cottonmc", name = "LibGui", version.ref = "libgui" } +malum = { group = "curse.maven", name = "malum-484064", version.ref = "malum"} midnightlib = { module = "maven.modrinth:midnightlib", version.ref = "midnightlib"} mobz = { group = "curse.maven", name = "mobz-336554", version.ref = "mobz" } omegaConfig = { group = "com.github.Draylar.omega-config", name = "omega-config-base", version.ref = "omegaConfig" } diff --git a/requiem-api/src/main/resources/quilt.mod.json b/requiem-api/src/main/resources/quilt.mod.json index 269077af7..28d49ceed 100644 --- a/requiem-api/src/main/resources/quilt.mod.json +++ b/requiem-api/src/main/resources/quilt.mod.json @@ -48,7 +48,7 @@ "requiem:wololo", "requiem:origin_holder", "requiem:apoli_power_holder", - "requiem:haema_holder", + "requiem:bewitchment_holder", "requiem:attrition_focus", "requiem:effect_reapplicator", "requiem:curable", diff --git a/requiem-core/src/main/java/ladysnake/requiem/core/mixin/possession/possessed/PossessableLivingEntityMixin.java b/requiem-core/src/main/java/ladysnake/requiem/core/mixin/possession/possessed/PossessableLivingEntityMixin.java index a0f241f76..4f18c0e30 100644 --- a/requiem-core/src/main/java/ladysnake/requiem/core/mixin/possession/possessed/PossessableLivingEntityMixin.java +++ b/requiem-core/src/main/java/ladysnake/requiem/core/mixin/possession/possessed/PossessableLivingEntityMixin.java @@ -258,7 +258,7 @@ private void afterTravel(CallbackInfo ci) { this.setPosition(player.getX(), player.getY(), player.getZ()); // TODO update limb movement - this.limbData = player.limbData; +// this.limbData = player.limbData; // this.limbData.limbAngle = player.limbData.getLimbAngle(0); // this.limbData.setLimbDistance(player.limbData.getLimbDistance()); this.horizontalCollision = player.horizontalCollision; diff --git a/src/main/java/ladysnake/requiem/common/block/obelisk/RiftRunestoneBlock.java b/src/main/java/ladysnake/requiem/common/block/obelisk/RiftRunestoneBlock.java index 46914c01f..65c8b1ccf 100644 --- a/src/main/java/ladysnake/requiem/common/block/obelisk/RiftRunestoneBlock.java +++ b/src/main/java/ladysnake/requiem/common/block/obelisk/RiftRunestoneBlock.java @@ -35,6 +35,7 @@ package ladysnake.requiem.common.block.obelisk; import ladysnake.requiem.Requiem; +import ladysnake.requiem.api.v1.block.ObeliskDescriptor; import ladysnake.requiem.api.v1.block.ObeliskRune; import ladysnake.requiem.api.v1.block.VagrantTargetableBlock; import ladysnake.requiem.api.v1.remnant.RemnantComponent; @@ -103,7 +104,10 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt @Override public @Nullable NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) { if (world.getBlockEntity(pos) instanceof RunestoneBlockEntity controller) { - return new RiftScreenHandlerFactory(controller.getDescriptor().orElseThrow(), controller::canBeUsedBy); + Optional optionalObeliskDescriptor = controller.getDescriptor(); + if (optionalObeliskDescriptor.isPresent()) { + return new RiftScreenHandlerFactory(optionalObeliskDescriptor.get(), controller::canBeUsedBy); + } } return null; } diff --git a/src/main/java/ladysnake/requiem/compat/BewitchmentCompat.java b/src/main/java/ladysnake/requiem/compat/BewitchmentCompat.java index b1247c6c4..a87945218 100644 --- a/src/main/java/ladysnake/requiem/compat/BewitchmentCompat.java +++ b/src/main/java/ladysnake/requiem/compat/BewitchmentCompat.java @@ -34,17 +34,24 @@ */ package ladysnake.requiem.compat; +import dev.onyxstudios.cca.api.v3.component.ComponentKey; +import dev.onyxstudios.cca.api.v3.component.ComponentRegistry; +import ladysnake.requiem.Requiem; import ladysnake.requiem.api.v1.RequiemApi; import ladysnake.requiem.api.v1.RequiemPlayer; import ladysnake.requiem.api.v1.RequiemPlugin; import ladysnake.requiem.api.v1.annotation.CalledThroughReflection; import ladysnake.requiem.api.v1.event.requiem.PossessionStartCallback; +import ladysnake.requiem.api.v1.event.requiem.RemnantStateChangeCallback; import ladysnake.requiem.api.v1.remnant.RemnantComponent; import moriyashiine.bewitchment.api.BewitchmentAPI; +import moriyashiine.bewitchment.api.component.TransformationComponent; import moriyashiine.bewitchment.api.registry.RitualFunction; +import moriyashiine.bewitchment.api.registry.Transformation; import moriyashiine.bewitchment.common.item.TaglockItem; import moriyashiine.bewitchment.common.registry.BWComponents; import moriyashiine.bewitchment.common.registry.BWRegistries; +import moriyashiine.bewitchment.common.registry.BWTransformations; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.MobEntity; @@ -61,17 +68,39 @@ public class BewitchmentCompat implements RequiemPlugin { + public static final ComponentKey TRANSFORMATION_KEY = BWComponents.TRANSFORMATION_COMPONENT; + + @SuppressWarnings("unchecked") + public static final ComponentKey> HOLDER_KEY = + ComponentRegistry.getOrCreate(Requiem.id("bewitchment_holder"), ((Class>) (Class) ComponentDataHolder.class)); + public static final RitualFunction DECAY = new DecayRitualFunction(); @CalledThroughReflection public static void init() { RequiemApi.registerPlugin(new BewitchmentCompat()); - Registry.register(BWRegistries.RITUAL_FUNCTION, new Identifier("dark_rites", "decay"), DECAY); + Registry.register(BWRegistries.RITUAL_FUNCTION, new Identifier("requiem", "decay"), DECAY); + + RemnantStateChangeCallback.EVENT.register((player, state, cause) -> { + if (!player.getWorld().isClient) { + if (state.isVagrant()) { + HOLDER_KEY.get(player).storeDataFrom(player, !cause.isCharacterSwitch()); + TransformationComponent transformationComponent = TRANSFORMATION_KEY.get(player); + + transformationComponent.setTransformation(BWTransformations.HUMAN); + } else if (!cause.isCharacterSwitch()) { + HOLDER_KEY.get(player).restoreDataToPlayer(player, true); + } + + TRANSFORMATION_KEY.sync(player); + } + }); + RequiemCompatibilityManager.registerShellDataCallbacks(BewitchmentCompat.HOLDER_KEY); } @Override public void onRequiemInitialize() { - PossessionStartCallback.EVENT.register(new Identifier("dark_rites", "allow_familiars"), (target, possessor, simulate) -> { + PossessionStartCallback.EVENT.register(new Identifier("requiem", "allow_familiars"), (target, possessor, simulate) -> { NbtCompound entityTag = new NbtCompound(); target.saveSelfNbt(entityTag); diff --git a/src/main/java/ladysnake/requiem/compat/MalumCompat.java b/src/main/java/ladysnake/requiem/compat/MalumCompat.java new file mode 100644 index 000000000..a79d08cbf --- /dev/null +++ b/src/main/java/ladysnake/requiem/compat/MalumCompat.java @@ -0,0 +1,59 @@ +/* + * Requiem + * Copyright (C) 2017-2024 Ladysnake + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Linking this mod statically or dynamically with other + * modules is making a combined work based on this mod. + * Thus, the terms and conditions of the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holders of + * this mod give you permission to combine this mod + * with free software programs or libraries that are released under the GNU LGPL + * and with code included in the standard release of Minecraft under All Rights Reserved (or + * modified versions of such code, with unchanged license). + * You may copy and distribute such a system following the terms of the GNU GPL for this mod + * and the licenses of the other code concerned. + * + * Note that people who make modified versions of this mod are not obligated to grant + * this special exception for their modified versions; it is their choice whether to do so. + * The GNU General Public License gives permission to release a modified version without this exception; + * this exception also makes it possible to release a modified version which carries forward this exception. + */ +package ladysnake.requiem.compat; + +import com.sammy.malum.MalumMod; +import com.sammy.malum.common.components.MalumComponents; +import com.sammy.malum.common.components.MalumLivingEntityDataComponent; +import ladysnake.requiem.api.v1.RequiemPlugin; +import ladysnake.requiem.api.v1.annotation.CalledThroughReflection; +import ladysnake.requiem.api.v1.event.requiem.PossessionStartCallback; + +import java.util.Optional; + +public class MalumCompat implements RequiemPlugin { + + @CalledThroughReflection + public static void init() { + PossessionStartCallback.EVENT.register(MalumMod.malumPath("soulless"), (target, possessor, simulate) -> { + Optional optionalComponent = MalumComponents.MALUM_LIVING_ENTITY_COMPONENT.maybeGet(target); + if (optionalComponent.isPresent() && optionalComponent.get().soulData.soulless) { + return PossessionStartCallback.Result.ALLOW; + } + return PossessionStartCallback.Result.PASS; + }); + + } +} diff --git a/src/main/java/ladysnake/requiem/compat/RequiemCompatibilityManager.java b/src/main/java/ladysnake/requiem/compat/RequiemCompatibilityManager.java index e6c016afc..f45ae8f67 100644 --- a/src/main/java/ladysnake/requiem/compat/RequiemCompatibilityManager.java +++ b/src/main/java/ladysnake/requiem/compat/RequiemCompatibilityManager.java @@ -61,6 +61,7 @@ public static void init() { load("golemsgalore", GolemsGaloreCompat.class); // Haema must be loaded before Origins, because vampire data must be stored before the origin gets cleared load("bewitchment", BewitchmentCompat.class); + load("malum", MalumCompat.class); load("origins", OriginsCompat.class); load("snowmercy", SnowMercyCompat.class); load("the_bumblezone", BumblezoneCompat.class); @@ -87,6 +88,10 @@ public static void registerEntityComponentFactories(EntityComponentFactoryRegist registry.beginRegistration(PlayerShellEntity.class, OriginsCompat.APOLI_HOLDER_KEY).end(shell -> new ComponentDataHolder<>(OriginsCompat.APOLI_POWER_KEY, OriginsCompat.APOLI_HOLDER_KEY)); registry.beginRegistration(PlayerShellEntity.class, OriginsCompat.ORIGIN_HOLDER_KEY).after(OriginsCompat.APOLI_HOLDER_KEY).end(shell -> new OriginsCompat.OriginDataHolder(OriginsCompat.ORIGIN_KEY, OriginsCompat.ORIGIN_HOLDER_KEY)); } + if (QuiltLoader.isModLoaded("bewitchment")) { + registry.registerForPlayers(BewitchmentCompat.HOLDER_KEY, p -> new ComponentDataHolder<>(BewitchmentCompat.TRANSFORMATION_KEY, BewitchmentCompat.HOLDER_KEY), RespawnCopyStrategy.ALWAYS_COPY); + registry.registerFor(PlayerShellEntity.class, BewitchmentCompat.HOLDER_KEY, shell -> new ComponentDataHolder<>(BewitchmentCompat.TRANSFORMATION_KEY, BewitchmentCompat.HOLDER_KEY)); + } } static void findEntityType(Identifier id, Consumer> action) { diff --git a/src/main/resources/data/requiem/recipes/ritual/decay_skeleton.json b/src/main/resources/data/requiem/recipes/ritual/decay_skeleton.json index 3a7d2caf3..7b63ede23 100644 --- a/src/main/resources/data/requiem/recipes/ritual/decay_skeleton.json +++ b/src/main/resources/data/requiem/recipes/ritual/decay_skeleton.json @@ -16,6 +16,6 @@ ], "inner": "fiery", "outer": "eldritch", - "ritual_function": "darkrites:decay", + "ritual_function": "requiem:decay", "cost": 666 } diff --git a/src/main/resources/data/requiem/recipes/ritual/decay_zombie.json b/src/main/resources/data/requiem/recipes/ritual/decay_zombie.json index 0cbf641d2..d87a2c15f 100644 --- a/src/main/resources/data/requiem/recipes/ritual/decay_zombie.json +++ b/src/main/resources/data/requiem/recipes/ritual/decay_zombie.json @@ -16,6 +16,6 @@ ], "inner": "fiery", "outer": "eldritch", - "ritual_function": "darkrites:decay", + "ritual_function": "requiem:decay", "cost": 666 }