Jump to content

Recommended Posts

Posted

Hello! the mod I'm working on requires me to generate an image based on the player's perspective - similar (but not exactly like) a screenshot, in order to be used to generate a texture for a block (or entity, haven't figured out which is ideal to use yet)

However, I've already hit a standstill, as I simply can not figure out a good way of doing this. the image is generated once, and simply instructing the client to take a screenshot, crop it, and send it to the server to assign the texture doesn't seem like the best idea for a few reasons:

1. if it's a screenshot, the player's texture pack will be taken into account - not ideal, but I can live with it arguably a good thing, but the potential for art-style clashes concerns me.
2. UI would be on the painting, and I don't believe for a second that there isn't a better way to circumvent that issue than disabling UI for a frame, taking the screenie, and reenabling UI before sending it to the server.


Note that I am for lack of a better word, a Peabrain - and this is my first serious attempt at making a mod. Yes, I know Java.

Posted

Check out ScreenShotHelper to see how screenshots are made. Thankfully it's a pretty painless process there. You may have to transfer pixel data from a NativeImage to a BufferedImage to do more complex image editing operations, however. I'd need to experiment with it to figure out the exact method for that.

As for your concerns:

  1. Sadly I don't know of any clean workarounds for texture packs. Shaders and other client-side graphical mods would also be hard to work around. The process for any such workaround would certainly be way out of my skill set.
  2. To take a screenshot without the hud, use RenderGameOverlayEvent.Pre filtered by the ALL type and run the code there. It will also work when an overlay screen (like the inventory or pause menu) is being displayed since the event triggers before they render. You may want to use a higher event priority to ensure your code is run before other mods' code.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Posted
9 hours ago, Pacmandevil said:

and send it to the server to assign the texture

Why are you sending the texture to the server anyways? The server doesn't deal with assets at all. Are you trying to make this image the same across all players?

 

9 hours ago, Pacmandevil said:

Hello! the mod I'm working on requires me to generate an image based on the player's perspective - similar (but not exactly like) a screenshot, in order to be used to generate a texture for a block (or entity, haven't figured out which is ideal to use yet)

What exactly are you trying to do. Why are you needing to generate an image? More specifically why can't this be done before runtime? What is the exact thing you want to do from a users perspective?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
14 hours ago, Animefan8888 said:

Why are you sending the texture to the server anyways? The server doesn't deal with assets at all. Are you trying to make this image the same across all players?

 

What exactly are you trying to do. Why are you needing to generate an image? More specifically why can't this be done before runtime? What is the exact thing you want to do from a users perspective?

Yes, the image should be the same across all players.

It can't generate the image pre runtime, as there wouldn't be an image to generate - it's decided on runtime. I'm trying to Make a portal that renders the opposite side once, and does an effect when it's used akin to mario 64's paintings.

From a user's perspective:

Right click with magic paintbrush, Magic paintbrush gets an image based on the user's perspective (without GUI.), and stores it on a painting item which is created.

When placed, this painting item uses that image as a texture - and when collided with, teleports the entitiy to where the image was taken/paintbrush was right clicked.

An alternative method would be having a GUI which asks for an image to be uploaded, but I'd prefer to have the "Screenshot" functionality either way.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.