Tuesday, November 29, 2022
HomeGame DevelopmentEyedropper instrument inside Minecraft Java

Eyedropper instrument inside Minecraft Java


I am attempting to make an eyedropper instrument (one the place it picks up the colour the instrument is being pointed at) for a Minecraft mod that makes use of Forge on IntelliJ IDEA. I have already got the merchandise/instrument prepared and capable of be crafted, however I am unsure the right way to construct it so it will probably decide up pixel coloration, whether or not it is potential with out Javascript, or if it will be potential to construct it as of now contemplating it is in a sport software program moderately than inside a browser.

This is the closest I’ve come to with analysis on how I can construct it with Java, however import internet.java.swing.software.* was a difficulty for which I am unsure the explanation.

import java.textual content.*;
import java.util.Listing;
import java.awt.*;
import javax.swing.*;


public class PickupColor extends SingleFrameApplication { // "Can not resolve image 'SingleFrameApplication'"
    public JButton eyedropper, give up;
    public JComponent colormap;
    public JFrame rootFrame;
    public Picture background_image;
    public Robotic robotic;
    public Dimension screen_size;
    public Container contentPane;
    public JComponent button_panel;
    public JPanel image_panel;
    public JPanel control_panel;
    public JPanel color_panel;
    public ColorLabel selected_color; // "Can not resolve image 'ColorLabel'"
    public ColorLabel color_rich, color_pale,
            color_bright, color_dark; // // "Can not resolve image 'ColorLabel'"
    public Font color_font;

    /* init code */
    public void init(JFrame rootFrame,
                     Container contentPane, Listing args) {
        strive {
            this.rootFrame = rootFrame;
            this.contentPane = contentPane;
            this.color_font = new Font("Monospaced",Font.PLAIN,14);

            // take a screenshot
            screen_size = Toolkit.getDefaultToolkit().getScreenSize();
            Rectangle rect = new Rectangle(0,0,
                    (int)screen_size.getWidth(),
                    (int)screen_size.getHeight());
            this.robotic = new Robotic();
            background_image = robotic.createScreenCapture(rect);

            tremendous.init(rootFrame,contentPane,args); // "Can not resolve technique 'init(JFrame, Container, Listing)'"

        } catch (Exception ex) {
            p(ex.toString()); // "Can not resolve technique 'p' in 'PickupColor'"
        }
}

The errors listed above are most certainly due to that one import I’m unable to incorporate.

The plan for the instrument is as follows:

  • The eyedropper instrument is in the proper hand of the participant, and much like mods like Chisels and Bits (right here is the GitHub too), it will decide up the pixels of the block that is being pointed at with the instrument
  • The one particular pixel being pointed at is zoomed in on and shows the hex worth of that pixel above
  • The participant can right-click it to save lots of that coloration briefly for different capabilities
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments