#94 feature portal port#334
Open
timplay33 wants to merge 4 commits into
Open
Conversation
| double dist = dir.length(); | ||
| double totalDist = 2.0; | ||
| float progress = (float) Math.max(0.0, Math.min(1.0, 1.0 - (dist / totalDist))); | ||
| float progress = (float) Math.clamp(1.0 - (dist / totalDist), 0.0, 1.0); |
Comment on lines
+175
to
+178
| public static Set<BlockPos> getPortalPortPositions(ServerLevel serverLevel) { | ||
| return PortalPortTracker.get(serverLevel).getAll(); | ||
| } | ||
|
|
Comment on lines
+179
to
+190
| private static @Nullable RoboTarget findCrossLevelTarget(ServerLevel level, String address, VirtualRobo robo, UUID logisticsNetworkId) { | ||
| PlayerTarget playerTarget = PlayerTarget.fromAddress(level, address, logisticsNetworkId); | ||
| if (playerTarget != null) { | ||
| CreateMobilePackages.LOGGER.debug(" found player target: {}", address); | ||
| return playerTarget; | ||
| } | ||
|
|
||
| BeePortBlockEntity addressedPort = CMPHelper.getClosestBeePort(level, address, BlockPos.containing(robo.getCurrentPos()), robo, logisticsNetworkId); | ||
| if (addressedPort != null) { | ||
| CreateMobilePackages.LOGGER.debug(" found addressed port: {} at {}", address, addressedPort.getBlockPos()); | ||
| return new BeePortBlockEntityTarget(addressedPort); | ||
| } |
Comment on lines
+355
to
+366
| // Check if the item can be sent to a player (search all levels). | ||
| if (level instanceof ServerLevel serverLevel && serverLevel.getServer() != null) { | ||
| for (ServerLevel candidateLevel : serverLevel.getServer().getAllLevels()) { | ||
| for (Player player : candidateLevel.players()) { | ||
| if (!playerUUIDs.contains(player.getUUID())) { | ||
| continue; // skip players not in the logistics network | ||
| } | ||
| if (CMPHelper.doesAddressMatchPlayer(player, address) && CMPHelper.isWithinRange(candidateLevel, player.blockPosition(), this.getBlockPos())) { | ||
| sendToPlayer(player, itemStack, slot); | ||
| return; | ||
| } | ||
| } |
| @Override | ||
| public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) { | ||
| return this.defaultBlockState() | ||
| .setValue(IS_OPEN_TEXTURE, true) |
Comment on lines
+427
to
+437
| ServerLevel destinationLevel = serverLevel.getServer().getLevel(transferDestinationDimension); | ||
| if (destinationLevel == null) { | ||
| CreateMobilePackages.LOGGER.warn("Robo {} transfer failed: destination dimension no longer loaded", getId()); | ||
| invalidateTarget(); | ||
| return false; | ||
| } | ||
| if (!destinationLevel.getBlockState(transferDestinationPortalPos).is(de.theidler.create_mobile_packages.index.CMPBlocks.PORTAL_PORT.get())) { | ||
| CreateMobilePackages.LOGGER.warn("Robo {} transfer failed: destination portal at {} no longer exists", getId(), transferDestinationPortalPos); | ||
| invalidateTarget(); | ||
| return false; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the portal port?
The portal port is a block that can be linked to a logistics network. The linked block can then be placed into one dimension. Another one with the same logistics network linked can then be placed in a different dimension. A bee will try to find a target in the current dimension. If not found, it will take a look into the other ones. Portal ports then allow the bee to travel from the current dimension to the target dimension.
What happens if I have multiple portal ports in one dimension within the same logistics network?
If you have multiple portal ports linked to the same logistics network in one dimension. Then the bee will take the portal port closest to the target.