From badc965e29bea3d471d91bf3c0b073ebb13db418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SrNadien=20=F0=9F=94=A5?= <76491773+SrNadien@users.noreply.github.com> Date: Wed, 29 Apr 2026 21:41:37 -0300 Subject: [PATCH 1/2] Chunkloader was added to the dimensional card and the infinite card. This can be disabled in infinity booster-common.toml it is enabled by default --- build.gradle | 75 ++++++++++--------- gradle.properties | 25 +++++-- .../config/AEInfinityBoosterConfig.java | 7 +- .../init/IChunkForceable.java | 5 ++ .../mixins/MixinWirelessBlockEntity.java | 63 +++++++++++----- .../MixinWirelessBlockEntityRemove.java | 19 +++++ .../resources/AEInfinityBooster.mixins.json | 3 +- .../resources/META-INF/neoforge.mods.toml | 18 ++++- .../assets/aeinfinitybooster/lang/es_ar.json | 2 +- 9 files changed, 148 insertions(+), 69 deletions(-) create mode 100644 src/main/java/uk/co/hexeption/aeinfinitybooster/init/IChunkForceable.java create mode 100644 src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntityRemove.java diff --git a/build.gradle b/build.gradle index b668cfa..4209289 100644 --- a/build.gradle +++ b/build.gradle @@ -12,36 +12,11 @@ tasks.named('wrapper', Wrapper).configure { distributionType = Wrapper.DistributionType.BIN } -def env = System.getenv() -if (env.GITHUB_RUN_NUMBER) { - mod_version = '1.21.1-1.0.0' + "." + "${env.GITHUB_RUN_NUMBER}" -} - -version = mod_version +version =minecraft_version + "-" + mod_version + "-" + tag_platform group = mod_group_id -repositories { - mavenLocal() - maven { - name "Modmaven" - url "https://modmaven.dev/" - content { - includeGroup 'appeng' - } - } - maven { - name = "Progwml6 maven" - url = "https://dvs1.progwml6.com/files/maven/" - } - maven { - // location of the maven that hosts JEI files since January 2023 - name = "Jared's maven" - url = "https://maven.blamejared.com/" - } -} - base { - archivesName = mod_id + "-neoforge" + archivesName = mod_name } // Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21. @@ -80,27 +55,55 @@ configurations { runtimeClasspath.extendsFrom localRuntime } +repositories { + mavenLocal() + mavenCentral() + maven { + name "Modmaven" + url "https://modmaven.dev/" + } + maven { + name = "Progwml6 maven" + url = "https://dvs1.progwml6.com/files/maven/" + } + maven { + // location of the maven that hosts JEI files since January 2023 + name = "Jared's maven" + url = "https://maven.blamejared.com/" + } +} + + dependencies { implementation "net.neoforged:neoforge:${neo_version}" + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' - runtimeOnly "mezz.jei:jei-1.21.1-neoforge:19.21.0.247" - compileOnly "appeng:appliedenergistics2:19.1.2-beta" - runtimeOnly "appeng:appliedenergistics2:19.1.2-beta" -} + + + runtimeOnly "mezz.jei:jei-1.21.1-neoforge:${jei_version}" + implementation "mezz.jei:jei-1.21.1-neoforge:${jei_version}" + + //AE2 + compileOnly "org.appliedenergistics:appliedenergistics2:${ae2_version}" + runtimeOnly "org.appliedenergistics:appliedenergistics2:${ae2_version}" + implementation "org.appliedenergistics:appliedenergistics2:${ae2_version}" + implementation "org.appliedenergistics:guideme:${guideme_version}" + } tasks.withType(ProcessResources).configureEach { var replaceProperties = [ minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, neo_version : neo_version, - neo_version_range : neo_version_range, loader_version_range : loader_version_range, mod_id : mod_id, mod_name : mod_name, mod_license : mod_license, mod_version : mod_version, mod_authors : mod_authors, - mod_description : mod_description + mod_description : mod_description, + issue_tracker : issue_tracker, + ae2_version : ae2_version, + jei_version : jei_version ] inputs.properties replaceProperties @@ -124,7 +127,7 @@ idea { task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) { - apiToken = env.CURSE_API_KEY + apiToken = System.getenv("CURSE_API_KEY") // The main file to upload def mainFile = upload(559313, jar) @@ -139,7 +142,7 @@ task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) } modrinth { - token = env.MODRINTH_API_KEY + token = System.getenv("MODRINTH_API_KEY") projectId = 'VQhDBNs8' versionName = "AEInfinityBooster $version" changelog = 'A changelog can be found at https://github.com/Hexeption/AEInfinityBooster' diff --git a/gradle.properties b/gradle.properties index ad8f77c..c9bad85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,22 +1,33 @@ -org.gradle.jvmargs=-Xmx3G +org.gradle.jvmargs=-Xmx2G org.gradle.daemon=false +org.gradle.warning.mode=none +## Parchment Properties neogradle.subsystems.parchment.minecraftVersion=1.21.1 neogradle.subsystems.parchment.mappingsVersion=2024.11.17 -minecraft_version=1.21.1 -minecraft_version_range=[1.21.1] -neo_version=21.1.122 -neo_version_range=[21.1.122,) +## NeoForge Properties +neo_version=21.1.215 loader_version_range=[4,) ## Mod Properties +minecraft_version=1.21.1 +minecraft_version_range=[1.21.1] +tag_platform=NeoForge mod_id=aeinfinitybooster mod_name=AEInfinityBooster -mod_license=GNU Lesser General Public License -mod_version=1.0.0 +mod_license=All Rights Reserved +mod_version=1.0.1 mod_group_id=uk.co.hexeption.aeinfinitybooster mod_authors=Hexeption mod_description=Adds Infinite Range Card and Dimension Card to AE2 +issue_tracker=https://github.com/Hexeption/AEInfinityBooster/issues + +## Applied Energistics 2 Properties +ae2_version=19.2.17 +guideme_version=21.1.15 + +## JEI Properties +jei_version=19.27.0.340 \ No newline at end of file diff --git a/src/main/java/uk/co/hexeption/aeinfinitybooster/config/AEInfinityBoosterConfig.java b/src/main/java/uk/co/hexeption/aeinfinitybooster/config/AEInfinityBoosterConfig.java index ee12c04..5366655 100644 --- a/src/main/java/uk/co/hexeption/aeinfinitybooster/config/AEInfinityBoosterConfig.java +++ b/src/main/java/uk/co/hexeption/aeinfinitybooster/config/AEInfinityBoosterConfig.java @@ -11,6 +11,7 @@ public class AEInfinityBoosterConfig { public static ModConfigSpec.IntValue DIMENSION_CARD_DRAIN; public static ModConfigSpec.IntValue INFINITY_CARD_DRAIN; + public static ModConfigSpec.BooleanValue CHUNK_LOADING_ENABLED; private AEInfinityBoosterConfig(ModConfigSpec.Builder builder) { builder.push("general"); @@ -19,6 +20,10 @@ private AEInfinityBoosterConfig(ModConfigSpec.Builder builder) { .defineInRange("dimensionCardDrain", 100, 0, Integer.MAX_VALUE); INFINITY_CARD_DRAIN = builder.comment("The amount of power the Infinity Card drains per tick") .defineInRange("infinityCardDrain", 50, 0, Integer.MAX_VALUE); + CHUNK_LOADING_ENABLED = builder.comment( + "If true, inserting a Dimension Card or Infinity Card into a Wireless Access Point", + "will keep the chunk loaded even when no players are nearby.") + .define("chunkLoadingEnabled", true); builder.pop(); } @@ -28,4 +33,4 @@ private AEInfinityBoosterConfig(ModConfigSpec.Builder builder) { CONFIG = pair.getLeft(); CONFIG_SPEC = pair.getRight(); } -} +} \ No newline at end of file diff --git a/src/main/java/uk/co/hexeption/aeinfinitybooster/init/IChunkForceable.java b/src/main/java/uk/co/hexeption/aeinfinitybooster/init/IChunkForceable.java new file mode 100644 index 0000000..0e18df1 --- /dev/null +++ b/src/main/java/uk/co/hexeption/aeinfinitybooster/init/IChunkForceable.java @@ -0,0 +1,5 @@ +package uk.co.hexeption.aeinfinitybooster.init; + +public interface IChunkForceable { + void ib$setChunkForced(boolean forced); +} \ No newline at end of file diff --git a/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java b/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java index 7b8e7c9..b546cc1 100644 --- a/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java +++ b/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java @@ -1,11 +1,13 @@ package uk.co.hexeption.aeinfinitybooster.mixins; import appeng.api.inventories.InternalInventory; +import appeng.blockentity.AEBaseBlockEntity; import appeng.blockentity.networking.WirelessAccessPointBlockEntity; import appeng.core.definitions.AEItems; import appeng.util.inv.AppEngInternalInventory; import appeng.util.inv.filter.IAEItemFilter; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -15,21 +17,34 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import uk.co.hexeption.aeinfinitybooster.config.AEInfinityBoosterConfig; import uk.co.hexeption.aeinfinitybooster.setup.ModItems; +import uk.co.hexeption.aeinfinitybooster.init.IChunkForceable; -/** - * MixinWirelessBlockEntity - * - * @author Hexeption admin@hexeption.co.uk - * @since 22/12/2021 - 09:06 am - */ @Mixin(value = WirelessAccessPointBlockEntity.class, remap = false) -public class MixinWirelessBlockEntity { +public abstract class MixinWirelessBlockEntity extends AEBaseBlockEntity implements IChunkForceable { @Shadow @Final private AppEngInternalInventory inv; - @Inject(method = "", at = @At(value = "RETURN")) - private void init(BlockEntityType blockEntityType, BlockPos pos, BlockState blockState, CallbackInfo ci){ + public MixinWirelessBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { + super(type, pos, blockState); + } + + boolean ib$hasChunkLoadCard() { + ItemStack card = inv.getStackInSlot(0); + return card.is(ModItems.DIMENSION_CARD.get()) || card.is(ModItems.INFINITY_CARD.get()); + } + + @Override + public void ib$setChunkForced(boolean force) { + if (level instanceof ServerLevel serverLevel) { + BlockPos pos = getBlockPos(); + serverLevel.setChunkForced(pos.getX() >> 4, pos.getZ() >> 4, force); + } + } + + @Inject(method = "", at = @At("RETURN")) + private void init(BlockEntityType type, BlockPos pos, BlockState blockState, CallbackInfo ci) { inv.setFilter(new IAEItemFilter() { @Override public boolean allowExtract(InternalInventory inv, int slot, int amount) { @@ -38,16 +53,26 @@ public boolean allowExtract(InternalInventory inv, int slot, int amount) { @Override public boolean allowInsert(InternalInventory inv, int slot, ItemStack stack) { - if(AEItems.WIRELESS_BOOSTER.is(stack)) { - return true; - } - - if(stack.is(ModItems.DIMENSION_CARD.get()) || stack.is(ModItems.INFINITY_CARD.get())){ - return true; - } - - return false; + return AEItems.WIRELESS_BOOSTER.is(stack) + || stack.is(ModItems.DIMENSION_CARD.get()) + || stack.is(ModItems.INFINITY_CARD.get()); } }); } -} + + @Inject(method = "onReady", at = @At("RETURN")) + private void onReady(CallbackInfo ci) { + if (AEInfinityBoosterConfig.CHUNK_LOADING_ENABLED.get() && ib$hasChunkLoadCard()) { + ib$setChunkForced(true); + } + } + + @Inject(method = "saveChanges", at = @At("HEAD")) + private void onSaveChanges(CallbackInfo ci) { + if (AEInfinityBoosterConfig.CHUNK_LOADING_ENABLED.get()) { + ib$setChunkForced(ib$hasChunkLoadCard()); + } else { + ib$setChunkForced(false); + } + } +} \ No newline at end of file diff --git a/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntityRemove.java b/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntityRemove.java new file mode 100644 index 0000000..5ddf242 --- /dev/null +++ b/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntityRemove.java @@ -0,0 +1,19 @@ +package uk.co.hexeption.aeinfinitybooster.mixins; + +import net.minecraft.world.level.block.entity.BlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import uk.co.hexeption.aeinfinitybooster.init.IChunkForceable; + +@Mixin(value = BlockEntity.class, remap = true) +public abstract class MixinWirelessBlockEntityRemove { + + @Inject(method = "setRemoved", at = @At("HEAD"), remap = false) + private void onSetRemoved(CallbackInfo ci) { + if ((Object) this instanceof IChunkForceable forceable) { + forceable.ib$setChunkForced(false); + } + } +} \ No newline at end of file diff --git a/src/main/resources/AEInfinityBooster.mixins.json b/src/main/resources/AEInfinityBooster.mixins.json index d5f1a01..c3f4730 100644 --- a/src/main/resources/AEInfinityBooster.mixins.json +++ b/src/main/resources/AEInfinityBooster.mixins.json @@ -9,7 +9,8 @@ "MixinWirelessBlockEntity", "MixinRestrictedInputSlot", "MixinWirelessMenu", - "MixinWirelessAccessPointScreen" + "MixinWirelessAccessPointScreen", + "MixinWirelessBlockEntityRemove" ], "client": [ ], diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 3fe61d5..bfd67a7 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -1,7 +1,9 @@ modLoader="javafml" #mandatory loaderVersion="${loader_version_range}" #mandatory license="${mod_license}" -#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional +issueTrackerURL="${issue_tracker}" #optional + + [[mods]] #mandatory modId="${mod_id}" #mandatory version="${mod_version}" #mandatory @@ -20,20 +22,28 @@ config="AEInfinityBooster.mixins.json" [[dependencies.${mod_id}]] #optional modId="neoforge" #mandatory type="required" #mandatory - versionRange="${neo_version_range}" #mandatory + versionRange="${neo_version}" #mandatory ordering="NONE" side="BOTH" [[dependencies.${mod_id}]] modId="minecraft" type="required" - versionRange="${minecraft_version_range}" + versionRange="${minecraft_version}" ordering="NONE" side="BOTH" [[dependencies.${mod_id}]] modId="ae2" type="required" -versionRange="[19.1.2-beta,)" +versionRange="${ae2_version}" ordering="AFTER" side="BOTH" + +[[dependencies.${mod_id}]] +modId="jei" +type="optional" +versionRange="${jei_version}" +ordering="AFTER" +side="BOTH" + diff --git a/src/main/resources/assets/aeinfinitybooster/lang/es_ar.json b/src/main/resources/assets/aeinfinitybooster/lang/es_ar.json index 342e0d3..23072be 100644 --- a/src/main/resources/assets/aeinfinitybooster/lang/es_ar.json +++ b/src/main/resources/assets/aeinfinitybooster/lang/es_ar.json @@ -1,4 +1,4 @@ { -"item.aeinfinitybooster.infinity_card": "Tarjeta De Rango Infinito", +"item.aeinfinitybooster.infinity_card": "Tarjeta De Rango Infinito", "item.aeinfinitybooster.dimension_card": "Tarjeta De Rango Dimensional" } From 81170087df24994839e417b204961bdf0d417ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SrNadien=20=F0=9F=94=A5?= <76491773+SrNadien@users.noreply.github.com> Date: Wed, 29 Apr 2026 21:44:31 -0300 Subject: [PATCH 2/2] updated --- .../aeinfinitybooster/mixins/MixinWirelessBlockEntity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java b/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java index b546cc1..88f36ce 100644 --- a/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java +++ b/src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessBlockEntity.java @@ -21,6 +21,12 @@ import uk.co.hexeption.aeinfinitybooster.setup.ModItems; import uk.co.hexeption.aeinfinitybooster.init.IChunkForceable; +/** + * MixinWirelessBlockEntity + * + * @author Hexeption admin@hexeption.co.uk + * @since 22/12/2021 - 09:06 am + */ @Mixin(value = WirelessAccessPointBlockEntity.class, remap = false) public abstract class MixinWirelessBlockEntity extends AEBaseBlockEntity implements IChunkForceable {