diff --git a/project/hexic/build.gradle.kts b/project/hexic/build.gradle.kts index 58fa9a1..f51915f 100644 --- a/project/hexic/build.gradle.kts +++ b/project/hexic/build.gradle.kts @@ -235,6 +235,7 @@ tasks.processResources { depends("trinkets", "^3.7.2") depends("phlib", ">=0.1.2 <0.2.0") conflicts("valkyrienskies", "*") // need to figure out how to create dimensions without causing a crash + breaks("java", ">=26") entrypoint("org.eu.net.pool.hexic.main\$package::init") entrypoint("org.eu.net.pool.hexic.client\$package::init", Environment.Client) diff --git a/project/hexic/src/main/resources/hexic.mixins.json b/project/hexic/src/main/resources/hexic.mixins.json index 5d520f0..e98f5e0 100644 --- a/project/hexic/src/main/resources/hexic.mixins.json +++ b/project/hexic/src/main/resources/hexic.mixins.json @@ -21,6 +21,7 @@ "LivingEntityMixin", "MediafiedItemManagerIndexMixin", "OpDimTeleport$SpellMixin", + "OpDimTeleportMixin", "OpEdifySaplingMixin", "OpEdifySaplingMixin$Spell", "OpObservePropertyMixin", @@ -30,6 +31,7 @@ "PacketByteBufMixin", "PlayerInventoryMixin", "SimpleRegistryMixin", + "SpellAction$ResultAccessor", "StaffCastEnvMixin", "WorldMixin" ], diff --git a/project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/OpDimTeleportMixin.java b/project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/OpDimTeleportMixin.java new file mode 100644 index 0000000..81ade51 --- /dev/null +++ b/project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/OpDimTeleportMixin.java @@ -0,0 +1,27 @@ +package org.eu.net.pool.hexic.mixin; + +import at.petrak.hexcasting.api.casting.castables.SpellAction; +import at.petrak.hexcasting.api.misc.MediaConstants; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; +import net.beholderface.oneironaut.casting.patterns.spells.great.OpDimTeleport; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(OpDimTeleport.class) +public class OpDimTeleportMixin { + @ModifyReturnValue(at = @At("RETURN"), method = "execute") + SpellAction.Result modifyCost(SpellAction.Result result, @Local(name = "origin") ServerWorld origin, @Local(name = "destination") ServerWorld destination) { + Identifier sourceID = origin.getRegistryKey().getValue(); + boolean fromDemiplane = sourceID.getNamespace().equals("hexic") && sourceID.getPath().startsWith("fresh-"); + Identifier targetID = destination.getRegistryKey().getValue(); + boolean toDemiplane = targetID.getNamespace().equals("hexic") && targetID.getPath().startsWith("fresh-"); + if (fromDemiplane && toDemiplane) ((SpellAction$ResultAccessor) (Object) result).setCost(0); + else if (fromDemiplane || toDemiplane) ((SpellAction$ResultAccessor) (Object) result).setCost(5 * MediaConstants.SHARD_UNIT); + return result; + } +} diff --git a/project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/SpellAction$ResultAccessor.java b/project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/SpellAction$ResultAccessor.java new file mode 100644 index 0000000..7446a75 --- /dev/null +++ b/project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/SpellAction$ResultAccessor.java @@ -0,0 +1,12 @@ +package org.eu.net.pool.hexic.mixin; + +import at.petrak.hexcasting.api.casting.castables.SpellAction; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(SpellAction.Result.class) +public interface SpellAction$ResultAccessor { + @Accessor @Mutable void setCost(long cost); +}