Skip to content

Commit

Permalink
Merge pull request Ladysnake#665 from mrsterner/1.20
Browse files Browse the repository at this point in the history
Bugfixes i find
  • Loading branch information
Pyrofab authored Jun 25, 2024
2 parents 3ac7693 + d36a754 commit 0f5b294
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 8 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions gradle/compat-libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion requiem-api/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ObeliskDescriptor> optionalObeliskDescriptor = controller.getDescriptor();
if (optionalObeliskDescriptor.isPresent()) {
return new RiftScreenHandlerFactory(optionalObeliskDescriptor.get(), controller::canBeUsedBy);
}
}
return null;
}
Expand Down
33 changes: 31 additions & 2 deletions src/main/java/ladysnake/requiem/compat/BewitchmentCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,17 +68,39 @@

public class BewitchmentCompat implements RequiemPlugin {

public static final ComponentKey<TransformationComponent> TRANSFORMATION_KEY = BWComponents.TRANSFORMATION_COMPONENT;

@SuppressWarnings("unchecked")
public static final ComponentKey<ComponentDataHolder<TransformationComponent>> HOLDER_KEY =
ComponentRegistry.getOrCreate(Requiem.id("bewitchment_holder"), ((Class<ComponentDataHolder<TransformationComponent>>) (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);

Expand Down
59 changes: 59 additions & 0 deletions src/main/java/ladysnake/requiem/compat/MalumCompat.java
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses>.
*
* 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<MalumLivingEntityDataComponent> optionalComponent = MalumComponents.MALUM_LIVING_ENTITY_COMPONENT.maybeGet(target);
if (optionalComponent.isPresent() && optionalComponent.get().soulData.soulless) {
return PossessionStartCallback.Result.ALLOW;
}
return PossessionStartCallback.Result.PASS;
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 <T extends Entity> void findEntityType(Identifier id, Consumer<EntityType<T>> action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
],
"inner": "fiery",
"outer": "eldritch",
"ritual_function": "darkrites:decay",
"ritual_function": "requiem:decay",
"cost": 666
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
],
"inner": "fiery",
"outer": "eldritch",
"ritual_function": "darkrites:decay",
"ritual_function": "requiem:decay",
"cost": 666
}

0 comments on commit 0f5b294

Please sign in to comment.