commit 5f62d807b374df4f08e70f0159c6dc1e67dacbad from: rohanverma2007 date: Sun Apr 26 16:20:22 2026 UTC support pc cobblemon commit - 9e6c197f44d42c88b15cf79edcf2b5bdce9f0f0b commit + 5f62d807b374df4f08e70f0159c6dc1e67dacbad blob - 1f8ee11a5903168dc0a82083a1ea845fb84fea5c blob + ecaf3c0caf6d160e40e3a4cad3453072f2aee257 --- build.gradle +++ build.gradle @@ -94,6 +94,7 @@ jar { exclude 'dev/simulated_team/**' exclude 'me/desht/**' exclude 'net/mehvahdjukaar/**' + exclude 'com/cobblemon/**' } var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { blob - 2c260442910ad072e003f809c87e5384f48e1dd2 blob + e4dd34659d84c959263e9a1ea8e516325f5860fa --- gradle.properties +++ gradle.properties @@ -25,7 +25,7 @@ citadel_version_range=[2.0.0,3.0.0) mod_id=aeronauticscompat mod_name=AeronauticsCompat mod_license=MIT -mod_version=1.1.0 +mod_version=1.1.1 mod_authors=rohan mod_description=Compatibility fixes for Create: Aeronautics / Sable sub-levels. Per-mod patches apply only when the target mod is installed. mod_group_id=sh.rsap.aeronauticscompat blob - /dev/null blob + e2b81cb6f4ac20df2deb43413e1e764fffdbefdf (mode 644) --- /dev/null +++ src/main/java/com/cobblemon/mod/common/api/storage/pc/link/ProximityPCLink.java @@ -0,0 +1,7 @@ +package com.cobblemon.mod.common.api.storage.pc.link; + +import net.minecraft.server.level.ServerPlayer; + +public abstract class ProximityPCLink { + public boolean isPermitted(ServerPlayer player) { return false; } +} blob - dc75a8ad6b5bf6be0adbc1eecc5b47cc9b51a870 blob + 5319aa243154738410e10270af29660aef00a23e --- src/main/java/sh/rsap/aeronauticscompat/mixin/AeronauticsCompatMixinPlugin.java +++ src/main/java/sh/rsap/aeronauticscompat/mixin/AeronauticsCompatMixinPlugin.java @@ -18,6 +18,7 @@ public class AeronauticsCompatMixinPlugin implements I private static final String BITS_N_BOBS = "com.kipti.bnb.content.cogwheel_chain.block.CogwheelChainBlockEntity"; private static final String SIMULATED = "dev.simulated_team.simulated.util.SimAssemblyHelper"; private static final String PNEUMATIC_CRAFT = "me.desht.pneumaticcraft.common.block.entity.utility.SentryTurretBlockEntity"; + private static final String COBBLEMON = "com.cobblemon.mod.common.api.storage.pc.link.ProximityPCLink"; /** Per-mixin marker-class requirements (all must resolve to apply). */ private static final Map REQUIREMENTS = Map.ofEntries( @@ -42,7 +43,9 @@ public class AeronauticsCompatMixinPlugin implements I Map.entry("sh.rsap.aeronauticscompat.mixin.pneumaticcraft.AbstractPneumaticCraftBlockMixin", new String[]{SABLE, PNEUMATIC_CRAFT}), Map.entry("sh.rsap.aeronauticscompat.mixin.sable.ClientPacketListenerMixin", - new String[]{SABLE}) + new String[]{SABLE}), + Map.entry("sh.rsap.aeronauticscompat.mixin.cobblemon.ProximityPCLinkMixin", + new String[]{SABLE, COBBLEMON}) ); @Override public void onLoad(String mixinPackage) { @@ -55,7 +58,8 @@ public class AeronauticsCompatMixinPlugin implements I + " thick_air=" + resolves(THICK_AIR, cl) + " bnb=" + resolves(BITS_N_BOBS, cl) + " simulated=" + resolves(SIMULATED, cl) - + " pneumaticcraft=" + resolves(PNEUMATIC_CRAFT, cl)); + + " pneumaticcraft=" + resolves(PNEUMATIC_CRAFT, cl) + + " cobblemon=" + resolves(COBBLEMON, cl)); } @Override blob - /dev/null blob + 48ea7138c4300293a114cf90146cf4902c0c6974 (mode 644) --- /dev/null +++ src/main/java/sh/rsap/aeronauticscompat/mixin/cobblemon/ProximityPCLinkMixin.java @@ -0,0 +1,70 @@ +package sh.rsap.aeronauticscompat.mixin.cobblemon; + +import com.cobblemon.mod.common.api.storage.pc.link.ProximityPCLink; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import sh.rsap.aeronauticscompat.compat.SableBridge; + +import java.lang.reflect.Field; + +@Pseudo +@Mixin(value = ProximityPCLink.class, remap = false) +public abstract class ProximityPCLinkMixin { + + private static volatile Field WORLD_FIELD; + private static volatile Field POS_FIELD; + private static volatile Field MAX_DISTANCE_FIELD; + + @Inject(method = "isPermitted", at = @At("HEAD"), cancellable = true, remap = false) + private void aeronauticscompat$crossSubLevelRangeCheck( + ServerPlayer player, CallbackInfoReturnable cir) { + + if (!SableBridge.isAvailable()) return; + + try { + Field worldField = WORLD_FIELD; + if (worldField == null) { + worldField = this.getClass().getDeclaredField("world"); + worldField.setAccessible(true); + WORLD_FIELD = worldField; + } + Field posField = POS_FIELD; + if (posField == null) { + posField = this.getClass().getDeclaredField("pos"); + posField.setAccessible(true); + POS_FIELD = posField; + } + Field maxDistField = MAX_DISTANCE_FIELD; + if (maxDistField == null) { + maxDistField = this.getClass().getDeclaredField("maxDistance"); + maxDistField.setAccessible(true); + MAX_DISTANCE_FIELD = maxDistField; + } + + Level world = (Level) worldField.get(this); + BlockPos pos = (BlockPos) posField.get(this); + double maxDistance = (Double) maxDistField.get(this); + + if (world == null || pos == null) return; + if (player.level() != world) return; + + Vec3 pcCenter = new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + double distSq = SableBridge.distanceSquaredWithSubLevels(world, player.position(), pcCenter); + if (Double.isNaN(distSq)) return; + + if (distSq <= maxDistance * maxDistance) { + Object be = world.getBlockEntity(pos); + if (be != null && "PCBlockEntity".equals(be.getClass().getSimpleName())) { + cir.setReturnValue(true); + } + } + } catch (Throwable ignored) {} + } +} blob - 8d2da57a4aae63c1fb37b53472aaa3dc719a89a9 blob + 659a02f705416d640f81745c4bf74f544f1b1ddf --- src/main/resources/aeronauticscompat.mixins.json +++ src/main/resources/aeronauticscompat.mixins.json @@ -11,7 +11,8 @@ "simulated.SimAssemblyHelperMixin", "bitsnbobs.CogwheelChainBlockEntityMixin", "pneumaticcraft.SentryTurretEntitySelectorMixin", - "pneumaticcraft.AbstractPneumaticCraftBlockMixin" + "pneumaticcraft.AbstractPneumaticCraftBlockMixin", + "cobblemon.ProximityPCLinkMixin" ], "client": [ "etched.EtchedStopListeningSoundMixin",