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

Dioptra extension #6

Open
Szasdragon opened this issue Mar 29, 2020 · 8 comments
Open

Dioptra extension #6

Szasdragon opened this issue Mar 29, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@Szasdragon
Copy link

The computer could be read the Vis and Flux level values in the Dioptria's detection range. The "TileDioptra.java" has a public, byte array called "grid_amt". I suggest two new callbacks. With this, we don't need 144 Dioptra, just to monitor the surrounding aura.

@jco2641
Copy link
Owner

jco2641 commented Apr 3, 2020

If I've understood it correctly grid_amt is a 13x13 array of the vis or flux values in the surrounding aura chunks, depending on the current state of whether the dioptra block is displaying vis or flux values.
The existing callbacks in the dioptra driver just use the aurahelper class to check vis and flux levels in the chunk the dioptra TE is in.
I think I could fetch the current value of grid_amt and be able to figure out whether its vis or flux values. It would possibly be useful to be able to toggle the mode of the dioptra to be able to get the other type of value array.
Alternatively, the callbacks could calculate an equivalent array of values for each of vis and flux and return those.

@jco2641 jco2641 added the enhancement New feature or request label Apr 3, 2020
@Szasdragon
Copy link
Author

I think it stores both of them. I used "Show Java" decompiler on my tablet. I only have methods present in thaumcraft java. Everything else outside from this have only reference names.

@Szasdragon
Copy link
Author

Also I can't math. 13^2 = 169 😑

@jco2641
Copy link
Owner

jco2641 commented Apr 12, 2020

The magic in the dioptra is in the update() function. This is called during server ticks.
Line 44 (per the output of my decompiler) checks the block metatdata 'enabled' parameter, and depending on what it finds populates the grid_amt array with either vis values or flux values.
That block property is toggled by right-clicking the block. (BlockDioptra.class, line 57)
My guess is the block rendering handles checking which state its in to change the color that the grid map on the block is drawn. I don't understand GUI stuff yet.

So, just reading the array by itself, you don't necessarily know if the values you're getting are vis or flux. The function could probably also expose a flag for which is which by likewise checking the block metadata.
I think it would be more useful to just make the array of each type available to the computer upon demand.

jco2641 added a commit that referenced this issue Apr 12, 2020
@jco2641
Copy link
Owner

jco2641 commented Apr 12, 2020

@Szasdragon
Copy link
Author

Thanks for the beta. I don't know how compile this project.
I tested the Dioptra map calls with parameter 7. It's works well. I can access any individual chunk Vis or Flux level.
In the documentation I would include:
"The list start from north (-Z) west (-X) corner and end in the south (+Z) east (+X) corner."
If it will merge with the master branch, I begin to develop a flux alarm program.

@Szasdragon
Copy link
Author

Szasdragon commented Jun 12, 2020

Also tested with other parameters.

Parameter; List Size

6+; 169

6; 169

5; 121

4; 81

3; 49

2; 25

1; 9

0; 1 (same as GetVis() or GetFlux() method)

0-; 0 (Hmm... interesting... can it bee considered as an empty list?)

The parameter should be kept in range? [1; 6]

@Szasdragon
Copy link
Author

Update to the mod description, after merging:

Thaumic Dioptra:

  1. Place an Adapter next to a Dioptra.
  2. The connected computer can query levels of the Vis and Flux from the chunks.
    Calling metods:
    getVis():float - Get the Vis in the current chunk.
    getFlux():float - Get the Flux in the current chunk.
    getVisMap():list(float) - Get the Vis in the surrounding N (<7) chunk radius. The list first entry the North-West (-X; -Z) chunk, toward East and South (+X; +Z).
    getFluxMap():list(float) - Get the Flux in the surrounding N (<7) chunk radius. The list first entry the North-West (-X; -Z) chunk, toward East and South (+X; +Z).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants