Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pocket computer lecterns #2098

Merged
merged 4 commits into from
Feb 13, 2025
Merged

Pocket computer lecterns #2098

merged 4 commits into from
Feb 13, 2025

Conversation

SquidDev
Copy link
Member

@SquidDev SquidDev commented Feb 10, 2025

This allows placing pocket computers on lecterns. The terminal is rendered to all nearby players, and right clicking opens the off-hand pocket GUI. Fixes #1912.

A screenshot of a pocket computer on a lectern.

I'd originally marked this as 1.21.4 only, as it requires some API changes (getEntity is now always nullable. This was always the case, but some mods relied on it being non-null when an upgrade's peripheral is created). I've changed my mind, and we're going to do it on 1.20.1 and deal with the consequences.

Currently marking as draft for a couple of reasons:

  • It looks bad. There's no pixel consistency, and it's so flat!!!!! I don't know what to do about this — the correct thing would be to have a custom model (like we do for printouts), but we'd also need the model to be resizeable, and I'm not sure how feasible that is.

  • We should only render the terminal when the player is close (16 blocks?, maybe make this configurable?). OC did a nice thing where it faded in the terminal, to avoid pop-in.

    We could also avoid broadcasting the terminal to distant players. However, this makes the player tracking in the pocket computer significantly more complicated, so I think we should skip for now, and deal with it if it becomes an issue.

Surprisingly easy — got this done in <2 hours. It's nice when all the
refactoring you did before hand was worth it!
@SquidDev SquidDev added enhancement An extension of a feature or a new feature. area-Minecraft This affects CC's Minecraft-specific content. labels Feb 10, 2025
@Karotte128
Copy link
Contributor

Cool feature! Does this also work with wired modems (attaching a wired modem at the bottom of the lectern) to connect the pocket computer to a wired network?

@SquidDev
Copy link
Member Author

Not currently. I'm not 100% sure of it as a feature, and I think that's going to be quite awkward to get working, and so want to get the core feature in first.

@SquidDev
Copy link
Member Author

Okay, switching to an actual model works pretty well. I think we're going to have to split the model up so the light is a separate texture, but otherwise I think this looks good?

Three pocket computers (normal, light blue, advanced) sat on a lectern. The model is actually 3D now, very similar to the item model.

I should note that this is a 32x32 picture, and so twice as detailed than the lectern. I think this is fine — it's not great, but it's at least a multiple of two.

A picture from above, showing a computer running paint. You can see the border of the pocket computer is half the width of a pixel on the lectern.

 - Split light into a separate model
 - Unify colour and normal models a bit — this is now much closer to
   pocket computers, where we have a separate colour/frame texture for
   coloured models, and a single texture for normal ones.
 - Don't render terminals if more than 32 blocks away.
@SquidDev SquidDev marked this pull request as ready for review February 13, 2025 12:59
@SquidDev SquidDev merged commit 2e2f308 into mc-1.20.x Feb 13, 2025
6 checks passed
@SquidDev SquidDev deleted the feature/pocket-lectern branch February 13, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Minecraft This affects CC's Minecraft-specific content. enhancement An extension of a feature or a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an ability to place pocket computers on lecterns
2 participants