diff --git a/build.gradle b/build.gradle index 65617c4..6f8228d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "com.modrinth.minotaur" version "2.+" - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } @@ -17,10 +17,6 @@ repositories { // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. - maven { - name = 'Ladysnake Mods' - url = 'https://ladysnake.jfrog.io/artifactory/mods' - } maven { name = "Ladysnake Mods" url = 'https://maven.ladysnake.org/releases' @@ -54,7 +50,7 @@ dependencies { // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" - modCompileOnly ("com.github.iPortalTeam:ImmersivePortalsMod:${project.immersive_portals_version}") + modImplementation ("com.github.iPortalTeam:ImmersivePortalsMod:${project.immersive_portals_version}") // Replace modImplementation with modApi if you expose components in your own API modImplementation "org.ladysnake.cardinal-components-api:cardinal-components-base:${project.cca_version}" @@ -66,20 +62,10 @@ dependencies { // Includes Cardinal Components API as a Jar-in-Jar dependency (optional but recommended) include "org.ladysnake.cardinal-components-api:cardinal-components-level:${project.cca_version}" - //include(modApi(platform("de.siphalor.tweed4:tweed4-bom-$project.minecraft_version_major:$project.tweed_version"))) - // Pick any modules you want to use, e.g.: - //include(modApi("de.siphalor.tweed4:tweed4-base-$project.minecraft_version_major")) - //include(modApi("de.siphalor.tweed4:tweed4-annotated-$project.minecraft_version_major")) - //include(modApi("de.siphalor.tweed4:tweed4-data-$project.minecraft_version_major")) - //include(modApi("de.siphalor.tweed4:tweed4-data-hjson-$project.minecraft_version_major")) - //include(modApi("de.siphalor.tweed4:tweed4-tailor-cloth-$project.minecraft_version_major")) - //include(modApi("de.siphalor.tweed4:tweed4-tailor-screen-$project.minecraft_version_major")) - + //Config lib modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" include "maven.modrinth:midnightlib:${project.midnightlib_version}" - modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version") - modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") } diff --git a/gradle.properties b/gradle.properties index 968ae96..87f8651 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,22 +4,20 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21 +minecraft_version=1.21.1 minecraft_version_major=1.21 -yarn_mappings=1.21+build.2 -loader_version=0.15.11 +yarn_mappings=1.21.1+build.3 +loader_version=0.16.7 # Mod Properties -mod_version=0.9.6 +mod_version=0.9.7 maven_group=quimufu.colourful-portals archives_base_name=colourful-portals # Dependencies -fabric_version=0.100.1+1.21 -cca_version = 6.1.0 -immersive_portals_version_short=5.1.7 -immersive_portals_version=v5.1.7-mc1.20.4 -tweed_version=1.3.0+mc1.20.2 -sodium_version=mc1.21-0.5.9 -cloth_config_version=15.0.127 -midnightlib_version=1.5.7-fabric \ No newline at end of file +fabric_version=0.105.0+1.21.1 +cca_version = 6.1.1 +immersive_portals_version_short=6.0.3 +immersive_portals_version=v6.0.3-mc1.21.1 +sodium_version=mc1.21-0.5.11 +midnightlib_version=1.6.3-fabric \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a7..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 129d130..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Sun Jun 16 00:12:45 CEST 2024 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.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cb..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,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 +57,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/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java b/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java index e7e3821..c8549e6 100644 --- a/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java +++ b/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java @@ -57,6 +57,7 @@ public class ColourfulPortalsMod implements ModInitializer { public static final ColourfulAirBottleItem COLOURFUL_AIR_BOTTLE_ITEM = new ColourfulAirBottleItem(COLOURFUL_AIR, new Item.Settings().rarity(Rarity.RARE).component(DataComponentTypes.BASE_COLOR, DyeColor.BLACK)); public static final EnumMap COLOURFUL_AIR_PARTICLE_BY_COLOUR; + static { COLOURFUL_AIR_PARTICLE_BY_COLOUR = new EnumMap<>(DyeColor.class); for (DyeColor dyeColor : DyeColor.values()) { @@ -104,14 +105,14 @@ public class ColourfulPortalsMod implements ModInitializer { ColourfulPortalConfig.registerListener(this::onConfigUpdate); onConfigUpdate(); - if (!ColourfulPortalConfig.disableImmersivePortals && hasImmPtl()) { - Registry.register(PORTAL_LINKING_SYSTEM_BUILDER_REGISTRY, ImmersivePortalsLinkingSystem.IMMERSIVE_PORTALS_LINKING_SYSTEM, new PrioritizedPortalLinkingSystemBuilder(ImmersivePortalsLinkingSystem::new, 100)); + if (hasImmPtl()) { + Registry.register(PORTAL_LINKING_SYSTEM_BUILDER_REGISTRY, ImmersivePortalsLinkingSystem.IMMERSIVE_PORTALS_LINKING_SYSTEM, new PrioritizedPortalLinkingSystemBuilder(ImmersivePortalsLinkingSystem::new, () -> ColourfulPortalConfig.disableImmersivePortals ? -1 : 100)); } for (Map.Entry entry : COLOURFUL_AIR_PARTICLE_BY_COLOUR.entrySet()) { Registry.register(Registries.PARTICLE_TYPE, Identifier.of(MOD_ID, entry.getKey().getName() + "_colourful_air_sparkle"), entry.getValue()); } - Registry.register(PORTAL_LINKING_SYSTEM_BUILDER_REGISTRY, DefaultLinkingSystem.DEFAULT_LINKING_SYSTEM, new PrioritizedPortalLinkingSystemBuilder(DefaultLinkingSystem::new, 90)); + Registry.register(PORTAL_LINKING_SYSTEM_BUILDER_REGISTRY, DefaultLinkingSystem.DEFAULT_LINKING_SYSTEM, new PrioritizedPortalLinkingSystemBuilder(DefaultLinkingSystem::new, () -> 90)); Identifier identifier = Identifier.of(MOD_ID, "portal_block"); @@ -151,7 +152,7 @@ public class ColourfulPortalsMod implements ModInitializer { } DIMENSION_WEIGHTS_COLOURFUL_PEARL.clear(); for (Map.Entry weight : ColourfulPortalConfig.pearlDimensionWeights.entrySet()) { - DIMENSION_WEIGHTS_COLOURFUL_PEARL.add(Identifier.of(weight.getKey()),weight.getValue()); + DIMENSION_WEIGHTS_COLOURFUL_PEARL.add(Identifier.of(weight.getKey()), weight.getValue()); } } @@ -170,7 +171,7 @@ public class ColourfulPortalsMod implements ModInitializer { PortalListComponent portalList = PORTAL_LIST.get(minecraftServer.getSaveProperties().getMainWorldProperties()); PortalLinkingSystem currentLinkingSystem = getCurrentlyConfiguredLinkingSystem(minecraftServer); - if (currentLinkingSystem.getLinkingSystemId() != portalList.lastPortalLinkingSystemId() || currentLinkingSystem.needsReInit()) { + if (!Objects.equals(currentLinkingSystem.getLinkingSystemId(), portalList.lastPortalLinkingSystemId()) || currentLinkingSystem.needsReInit()) { PrioritizedPortalLinkingSystemBuilder prevSystem; if ((prevSystem = PORTAL_LINKING_SYSTEM_BUILDER_REGISTRY.get(portalList.lastPortalLinkingSystemId())) != null) { PortalLinkingSystem prevLS = prevSystem.portalLinkingSystemBuilder().build(minecraftServer); @@ -191,7 +192,8 @@ public class ColourfulPortalsMod implements ModInitializer { private PortalLinkingSystem getCurrentlyConfiguredLinkingSystem(MinecraftServer minecraftServer) { return PORTAL_LINKING_SYSTEM_BUILDER_REGISTRY .stream() - .min(Comparator.comparing(PrioritizedPortalLinkingSystemBuilder::priority)) + .filter(prio -> prio.priority().getAsInt() >= 0) + .max(Comparator.comparing(prio -> prio.priority().getAsInt())) .map(PrioritizedPortalLinkingSystemBuilder::portalLinkingSystemBuilder) .orElse(DefaultLinkingSystem::new) .build(minecraftServer); diff --git a/src/main/java/quimufu/colourful_portals/Components.java b/src/main/java/quimufu/colourful_portals/Components.java index 389926e..fbe6c95 100644 --- a/src/main/java/quimufu/colourful_portals/Components.java +++ b/src/main/java/quimufu/colourful_portals/Components.java @@ -15,8 +15,8 @@ public class Components implements LevelComponentInitializer { @Override public void registerLevelComponentFactories(LevelComponentFactoryRegistry registry) { - registry.register(PORTAL_LIST, PortalListComponent::new); - registry.register(PORTAL_CANDIDATE_LIST, PortalListComponent::new); + registry.register(PORTAL_LIST, worldProperties1 -> new PortalListComponent()); + registry.register(PORTAL_CANDIDATE_LIST, worldProperties -> new PortalListComponent()); } } diff --git a/src/main/java/quimufu/colourful_portals/client/rendering/fluid/CommonPortalFluidRendererV2.java b/src/main/java/quimufu/colourful_portals/client/rendering/fluid/CommonPortalFluidRendererV2.java index 502a1b8..f611f6a 100644 --- a/src/main/java/quimufu/colourful_portals/client/rendering/fluid/CommonPortalFluidRendererV2.java +++ b/src/main/java/quimufu/colourful_portals/client/rendering/fluid/CommonPortalFluidRendererV2.java @@ -180,12 +180,9 @@ public class CommonPortalFluidRendererV2 implements CommonPortalFluidRenderer { } } } - LOGGER.info("{} {} {}\n{} {} {}\n{} {} {}", amounts[0], amounts[1], amounts[2], amounts[3], amounts[4], amounts[5], amounts[6], amounts[7], amounts[8]); - for (int a = 0; a < 9; a++) { heights[a] = heights[a] / heightsC[a]; } - LOGGER.info("{} {} {}\n{} {} {}\n{} {} {}", heights[0], heights[1], heights[2], heights[3], heights[4], heights[5], heights[6], heights[7], heights[8]); for (int i = 0; i < quads.length / 3; i++) { int x = (int) ((quads[i * 3] + 0.5f) * 2); int z = (int) ((quads[i * 3 + 2] + 0.5f) * 2); diff --git a/src/main/java/quimufu/colourful_portals/item/ColourfulAirBottleItem.java b/src/main/java/quimufu/colourful_portals/item/ColourfulAirBottleItem.java index 1bda896..8f95a4b 100644 --- a/src/main/java/quimufu/colourful_portals/item/ColourfulAirBottleItem.java +++ b/src/main/java/quimufu/colourful_portals/item/ColourfulAirBottleItem.java @@ -3,8 +3,6 @@ package quimufu.colourful_portals.item; import net.minecraft.advancement.criterion.Criteria; import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.world.ClientWorld; import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -17,7 +15,6 @@ import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.event.GameEvent; -import org.jetbrains.annotations.Nullable; import quimufu.colourful_portals.ColourfulAirBlock; import quimufu.colourful_portals.ColourfulPortalsMod; import quimufu.colourful_portals.client.mixin.MinecraftClientAccessor; diff --git a/src/main/java/quimufu/colourful_portals/portal/DefaultLinkingSystem.java b/src/main/java/quimufu/colourful_portals/portal/DefaultLinkingSystem.java index b4e4cb6..3bdac01 100644 --- a/src/main/java/quimufu/colourful_portals/portal/DefaultLinkingSystem.java +++ b/src/main/java/quimufu/colourful_portals/portal/DefaultLinkingSystem.java @@ -42,7 +42,7 @@ public class DefaultLinkingSystem implements PortalLinkingSystem { @Override public void linkPortals(LinkedList portalRepresentations) { - LOGGER.info("start linkPortals"); + LOGGER.debug("start linkPortals"); for (Node node = portalRepresentations.getNode(0); node != null; node = node.getNext()) { PortalRepresentation portalRepresentation = node.getValue(); @@ -53,7 +53,7 @@ public class DefaultLinkingSystem implements PortalLinkingSystem { portalsAtPosition.add(finalNode); }); } - LOGGER.info("end linkPortals"); + LOGGER.debug("end linkPortals"); } @Override @@ -72,7 +72,6 @@ public class DefaultLinkingSystem implements PortalLinkingSystem { prevEntityPos = new Vec3d(entity.prevX, entity.prevY, entity.prevZ); } if (RaycastHelper.passedOnAxis(prevEntityPos, entity.getPos(), pos, axis)) { - //LOGGER.info("passed on Axis!"); if (onPortalPassed(entity, pos, world, axis)) { return true; } diff --git a/src/main/java/quimufu/colourful_portals/portal/ImmersivePortalsLinkingSystem.java b/src/main/java/quimufu/colourful_portals/portal/ImmersivePortalsLinkingSystem.java index d8b3a8b..bbcc0c5 100644 --- a/src/main/java/quimufu/colourful_portals/portal/ImmersivePortalsLinkingSystem.java +++ b/src/main/java/quimufu/colourful_portals/portal/ImmersivePortalsLinkingSystem.java @@ -10,6 +10,8 @@ import net.minecraft.util.TypeFilter; import net.minecraft.util.math.*; import net.minecraft.world.World; import qouteall.imm_ptl.core.api.PortalAPI; +import qouteall.imm_ptl.core.portal.Portal; +import qouteall.imm_ptl.core.portal.global_portals.GlobalPortalStorage; import qouteall.q_misc_util.my_util.DQuaternion; import quimufu.colourful_portals.general_util.LinkedList; @@ -44,17 +46,17 @@ public class ImmersivePortalsLinkingSystem implements PortalLinkingSystem { BlockBox linkedToPortalBlockBox = linkedToPortalRepresentation.location(); Box linkedToPortalBox = Box.from(linkedToPortalBlockBox); - List outgoingPortals = new ArrayList<>(getPortalList(fromPortalRepresentation)); + List outgoingPortals = new ArrayList<>(getPortalList(fromPortalRepresentation)); if (outgoingPortals.size() > 2) { LOGGER.warn("Found more then 2 portals in {}, cleaning up", fromPortalBox); for (int i = 2; i < outgoingPortals.size(); i++) { - qouteall.imm_ptl.core.portal.Portal outgoingPortal = outgoingPortals.get(i); - outgoingPortal.kill(); + Portal outgoingPortal = outgoingPortals.get(i); + PortalAPI.removeGlobalPortal(getPortalWorld(fromPortalRepresentation), outgoingPortal); } } if (outgoingPortals.isEmpty()) { - qouteall.imm_ptl.core.portal.Portal portal = qouteall.imm_ptl.core.portal.Portal.ENTITY_TYPE.create(fromPortalWorld); + Portal portal = Portal.ENTITY_TYPE.create(fromPortalWorld); if (portal == null) { LOGGER.error("could not create PortalRepresentation entity for {}", fromPortalRepresentation); return; @@ -72,25 +74,19 @@ public class ImmersivePortalsLinkingSystem implements PortalLinkingSystem { ); portal.setRotationTransformation(DQuaternion.getRotationBetween(axisW, Vec3d.of(PortalHelper.getAxisW(linkedToPortalBlockBox).getVector()))); outgoingPortals.add(portal); - if (!fromPortalWorld.spawnEntity(portal)) { - LOGGER.error("could not spawn PortalRepresentation entity for {}", fromPortalRepresentation); - return; - } + PortalAPI.addGlobalPortal(fromPortalWorld, portal); } if (outgoingPortals.size() == 1) { - qouteall.imm_ptl.core.portal.Portal portal = PortalAPI.createFlippedPortal(outgoingPortals.getFirst()); + Portal portal = PortalAPI.createFlippedPortal(outgoingPortals.getFirst()); outgoingPortals.add(portal); - if (!fromPortalWorld.spawnEntity(portal)) { - LOGGER.error("could not spawn second PortalRepresentation entity for {}", fromPortalRepresentation); - return; - } + PortalAPI.addGlobalPortal(fromPortalWorld, portal); } - for (qouteall.imm_ptl.core.portal.Portal outgoingPortal : outgoingPortals) { + for (Portal outgoingPortal : outgoingPortals) { outgoingPortal.setDestinationDimension(linkedToPortalWorldRegKey); outgoingPortal.setDestination(linkedToPortalBox.getCenter()); Vec3d axisW = Vec3d.of(PortalHelper.getAxisW(fromPortalBlockBox).getVector()); outgoingPortal.setRotationTransformation(DQuaternion.getRotationBetween(axisW, Vec3d.of(PortalHelper.getAxisW(linkedToPortalBlockBox).getVector()))); - outgoingPortal.reloadAndSyncToClient(); + GlobalPortalStorage.get(getPortalWorld(fromPortalRepresentation)).onDataChanged(); } } @@ -106,7 +102,7 @@ public class ImmersivePortalsLinkingSystem implements PortalLinkingSystem { @Override public void unLinkPortal(PortalRepresentation portalRepresentation) { - List portals = getPortalList(portalRepresentation); + List portals = getPortalList(portalRepresentation); portals.forEach(portalEntity -> PortalAPI.removeGlobalPortal(getPortalWorld(portalRepresentation), portalEntity)); } @@ -131,10 +127,12 @@ public class ImmersivePortalsLinkingSystem implements PortalLinkingSystem { return false; } - private List getPortalList(PortalRepresentation portalRepresentation) { + private List getPortalList(PortalRepresentation portalRepresentation) { Box portalBox = Box.from(portalRepresentation.location()); - return getPortalWorld(portalRepresentation) - .getEntitiesByType(TypeFilter.instanceOf(qouteall.imm_ptl.core.portal.Portal.class), portalBox, e -> e.isAlive() && contains(portalBox, e.getBoundingBox())); + getPortalWorld(portalRepresentation) + .getEntitiesByType(TypeFilter.instanceOf(Portal.class), portalBox, e -> e.isAlive() && contains(portalBox, e.getBoundingBox())) + .forEach(GlobalPortalStorage::convertNormalPortalIntoGlobalPortal); + return GlobalPortalStorage.get(getPortalWorld(portalRepresentation)).data.stream().filter(portal -> contains(portalBox, portal.getThinBoundingBox())).toList(); } private boolean contains(Box outside, Box inside) { diff --git a/src/main/java/quimufu/colourful_portals/portal/PortalListComponent.java b/src/main/java/quimufu/colourful_portals/portal/PortalListComponent.java index c92fdf2..fe13e0c 100644 --- a/src/main/java/quimufu/colourful_portals/portal/PortalListComponent.java +++ b/src/main/java/quimufu/colourful_portals/portal/PortalListComponent.java @@ -8,7 +8,6 @@ import net.minecraft.registry.RegistryWrapper; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldProperties; import org.ladysnake.cca.api.v3.component.Component; import quimufu.colourful_portals.general_util.LinkedList; import quimufu.colourful_portals.general_util.Node; @@ -21,13 +20,11 @@ import static quimufu.colourful_portals.ColourfulPortalsMod.*; public class PortalListComponent implements Component { public static final int CURRENT_VERSION = 1; - private final WorldProperties worldProperties; HashMap> portalsPerPortalBlock = new HashMap<>(); Identifier lastPortalLinkingSystem = Identifier.of(MOD_ID, "immersive_portals_linking_system"); - public PortalListComponent(WorldProperties worldProperties) { - this.worldProperties = worldProperties; + public PortalListComponent() { } @Override @@ -40,7 +37,7 @@ public class PortalListComponent implements Component { LOGGER.warn("portals component comes from a newer version! Hopefully backwards compatible. Proceeding"); } if (tag.contains("linking_system")) { - lastPortalLinkingSystem = Identifier.tryParse(tag.getString("version")); + lastPortalLinkingSystem = Identifier.tryParse(tag.getString("linking_system")); } NbtCompound blocks = tag.getCompound("blocks"); for (String block : blocks.getKeys()) { @@ -116,7 +113,7 @@ public class PortalListComponent implements Component { } } - LOGGER.info("portals {}", tag); + LOGGER.debug("portals {}", tag); } @@ -147,16 +144,12 @@ public class PortalListComponent implements Component { } public PortalRepresentation getNext(Identifier blockId, PortalRepresentation portalRepresentationWithDim) { - LOGGER.info("gn"); LinkedList portals = getPortals(blockId); Node node; if ((node = portals.getNodeOf(portalRepresentationWithDim)) == null) { - return portals.getFirst(); } - PortalRepresentation portalRepresentation = node.getNext() == null ? portals.getFirst() : node.getNext().getValue(); - LOGGER.info("gne"); - return portalRepresentation; + return node.getNext() == null ? portals.getFirst() : node.getNext().getValue(); } public boolean containsPortal(Identifier blockId, PortalRepresentation portalRepresentation) { diff --git a/src/main/java/quimufu/colourful_portals/portal/PrioritizedPortalLinkingSystemBuilder.java b/src/main/java/quimufu/colourful_portals/portal/PrioritizedPortalLinkingSystemBuilder.java index 06a60bf..a8948d8 100644 --- a/src/main/java/quimufu/colourful_portals/portal/PrioritizedPortalLinkingSystemBuilder.java +++ b/src/main/java/quimufu/colourful_portals/portal/PrioritizedPortalLinkingSystemBuilder.java @@ -1,4 +1,6 @@ package quimufu.colourful_portals.portal; +import java.util.function.IntSupplier; + public record PrioritizedPortalLinkingSystemBuilder(PortalLinkingSystemBuilder portalLinkingSystemBuilder, - int priority) {} + IntSupplier priority) {} diff --git a/src/main/java/quimufu/colourful_portals/util/RaycastHelper.java b/src/main/java/quimufu/colourful_portals/util/RaycastHelper.java index 7060551..0f4b4cb 100644 --- a/src/main/java/quimufu/colourful_portals/util/RaycastHelper.java +++ b/src/main/java/quimufu/colourful_portals/util/RaycastHelper.java @@ -3,7 +3,6 @@ package quimufu.colourful_portals.util; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import quimufu.colourful_portals.ColourfulPortalsMod; import java.util.LinkedList; import java.util.List; @@ -72,8 +71,6 @@ public class RaycastHelper { return false; } - //ColourfulPortalsMod.LOGGER.info("{}, {}: {} -> {}", hitAfter,axis, from, to); - return BlockPos.ofFloored(from.add(diff.multiply(hitAfter))) .equals(blockPos); }