diff --git a/CHANGELOG.md b/CHANGELOG.md index 347ceb3..eef3425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Crystal Nest Semantic Versioning](https://crystalne - Nothing new. +## [v4.0.1] - 2024/12/16 + +- Ported to 1.21.3. + ## [v4.0.1] - 2024/07/30 - 1.21 and above only. diff --git a/README.md b/README.md index 3879ad3..16b3c9e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![Nightworld banner](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/nightworld/banner.png) --- -![Minecraft](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.21.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21-1.svg)](https://modrinth.com/mod/nightworld/versions?g=1.21.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.21](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21.svg)](https://modrinth.com/mod/nightworld/versions?g=1.21)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-4.svg)](https://modrinth.com/mod/nightworld/versions?g=1.20.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/nightworld/versions?g=1.20.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-1.svg)](https://modrinth.com/mod/nightworld/versions?g=1.20.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-4.svg)](https://modrinth.com/mod/nightworld/versions?g=1.19.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://modrinth.com/mod/nightworld/versions?g=1.19.2) +![Minecraft](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.21.3](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21-3.svg)](https://modrinth.com/mod/nightworld/versions?g=1.21.3)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.21.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21-1.svg)](https://modrinth.com/mod/nightworld/versions?g=1.21.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.21](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21.svg)](https://modrinth.com/mod/nightworld/versions?g=1.21)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-4.svg)](https://modrinth.com/mod/nightworld/versions?g=1.20.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/nightworld/versions?g=1.20.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-1.svg)](https://modrinth.com/mod/nightworld/versions?g=1.20.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-4.svg)](https://modrinth.com/mod/nightworld/versions?g=1.19.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://modrinth.com/mod/nightworld/versions?g=1.19.2) ![Loader](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/loader.svg)[![NeoForge](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/neoforge.svg)](https://modrinth.com/mod/nightworld/versions?l=neoforge)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![Forge](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/forge.svg)](https://modrinth.com/mod/nightworld/versions?l=forge)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![Fabric](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/fabric.svg)](https://modrinth.com/mod/nightworld/versions?l=fabric) diff --git a/build.gradle b/build.gradle index 006c00d..199fa50 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { id "org.sonarqube" version "4.4.1.3373" id "com.hypherionmc.modutils.modpublisher" version "2.1.4" apply false - id "net.neoforged.moddev" version "0.1.110" apply false - id "fabric-loom" version "1.7-SNAPSHOT" apply false + id "net.neoforged.moddev" version "2.0.49-beta" apply false + id "fabric-loom" version "1.8-SNAPSHOT" apply false } sonar { diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle index 581724d..bc34329 100644 --- a/buildSrc/src/main/groovy/multiloader-common.gradle +++ b/buildSrc/src/main/groovy/multiloader-common.gradle @@ -219,10 +219,8 @@ publisher { switch (loader) { case "Fabric": required "fabric-api" - incompatible "immersiveportals" break case "NeoForge": - incompatible "immersive-portals-neoforge" break } } @@ -233,10 +231,8 @@ publisher { switch (loader) { case "Fabric": required "fabric-api" - incompatible "immersive-portals-mod" break case "NeoForge": - incompatible "immersive-portals-for-forge" break } } diff --git a/common/build.gradle b/common/build.gradle index 4619786..2fb109b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -7,10 +7,10 @@ neoForge { neoFormVersion = neo_form_version def at = file("src/main/resources/META-INF/accesstransformer.cfg") if (at.exists()) { - accessTransformers.add(at.absolutePath) + accessTransformers.from(at.absolutePath) } parchment { - minecraftVersion = minecraft_version + minecraftVersion = parchment_minecraft mappingsVersion = parchment_version } } diff --git a/common/src/main/java/it/crystalnest/nightworld/mixin/NetherPortalBlockMixin.java b/common/src/main/java/it/crystalnest/nightworld/mixin/NetherPortalBlockMixin.java index eeb5d19..81a3160 100644 --- a/common/src/main/java/it/crystalnest/nightworld/mixin/NetherPortalBlockMixin.java +++ b/common/src/main/java/it/crystalnest/nightworld/mixin/NetherPortalBlockMixin.java @@ -6,15 +6,17 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.NetherPortalBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -22,9 +24,13 @@ * Injects into {@link NetherPortalBlock} to alter Nightworld Portals mob spawn and dimension travel. */ @Mixin(NetherPortalBlock.class) -public abstract class NetherPortalBlockMixin { +public abstract class NetherPortalBlockMixin extends Block { + private NetherPortalBlockMixin() { + super(BlockBehaviour.Properties.of()); + } + /** - * Injects into the method {@link NetherPortalBlock#randomTick(BlockState, ServerLevel, BlockPos, RandomSource)} before the call to {@link BlockState#isValidSpawn(BlockGetter, BlockPos, EntityType)}.
+ * Injects into the method {@link NetherPortalBlock#randomTick(BlockState, ServerLevel, BlockPos, RandomSource)} before the call to {@link BlockState#isValidSpawn(BlockGetter, BlockPos, EntityType)}.
* Allows Zombies and Skeletons spawn when it's a Nightworld Portal. * * @param state block state. @@ -33,14 +39,18 @@ public abstract class NetherPortalBlockMixin { * @param random random source. * @param ci {@link CallbackInfo}. */ - @Inject(method = "randomTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;isValidSpawn(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/EntityType;)Z", shift = Shift.BEFORE)) + @SuppressWarnings({"JavadocReference", "StatementWithEmptyBody"}) + @Inject(method = "randomTick", at = @At(value = "HEAD"), cancellable = true) private void onRandomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random, CallbackInfo ci) { - if (CustomPortalChecker.isPortalForDimension(level, pos.above(), Constants.MOD_ID)) { - if (random.nextInt(0, 100) < 50) { - this.handleSpawnEntity(EntityType.ZOMBIE, level, pos); + if (level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(500) < level.getDifficulty().getId() && CustomPortalChecker.isPortalForDimension(level, pos.above(), Constants.MOD_ID)) { + BlockPos bottom; + for (bottom = pos; level.getBlockState(bottom).is(this); bottom = bottom.below()); + if (random.nextInt(0, 10) < 5) { + this.handleSpawnEntity(EntityType.ZOMBIE, level, bottom); } else { - this.handleSpawnEntity(EntityType.SKELETON, level, pos); + this.handleSpawnEntity(EntityType.SKELETON, level, bottom); } + ci.cancel(); } } @@ -54,9 +64,15 @@ private void onRandomTick(BlockState state, ServerLevel level, BlockPos pos, Ran */ @Unique private > void handleSpawnEntity(T entityType, ServerLevel level, BlockPos pos) { - Entity entity; - if (level.getBlockState(pos).isValidSpawn(level, pos, entityType) && (entity = entityType.spawn(level, pos.above(), MobSpawnType.STRUCTURE)) != null) { - entity.setPortalCooldown(); + if (level.getBlockState(pos).isValidSpawn(level, pos, entityType)) { + Entity entity = entityType.spawn(level, pos.above(), EntitySpawnReason.STRUCTURE); + if (entity != null) { + entity.setPortalCooldown(); + Entity vehicle = entity.getVehicle(); + if (vehicle != null) { + vehicle.setPortalCooldown(); + } + } } } } diff --git a/fabric/build.gradle b/fabric/build.gradle index 24c74bf..370da45 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -7,7 +7,7 @@ dependencies { minecraft "com.mojang:minecraft:$minecraft_version" mappings loom.layered { officialMojangMappings() - parchment("org.parchmentmc.data:parchment-$minecraft_version:$parchment_version@zip") + parchment("org.parchmentmc.data:parchment-$parchment_minecraft:$parchment_version@zip") } modImplementation "net.fabricmc:fabric-loader:$fabric_loader_version" modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version" diff --git a/gradle.properties b/gradle.properties index d6d6147..6392ad2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,23 +13,24 @@ description = Explore a parallel world! credits = github_user = crystal-nest curseforge_id = 865641 -minecraft_version = 1.21 +minecraft_version = 1.21.3 # https://parchmentmc.org/docs/getting-started#choose-a-version -parchment_version = 2024.06.23 +parchment_minecraft = 1.21.3 +parchment_version = 2024.12.07 # https://projects.neoforged.net/neoforged/neoform -neo_form_version = 1.21-20240613.152323 +neo_form_version = 1.21.3-20241023.131943 # Fabric -fabric_version = 0.100.6+1.21 -fabric_loader_version = 0.15.11 +fabric_version = 0.110.0+1.21.3 +fabric_loader_version = 0.16.9 # NeoForge -neoforge_version = 21.0.59-beta -neoforge_loader_version_range = [21.0,) +neoforge_version = 21.3.50-beta +neoforge_loader_version_range = [21.3,) # Dependencies -cobweb_version = 1.1.2 -server_sided_portals_version = 1.1.0 +cobweb_version = 1.3.0 +server_sided_portals_version = 1.1.1 # Gradle org.gradle.jvmargs = -Xmx4G diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 04f2adc..3c94f9a 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -7,10 +7,10 @@ neoForge { version = neoforge_version def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg') if (at.exists()) { - accessTransformers.add(at.absolutePath) + accessTransformers.from(at.absolutePath) } parchment { - minecraftVersion = minecraft_version + minecraftVersion = parchment_minecraft mappingsVersion = parchment_version } runs {