├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── config.yml
│ └── feature_request.md
├── assets
│ ├── advanced-xray-neoforge-logo.svg
│ └── xray-fabric-badge.svg
└── workflows
│ ├── build.yml
│ └── release.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
├── src
└── main
│ ├── java
│ └── pro
│ │ └── mikey
│ │ └── xray
│ │ ├── ClientController.java
│ │ ├── Configuration.java
│ │ ├── Utils.java
│ │ ├── XRay.java
│ │ ├── gui
│ │ ├── GuiHelp.java
│ │ ├── GuiOverlay.java
│ │ ├── GuiSelectionScreen.java
│ │ ├── manage
│ │ │ ├── BlockListScreen.java
│ │ │ ├── GuiAddBlock.java
│ │ │ └── GuiEdit.java
│ │ └── utils
│ │ │ ├── GuiBase.java
│ │ │ └── SupportButton.java
│ │ ├── keybinding
│ │ └── KeyBindings.java
│ │ ├── mixins
│ │ ├── BlockRenderMixin.java
│ │ └── ClientDestroyBlockEvent.java
│ │ ├── store
│ │ ├── BlockStore.java
│ │ ├── DiscoveryStorage.java
│ │ └── GameBlockStore.java
│ │ ├── utils
│ │ ├── BlockData.java
│ │ └── RenderBlockProps.java
│ │ └── xray
│ │ ├── Controller.java
│ │ ├── Events.java
│ │ ├── Render.java
│ │ └── RenderEnqueue.java
│ └── resources
│ ├── META-INF
│ ├── accesstransformer.cfg
│ └── neoforge.mods.toml
│ ├── assets
│ └── xray
│ │ ├── lang
│ │ ├── en_us.json
│ │ ├── fr_ca.json
│ │ └── zh_cn.json
│ │ ├── logo-small.jpg
│ │ ├── shaders
│ │ └── frag
│ │ │ └── constant_color.fsh
│ │ └── textures
│ │ └── gui
│ │ ├── bg-help.png
│ │ ├── bg.png
│ │ ├── circle.png
│ │ └── color-bg.png
│ ├── pack.mcmeta
│ └── xray.mixins.json
└── versions.json
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: If you've found a bug that you think needs to be fixed then use this template. Be sure to fill out the form as shown and don't leave any sections off.
4 | ---
5 |
6 | **Describe the bug**
7 | A clear and concise description of what the bug is.
8 |
9 | **To Reproduce**
10 | Steps to reproduce the behavior:
11 | 1. step one
12 |
13 | **Expected behavior**
14 | A clear and concise description of what you expected to happen.
15 |
16 | **Screenshots**
17 | If applicable (delete if not), add screenshots to help explain your problem.
18 |
19 | **Minecraft Enviorment**
20 | - Minecraft Version: [eg: 1.12.2]
21 | - XRay Mod Version: [eg: 1.5.0]
22 | - Mod Pack & Version if applicable
23 | - Forge Version if applicable
24 |
25 | **Additional context**
26 | Add any other context about the problem here.
27 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/.github/assets/advanced-xray-neoforge-logo.svg:
--------------------------------------------------------------------------------
1 |
45 |
--------------------------------------------------------------------------------
/.github/assets/xray-fabric-badge.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build and Package
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v4
12 | - name: Set up JDK
13 | uses: actions/setup-java@v4
14 | with:
15 | java-version: '21'
16 | cache: 'gradle'
17 | distribution: 'microsoft'
18 | - name: Build with Gradle
19 | run: |
20 | chmod +x ./gradlew
21 | ./gradlew build
22 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: CI Build & Release
2 |
3 | on:
4 | push:
5 | tags:
6 | - v/*
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v4
13 | - name: Set up JDK
14 | uses: actions/setup-java@v4
15 | with:
16 | java-version: '21'
17 | cache: 'gradle'
18 | distribution: 'microsoft'
19 | - name: Publish & Release to Curse
20 | env:
21 | SAPS_TOKEN: ${{ secrets.SAPS_TOKEN }}
22 | CURSE_DEPLOY_TOKEN: ${{ secrets.CURSE_DEPLOY_TOKEN }}
23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 | run: |
25 | chmod +x ./gradlew
26 | ./gradlew build publish publishMods --stacktrace --no-daemon
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # eclipse
2 | bin
3 | *.launch
4 | .settings
5 | .metadata
6 | .classpath
7 | .project
8 |
9 | # idea
10 | out
11 | *.ipr
12 | *.iws
13 | *.iml
14 | .idea
15 |
16 | # gradle
17 | build
18 | .gradle
19 |
20 | # other
21 | eclipse
22 | run
23 |
24 | CREDITS-fml.txt
25 | *.txt
26 |
27 | classes/
28 | .DS_Store
29 | /logs/
30 | runs/
31 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [21.5.1]
2 |
3 | ### Fixed
4 |
5 | - Rendering issue causing water and other effects to mutate vertex colours (Thanks to [@cargocats](https://github.com/cargocats) [#303](https://github.com/AdvancedXRay/XRay-Mod/pull/303))
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Advanced XRay (NeoForge Edition)
4 | Minecraft Forge based XRay mod designed to aid players who don't like the ore searching process.
5 |
6 | [](https://www.curseforge.com/minecraft/mc-mods/advanced-xray) [](https://www.curseforge.com/minecraft/mc-mods/advanced-xray)
7 |
8 | ##### Looking for the Fabric version? Click the button below :tada:
9 |
10 |
11 |
12 |
13 | ## Feature
14 |
15 | - Built using Forge ⚒
16 | - Clean UI For Adding, Deleting and Editing the blocks you want to X-Ray
17 | - Full RGB Colour selector
18 | - Searchable List to find Blocks
19 | - Add Blocks from your hand
20 | - Add Blocks you're looking at!
21 | - Searchable list of blocks you've added
22 | - Json store for the blocks you've added. Easy to edit and share!
23 |
24 | ## Todo (TBA)
25 |
26 | - Mob support
27 | - Support for all fluids now it's a new system in 1.14.
28 |
29 | ## How to use
30 |
31 | **Using XRay**
32 |
33 | > Please note that these aren't always the ones set by default. Be sure to check your controls settings under `XRay` to find the correct keys*
34 |
35 | - Press `Backslash` to toggle XRay `ON/OFF`
36 | - Press `G` to open the `selection & settings` Gui
37 |
38 | **Adding Blocks**
39 |
40 | - Open the `selection & settings` Gui
41 | - Select the method you'd like to use to add a block, either
42 | - `From hand` *will set up the basic version of the block. So no axis, facing, etc*
43 | - `Looking At` *Will set up the complex version of the block, good for blocks you need specifc data from*
44 | - `Searching a list` *Like `From hand`, it will only setup a basic block*
45 | - Set the Name, Color, and anything else you'd like to change
46 | - Click add and Enable the Block if it's not enabled. You can enable and disable blocks by clicking on them in the Gui.
47 |
48 | **Editing Blocks**
49 |
50 | - Right click on any item in the Gui and edit as needed
51 | - Click save and the changed will be applied instantly
52 |
53 | [](https://discord.gg/KV7yDTfEkm)
54 |
55 | ## Previews
56 |
57 | The [Imgur Album](http://imgur.com/a/23dX5)
58 | 
59 |
60 | ## Use on public servers
61 |
62 | I **DO NOT** support the use of this mod on any public servers which do not allow this kind of mod. The mod **does** work on servers but I do not approve of, and will not, support anyone that attempts to use this mod on servers. I **do not** have the time to review each issue; I will simply close any issue with server connections in the crash log.
63 |
64 | If you wish to use this mod on private servers then that's on you. If you use this on public servers and are banned then that's on you and I will **not** support your use of this mod in that way.
65 |
66 | Join my Discord and ask about how to change the mod to use it on a server, if you can use it on servers or anything related, you will be banned without warning.
67 |
68 | ## A note on Optifine
69 | Currently, the mod does not and has not work with Optifine since MC `1.7.x`. I am not sure why the two mods do not work
70 | together and due to Optfine being closed source I don't have the ability to investigate it properly. For now, I just recommend not using the two mods together. I hope to have it fixed soon.
71 |
72 | ## A note on Minecraft Forge
73 |
74 | As of Minecraft `1.20.5+` I am no longer supporting Minecraft Forge. I have moved to NeoForge as it a maintained, feature-rich, and more stable fork of Minecraft Forge. This will mean going forwards, this mod will no longer be usable on Minecraft Forge.
75 |
76 | Sorry for any inconvenience this may cause.
77 |
78 | ## Game support system
79 |
80 | I only support the last two major versions of Minecraft. For example `1.18` is the current (as of 02/2022) version of Minecraft, thus this is the First major version I support. The last long-lived versions of Minecraft was `1.16` and thus I will continue to support that until `1.18` is replaced by another long-lived version. At that point, I'll switch to `1.XX` & `1.18` for example.
81 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'idea'
3 | id 'java-library'
4 | id 'maven-publish'
5 | id 'net.neoforged.moddev' version '2.0.78'
6 | id "me.modmuss50.mod-publish-plugin" version "0.8.4"
7 | }
8 |
9 | tasks.named('wrapper', Wrapper).configure {
10 | distributionType = Wrapper.DistributionType.BIN
11 | }
12 |
13 | java.toolchain.languageVersion = JavaLanguageVersion.of(21)
14 |
15 | version = mod_version
16 | group = 'pro.mikey'
17 |
18 | base {
19 | archivesName = "advanced-xray-neoforge"
20 | }
21 |
22 | neoForge {
23 | version = project.forge_version
24 | accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
25 |
26 | runs {
27 | // applies to all the run configs below
28 | configureEach {
29 | systemProperty 'forge.logging.markers', 'REGISTRIES'
30 | logLevel = org.slf4j.event.Level.DEBUG
31 | }
32 |
33 | client {
34 | client()
35 | systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
36 | }
37 | }
38 |
39 | mods {
40 | "${mod_id}" {
41 | sourceSet(sourceSets.main)
42 | }
43 | }
44 | }
45 |
46 | def replaceProperties = [
47 | minecraft_version: minecraft_version,
48 | minecraft_version_range: minecraft_version_range.replace("[%base]", minecraft_version),
49 | forge_version_range: forge_version_range,
50 | version: version,
51 | ]
52 |
53 | processResources {
54 | inputs.properties replaceProperties
55 |
56 | filesMatching("META-INF/neoforge.mods.toml") {
57 | expand replaceProperties
58 | }
59 | }
60 |
61 | configurations {
62 | runtimeClasspath.extendsFrom localRuntime
63 | }
64 |
65 | dependencies {
66 | }
67 |
68 | repositories {
69 | maven {
70 | url "https://maven.neoforged.net/releases"
71 | }
72 | }
73 |
74 | java {
75 | withSourcesJar()
76 | }
77 |
78 | publishing {
79 | publications {
80 | mavenJava(MavenPublication) {
81 | artifactId = rootProject.archivesBaseName
82 | from components.java
83 | }
84 | }
85 |
86 | repositories {
87 | def token = providers.environmentVariable("SAPS_TOKEN");
88 | if (token.isPresent()) {
89 | maven {
90 | url "https://maven.saps.dev/releases"
91 | credentials {
92 | username = "mikeymods"
93 | password = token.get()
94 | }
95 | }
96 | }
97 | }
98 | }
99 |
100 | publishMods {
101 | dryRun = providers.environmentVariable("CURSE_DEPLOY_TOKEN").getOrNull() == null
102 | changelog = file("./CHANGELOG.md").text
103 | version = "${mod_version}"
104 | type = STABLE
105 |
106 | curseforge {
107 | accessToken = providers.environmentVariable("CURSE_DEPLOY_TOKEN")
108 | projectId = "${curse_id}"
109 | minecraftVersions.add("${minecraft_version}")
110 | modLoaders.add("neoforge")
111 | displayName = "[NEOFORGE] [${minecraft_version}] ${project.name} ${mod_version}"
112 | file = project.tasks.jar.archiveFile
113 | }
114 |
115 | github {
116 | accessToken = providers.environmentVariable("GITHUB_TOKEN")
117 | repository = "AdvancedXRay/XRay-Mod"
118 | commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun")
119 | tagName = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryRun")
120 |
121 | file = project.tasks.jar.archiveFile
122 | }
123 | }
124 |
125 | tasks.withType(JavaCompile).configureEach {
126 | options.encoding = 'UTF-8'
127 | }
128 |
129 | idea {
130 | module {
131 | downloadSources = true
132 | downloadJavadoc = true
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties.
2 | # This is required to provide enough memory for the Minecraft decompilation process.
3 | org.gradle.jvmargs=-Xmx4G
4 | org.gradle.daemon=true
5 | org.gradle.parallel=true
6 | org.gradle.caching=true
7 | org.gradle.configuration-cache=true
8 |
9 | # https://parchmentmc.org/docs/getting-started
10 | parchment_minecraft_version=1.21.4
11 | parchment_mappings_version=2025.03.23
12 |
13 | mod_id=xray
14 | mod_version=21.5.1
15 | minecraft_version=1.21.5
16 | minecraft_version_range=[%base],1.21.6
17 |
18 | # Forge
19 | forge_version=21.5.7-beta
20 | forge_version_range=21.5
21 | curse_id=256256
22 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MSYS* | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | mavenLocal()
4 | gradlePluginPortal()
5 | maven { url = 'https://maven.neoforged.net/releases' }
6 | }
7 | }
8 |
9 | plugins {
10 | id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/ClientController.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray;
2 |
3 | import net.minecraft.ChatFormatting;
4 | import net.minecraft.client.Minecraft;
5 | import net.minecraft.client.resources.language.I18n;
6 | import net.minecraft.network.chat.Component;
7 | import net.minecraft.world.entity.player.Player;
8 | import net.neoforged.bus.api.IEventBus;
9 | import net.neoforged.fml.ModLoadingContext;
10 | import net.neoforged.fml.config.ModConfig;
11 | import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
12 | import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
13 | import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent;
14 | import net.neoforged.neoforge.common.NeoForge;
15 | import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;
16 | import pro.mikey.xray.keybinding.KeyBindings;
17 | import pro.mikey.xray.store.BlockStore;
18 | import pro.mikey.xray.store.DiscoveryStorage;
19 | import pro.mikey.xray.store.GameBlockStore;
20 | import pro.mikey.xray.utils.BlockData;
21 | import pro.mikey.xray.xray.Controller;
22 | import pro.mikey.xray.xray.Events;
23 |
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | public class ClientController {
28 | // This contains all the games blocks to allow us to reference them
29 | // when needed. This allows us to avoid continually rebuilding
30 | public static GameBlockStore gameBlockStore = new GameBlockStore();
31 | public static DiscoveryStorage blockStore;
32 |
33 | static void onSetup(final FMLClientSetupEvent event) {
34 | XRay.logger.debug(I18n.get("xray.debug.init"));
35 |
36 | blockStore = new DiscoveryStorage();
37 | ClientController.gameBlockStore.populate();
38 | Controller.init();
39 |
40 | KeyBindings.setup();
41 | List data = ClientController.blockStore.read();
42 | if( data.isEmpty() )
43 | return;
44 |
45 | ArrayList map = BlockStore.getFromSimpleBlockList(data);
46 | Controller.getBlockStore().setStore(map);
47 | }
48 |
49 | static void onGameJoin(final EntityJoinLevelEvent event) {
50 | if (!Configuration.firstRun.get()) {
51 | return;
52 | }
53 |
54 | if (!event.getLevel().isClientSide() || !( event.getEntity() instanceof Player player)) {
55 | return;
56 | }
57 |
58 | if (player != Minecraft.getInstance().player) {
59 | return;
60 | }
61 |
62 | player.displayClientMessage(Component.translatable("xray.chat.first-time", KeyBindings.toggleGui.getKey().getDisplayName().copy().withStyle(ChatFormatting.GREEN), KeyBindings.toggleXRay.getKey().getDisplayName().copy().withStyle(ChatFormatting.GREEN)), false);
63 | player.displayClientMessage(Component.translatable("xray.chat.first-time-line-2"), false);
64 | Configuration.firstRun.set(false);
65 | Configuration.firstRun.save();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/Configuration.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray;
2 |
3 |
4 | import net.neoforged.neoforge.common.ModConfigSpec;
5 |
6 | public class Configuration
7 | {
8 | private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
9 |
10 | public static final General general = new General();
11 | public static final Store store = new Store();
12 |
13 | public static final ModConfigSpec.BooleanValue firstRun = BUILDER
14 | .comment("DO NOT TOUCH!", "This is not for you.", "This is used to check if it's the first time the mod has been run")
15 | .define("firstRun", true);
16 |
17 | public static class General {
18 | public final ModConfigSpec.BooleanValue showOverlay;
19 | public final ModConfigSpec.DoubleValue outlineThickness;
20 |
21 | General() {
22 | BUILDER.push("general");
23 |
24 | showOverlay = BUILDER
25 | .comment("This allows you hide or show the overlay in the top right of the screen when XRay is enabled")
26 | .define("showOverlay", true);
27 |
28 | outlineThickness = BUILDER
29 | .comment("This allows you to set your own outline thickness, I find that 1.0 is perfect but others my",
30 | "think differently. The max is 5.0")
31 | .defineInRange("outlineThickness", 1.0, 1.0, 5.0);
32 |
33 | BUILDER.pop();
34 | }
35 | }
36 |
37 | public static class Store {
38 | public final ModConfigSpec.IntValue radius;
39 | public final ModConfigSpec.BooleanValue lavaActive;
40 |
41 | Store() {
42 | BUILDER.comment("DO NOT TOUCH!").push("store");
43 |
44 | radius = BUILDER
45 | .comment("DO NOT TOUCH!", "This is not for you.")
46 | .defineInRange("radius", 2, 0, 5);
47 |
48 | lavaActive = BUILDER
49 | .comment("Memory value for if you're currently wanting Lava to be rendered into the mix")
50 | .define("lavaActive", false);
51 |
52 | BUILDER.pop();
53 | }
54 | }
55 |
56 | public static final ModConfigSpec SPEC = BUILDER.build();
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/Utils.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray;
2 |
3 | import net.minecraft.network.chat.Component;
4 | import net.minecraft.resources.ResourceLocation;
5 | import net.minecraft.world.item.ItemStack;
6 | import org.jetbrains.annotations.Nullable;
7 |
8 | public class Utils {
9 | public static ResourceLocation rl(String path) {
10 | return ResourceLocation.fromNamespaceAndPath(XRay.MOD_ID, path);
11 | }
12 |
13 | public static ResourceLocation rlFull(String namespaceAndPath) {
14 | return ResourceLocation.tryParse(namespaceAndPath);
15 | }
16 |
17 | public static Component safeItemStackName(ItemStack stack) {
18 | try {
19 | @Nullable var hoverName = stack.getHoverName();
20 | if (hoverName != null) {
21 | return hoverName;
22 | }
23 |
24 | var displayName = stack.getDisplayName();
25 | if (displayName != null) {
26 | return displayName;
27 | }
28 |
29 | return Component.translatable(stack.getItem().getDescriptionId());
30 | } catch (Exception e) {
31 | return Component.literal("Unknown...");
32 | }
33 | }
34 |
35 | private static int packColorWithAlpha(int red, int green, int blue, int alpha) {
36 | return (red << 24) | (green << 16) | (blue << 8) | alpha;
37 | }
38 |
39 | private static int packColor(int red, int green, int blue) {
40 | return packColorWithAlpha(red, green, blue, 255);
41 | }
42 |
43 | public static int packColorWithAlpha(float red, float green, float blue, float alpha) {
44 | return packColorWithAlpha((int) (red * 255), (int) (green * 255), (int) (blue * 255), (int) (alpha * 255));
45 | }
46 |
47 | public static int packColor(float red, float green, float blue) {
48 | return packColorWithAlpha(red, green, blue, 1.0f);
49 | }
50 |
51 | public static int addAlphaToPackedColor(int packedColor, float alpha) {
52 | return (packedColor & 0x00FFFFFF) | ((int) (alpha * 255) << 24);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/XRay.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray;
2 |
3 | import net.neoforged.bus.api.IEventBus;
4 | import net.neoforged.fml.ModLoadingContext;
5 | import net.neoforged.fml.common.Mod;
6 | import net.neoforged.fml.config.ModConfig;
7 | import net.neoforged.fml.loading.FMLEnvironment;
8 | import net.neoforged.neoforge.client.event.RegisterRenderPipelinesEvent;
9 | import net.neoforged.neoforge.common.NeoForge;
10 | import org.apache.logging.log4j.LogManager;
11 | import org.apache.logging.log4j.Logger;
12 | import pro.mikey.xray.keybinding.KeyBindings;
13 | import pro.mikey.xray.xray.Events;
14 | import pro.mikey.xray.xray.Render;
15 |
16 | @Mod(XRay.MOD_ID)
17 | public class XRay {
18 | public static final String MOD_ID = "xray";
19 | public static final String PREFIX_GUI = String.format("%s:textures/gui/", MOD_ID);
20 |
21 | public static Logger logger = LogManager.getLogger();
22 |
23 | public XRay(IEventBus eventBus) {
24 | if (!FMLEnvironment.dist.isClient()) {
25 | return;
26 | }
27 |
28 | ModLoadingContext.get().getActiveContainer()
29 | .registerConfig(ModConfig.Type.CLIENT, Configuration.SPEC);
30 |
31 | eventBus.addListener(ClientController::onSetup);
32 | eventBus.addListener(KeyBindings::registerKeyBinding);
33 | eventBus.addListener(this::registerPipeline);
34 |
35 | // Keybindings
36 | NeoForge.EVENT_BUS.addListener(KeyBindings::eventInput);
37 | NeoForge.EVENT_BUS.addListener(ClientController::onGameJoin);
38 |
39 | NeoForge.EVENT_BUS.addListener(Events::tickEnd);
40 | NeoForge.EVENT_BUS.addListener(Events::onWorldRenderLast);
41 | }
42 |
43 | private void registerPipeline(RegisterRenderPipelinesEvent event) {
44 | event.registerPipeline(Render.LINES_NO_DEPTH);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/GuiHelp.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui;
2 |
3 | import com.mojang.blaze3d.vertex.PoseStack;
4 | import net.minecraft.client.Minecraft;
5 | import net.minecraft.client.gui.GuiGraphics;
6 | import net.minecraft.client.gui.components.Button;
7 | import net.minecraft.client.resources.language.I18n;
8 | import net.minecraft.network.chat.Component;
9 | import net.minecraft.resources.ResourceLocation;
10 | import pro.mikey.xray.gui.utils.GuiBase;
11 |
12 | import java.awt.*;
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | public class GuiHelp extends GuiBase {
17 | public GuiHelp() {
18 | super(false);
19 | this.setSize(380, 210);
20 | }
21 |
22 | private List areas = new ArrayList<>();
23 |
24 | @Override
25 | public void init() {
26 | super.init();
27 |
28 | areas.clear();
29 | areas.add(new LinedText("xray.message.help.gui"));
30 | areas.add(new LinedText("xray.message.help.warning"));
31 |
32 | this.addRenderableWidget(Button.builder(Component.translatable("xray.single.close"), btn -> {
33 | this.onClose();
34 | Minecraft.getInstance().setScreen(new GuiSelectionScreen());
35 | })
36 | .pos((getWidth() / 2) - 100, (getHeight() / 2) + 80)
37 | .size(200, 20)
38 | .build()
39 | );
40 | }
41 |
42 | @Override
43 | public void renderExtra(GuiGraphics guiGraphics, int x, int y, float partialTicks) {
44 | int lineY = (getHeight() / 2) - 85;
45 | for (LinedText linedText : areas) {
46 | for (String line : linedText.getLines()) {
47 | lineY += 12;
48 | guiGraphics.drawString(getFontRender(), line, (getWidth() / 2) - 176, lineY, Color.WHITE.getRGB());
49 | }
50 | lineY += 10;
51 | }
52 | }
53 |
54 | @Override
55 | public boolean hasTitle() {
56 | return true;
57 | }
58 |
59 | @Override
60 | public ResourceLocation getBackground() {
61 | return BG_LARGE;
62 | }
63 |
64 | @Override
65 | public String title() {
66 | return I18n.get("xray.single.help");
67 | }
68 |
69 | private static class LinedText {
70 | private String[] lines;
71 |
72 | LinedText(String key) {
73 | this.lines = I18n.get(key).split("\\R");
74 | }
75 |
76 | String[] getLines() {
77 | return lines;
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/GuiOverlay.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui;
2 |
3 | import com.mojang.blaze3d.systems.GpuDevice;
4 | import com.mojang.blaze3d.systems.RenderSystem;
5 | import net.minecraft.client.Minecraft;
6 | import net.minecraft.client.gui.GuiGraphics;
7 | import net.minecraft.client.renderer.RenderType;
8 | import net.minecraft.client.resources.language.I18n;
9 | import net.minecraft.resources.ResourceLocation;
10 | import net.neoforged.api.distmarker.Dist;
11 | import net.neoforged.api.distmarker.OnlyIn;
12 | import net.neoforged.bus.api.EventPriority;
13 | import net.neoforged.bus.api.SubscribeEvent;
14 | import net.neoforged.fml.common.EventBusSubscriber;
15 | import net.neoforged.neoforge.client.event.RenderGuiEvent;
16 | import pro.mikey.xray.Configuration;
17 | import pro.mikey.xray.Utils;
18 | import pro.mikey.xray.XRay;
19 | import pro.mikey.xray.xray.Controller;
20 |
21 | @EventBusSubscriber(modid = XRay.MOD_ID, value = Dist.CLIENT)
22 | public class GuiOverlay {
23 | private static final ResourceLocation CIRCLE = Utils.rlFull(XRay.PREFIX_GUI + "circle.png");
24 |
25 | @OnlyIn(Dist.CLIENT)
26 | @SubscribeEvent(priority = EventPriority.LOWEST)
27 | public static void RenderGameOverlayEvent(RenderGuiEvent.Post event) {
28 | // Draw Indicator
29 | if(!Controller.isXRayActive() || !Configuration.general.showOverlay.get())
30 | return;
31 |
32 | GuiGraphics guiGraphics = event.getGuiGraphics();
33 |
34 | GpuDevice gpuDevice = RenderSystem.tryGetDevice();
35 | boolean renderDebug = gpuDevice != null && gpuDevice.isDebuggingEnabled();
36 |
37 | int x = 5, y = 5;
38 | if (renderDebug) {
39 | x = Minecraft.getInstance().getWindow().getGuiScaledWidth() - 10;
40 | y = Minecraft.getInstance().getWindow().getGuiScaledHeight() - 10;
41 | }
42 |
43 | guiGraphics.blit(RenderType::guiTextured, CIRCLE, x, y, 0f, 0f, 5, 5, 5, 5, 0xFF00FF00);
44 |
45 | int width = Minecraft.getInstance().font.width(I18n.get("xray.overlay"));
46 | guiGraphics.drawString(Minecraft.getInstance().font, I18n.get("xray.overlay"), x + (!renderDebug ? 10 : -width - 5), y - (!renderDebug ? 1 : 2), 0xff00ff00);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/GuiSelectionScreen.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui;
2 |
3 | import com.mojang.blaze3d.vertex.PoseStack;
4 | import net.minecraft.client.Minecraft;
5 | import net.minecraft.client.gui.Font;
6 | import net.minecraft.client.gui.GuiGraphics;
7 | import net.minecraft.client.gui.components.Button;
8 | import net.minecraft.client.gui.components.EditBox;
9 | import net.minecraft.client.gui.components.ObjectSelectionList;
10 | import net.minecraft.client.renderer.RenderType;
11 | import net.minecraft.client.renderer.entity.ItemRenderer;
12 | import net.minecraft.client.resources.language.I18n;
13 | import net.minecraft.network.chat.Component;
14 | import net.minecraft.resources.ResourceLocation;
15 | import net.minecraft.world.InteractionHand;
16 | import net.minecraft.world.entity.player.Player;
17 | import net.minecraft.world.item.BlockItem;
18 | import net.minecraft.world.item.ItemStack;
19 | import net.minecraft.world.level.ClipContext;
20 | import net.minecraft.world.level.block.Block;
21 | import net.minecraft.world.phys.BlockHitResult;
22 | import net.minecraft.world.phys.HitResult;
23 | import net.minecraft.world.phys.Vec3;
24 | import pro.mikey.xray.ClientController;
25 | import pro.mikey.xray.Configuration;
26 | import pro.mikey.xray.Utils;
27 | import pro.mikey.xray.XRay;
28 | import pro.mikey.xray.gui.manage.BlockListScreen;
29 | import pro.mikey.xray.gui.manage.GuiAddBlock;
30 | import pro.mikey.xray.gui.manage.GuiEdit;
31 | import pro.mikey.xray.gui.utils.GuiBase;
32 | import pro.mikey.xray.gui.utils.SupportButton;
33 | import pro.mikey.xray.keybinding.KeyBindings;
34 | import pro.mikey.xray.store.BlockStore;
35 | import pro.mikey.xray.utils.BlockData;
36 | import pro.mikey.xray.xray.Controller;
37 |
38 | import javax.annotation.Nullable;
39 | import java.awt.*;
40 | import java.util.ArrayList;
41 | import java.util.Arrays;
42 | import java.util.Comparator;
43 | import java.util.List;
44 | import java.util.stream.Collectors;
45 |
46 | public class GuiSelectionScreen extends GuiBase {
47 | private static final ResourceLocation CIRCLE = Utils.rlFull(XRay.PREFIX_GUI + "circle.png");
48 |
49 | private Button distButtons;
50 | private EditBox search;
51 | public ItemRenderer render;
52 |
53 | private String lastSearch = "";
54 |
55 | private ArrayList itemList, originalList;
56 | private ScrollingBlockList scrollList;
57 |
58 | public GuiSelectionScreen() {
59 | super(true);
60 | this.setSideTitle(I18n.get("xray.single.tools"));
61 |
62 | // Inject this hear as everything is loaded
63 | if (ClientController.blockStore.created) {
64 | List blocks = ClientController.blockStore.populateDefault();
65 | Controller.getBlockStore().setStore(BlockStore.getFromSimpleBlockList(blocks));
66 |
67 | ClientController.blockStore.created = false;
68 | }
69 |
70 | this.itemList = new ArrayList<>(Controller.getBlockStore().getStore().values());
71 | this.itemList.sort(Comparator.comparingInt(BlockData::getOrder));
72 |
73 | this.originalList = this.itemList;
74 | }
75 |
76 | @Override
77 | public void init() {
78 | if (getMinecraft().player == null)
79 | return;
80 |
81 | this.render = Minecraft.getInstance().getItemRenderer();
82 | this.children().clear();
83 |
84 | this.scrollList = new ScrollingBlockList(((getWidth() / 2) - (203 / 2)) - 37, getHeight() / 2 + 10, 203, 185, this.itemList, this);
85 | addRenderableWidget(this.scrollList);
86 |
87 | this.search = new EditBox(getFontRender(), getWidth() / 2 - 137, getHeight() / 2 - 105, 202, 18, Component.empty());
88 | this.search.setCanLoseFocus(true);
89 | addRenderableWidget(this.search);
90 |
91 | // side bar buttons
92 | addRenderableWidget(new SupportButtonInner((getWidth() / 2) + 79, getHeight() / 2 - 60, 120, 20, I18n.get("xray.input.add"), "xray.tooltips.add_block", button -> {
93 | getMinecraft().setScreen(new BlockListScreen());
94 | }));
95 | addRenderableWidget(new SupportButtonInner(getWidth() / 2 + 79, getHeight() / 2 - 38, 120, 20, I18n.get("xray.input.add_hand"), "xray.tooltips.add_block_in_hand", button -> {
96 | ItemStack handItem = getMinecraft().player.getItemInHand(InteractionHand.MAIN_HAND);
97 |
98 | // Check if the hand item is a block or not
99 | if (!(handItem.getItem() instanceof BlockItem)) {
100 | getMinecraft().player.displayClientMessage(Component.literal("[XRay] " + I18n.get("xray.message.invalid_hand", Utils.safeItemStackName(handItem).getString())), false);
101 | return;
102 | }
103 |
104 | getMinecraft().setScreen(new GuiAddBlock(((BlockItem) handItem.getItem()).getBlock(), GuiSelectionScreen::new));
105 | }));
106 | addRenderableWidget(new SupportButtonInner(getWidth() / 2 + 79, getHeight() / 2 - 16, 120, 20, I18n.get("xray.input.add_look"), "xray.tooltips.add_block_looking_at", button -> {
107 | Player player = getMinecraft().player;
108 | if (getMinecraft().level == null || player == null)
109 | return;
110 |
111 | this.onClose();
112 | try {
113 | Vec3 look = player.getLookAngle();
114 | Vec3 start = new Vec3(player.blockPosition().getX(), player.blockPosition().getY() + player.getEyeHeight(), player.blockPosition().getZ());
115 | Vec3 end = new Vec3(player.blockPosition().getX() + look.x * 100, player.blockPosition().getY() + player.getEyeHeight() + look.y * 100, player.blockPosition().getZ() + look.z * 100);
116 |
117 | ClipContext context = new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player);
118 | BlockHitResult result = getMinecraft().level.clip(context);
119 |
120 | if (result.getType() == HitResult.Type.BLOCK) {
121 | Block lookingAt = getMinecraft().level.getBlockState(result.getBlockPos()).getBlock();
122 |
123 | player.closeContainer();
124 | getMinecraft().setScreen(new GuiAddBlock(lookingAt, GuiSelectionScreen::new));
125 | } else
126 | player.displayClientMessage(Component.literal("[XRay] " + I18n.get("xray.message.nothing_infront")), false);
127 | } catch (NullPointerException ex) {
128 | player.displayClientMessage(Component.literal("[XRay] " + I18n.get("xray.message.thats_odd")), false);
129 | }
130 | }));
131 |
132 | addRenderableWidget(distButtons = new SupportButtonInner((getWidth() / 2) + 79, getHeight() / 2 + 6, 120, 20, I18n.get("xray.input.show-lava", Controller.isLavaActive()), "xray.tooltips.show_lava", button -> {
133 | Controller.toggleLava();
134 | button.setMessage(Component.translatable("xray.input.show-lava", Controller.isLavaActive()));
135 | }));
136 |
137 | addRenderableWidget(distButtons = new SupportButtonInner((getWidth() / 2) + 79, getHeight() / 2 + 36, 120, 20, I18n.get("xray.input.distance", Controller.getVisualRadius()), "xray.tooltips.distance", button -> {
138 | Controller.incrementCurrentDist();
139 | button.setMessage(Component.translatable("xray.input.distance", Controller.getVisualRadius()));
140 | }));
141 | addRenderableWidget(
142 | Button.builder(Component.translatable("xray.single.help"), button -> {
143 | getMinecraft().setScreen(new GuiHelp());
144 | })
145 | .pos(getWidth() / 2 + 79, getHeight() / 2 + 58)
146 | .size(60, 20)
147 | .build()
148 | );
149 | addRenderableWidget(
150 | Button.builder(Component.translatable("xray.single.close"), button -> {
151 | this.onClose();
152 | })
153 | .pos((getWidth() / 2 + 79) + 62, getHeight() / 2 + 58)
154 | .size(59, 20)
155 | .build()
156 | );
157 | }
158 |
159 | @Override
160 | public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
161 | if (!search.isFocused() && keyCode == KeyBindings.toggleGui.getKey().getValue()) {
162 | this.onClose();
163 | return true;
164 | }
165 | return super.keyPressed(keyCode, scanCode, modifiers);
166 | }
167 |
168 | private void updateSearch() {
169 | if (lastSearch.equals(search.getValue()))
170 | return;
171 |
172 | if (search.getValue().isEmpty()) {
173 | this.itemList = this.originalList;
174 | this.scrollList.updateEntries(this.itemList);
175 | lastSearch = "";
176 | return;
177 | }
178 |
179 | // Special cases
180 | if (search.getValue().equals(":on") || search.getValue().equals(":off")) {
181 | var state = search.getValue().equals(":on");
182 | this.itemList = this.originalList.stream()
183 | .filter(e -> e.isDrawing() == state)
184 | .collect(Collectors.toCollection(ArrayList::new));
185 |
186 | this.itemList.sort(Comparator.comparingInt(BlockData::getOrder));
187 | this.scrollList.updateEntries(this.itemList);
188 | lastSearch = search.getValue();
189 | return;
190 | }
191 |
192 | this.itemList = this.originalList.stream()
193 | .filter(b -> b.getEntryName().toLowerCase().contains(search.getValue().toLowerCase()))
194 | .collect(Collectors.toCollection(ArrayList::new));
195 |
196 | this.itemList.sort(Comparator.comparingInt(BlockData::getOrder));
197 |
198 | this.scrollList.updateEntries(this.itemList);
199 | lastSearch = search.getValue();
200 | }
201 |
202 | @Override
203 | public void tick() {
204 | super.tick();
205 |
206 | updateSearch();
207 | }
208 |
209 | @Override
210 | public boolean mouseClicked(double x, double y, int mouse) {
211 | if (search.mouseClicked(x, y, mouse))
212 | this.setFocused(search);
213 |
214 | if (mouse == 1 && distButtons.isMouseOver(x, y)) {
215 | Controller.decrementCurrentDist();
216 | distButtons.setMessage(Component.translatable("xray.input.distance", Controller.getVisualRadius()));
217 | distButtons.playDownSound(Minecraft.getInstance().getSoundManager());
218 | }
219 |
220 | return super.mouseClicked(x, y, mouse);
221 | }
222 |
223 | @Override
224 | public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
225 | if (!search.isFocused() && search.getValue().equals(""))
226 | graphics.drawString(getFontRender(), I18n.get("xray.single.search"), getWidth() / 2 - 130, getHeight() / 2 - 101, Color.GRAY.getRGB());
227 |
228 | PoseStack pose = graphics.pose();
229 | pose.pushPose();
230 | pose.translate(this.getWidth() / 2f - 140, ((this.getHeight() / 2f) - 3) + 120, 0);
231 | pose.scale(0.75f, 0.75f, 0.75f);
232 | graphics.drawString(this.font, Component.translatable("xray.tooltips.edit1"), 0, 0, Color.GRAY.getRGB());
233 | pose.translate(0, 12, 0);
234 | graphics.drawString(this.font, Component.translatable("xray.tooltips.edit2"), 0, 0, Color.GRAY.getRGB());
235 | pose.popPose();
236 | }
237 |
238 | @Override
239 | public void removed() {
240 | Configuration.store.radius.save();
241 | ClientController.blockStore.write(new ArrayList<>(Controller.getBlockStore().getStore().values()));
242 |
243 | Controller.requestBlockFinder(true);
244 | super.removed();
245 | }
246 |
247 | static final class SupportButtonInner extends SupportButton {
248 | public SupportButtonInner(int widthIn, int heightIn, int width, int height, String text, String i18nKey, OnPress onPress) {
249 | super(widthIn, heightIn, width, height, Component.literal(text), Component.translatable(i18nKey), onPress);
250 | }
251 | }
252 |
253 | class ScrollingBlockList extends ObjectSelectionList {
254 | static final int SLOT_HEIGHT = 35;
255 | public GuiSelectionScreen parent;
256 |
257 | ScrollingBlockList(int x, int y, int width, int height, List blocks, GuiSelectionScreen parent) {
258 | super(GuiSelectionScreen.this.minecraft, width - 2, height, (GuiSelectionScreen.this.height / 2) - (height / 2) + 10, SLOT_HEIGHT);
259 | this.updateEntries(blocks);
260 | this.parent = parent;
261 |
262 | this.setX(x + 2);
263 | }
264 |
265 | @Override
266 | public int getRowWidth() {
267 | return 188;
268 | }
269 |
270 | @Override
271 | protected int scrollBarX() {
272 | return this.getX() + this.getRowWidth() + 6;
273 | }
274 |
275 | public void setSelected(@Nullable BlockSlot entry, int mouse) {
276 | if (entry == null)
277 | return;
278 |
279 | if (GuiSelectionScreen.hasShiftDown()) {
280 | Minecraft.getInstance().player.closeContainer();
281 | Minecraft.getInstance().setScreen(new GuiEdit(entry.block));
282 | return;
283 | }
284 |
285 | Controller.getBlockStore().toggleDrawing(entry.block);
286 | ClientController.blockStore.write(new ArrayList<>(Controller.getBlockStore().getStore().values()));
287 | }
288 |
289 | void updateEntries(List blocks) {
290 | this.clearEntries();
291 | blocks.forEach(block -> this.addEntry(new BlockSlot(block, this))); // @mcp: addEntry = addEntry
292 | }
293 |
294 | public static class BlockSlot extends ObjectSelectionList.Entry {
295 | BlockData block;
296 | ScrollingBlockList parent;
297 |
298 | BlockSlot(BlockData block, ScrollingBlockList parent) {
299 | this.block = block;
300 | this.parent = parent;
301 | }
302 |
303 | public BlockData getBlock() {
304 | return block;
305 | }
306 |
307 | @Override
308 | public void render(GuiGraphics guiGraphics, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
309 | BlockData blockData = this.block;
310 |
311 | Font font = Minecraft.getInstance().font;
312 |
313 | guiGraphics.drawString(font, blockData.getEntryName(), left + 25, top + 7, 0xFFFFFF);
314 | guiGraphics.drawString(font, blockData.isDrawing() ? "Enabled" : "Disabled", left + 25, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB());
315 |
316 | guiGraphics.renderItem(blockData.getItemStack(), left, top + 7);
317 | guiGraphics.renderItemDecorations(font, blockData.getItemStack(), left, top + 7); // TODO: verify
318 |
319 | var stack = guiGraphics.pose();
320 | stack.pushPose();
321 |
322 | guiGraphics.blit(RenderType::guiTextured, GuiSelectionScreen.CIRCLE, (left + entryWidth) - 23, (int) (top + (entryHeight / 2f) - 9), 0, 0, 14, 14, 14, 14, 0x7F000000);
323 | guiGraphics.blit(RenderType::guiTextured, GuiSelectionScreen.CIRCLE, (left + entryWidth) - 21, (int) (top + (entryHeight / 2f) - 7), 0, 0, 10, 10, 10, 10, 0xFF000000 | blockData.getColor());
324 |
325 | stack.popPose();
326 | }
327 |
328 | @Override
329 | public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int mouse) {
330 | this.parent.setSelected(this, mouse);
331 | return false;
332 | }
333 |
334 | @Override
335 | public Component getNarration() {
336 | return Component.empty();
337 | }
338 | }
339 | }
340 | }
341 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/manage/BlockListScreen.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui.manage;
2 |
3 | import net.minecraft.client.Minecraft;
4 | import net.minecraft.client.gui.Font;
5 | import net.minecraft.client.gui.GuiGraphics;
6 | import net.minecraft.client.gui.components.Button;
7 | import net.minecraft.client.gui.components.EditBox;
8 | import net.minecraft.client.gui.components.ObjectSelectionList;
9 | import net.minecraft.core.registries.BuiltInRegistries;
10 | import net.minecraft.network.chat.Component;
11 | import net.minecraft.resources.ResourceLocation;
12 | import pro.mikey.xray.ClientController;
13 | import pro.mikey.xray.Utils;
14 | import pro.mikey.xray.gui.GuiSelectionScreen;
15 | import pro.mikey.xray.gui.utils.GuiBase;
16 | import pro.mikey.xray.store.GameBlockStore;
17 |
18 | import javax.annotation.Nullable;
19 | import java.awt.*;
20 | import java.util.ArrayList;
21 | import java.util.List;
22 | import java.util.stream.Collectors;
23 |
24 | public class BlockListScreen extends GuiBase {
25 | private ScrollingBlockList blockList;
26 | private ArrayList blocks;
27 | private EditBox search;
28 | private String lastSearched = "";
29 |
30 | public BlockListScreen() {
31 | super(false);
32 | this.blocks = ClientController.gameBlockStore.getStore();
33 | }
34 |
35 | @Override
36 | public void init() {
37 | this.blockList = new ScrollingBlockList((getWidth() / 2) + 1, getHeight() / 2 - 12, 202, 182, this.blocks);
38 | addRenderableWidget(this.blockList);
39 |
40 | search = new EditBox(getFontRender(), getWidth() / 2 - 100, getHeight() / 2 + 85, 140, 18, Component.literal(""));
41 | search.setFocused(true);
42 | this.setFocused(search);
43 |
44 | addRenderableWidget(Button.builder(Component.translatable("xray.single.cancel"), b -> {
45 | this.onClose();
46 | Minecraft.getInstance().setScreen(new GuiSelectionScreen());
47 | })
48 | .pos(getWidth() / 2 + 43, getHeight() / 2 + 84)
49 | .size(60, 20)
50 | .build());
51 | }
52 |
53 | @Override
54 | public void tick() {
55 | if (!search.getValue().equals(this.lastSearched))
56 | reloadBlocks();
57 |
58 | super.tick();
59 | }
60 |
61 | private void reloadBlocks() {
62 | if (this.lastSearched.equals(search.getValue()))
63 | return;
64 |
65 | this.blockList.updateEntries(
66 | search.getValue().isEmpty()
67 | ? this.blocks
68 | : this.blocks.stream()
69 | .filter(e -> Utils.safeItemStackName(e.getItemStack()).getString().toLowerCase().contains(search.getValue().toLowerCase()))
70 | .collect(Collectors.toList())
71 | );
72 |
73 | lastSearched = search.getValue();
74 | this.blockList.setScrollAmount(0);
75 | }
76 |
77 | @Override
78 | public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
79 | search.render(graphics, x, y, partialTicks);
80 | blockList.render(graphics, x, y, partialTicks);
81 | }
82 |
83 | @Override
84 | public boolean mouseClicked(double x, double y, int button) {
85 | if( this.search.mouseClicked (x, y, button) )
86 | this.setFocused(this.search);
87 |
88 | return super.mouseClicked(x, y, button);
89 | }
90 |
91 | @Override
92 | public boolean mouseScrolled(double mouseX, double mouseY, double mouseXDelta, double mouseYDelta) {
93 | blockList.mouseScrolled(mouseX, mouseY, mouseXDelta, mouseYDelta);
94 | return super.mouseScrolled(mouseX, mouseY, mouseXDelta, mouseYDelta);
95 | }
96 |
97 | public class ScrollingBlockList extends ObjectSelectionList {
98 | static final int SLOT_HEIGHT = 35;
99 |
100 | ScrollingBlockList(int x, int y, int width, int height, List blocks) {
101 | super(BlockListScreen.this.minecraft, width, height, (BlockListScreen.this.height / 2) - (height / 2) - 10, SLOT_HEIGHT);
102 | // super(x, y, width, height, SLOT_HEIGHT);
103 | this.updateEntries(blocks);
104 | this.setX((BlockListScreen.this.getWidth() / 2) - (width / 2) + 1);
105 | }
106 |
107 | @Override
108 | public int getRowWidth() {
109 | return 188;
110 | }
111 |
112 | @Override
113 | protected int scrollBarX() {
114 | return this.getX() + this.getRowWidth() + 7;
115 | }
116 |
117 | @Override
118 | public void setSelected(@Nullable BlockSlot entry) {
119 | if (entry == null)
120 | return;
121 |
122 | Minecraft.getInstance().player.closeContainer();
123 | Minecraft.getInstance().setScreen(new GuiAddBlock(entry.getBlock().getBlock(), BlockListScreen::new));
124 | }
125 |
126 | void updateEntries(List blocks) {
127 | this.clearEntries(); // @mcp: clearEntries = clearEntries
128 | blocks.forEach(block -> this.addEntry(new BlockSlot(block, this)));
129 | }
130 |
131 | @Override
132 | public void renderWidget(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
133 | super.renderWidget(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
134 | }
135 |
136 | public class BlockSlot extends ObjectSelectionList.Entry {
137 | GameBlockStore.BlockWithItemStack block;
138 | private final ScrollingBlockList parent;
139 |
140 | public BlockSlot(GameBlockStore.BlockWithItemStack block, ScrollingBlockList parent) {
141 | this.block = block;
142 | this.parent = parent;
143 | }
144 |
145 | public GameBlockStore.BlockWithItemStack getBlock() {
146 | return block;
147 | }
148 |
149 | @Override
150 | public void render(GuiGraphics graphics, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
151 | Font font = this.parent.minecraft.font;
152 |
153 | ResourceLocation resource = BuiltInRegistries.ITEM.getKey(this.block.getItemStack().getItem());
154 | graphics.drawString(font, this.block.getItemStack().getItem().getName().getString(), left + 25, top + 7, Color.WHITE.getRGB());
155 | graphics.drawString(font, resource != null ? resource.getNamespace() : "", left + 25, top + 17, Color.GRAY.getRGB());
156 |
157 | graphics.renderItem(this.block.getItemStack(), left, top + 7);
158 | graphics.renderItemDecorations(font, this.block.getItemStack(), left, top + 7);
159 | }
160 |
161 | @Override
162 | public Component getNarration() {
163 | return Component.empty();
164 | }
165 |
166 | @Override
167 | public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
168 | this.parent.setSelected(this);
169 | return false;
170 | }
171 | }
172 | }
173 | }
174 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/manage/GuiAddBlock.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui.manage;
2 |
3 | import net.minecraft.client.Minecraft;
4 | import net.minecraft.client.gui.GuiGraphics;
5 | import net.minecraft.client.gui.components.Button;
6 | import net.minecraft.client.gui.components.EditBox;
7 | import net.minecraft.client.resources.language.I18n;
8 | import net.minecraft.core.registries.BuiltInRegistries;
9 | import net.minecraft.network.chat.Component;
10 | import net.minecraft.resources.ResourceLocation;
11 | import net.minecraft.world.item.ItemStack;
12 | import net.minecraft.world.level.block.Block;
13 | import net.neoforged.neoforge.client.gui.widget.ExtendedSlider;
14 | import pro.mikey.xray.ClientController;
15 | import pro.mikey.xray.gui.GuiSelectionScreen;
16 | import pro.mikey.xray.gui.utils.GuiBase;
17 | import pro.mikey.xray.utils.BlockData;
18 | import pro.mikey.xray.xray.Controller;
19 |
20 | import java.util.ArrayList;
21 | import java.util.Objects;
22 | import java.util.function.Supplier;
23 |
24 | public class GuiAddBlock extends GuiBase {
25 | private EditBox oreName;
26 | private ExtendedSlider redSlider;
27 | private ExtendedSlider greenSlider;
28 | private ExtendedSlider blueSlider;
29 |
30 | private final Block selectBlock;
31 | private final ItemStack itemStack;
32 |
33 | private boolean oreNameCleared = false;
34 |
35 | private final Supplier previousScreenCallback;
36 |
37 | public GuiAddBlock(Block selectedBlock, Supplier previousScreenCallback) {
38 | super(false);
39 | this.selectBlock = selectedBlock;
40 | this.previousScreenCallback = previousScreenCallback;
41 | this.itemStack = new ItemStack(selectBlock, 1);
42 | }
43 |
44 | @Override
45 | public void init() {
46 | // Called when the gui should be (re)created
47 | addRenderableWidget(Button.builder(Component.translatable("xray.single.add"), b -> {
48 | this.onClose();
49 |
50 | ResourceLocation key = BuiltInRegistries.BLOCK.getKey(selectBlock);
51 | if (key == null)
52 | return;
53 |
54 | // Push the block to the render stack
55 | Controller.getBlockStore().put(
56 | new BlockData(
57 | oreName.getValue(),
58 | key.toString(),
59 | (((int) (redSlider.getValue()) << 16) + ((int) (greenSlider.getValue()) << 8) + (int) (blueSlider.getValue() )),
60 | this.itemStack,
61 | true,
62 | Controller.getBlockStore().getStore().size() + 1
63 | )
64 | );
65 |
66 | ClientController.blockStore.write(new ArrayList<>(Controller.getBlockStore().getStore().values()));
67 | getMinecraft().setScreen(new GuiSelectionScreen());
68 | })
69 | .pos(getWidth() / 2 - 100, getHeight() / 2 + 85)
70 | .size(128, 20)
71 | .build());
72 |
73 | addRenderableWidget(Button.builder(Component.translatable("xray.single.cancel"), b -> {
74 | this.onClose();
75 | Minecraft.getInstance().setScreen(this.previousScreenCallback.get());
76 | })
77 | .pos(getWidth() / 2 + 30, getHeight() / 2 + 85)
78 | .size(72, 20)
79 | .build());
80 |
81 | addRenderableWidget(redSlider = new ExtendedSlider(getWidth() / 2 - 100, getHeight() / 2 + 7, 202, 20, Component.translatable("xray.color.red"), Component.empty(), 0, 255, 0, true));
82 | addRenderableWidget(greenSlider = new ExtendedSlider(getWidth() / 2 - 100, getHeight() / 2 + 30, 202, 20, Component.translatable("xray.color.green"), Component.empty(), 0, 255, 165, true));
83 | addRenderableWidget(blueSlider = new ExtendedSlider(getWidth() / 2 - 100, getHeight() / 2 + 53,202, 20, Component.translatable("xray.color.blue"), Component.empty(), 0, 255, 255, true));
84 |
85 | oreName = new EditBox(getMinecraft().font, getWidth() / 2 - 100, getHeight() / 2 - 70, 202, 20, Component.empty());
86 | oreName.setValue(this.selectBlock.getName().getString());
87 | addRenderableWidget(oreName);
88 | }
89 |
90 | @Override
91 | public void tick() {
92 | super.tick();
93 | }
94 |
95 | @Override
96 | public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
97 | graphics.drawString(font, selectBlock.getName().getString(), getWidth() / 2 - 100, getHeight() / 2 - 90, 0xffffff);
98 |
99 | int color = (255 << 24) | ((int) (this.redSlider.getValue()) << 16) | ((int) (this.greenSlider.getValue()) << 8) | (int) (this.blueSlider.getValue());
100 | graphics.fill(this.getWidth() / 2 - 100, this.getHeight() / 2 - 45, (this.getWidth() / 2 + 2) + 100, (this.getHeight() / 2 - 45) + 45, color);
101 |
102 | oreName.render(graphics, x, y, partialTicks);
103 |
104 | graphics.renderItem(this.itemStack, this.getWidth() / 2 + 85, this.getHeight() / 2 - 105);
105 | graphics.renderItemDecorations(font, this.itemStack, this.getWidth() / 2 + 85, this.getHeight() / 2 - 105); // TODO: Verify
106 |
107 | // Lighting.setupForFlatItems();
108 | // this.itemRenderer.renderAndDecorateItem(stack, this.itemStack, getWidth() / 2 + 85, getHeight() / 2 - 105);
109 | // Lighting.setupFor3DItems();
110 | }
111 |
112 | @Override
113 | public boolean mouseClicked(double x, double y, int mouse) {
114 | if (oreName.mouseClicked(x, y, mouse))
115 | this.setFocused(oreName);
116 |
117 | if (oreName.isFocused() && !oreNameCleared) {
118 | oreName.setValue("");
119 | oreNameCleared = true;
120 | }
121 |
122 | if (!oreName.isFocused() && oreNameCleared && Objects.equals(oreName.getValue(), "")) {
123 | oreNameCleared = false;
124 | oreName.setValue(this.selectBlock.getName().getString());
125 | }
126 |
127 | return super.mouseClicked(x, y, mouse);
128 | }
129 |
130 | @Override
131 | public boolean hasTitle() {
132 | return true;
133 | }
134 |
135 | @Override
136 | public String title() {
137 | return I18n.get("xray.title.config");
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/manage/GuiEdit.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui.manage;
2 |
3 | import net.minecraft.client.gui.GuiGraphics;
4 | import net.minecraft.client.gui.components.Button;
5 | import net.minecraft.client.gui.components.EditBox;
6 | import net.minecraft.client.resources.language.I18n;
7 | import net.minecraft.network.chat.Component;
8 | import net.neoforged.neoforge.client.gui.widget.ExtendedSlider;
9 | import org.apache.commons.lang3.tuple.Pair;
10 | import pro.mikey.xray.ClientController;
11 | import pro.mikey.xray.Utils;
12 | import pro.mikey.xray.gui.GuiSelectionScreen;
13 | import pro.mikey.xray.gui.utils.GuiBase;
14 | import pro.mikey.xray.utils.BlockData;
15 | import pro.mikey.xray.xray.Controller;
16 |
17 | import java.util.ArrayList;
18 | import java.util.UUID;
19 |
20 | public class GuiEdit extends GuiBase {
21 | private EditBox oreName;
22 | private ExtendedSlider redSlider;
23 | private ExtendedSlider greenSlider;
24 | private ExtendedSlider blueSlider;
25 | private final BlockData block;
26 |
27 | public GuiEdit(BlockData block) {
28 | super(true); // Has a sidebar
29 | this.setSideTitle(I18n.get("xray.single.tools"));
30 |
31 | this.block = block;
32 | }
33 |
34 | @Override
35 | public void init() {
36 | addRenderableWidget(Button.builder(Component.translatable("xray.single.delete"), b -> {
37 | Controller.getBlockStore().remove(block.getBlockName());
38 | ClientController.blockStore.write(new ArrayList<>(Controller.getBlockStore().getStore().values()));
39 |
40 | this.onClose();
41 | getMinecraft().setScreen(new GuiSelectionScreen());
42 | })
43 | .pos((getWidth() / 2) + 78, getHeight() / 2 - 60)
44 | .size(120, 20)
45 | .build());
46 |
47 | addRenderableWidget(Button.builder(Component.translatable("xray.single.cancel"), b -> {
48 | this.onClose();
49 | this.getMinecraft().setScreen(new GuiSelectionScreen());
50 | })
51 | .pos((getWidth() / 2) + 78, getHeight() / 2 + 58)
52 | .size(120, 20)
53 | .build());
54 |
55 | addRenderableWidget(Button.builder(Component.translatable("xray.single.save"), b -> {
56 | BlockData block = new BlockData(
57 | this.oreName.getValue(),
58 | this.block.getBlockName(),
59 | (((int) (redSlider.getValue()) << 16) + ((int) (greenSlider.getValue()) << 8) + (int) (blueSlider.getValue())),
60 | this.block.getItemStack(),
61 | this.block.isDrawing(),
62 | this.block.getOrder()
63 | );
64 |
65 | Pair data = Controller.getBlockStore().getStoreByReference(block.getBlockName());
66 | Controller.getBlockStore().getStore().remove(data.getValue());
67 | Controller.getBlockStore().getStore().put(data.getValue(), block);
68 |
69 | ClientController.blockStore.write(new ArrayList<>(Controller.getBlockStore().getStore().values()));
70 | this.onClose();
71 | getMinecraft().setScreen(new GuiSelectionScreen());
72 | })
73 | .pos(getWidth() / 2 - 138, getHeight() / 2 + 83)
74 | .size(202, 20)
75 | .build());
76 |
77 | addRenderableWidget(redSlider = new ExtendedSlider(getWidth() / 2 - 138, getHeight() / 2 + 7, 202, 20, Component.translatable("xray.color.red"), Component.empty(), 0, 255, (block.getColor() >> 16 & 0xff), true));
78 | addRenderableWidget(greenSlider = new ExtendedSlider(getWidth() / 2 - 138, getHeight() / 2 + 30, 202, 20, Component.translatable("xray.color.green"), Component.empty(), 0, 255, (block.getColor() >> 8 & 0xff), true));
79 | addRenderableWidget(blueSlider = new ExtendedSlider(getWidth() / 2 - 138, getHeight() / 2 + 53,202, 20, Component.translatable("xray.color.blue"), Component.empty(), 0, 255, (block.getColor() & 0xff), true));
80 |
81 | oreName = new EditBox(getMinecraft().font, getWidth() / 2 - 138, getHeight() / 2 - 63, 202, 20, Component.literal(""));
82 | oreName.setValue(this.block.getEntryName());
83 | addRenderableWidget(oreName);
84 | }
85 |
86 | @Override
87 | public void tick() {
88 | super.tick();
89 | }
90 |
91 | @Override
92 | public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
93 | graphics.drawString(font, Utils.safeItemStackName(this.block.getItemStack()).getString(), getWidth() / 2 - 138, getHeight() / 2 - 90, 0xffffff);
94 |
95 | oreName.render(graphics, x, y, partialTicks);
96 |
97 | int color = (255 << 24) | ((int) (this.redSlider.getValue()) << 16) | ((int) (this.greenSlider.getValue()) << 8) | (int) (this.blueSlider.getValue());
98 | graphics.fill(this.getWidth() / 2 - 138, this.getHeight() / 2 - 40, (this.getWidth() / 2 - 36) + 100, (this.getHeight() / 2 - 40) + 45, color);
99 |
100 | graphics.renderItem(this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105);
101 | graphics.renderItemDecorations(font, this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105);
102 |
103 | // Lighting.setupForFlatItems();
104 | // this.itemRenderer.renderAndDecorateItem(stack, this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105);
105 | // Lighting.setupFor3DItems();
106 | }
107 |
108 | @Override
109 | public boolean mouseClicked(double x, double y, int mouse) {
110 | if( oreName.mouseClicked(x, y, mouse) )
111 | this.setFocused(oreName);
112 |
113 | return super.mouseClicked(x, y, mouse);
114 | }
115 |
116 | @Override
117 | public boolean hasTitle() {
118 | return true;
119 | }
120 |
121 | @Override
122 | public String title() {
123 | return I18n.get("xray.title.edit");
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/utils/GuiBase.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui.utils;
2 |
3 | import net.minecraft.client.gui.Font;
4 | import net.minecraft.client.gui.GuiGraphics;
5 | import net.minecraft.client.gui.components.Renderable;
6 | import net.minecraft.client.gui.components.events.GuiEventListener;
7 | import net.minecraft.client.gui.screens.Screen;
8 | import net.minecraft.client.renderer.RenderType;
9 | import net.minecraft.locale.Language;
10 | import net.minecraft.network.chat.Component;
11 | import net.minecraft.resources.ResourceLocation;
12 | import pro.mikey.xray.Utils;
13 | import pro.mikey.xray.XRay;
14 |
15 | public abstract class GuiBase extends Screen {
16 | public static final ResourceLocation BG_NORMAL = Utils.rlFull(XRay.PREFIX_GUI + "bg.png");
17 | public static final ResourceLocation BG_LARGE = Utils.rlFull(XRay.PREFIX_GUI + "bg-help.png");
18 |
19 | private boolean hasSide;
20 | private String sideTitle = "";
21 | private int backgroundWidth = 229;
22 | private int backgroundHeight = 235;
23 |
24 | public GuiBase(boolean hasSide) {
25 | super(Component.literal(""));
26 | this.hasSide = hasSide;
27 | }
28 |
29 | public abstract void renderExtra(GuiGraphics guiGraphics, int x, int y, float partialTicks);
30 |
31 | @Override
32 | public boolean charTyped(char keyTyped, int __unknown) {
33 | super.charTyped(keyTyped, __unknown);
34 |
35 | if (keyTyped == 1 && getMinecraft().player != null)
36 | getMinecraft().player.closeContainer();
37 |
38 | return false;
39 | }
40 |
41 | @Override
42 | public void render(GuiGraphics guiGraphics, int x, int y, float partialTicks) {
43 | renderBackground(guiGraphics, x, y, partialTicks);
44 |
45 | int width = this.width;
46 | int height = this.height;
47 | if (this.hasSide) {
48 | guiGraphics.blit(RenderType::guiTextured, getBackground(), width / 2 + 60, height / 2 - 180 / 2, 0, 0, 150, 180, 150, 180);
49 | guiGraphics.blit(RenderType::guiTextured, getBackground(), width / 2 - 150, height / 2 - 118, 0, 0, this.backgroundWidth, this.backgroundHeight, this.backgroundWidth, this.backgroundHeight);
50 |
51 | if (hasSideTitle())
52 | guiGraphics.drawString(getFontRender(), this.sideTitle, width / 2 + 80, height / 2 - 77, 0xffff00);
53 | }
54 |
55 | if (!this.hasSide)
56 | guiGraphics.blit(RenderType::guiTextured, getBackground(), width / 2 - this.backgroundWidth / 2 + 1, height / 2 - this.backgroundHeight / 2, 0, 0, this.backgroundWidth, this.backgroundHeight, this.backgroundWidth, this.backgroundHeight);
57 |
58 | if (hasTitle()) {
59 | if (this.hasSide)
60 | guiGraphics.drawString(getFontRender(), title(), width / 2 - 138, height / 2 - 105, 0xffff00);
61 | else
62 | guiGraphics.drawString(getFontRender(), title(), width / 2 - (this.backgroundWidth / 2) + 14, height / 2 - (this.backgroundHeight / 2) + 13, 0xffff00);
63 | }
64 |
65 | for(Renderable renderable : this.renderables) {
66 | renderable.render(guiGraphics, x, y, partialTicks);
67 | }
68 |
69 | renderExtra(guiGraphics, x, y, partialTicks);
70 |
71 | for (GuiEventListener button : this.children()) {
72 | if (button instanceof SupportButton && ((SupportButton) button).isHovered())
73 | guiGraphics.renderTooltip(getFontRender(), Language.getInstance().getVisualOrder(((SupportButton) button).getSupport()), x, y);
74 | }
75 | }
76 |
77 | public ResourceLocation getBackground() {
78 | return BG_NORMAL;
79 | }
80 |
81 | public boolean hasTitle() {
82 | return false;
83 | }
84 |
85 | public String title() {
86 | return "";
87 | }
88 |
89 | private boolean hasSideTitle() {
90 | return !this.sideTitle.isEmpty();
91 | }
92 |
93 | protected void setSideTitle(String title) {
94 | this.sideTitle = title;
95 | }
96 |
97 | public void setSize(int width, int height) {
98 | this.backgroundWidth = width;
99 | this.backgroundHeight = height;
100 | }
101 |
102 | public Font getFontRender() {
103 | return getMinecraft().font;
104 | }
105 |
106 | public int getWidth() {
107 | return this.width;
108 | }
109 |
110 | public int getHeight() {
111 | return this.height;
112 | }
113 |
114 | @Override
115 | public boolean isPauseScreen() {
116 | return false;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/gui/utils/SupportButton.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.gui.utils;
2 |
3 | import net.minecraft.client.gui.components.Button;
4 | import net.minecraft.network.chat.Component;
5 | import net.minecraft.network.chat.FormattedText;
6 | import net.minecraft.network.chat.MutableComponent;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 |
12 | public class SupportButton extends Button {
13 | private List support = new ArrayList<>();
14 |
15 | public SupportButton(int widthIn, int heightIn, int width, int height, Component text, MutableComponent support, OnPress onPress) {
16 | super(builder(text, onPress)
17 | .pos(widthIn, heightIn)
18 | .size(width, height));
19 |
20 | for(String line : support.getString().split("\n")) {
21 | this.support.add(Component.literal(line));
22 | }
23 | }
24 |
25 | public List getSupport() {
26 | return support;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/keybinding/KeyBindings.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.keybinding;
2 |
3 | import net.minecraft.client.KeyMapping;
4 | import net.minecraft.client.Minecraft;
5 | import net.minecraft.client.resources.language.I18n;
6 | import net.neoforged.bus.api.SubscribeEvent;
7 | import net.neoforged.neoforge.client.event.InputEvent;
8 | import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
9 | import org.lwjgl.glfw.GLFW;
10 | import pro.mikey.xray.gui.GuiSelectionScreen;
11 | import pro.mikey.xray.xray.Controller;
12 |
13 |
14 | public class KeyBindings {
15 | private static final String CATEGORY = "X-Ray";
16 |
17 | public static KeyMapping toggleXRay = new KeyMapping(I18n.get("xray.config.toggle"), GLFW.GLFW_KEY_BACKSLASH, CATEGORY);
18 | public static KeyMapping toggleGui = new KeyMapping(I18n.get("xray.config.open"), GLFW.GLFW_KEY_G, CATEGORY);
19 |
20 | public static void setup() {
21 | }
22 |
23 | @SubscribeEvent
24 | public static void registerKeyBinding(RegisterKeyMappingsEvent event) {
25 | event.register(toggleXRay);
26 | event.register(toggleGui);
27 | }
28 |
29 | @SubscribeEvent
30 | public static void eventInput(InputEvent.Key event) {
31 | Minecraft mc = Minecraft.getInstance();
32 | if (mc.player == null || Minecraft.getInstance().screen != null || Minecraft.getInstance().level == null)
33 | return;
34 |
35 | if (toggleXRay.consumeClick()) {
36 | Controller.toggleXRay();
37 | }
38 |
39 | if (toggleGui.consumeClick()) {
40 | Minecraft.getInstance().setScreen(new GuiSelectionScreen());
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/mixins/BlockRenderMixin.java:
--------------------------------------------------------------------------------
1 | //package pro.mikey.xray.mixins;
2 | //
3 | //import net.minecraft.core.BlockPos;
4 | //import net.minecraft.core.Direction;
5 | //import net.minecraft.world.level.BlockGetter;
6 | //import net.minecraft.world.level.block.Block;
7 | //import net.minecraft.world.level.block.state.BlockState;
8 | //import org.spongepowered.asm.mixin.Mixin;
9 | //import org.spongepowered.asm.mixin.injection.At;
10 | //import org.spongepowered.asm.mixin.injection.Inject;
11 | //import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
12 | //
13 | //@Mixin(Block.class)
14 | //public class BlockRenderMixin {
15 | // @Inject(
16 | // at = @At("RETURN"),
17 | // method = "shouldRenderFace",
18 | // cancellable = true,
19 | // remap = false
20 | // )
21 | // private static void shouldRenderFace(BlockState p_152445_, BlockGetter p_152446_, BlockPos p_152447_, Direction p_152448_, BlockPos p_152449_, CallbackInfoReturnable ci) {
22 | // System.out.println("shouldRenderFace");
23 | // ci.setReturnValue(false);
24 | // }
25 | //}
26 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/mixins/ClientDestroyBlockEvent.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.mixins;
2 |
3 | import net.minecraft.client.multiplayer.ClientLevel;
4 | import net.minecraft.core.BlockPos;
5 | import net.minecraft.world.level.block.state.BlockState;
6 | import org.spongepowered.asm.mixin.Debug;
7 | import org.spongepowered.asm.mixin.Mixin;
8 | import org.spongepowered.asm.mixin.injection.At;
9 | import org.spongepowered.asm.mixin.injection.Inject;
10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
11 | import pro.mikey.xray.xray.Events;
12 |
13 | @Debug(export = true)
14 | @Mixin(ClientLevel.class)
15 | public abstract class ClientDestroyBlockEvent {
16 |
17 | @Inject(method = "setBlock", at = @At("RETURN"))
18 | public void onBlockDestroy(BlockPos arg, BlockState arg2, int i, int j, CallbackInfoReturnable cir) {
19 | if (cir.getReturnValue()) {
20 | Events.breakBlock(arg, arg2);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/store/BlockStore.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.store;
2 |
3 | import net.minecraft.core.registries.BuiltInRegistries;
4 | import pro.mikey.xray.Utils;
5 | import pro.mikey.xray.utils.BlockData;
6 | import net.minecraft.world.level.block.Block;
7 | import net.minecraft.world.item.ItemStack;
8 | import net.minecraft.resources.ResourceLocation;
9 | import org.apache.commons.lang3.tuple.ImmutablePair;
10 | import org.apache.commons.lang3.tuple.Pair;
11 |
12 | import java.util.*;
13 |
14 | public class BlockStore {
15 |
16 | private HashMap store = new HashMap<>();
17 | private HashMap storeReference = new HashMap<>();
18 |
19 | public void put(BlockData data) {
20 | if( this.storeReference.containsKey(data.getBlockName()) )
21 | return;
22 |
23 | UUID uniqueId = UUID.randomUUID();
24 | this.store.put(uniqueId, data);
25 | this.storeReference.put(data.getBlockName(), uniqueId);
26 | }
27 |
28 | public void remove(String blockRegistry) {
29 | if( !this.storeReference.containsKey(blockRegistry) )
30 | return;
31 |
32 | UUID uuid = this.storeReference.get(blockRegistry);
33 | this.storeReference.remove(blockRegistry);
34 | this.store.remove(uuid);
35 | }
36 |
37 | public HashMap getStore() {
38 | return store;
39 | }
40 |
41 | public void setStore(ArrayList store) {
42 | this.store.clear();
43 | this.storeReference.clear();
44 |
45 | store.forEach(this::put);
46 | }
47 |
48 | public Pair getStoreByReference(String name) {
49 | UUID uniqueId = storeReference.get(name);
50 | if( uniqueId == null )
51 | return null;
52 |
53 | BlockData blockData = this.store.get(uniqueId);
54 | if( blockData == null )
55 | return null;
56 |
57 | return new ImmutablePair<>(blockData, uniqueId);
58 | }
59 |
60 | public void toggleDrawing(BlockData data) {
61 | UUID uniqueId = storeReference.get(data.getBlockName());
62 | if( uniqueId == null )
63 | return;
64 |
65 | // We'd hope this never happens...
66 | BlockData blockData = this.store.get(uniqueId);
67 | if( blockData == null )
68 | return;
69 |
70 | blockData.setDrawing(!blockData.isDrawing());
71 | }
72 |
73 | public static ArrayList getFromSimpleBlockList(List simpleList)
74 | {
75 | ArrayList blockData = new ArrayList<>();
76 |
77 | for (BlockData.SerializableBlockData e : simpleList) {
78 | if( e == null )
79 | continue;
80 |
81 | ResourceLocation location = null;
82 | try {
83 | location = Utils.rlFull(e.getBlockName());
84 | } catch (Exception ignored) {};
85 | if( location == null )
86 | continue;
87 |
88 | Block block = BuiltInRegistries.BLOCK.getValue(location);
89 |
90 | blockData.add(
91 | new BlockData(
92 | e.getName(),
93 | e.getBlockName(),
94 | e.getColor(),
95 | new ItemStack( block, 1),
96 | e.isDrawing(),
97 | e.getOrder()
98 | )
99 | );
100 | }
101 |
102 | return blockData;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/store/DiscoveryStorage.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.store;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.GsonBuilder;
5 | import com.google.gson.JsonSyntaxException;
6 | import com.google.gson.reflect.TypeToken;
7 | import net.minecraft.client.Minecraft;
8 | import net.minecraft.core.registries.BuiltInRegistries;
9 | import net.minecraft.network.chat.Component;
10 | import net.minecraft.world.level.block.Block;
11 | import net.neoforged.neoforge.common.Tags;
12 | import org.apache.logging.log4j.Level;
13 | import org.apache.logging.log4j.LogManager;
14 | import org.apache.logging.log4j.Logger;
15 | import pro.mikey.xray.XRay;
16 | import pro.mikey.xray.utils.BlockData;
17 |
18 | import java.io.*;
19 | import java.lang.reflect.Type;
20 | import java.nio.file.Files;
21 | import java.nio.file.Path;
22 | import java.util.ArrayList;
23 | import java.util.List;
24 | import java.util.Objects;
25 | import java.util.Random;
26 |
27 | public class DiscoveryStorage {
28 | private static final Logger LOGGER = LogManager.getLogger();
29 |
30 | private static final Path STORE_FILE = Minecraft.getInstance().gameDirectory.toPath().resolve(String.format("config/%s/block_store.json", XRay.MOD_ID));
31 |
32 | private static final Random RANDOM = new Random();
33 | private static final Gson PRETTY_JSON = new GsonBuilder().setPrettyPrinting().create();
34 |
35 | public boolean created = false;
36 |
37 | // This should only be initialised once
38 | public DiscoveryStorage() {
39 | if (Files.exists(STORE_FILE)) {
40 | return;
41 | }
42 |
43 | boolean createdPath = STORE_FILE.getParent().toFile().mkdirs();
44 | if (!createdPath) {
45 | LOGGER.error("Failed to create dirs for {}", STORE_FILE);
46 | return;
47 | }
48 |
49 | this.created = true;
50 |
51 | // Create a file with nothing inside
52 | this.write(new ArrayList());
53 | LOGGER.info("Created block store");
54 | }
55 |
56 | public void write(ArrayList blockData) {
57 | List simpleBlockData = new ArrayList<>();
58 | blockData.forEach(e -> simpleBlockData.add(new BlockData.SerializableBlockData(e.getEntryName(), e.getBlockName(), e.getColor(), e.isDrawing(), e.getOrder())));
59 |
60 | this.write(simpleBlockData);
61 | }
62 |
63 | private void write(List simpleBlockData) {
64 | try (BufferedWriter writer = new BufferedWriter(new FileWriter(STORE_FILE.toFile()))) {
65 | PRETTY_JSON.toJson(simpleBlockData, writer);
66 | } catch (IOException e) {
67 | LOGGER.error("Failed to write json data to {}", STORE_FILE);
68 | }
69 | }
70 |
71 | public List read() {
72 | if (!Files.exists(STORE_FILE))
73 | return new ArrayList<>();
74 |
75 | try {
76 | Type type = new TypeToken>() {
77 | }.getType();
78 | try (BufferedReader reader = new BufferedReader(new FileReader(STORE_FILE.toFile()))) {
79 | return PRETTY_JSON.fromJson(reader, type);
80 | } catch (JsonSyntaxException ex) {
81 | XRay.logger.log(Level.ERROR, "Failed to read json data from " + STORE_FILE);
82 | }
83 | } catch (IOException e) {
84 | XRay.logger.log(Level.ERROR, "Failed to read json data from " + STORE_FILE);
85 | }
86 |
87 | return new ArrayList<>();
88 | }
89 |
90 | /**
91 | * Populate the ore list / block list with any blocks from the ORES tag in forge.
92 | *
93 | * @return a list of ores found in the tag
94 | */
95 | public List populateDefault() {
96 | List oresData = new ArrayList<>();
97 |
98 | var blocks = BuiltInRegistries.BLOCK.stream().toList();
99 | if (blocks.isEmpty()) {
100 | return List.of();
101 | }
102 |
103 | int orderTrack = 0;
104 | for (Block block : blocks) {
105 | if (block.defaultBlockState().is(Tags.Blocks.ORES)) {
106 | oresData.add(new BlockData.SerializableBlockData(Component.translatable(block.getDescriptionId()).getString(),
107 | Objects.requireNonNull(BuiltInRegistries.BLOCK.getKey(block)).toString(),
108 | (RANDOM.nextInt(255) << 16) + (RANDOM.nextInt(255) << 8) + RANDOM.nextInt(255),
109 | false,
110 | orderTrack++)
111 | );
112 | }
113 | }
114 |
115 | LOGGER.info("Setting up default ores to the render list");
116 | this.write(oresData);
117 | return oresData;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/store/GameBlockStore.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.store;
2 |
3 | import net.minecraft.core.registries.BuiltInRegistries;
4 | import pro.mikey.xray.xray.Controller;
5 | import net.minecraft.world.level.block.Block;
6 | import net.minecraft.world.level.block.Blocks;
7 | import net.minecraft.world.item.Item;
8 | import net.minecraft.world.item.ItemStack;
9 | import net.minecraft.world.item.Items;
10 |
11 | import java.util.ArrayList;
12 |
13 | public class GameBlockStore {
14 |
15 | private ArrayList store = new ArrayList<>();
16 |
17 | /**
18 | * This method is used to fill the store as we do not intend to update this after
19 | * it has been populated, it's a singleton by nature but we still need some
20 | * amount of control over when it is populated.
21 | */
22 | public void populate()
23 | {
24 | // Avoid doing the logic again unless repopulate is called
25 | if( this.store.size() != 0 )
26 | return;
27 |
28 | for ( Item item : BuiltInRegistries.ITEM.stream().toList() ) {
29 | if( !(item instanceof net.minecraft.world.item.BlockItem) )
30 | continue;
31 |
32 | Block block = Block.byItem(item);
33 | if ( item == Items.AIR || block == Blocks.AIR || Controller.blackList.contains(block) )
34 | continue; // avoids troubles
35 |
36 | store.add(new BlockWithItemStack(block, new ItemStack(item)));
37 | }
38 | }
39 |
40 | public void repopulate()
41 | {
42 | this.store.clear();
43 | this.populate();
44 | }
45 |
46 | public ArrayList getStore() {
47 | return this.store;
48 | }
49 |
50 | public static final class BlockWithItemStack {
51 | private Block block;
52 | private ItemStack itemStack;
53 |
54 | public BlockWithItemStack(Block block, ItemStack itemStack) {
55 | this.block = block;
56 | this.itemStack = itemStack;
57 | }
58 |
59 | public Block getBlock() {
60 | return block;
61 | }
62 |
63 | public ItemStack getItemStack() {
64 | return itemStack;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/utils/BlockData.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.utils;
2 |
3 | import net.minecraft.world.item.ItemStack;
4 |
5 | import java.awt.*;
6 |
7 | public class BlockData {
8 |
9 | private String entryName;
10 | private String blockName;
11 | private int color;
12 | private ItemStack itemStack;
13 | private boolean drawing;
14 | private int order;
15 |
16 | public BlockData(String entryName, String blockName, int color, ItemStack itemStack, boolean drawing, int order) {
17 | this.entryName = entryName;
18 | this.blockName = blockName;
19 | this.color = color;
20 | this.itemStack = itemStack;
21 | this.drawing = drawing;
22 | this.order = order;
23 | }
24 |
25 | public String getEntryName() {
26 | return entryName;
27 | }
28 |
29 | public String getBlockName() {
30 | return blockName;
31 | }
32 |
33 | public int getColor() {
34 | return color;
35 | }
36 |
37 | public ItemStack getItemStack() {
38 | return itemStack;
39 | }
40 |
41 | public boolean isDrawing() {
42 | return drawing;
43 | }
44 |
45 | public void setDrawing(boolean drawing) {
46 | this.drawing = drawing;
47 | }
48 |
49 | public void setColor(int color) {
50 | this.color = color;
51 | }
52 |
53 | public int getOrder() {
54 | return order;
55 | }
56 |
57 | // It's pretty annoying to serialize an ItemStack so we dont :D
58 | public static class SerializableBlockData {
59 |
60 | private String name;
61 | private String blockName;
62 | private int order;
63 |
64 | private int color;
65 | private boolean drawing;
66 |
67 | public SerializableBlockData(String name, String blockName, int color, boolean drawing, int order) {
68 | this.name = name;
69 | this.blockName = blockName;
70 | this.color = color;
71 | this.drawing = drawing;
72 | this.order = order;
73 | }
74 |
75 | public String getName() {
76 | return name;
77 | }
78 |
79 | public String getBlockName() {
80 | return blockName;
81 | }
82 |
83 | public int getColor() {
84 | return color;
85 | }
86 |
87 | public boolean isDrawing() {
88 | return drawing;
89 | }
90 |
91 | public int getOrder() {
92 | return order;
93 | }
94 |
95 | public void setOrder(int order) {
96 | this.order = order;
97 | }
98 | }
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/utils/RenderBlockProps.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.utils;
2 |
3 | import com.google.common.base.Objects;
4 | import net.minecraft.core.BlockPos;
5 |
6 | import javax.annotation.concurrent.Immutable;
7 |
8 | @Immutable
9 | public class RenderBlockProps {
10 | private final int color;
11 | private final BlockPos pos;
12 |
13 | public RenderBlockProps(BlockPos pos, int color) {
14 | this.pos = pos;
15 | this.color = color;
16 | }
17 |
18 | public RenderBlockProps(int x, int y, int z, int color) {
19 | this( new BlockPos(x, y, z), color );
20 | }
21 |
22 | public int getColor() {
23 | return color;
24 | }
25 |
26 | public BlockPos getPos() {
27 | return pos;
28 | }
29 |
30 | @Override
31 | public boolean equals(Object o) {
32 | if (this == o) return true;
33 | if (o == null || getClass() != o.getClass()) return false;
34 | RenderBlockProps that = (RenderBlockProps) o;
35 | return Objects.equal(pos, that.pos);
36 | }
37 |
38 | @Override
39 | public int hashCode() {
40 | return Objects.hashCode(pos);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/xray/Controller.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.xray;
2 |
3 | import net.minecraft.Util;
4 | import net.minecraft.client.Minecraft;
5 | import net.minecraft.network.chat.Component;
6 | import net.minecraft.util.Mth;
7 | import net.minecraft.world.level.ChunkPos;
8 | import net.minecraft.world.level.block.Block;
9 | import net.minecraft.world.level.block.Blocks;
10 | import pro.mikey.xray.Configuration;
11 | import pro.mikey.xray.store.BlockStore;
12 | import pro.mikey.xray.utils.RenderBlockProps;
13 |
14 | import java.util.ArrayList;
15 | import java.util.Collections;
16 | import java.util.HashSet;
17 | import java.util.Set;
18 |
19 | public class Controller {
20 | private static final int maxStepsToScan = 5;
21 |
22 | private static boolean isSearching = false;
23 |
24 | // Block blackList
25 | // Todo: move this to a configurable thing
26 | public static ArrayList blackList = new ArrayList<>() {{
27 | add(Blocks.AIR);
28 | add(Blocks.BEDROCK);
29 | add(Blocks.STONE);
30 | add(Blocks.GRASS_BLOCK);
31 | add(Blocks.DIRT);
32 | }};
33 |
34 | private static ChunkPos lastChunkPos = null;
35 |
36 | public static final Set syncRenderList = Collections.synchronizedSet(new HashSet<>()); // this is accessed by threads
37 |
38 | /**
39 | * Global blockStore used for:
40 | * [Rendering, GUI, Configuration Handling]
41 | */
42 | private static BlockStore blockStore = new BlockStore();
43 |
44 | // Thread management
45 |
46 | // Draw states
47 | private static boolean xrayActive = false; // Off by default
48 | private static boolean lavaActive = false;
49 |
50 | public static void init() {
51 | lavaActive = Configuration.store.lavaActive.get();
52 | }
53 |
54 | public static BlockStore getBlockStore() {
55 | return blockStore;
56 | }
57 |
58 | // Public accessors
59 | public static boolean isXRayActive() {
60 | return xrayActive && Minecraft.getInstance().level != null && Minecraft.getInstance().player != null;
61 | }
62 |
63 | public static void toggleXRay() {
64 | if (!xrayActive) // enable drawing
65 | {
66 | syncRenderList.clear(); // first, clear the buffer
67 | xrayActive = true; // then, enable drawing
68 | requestBlockFinder(true); // finally, force a refresh
69 |
70 | if (!Configuration.general.showOverlay.get() && Minecraft.getInstance().player != null)
71 | Minecraft.getInstance().player.displayClientMessage(Component.translatable("xray.toggle.activated"), false);
72 | } else // disable drawing
73 | {
74 | if (!Configuration.general.showOverlay.get() && Minecraft.getInstance().player != null)
75 | Minecraft.getInstance().player.displayClientMessage(Component.translatable("xray.toggle.deactivated"), false);
76 |
77 | xrayActive = false;
78 | }
79 | }
80 |
81 | public static boolean isLavaActive() {
82 | return lavaActive;
83 | }
84 |
85 | public static void toggleLava() {
86 | lavaActive = !lavaActive;
87 | Configuration.store.lavaActive.set(lavaActive);
88 | }
89 |
90 | public static int getRadius() {
91 | return Mth.clamp(Configuration.store.radius.get(), 0, maxStepsToScan) * 3;
92 | }
93 |
94 | public static int getHalfRange() {
95 | return Math.max(0, getRadius() / 2);
96 | }
97 |
98 | public static int getVisualRadius() {
99 | return Math.max(1, getRadius());
100 | }
101 |
102 | public static void incrementCurrentDist() {
103 | if (Configuration.store.radius.get() < maxStepsToScan)
104 | Configuration.store.radius.set(Configuration.store.radius.get() + 1);
105 | else
106 | Configuration.store.radius.set(0);
107 | }
108 |
109 | public static void decrementCurrentDist() {
110 | if (Configuration.store.radius.get() > 0)
111 | Configuration.store.radius.set(Configuration.store.radius.get() - 1);
112 | else
113 | Configuration.store.radius.set(maxStepsToScan);
114 | }
115 |
116 | /**
117 | * Precondition: world and player must be not null
118 | * Has player moved since the last region scan?
119 | * This method does not update the last player location so consecutive
120 | * calls yield the same result.
121 | *
122 | * @return true if the player has moved since the last blockFinder call
123 | */
124 | private static boolean playerHasMoved() {
125 | if (Minecraft.getInstance().player == null)
126 | return false;
127 |
128 | ChunkPos plyChunkPos = Minecraft.getInstance().player.chunkPosition();
129 | int range = getHalfRange();
130 |
131 | return lastChunkPos == null ||
132 | plyChunkPos.x > lastChunkPos.x + range || plyChunkPos.x < lastChunkPos.x - range ||
133 | plyChunkPos.z > lastChunkPos.z + range || plyChunkPos.z < lastChunkPos.z - range;
134 | }
135 |
136 | private static void updatePlayerPosition() {
137 | lastChunkPos = Minecraft.getInstance().player.chunkPosition();
138 | }
139 |
140 | /**
141 | * Starts a region scan thread if possible, that is if:
142 | * - we actually want to draw syncRenderList
143 | * - we are not already scanning an area
144 | * - either the player has moved since the last call
145 | * - or we want to (and can) force a scan
146 | *
147 | * @param force should we force a block scan even if the player hasn't moved?
148 | */
149 | public static synchronized void requestBlockFinder(boolean force) {
150 | if (isXRayActive() && (force || playerHasMoved()) && !isSearching) // world/player check done by xrayActive()
151 | {
152 | updatePlayerPosition(); // since we're about to run, update the last known position
153 | Util.backgroundExecutor().execute(() -> {
154 | isSearching = true;
155 | // Scan for the blocks
156 | Set c = RenderEnqueue.blockFinder();
157 | syncRenderList.clear();
158 | syncRenderList.addAll(c);
159 | isSearching = false;
160 |
161 | // Tell the render to update
162 | Render.requestedRefresh = true;
163 | });
164 | }
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/xray/Events.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.xray;
2 |
3 | import com.mojang.blaze3d.systems.RenderSystem;
4 | import net.minecraft.client.Minecraft;
5 | import net.minecraft.core.BlockPos;
6 | import net.minecraft.world.level.block.state.BlockState;
7 | import net.neoforged.neoforge.client.event.ClientTickEvent;
8 | import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
9 |
10 | public class Events {
11 | public static void breakBlock(BlockPos pos, BlockState blockState) {
12 | RenderEnqueue.checkBlock(pos, blockState, !blockState.isAir());
13 | }
14 |
15 | public static void tickEnd(ClientTickEvent.Post event) {
16 | if (Minecraft.getInstance().player != null && Minecraft.getInstance().level != null) {
17 | Controller.requestBlockFinder(false);
18 | }
19 | }
20 |
21 | public static void onWorldRenderLast(RenderLevelStageEvent event) {
22 | if (event.getStage() != RenderLevelStageEvent.Stage.AFTER_WEATHER) {
23 | return;
24 | }
25 |
26 | if (Controller.isXRayActive() && Minecraft.getInstance().player != null) {
27 | // this is a world pos of the player
28 | Render.renderBlocks(event);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/xray/Render.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.xray;
2 |
3 | import com.mojang.blaze3d.buffers.BufferType;
4 | import com.mojang.blaze3d.buffers.BufferUsage;
5 | import com.mojang.blaze3d.buffers.GpuBuffer;
6 | import com.mojang.blaze3d.pipeline.BlendFunction;
7 | import com.mojang.blaze3d.pipeline.RenderPipeline;
8 | import com.mojang.blaze3d.pipeline.RenderTarget;
9 | import com.mojang.blaze3d.platform.DepthTestFunction;
10 | import com.mojang.blaze3d.shaders.UniformType;
11 | import com.mojang.blaze3d.systems.RenderPass;
12 | import com.mojang.blaze3d.systems.RenderSystem;
13 | import com.mojang.blaze3d.vertex.*;
14 | import net.minecraft.client.Minecraft;
15 | import net.minecraft.client.renderer.RenderPipelines;
16 | import net.minecraft.client.renderer.ShapeRenderer;
17 | import net.minecraft.resources.ResourceLocation;
18 | import net.minecraft.world.phys.Vec3;
19 | import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
20 | import org.joml.Matrix4fStack;
21 | import pro.mikey.xray.XRay;
22 |
23 | import java.util.OptionalDouble;
24 | import java.util.OptionalInt;
25 |
26 | public class Render {
27 | public static boolean requestedRefresh = false;
28 | private static GpuBuffer vertexBuffer = null;
29 | private static int indexCount = 0;
30 | private static final RenderSystem.AutoStorageIndexBuffer indices = RenderSystem.getSequentialBuffer(VertexFormat.Mode.LINES);
31 |
32 | public static RenderPipeline LINES_NO_DEPTH = RenderPipeline.builder(RenderPipelines.MATRICES_COLOR_SNIPPET)
33 | .withLocation("pipeline/xray_lines")
34 | .withVertexShader("core/rendertype_lines")
35 | .withFragmentShader(ResourceLocation.fromNamespaceAndPath(XRay.MOD_ID, "frag/constant_color"))
36 | .withUniform("LineWidth", UniformType.FLOAT)
37 | .withUniform("ScreenSize", UniformType.VEC2)
38 | .withBlend(BlendFunction.TRANSLUCENT)
39 | .withCull(false)
40 | .withVertexFormat(DefaultVertexFormat.POSITION_COLOR_NORMAL, VertexFormat.Mode.LINES)
41 | .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
42 | .build();
43 |
44 | static void renderBlocks(RenderLevelStageEvent event) {
45 | if (Controller.syncRenderList.isEmpty()) {
46 | return;
47 | }
48 |
49 | RenderPipeline pipeline = LINES_NO_DEPTH;
50 | if (vertexBuffer == null || requestedRefresh) {
51 | requestedRefresh = false;
52 |
53 | if (vertexBuffer != null) {
54 | vertexBuffer.close();
55 | }
56 |
57 | BufferBuilder bufferBuilder = Tesselator.getInstance().begin(
58 | pipeline.getVertexFormatMode(), pipeline.getVertexFormat()
59 | );
60 |
61 | var opacity = 1F;
62 |
63 | Controller.syncRenderList.forEach(blockProps -> {
64 | if (blockProps == null) {
65 | return;
66 | }
67 |
68 | final float size = 1.0f;
69 | final int x = blockProps.getPos().getX(), y = blockProps.getPos().getY(), z = blockProps.getPos().getZ();
70 |
71 | final float red = (blockProps.getColor() >> 16 & 0xff) / 255f;
72 | final float green = (blockProps.getColor() >> 8 & 0xff) / 255f;
73 | final float blue = (blockProps.getColor() & 0xff) / 255f;
74 |
75 | ShapeRenderer.renderLineBox(event.getPoseStack(), bufferBuilder, x, y, z, x + size, y + size, z + size, red, green, blue, opacity);
76 | });
77 |
78 | try (MeshData meshData = bufferBuilder.buildOrThrow()) {
79 | vertexBuffer = RenderSystem.getDevice()
80 | .createBuffer(() -> "Xray vertex buffer", BufferType.VERTICES, BufferUsage.STATIC_WRITE, meshData.vertexBuffer());
81 |
82 | indexCount = meshData.drawState().indexCount();
83 | }
84 | }
85 |
86 | if (indexCount != 0) {
87 | Vec3 playerPos = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition().reverse();
88 |
89 | RenderTarget renderTarget = Minecraft.getInstance().getMainRenderTarget();
90 | if (renderTarget.getColorTexture() == null) {
91 | return;
92 | }
93 |
94 |
95 | GpuBuffer gpuBuffer = indices.getBuffer(indexCount);
96 | try (RenderPass renderPass = RenderSystem.getDevice()
97 | .createCommandEncoder()
98 | .createRenderPass(renderTarget.getColorTexture(), OptionalInt.empty(), renderTarget.getDepthTexture(), OptionalDouble.empty())) {
99 |
100 | Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack();
101 | matrix4fStack.pushMatrix();
102 | matrix4fStack.translate((float) playerPos.x(), (float) playerPos.y(), (float) playerPos.z());
103 |
104 | renderPass.setPipeline(pipeline);
105 | renderPass.setIndexBuffer(gpuBuffer, indices.type());
106 | renderPass.setVertexBuffer(0, vertexBuffer);
107 | renderPass.drawIndexed(0, indexCount);
108 |
109 | matrix4fStack.popMatrix();
110 | }
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/main/java/pro/mikey/xray/xray/RenderEnqueue.java:
--------------------------------------------------------------------------------
1 | package pro.mikey.xray.xray;
2 |
3 | import net.minecraft.client.Minecraft;
4 | import net.minecraft.core.BlockPos;
5 | import net.minecraft.core.registries.BuiltInRegistries;
6 | import net.minecraft.resources.ResourceLocation;
7 | import net.minecraft.world.entity.player.Player;
8 | import net.minecraft.world.level.Level;
9 | import net.minecraft.world.level.block.state.BlockState;
10 | import net.minecraft.world.level.material.FluidState;
11 | import net.minecraft.world.level.material.Fluids;
12 | import org.apache.commons.lang3.tuple.Pair;
13 | import pro.mikey.xray.utils.BlockData;
14 | import pro.mikey.xray.utils.RenderBlockProps;
15 |
16 | import java.util.*;
17 |
18 | public class RenderEnqueue {
19 | /**
20 | * Use Controller.requestBlockFinder() to trigger a scan.
21 | */
22 | public static Set blockFinder() {
23 | HashMap blocks = Controller.getBlockStore().getStore();
24 | if (blocks.isEmpty()) {
25 | return new HashSet<>(); // no need to scan the region if there's nothing to find
26 | }
27 |
28 | final Level world = Minecraft.getInstance().level;
29 | final Player player = Minecraft.getInstance().player;
30 |
31 | // Something is fatally wrong
32 | if (world == null || player == null) {
33 | return new HashSet<>();
34 | }
35 |
36 | final Set renderQueue = new HashSet<>();
37 |
38 | int range = Controller.getHalfRange();
39 |
40 | int cX = player.chunkPosition().x;
41 | int cZ = player.chunkPosition().z;
42 |
43 | BlockState currentState;
44 | FluidState currentFluid;
45 |
46 | Pair dataWithUUID;
47 | ResourceLocation block;
48 |
49 | for (int i = cX - range; i <= cX + range; i++) {
50 | int chunkStartX = i << 4;
51 | for (int j = cZ - range; j <= cZ + range; j++) {
52 | int chunkStartZ = j << 4;
53 |
54 | for (int k = chunkStartX; k < chunkStartX + 16; k++) {
55 | for (int l = chunkStartZ; l < chunkStartZ + 16; l++) {
56 | for (int m = world.getMinY(); m < world.getMaxY(); m++) {
57 | BlockPos pos = new BlockPos(k, m, l);
58 |
59 | currentState = world.getBlockState(pos);
60 | currentFluid = currentState.getFluidState();
61 |
62 | if ((currentFluid.getType() == Fluids.LAVA || currentFluid.getType() == Fluids.FLOWING_LAVA) && Controller.isLavaActive()) {
63 | renderQueue.add(new RenderBlockProps(pos.getX(), pos.getY(), pos.getZ(), 0xff0000));
64 | continue;
65 | }
66 |
67 | // Reject blacklisted blocks
68 | if (Controller.blackList.contains(currentState.getBlock()))
69 | continue;
70 |
71 | block = BuiltInRegistries.BLOCK.getKey(currentState.getBlock());
72 | if (block == null)
73 | continue;
74 |
75 | dataWithUUID = Controller.getBlockStore().getStoreByReference(block.toString());
76 | if (dataWithUUID == null)
77 | continue;
78 |
79 | if (dataWithUUID.getKey() == null || !dataWithUUID.getKey().isDrawing()) // fail safe
80 | continue;
81 |
82 | // Push the block to the render queue
83 | renderQueue.add(new RenderBlockProps(pos.getX(), pos.getY(), pos.getZ(), dataWithUUID.getKey().getColor()));
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
90 | return renderQueue;
91 | }
92 |
93 | /**
94 | * Single-block version of blockFinder. Can safely be called directly
95 | * for quick block check.
96 | *
97 | * @param pos the BlockPos to check
98 | * @param state the current state of the block
99 | * @param add true if the block was added to world, false if it was removed
100 | */
101 | public static void checkBlock(BlockPos pos, BlockState state, boolean add) {
102 | if (!Controller.isXRayActive() || Controller.getBlockStore().getStore().isEmpty())
103 | return; // just pass
104 |
105 | // If we're removing then remove :D
106 | if (!add) {
107 | boolean removed = Controller.syncRenderList.remove(new RenderBlockProps(pos, 0));
108 | if (removed) {
109 | Render.requestedRefresh = true;
110 | }
111 | return;
112 | }
113 |
114 | ResourceLocation block = BuiltInRegistries.BLOCK.getKey(state.getBlock());
115 | if (block == null)
116 | return;
117 |
118 | Pair dataWithUUID = Controller.getBlockStore().getStoreByReference(block.toString());
119 | if (dataWithUUID == null || dataWithUUID.getKey() == null || !dataWithUUID.getKey().isDrawing())
120 | return;
121 |
122 | // the block was added to the world, let's add it to the drawing buffer
123 | Controller.syncRenderList.add(new RenderBlockProps(pos, dataWithUUID.getKey().getColor()));
124 | Render.requestedRefresh = true;
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/accesstransformer.cfg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/src/main/resources/META-INF/accesstransformer.cfg
--------------------------------------------------------------------------------
/src/main/resources/META-INF/neoforge.mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml" #required
2 | loaderVersion="[4,)" #required
3 | credits="ErrorMikey" #optional
4 | authors="AdvancedXRay Team" #optional
5 | license="GNU GPL v3.0 (https://github.com/MichaelHillcox/XRay-Mod/blob/master/LICENSE)"
6 | displayTest="IGNORE_ALL_VERSION"
7 |
8 | [[mods]]
9 | modId="xray"
10 | version="${version}"
11 | displayName="Advanced XRay"
12 | description="An advanced XRay mod for Minecraft."
13 |
14 | [[dependencies.xray]]
15 | modId="neoforge"
16 | required=true
17 | versionRange="[${forge_version_range},)"
18 | ordering="NONE"
19 | side="CLIENT"
20 |
21 | [[dependencies.xray]]
22 | modId="minecraft"
23 | required=true
24 | versionRange="[${minecraft_version_range})"
25 | ordering="NONE"
26 | side="CLIENT"
27 |
28 | [[mixins]]
29 | config = 'xray.mixins.json'
30 |
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/lang/en_us.json:
--------------------------------------------------------------------------------
1 | {
2 | "xray.debug.init": "XRay Initialised",
3 |
4 | "xray.single.cancel": "Cancel",
5 | "xray.single.add": "Add",
6 | "xray.single.delete": "Delete",
7 | "xray.single.save": "Save",
8 | "xray.single.tools": "Tools",
9 | "xray.single.close": "Close",
10 | "xray.single.search": "Search",
11 | "xray.single.help": "Help",
12 |
13 | "xray.overlay": "XRay Active",
14 |
15 | "xray.color.red": "Red: ",
16 | "xray.color.green": "Green: ",
17 | "xray.color.blue": "Blue: ",
18 |
19 | "xray.input.gui": "GUI Name",
20 | "xray.input.add": "Add Block",
21 | "xray.input.add_hand": "Add Block in hand",
22 | "xray.input.add_look": "Add Looking at",
23 | "xray.input.distance": "Distance: %s",
24 | "xray.input.show-lava": "Show Lava: %s",
25 | "xray.input.toggle_oredict": "Use Dictionary",
26 |
27 | "xray.title.config": "Configure Block",
28 | "xray.title.edit": "Edit Block",
29 | "xray.title.edit_meta": "Edit Meta",
30 |
31 | "xray.chat.first-time": "§6Thank you for using Advanced XRay, §rYou can open the menu by pressing §a[%s§a] §rand turn XRay on with §a[%s§a]§r.",
32 | "xray.chat.first-time-line-2": "These can be changed in settings -> options -> controls -> keybindings. §cThis message will only show once.",
33 |
34 | "xray.message.missing_input": "You need to have all the inputs filled in",
35 | "xray.message.already_exists": "This block has already been added to the block list",
36 | "xray.message.added_block": "Successfully added %s.",
37 | "xray.message.updated_block": "Entry Updated",
38 | "xray.message.remove_block": "%s has been removed",
39 | "xray.message.block_exists": "%s already exists. Please enter a different name.",
40 | "xray.message.unknown": "Looks like the block you've tried to edit doesn't exist.",
41 | "xray.message.removed": "Successfully removed %s.",
42 | "xray.message.config_missing": "Config file not found. Creating now.",
43 | "xray.message.invalid_hand": "%s needs to be a block",
44 | "xray.message.thats_odd": "Something went wrong? Sorry about that. Make an issue if this continues to happen",
45 | "xray.message.nothing_infront": "You're not looking at anything are you?",
46 | "xray.message.not_a_number": "{%s} is not a number. Please use a number for your meta",
47 | "xray.message.meta_not_supported": "{%s} isn't a valid meta data for {%s}",
48 | "xray.message.state_warning": "Warning, this will limit you to default\nblocks. Use looking at or in hand to get\nthe absolute block you require.\nIn some cases (chests) this may be what you need to do\nif that's the case then this is the right option.",
49 |
50 | "xray.tooltips.add_block": "Select a block to add to the XRay'd blocks\nThis uses block defaults, if you require a specific block\nthen use 'Add Looking At'.",
51 | "xray.tooltips.add_block_in_hand": "Automatically selects the block you've\ngot in your hand to add to the list.",
52 | "xray.tooltips.add_block_looking_at": "Automatically selects the block you're\nlooking at to add to the list.",
53 | "xray.tooltips.show_lava": "Displays lava in RED like a normal block.\nWatch out! It's hot.",
54 | "xray.tooltips.distance": "Warning: Larger radius will lag for a second whilst updating.",
55 | "xray.tooltips.edit1": "Click to enable / disable",
56 | "xray.tooltips.edit2": "Hold shift and click to edit.",
57 |
58 | "xray.message.help.gui": "To edit a block simply shift click on the block you wish to edit.\nIf you want to enable / disable a block then click on a block\n and it'll toggle on and off.",
59 | "xray.message.help.warning": "As a warning, using any distance over 64 will cause FPS drops due\nto the vast amount of blocks that we have to scan. (It's like 256^3)",
60 |
61 | "xray.config.toggle": "Toggle XRay",
62 | "xray.config.open": "Open XRay Menu",
63 |
64 | "xray.toggle.activated": "XRay activated",
65 | "xray.toggle.deactivated": "XRay deactivated"
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/lang/fr_ca.json:
--------------------------------------------------------------------------------
1 | {
2 | "xray.debug.init": "XRay initialisé",
3 |
4 | "xray.single.cancel": "Annuler",
5 | "xray.single.add": "Ajouter",
6 | "xray.single.delete": "Supprimer",
7 | "xray.single.save": "Sauvegarder",
8 |
9 | "xray.color.red": "Rouge",
10 | "xray.color.green": "Vert",
11 | "xray.color.blue": "Bleu",
12 |
13 | "xray.input.gui": "Nom GUI",
14 | "xray.input.add": "Ajouter un minerai",
15 | "xray.input.distance": "Distance",
16 | "xray.input.toggle_oredict": "Substitutions",
17 |
18 | "xray.title.config": "Configurer le bloc",
19 | "xray.title.edit": "Modifier le bloc",
20 |
21 | "xray.message.missing_input": "Toutes les entrées doivent être remplies.",
22 | "xray.message.already_exists": "Ce bloc a déjà été ajouté à la liste des blocs",
23 | "xray.message.added_block": "%s a été ajouté avec succès.",
24 | "xray.message.unknown": "On dirait que le bloc que vous avez essayé de modifier n'existe pas.",
25 | "xray.message.removed": "%s a été retiré avec succès.",
26 | "xray.message.config_missing": "Le fichier de configuration est introuvable. Création en cours.",
27 |
28 | "xray.config.toggle": "Activer XRay",
29 | "xray.config.open": "Ouvrir le menu de XRay"
30 | }
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/lang/zh_cn.json:
--------------------------------------------------------------------------------
1 | {
2 | "xray.debug.init": "XRay 初始化完成",
3 |
4 | "xray.single.cancel": "取消",
5 | "xray.single.add": "添加",
6 | "xray.single.delete": "删除",
7 | "xray.single.save": "保存",
8 | "xray.single.tools": "工具",
9 | "xray.single.close": "关闭",
10 | "xray.single.search": "搜索",
11 | "xray.single.help": "帮助",
12 |
13 | "xray.overlay": "XRay 激活",
14 |
15 | "xray.color.red": "红色: ",
16 | "xray.color.green": "绿色: ",
17 | "xray.color.blue": "蓝色: ",
18 |
19 | "xray.input.gui": "GUI名称",
20 | "xray.input.add": "添加方块",
21 | "xray.input.add_hand": "添加手持方块",
22 | "xray.input.add_look": "添加目视方块",
23 | "xray.input.distance": "距离: %s",
24 | "xray.input.show-lava": "显示熔岩: %s",
25 | "xray.input.toggle_oredict": "使用矿物词典",
26 |
27 | "xray.title.config": "配置方块",
28 | "xray.title.edit": "编辑方块",
29 | "xray.title.edit_meta": "编辑元",
30 |
31 | "xray.message.missing_input": "你需要填写所有输入",
32 | "xray.message.already_exists": "此方块已添加到方块列表中",
33 | "xray.message.added_block": "已成功添加 %s.",
34 | "xray.message.updated_block": "条目已更新",
35 | "xray.message.remove_block": "%s 已被移除",
36 | "xray.message.block_exists": "%s 已存在. 请输入其他名称.",
37 | "xray.message.unknown": "你尝试编辑的方块似乎不存在.",
38 | "xray.message.removed": "成功移除 %s.",
39 | "xray.message.config_missing": "找不到配置文件. 正在创建.",
40 | "xray.message.invalid_hand": "%s 需要是一个方块",
41 | "xray.message.thats_odd": "出了点问题? 很抱歉. 如果这种情况继续发生,请反馈",
42 | "xray.message.nothing_infront": "你没有在看任何东西,对吗?",
43 | "xray.message.not_a_number": "{%s} 不是一个数字. 请为你的元使用一个数字",
44 | "xray.message.meta_not_supported": "{%s} 不是 {%s} 的有效元",
45 | "xray.message.state_warning": "警告,这会将你限制在默认\n方块. 使用“添加手持方块”或“添加目视方块”来获取\n你需要的方块.\n在某些情况下(箱子)这可能是你需要做的\n如果是这种情况,那么这是正确的选择.",
46 |
47 | "xray.tooltips.add_block": "选择要添加到 XRay 方块列表中的方块\n这使用方块默认值,如果您需要特定的方块\n请使用'添加目视方块'.",
48 | "xray.tooltips.add_block_in_hand": "自动选择您手中的方块\n将其添加到列表中.",
49 | "xray.tooltips.add_block_looking_at": "自动选择你目视的方块\n将其添加到列表中.",
50 | "xray.tooltips.show_lava": "就像普通方块一样用红色显示岩浆.\n小心! 它很烫.",
51 | "xray.tooltips.distance": "警告: 较大的半径将在更新时延迟一秒钟.",
52 | "xray.tooltips.edit1": "点击切换启用/禁用",
53 | "xray.tooltips.edit2": "按住 Shift 并单击以编辑.",
54 |
55 | "xray.message.help.gui": "要编辑方块,只需按住Shift键单击要编辑的块即可.\n如果要启用/禁用方块,请单击方块\n它将打开或关闭.",
56 | "xray.message.help.warning": "警告,使用超过64的任何距离都会导致帧率下降\n因为我们必须扫描大量的方块. (比如256^3)",
57 |
58 | "xray.config.toggle": "切换 XRay 状态",
59 | "xray.config.open": "打开 XRay 菜单",
60 |
61 | "xray.toggle.activated": "XRay 已激活",
62 | "xray.toggle.deactivated": "XRay 已关闭"
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/logo-small.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/src/main/resources/assets/xray/logo-small.jpg
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/shaders/frag/constant_color.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 vertexColor;
4 | out vec4 fragColor;
5 |
6 | void main() {
7 | fragColor = vertexColor;
8 | }
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/textures/gui/bg-help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/src/main/resources/assets/xray/textures/gui/bg-help.png
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/textures/gui/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/src/main/resources/assets/xray/textures/gui/bg.png
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/textures/gui/circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/src/main/resources/assets/xray/textures/gui/circle.png
--------------------------------------------------------------------------------
/src/main/resources/assets/xray/textures/gui/color-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdvancedXRay/XRay-Mod/7d4755b491615d7755d521217aa271985270140b/src/main/resources/assets/xray/textures/gui/color-bg.png
--------------------------------------------------------------------------------
/src/main/resources/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "description": "xray resources",
4 | "pack_format": 34,
5 | "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/resources/xray.mixins.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "package": "pro.mikey.xray.mixins",
4 | "compatibilityLevel": "JAVA_17",
5 | "client": [
6 | "ClientDestroyBlockEvent"
7 | ],
8 | "mixins": [],
9 | "injectors": {
10 | "defaultRequire": 1
11 | },
12 | "minVersion": "0.8"
13 | }
14 |
--------------------------------------------------------------------------------
/versions.json:
--------------------------------------------------------------------------------
1 | {
2 | "homepage": "https://github.com/MichaelHillcox/XRay-Mod",
3 | "1.18.1": {
4 | "1.18.1-r2.10.0": "See https://github.com/MichaelHillcox/XRay-Mod/commits/v1.18.1-r2.10.0"
5 | },
6 | "1.17.1": {
7 | "1.17.1-r2.9.0": "See https://github.com/MichaelHillcox/XRay-Mod/commits/v1.17.1-r2.9.0"
8 | },
9 | "1.16.5": {
10 | "1.16.5-r2.7.0": "See https://github.com/MichaelHillcox/XRay-Mod/commits/1.16.5-2.7.0"
11 | },
12 | "1.16.3": {
13 | "1.16.3-r2.5.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.16.3-v2.5.0"
14 | },
15 | "1.16.2": {
16 | "1.16.2-r2.4.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.16.2-v2.4.0"
17 | },
18 | "1.16.1": {
19 | "1.16.1-r2.3.2": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.16.1-v2.3.2",
20 | "1.16.1-r2.3.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.16.1-v2.3.1",
21 | "1.16.1-r2.3.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.16.1-v2.3.0"
22 | },
23 | "1.15.2": {
24 | "1.15.2-r2.2.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.15.2-v2.2.0"
25 | },
26 | "1.15.1": {
27 | "1.15.1-r2.1.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.15.1-v2.1.0"
28 | },
29 | "1.14.4": {
30 | "1.14.4-r2.0.2": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.14.4-v2.0.2",
31 | "1.14.4-r2.0.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.14.4-v2.0.1",
32 | "1.14.4-r2.0.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.14.4-v2.0.0"
33 | },
34 | "1.12.2": {
35 | "1.12.2-r1.6.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.2-v1.6.0",
36 | "1.12.2-r1.5.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.2-v1.5.0",
37 | "1.12.2-r1.4.2": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.2-v1.4.2",
38 | "1.12.2-r1.4.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.2-v1.4.1",
39 | "1.12.2-r1.4.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.2-v1.4.0",
40 | "1.12.2-r1.3.4": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.2-v1.3.4"
41 | },
42 | "1.12.1": {
43 | "1.12.1-r1.3.4": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12.1-v1.3.4"
44 | },
45 | "1.12": {
46 | "1.12-r1.3.3": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12-v1.3.3",
47 | "1.12-r1.3.2": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12-v1.3.2",
48 | "1.12-r1.3.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12-v1.3.1",
49 | "1.12-r1.3.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12-v1.3.0",
50 | "1.12-r1.2.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12-v1.2.1",
51 | "1.12-r1.2.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.12-v1.2.0"
52 | },
53 | "1.11.2": {
54 | "1.11.2-r1.3.3": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.11.2-v1.3.3",
55 | "1.11.2-r1.3.2": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.11.2-v1.3.2",
56 | "1.11.2-r1.3.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.11.2-v1.3.1",
57 | "1.11.2-r1.3.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.11.2-v1.3.0",
58 | "1.11.2-r1.1.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.11.2-v1.1.0"
59 | },
60 | "1.10.2": {
61 | "1.10.2-r1.3.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.10.2-v1.3.1",
62 | "1.10.2-r1.3.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.10.2-v1.3.0",
63 | "1.10.2-r1.2.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.10.2-v1.2.1",
64 | "1.10.2-r1.1.0.1": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.10.2-v1.1.0.1",
65 | "1.10.2-r1.1.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.10.2-v1.1.0"
66 | },
67 | "1.9.4": {
68 | "r1.0.9": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.0.9"
69 | },
70 | "1.8.9": {
71 | "1.8.9-r1.1.0": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.8.9-v1.1.0"
72 | },
73 | "1.7.10": {
74 | "r1.0.8": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.0.8",
75 | "r1.0.7": "See https://github.com/MichaelHillcox/XRay-Mod/releases/tag/1.0.1.75"
76 | },
77 | "promos": {
78 | "1.16.2-latest": "1.16.2-r2.4.0",
79 | "1.16.2-recommended": "1.16.2-r2.4.0",
80 | "1.16.1-latest": "1.16.1-r2.3.2",
81 | "1.16.1-recommended": "1.16.1-r2.3.2",
82 | "1.15.2-latest": "1.15.2-r2.2.0",
83 | "1.15.2-recommended": "1.15.2-r2.2.0",
84 | "1.15.1-latest": "1.15.1-r2.1.0",
85 | "1.15.1-recommended": "1.15.1-r2.1.0",
86 | "1.14.4-latest": "1.14.4-r2.0.2",
87 | "1.14.4-recommended": "1.14.4-r2.0.2",
88 | "1.12.2-latest": "1.12.2-r1.6.0",
89 | "1.12.2-recommended": "1.12.2-r1.6.0",
90 | "1.12.1-latest": "1.12.1-r1.3.4",
91 | "1.12.1-recommended": "1.12.1-r1.3.4",
92 | "1.12-latest": "1.12-r1.3.3",
93 | "1.12-recommended": "1.12-r1.3.3",
94 | "1.11.2-latest": "1.11.2-r1.3.3",
95 | "1.11.2-recommended": "1.11.2-r1.3.3",
96 | "1.10.2-latest": "1.10.2-r1.3.1",
97 | "1.10.2-recommended": "1.10.2-r1.3.1",
98 | "1.9.4-latest": "r1.0.9",
99 | "1.9.4-recommended": "r1.0.9",
100 | "1.8.9-latest": "1.8.9-r1.1.0",
101 | "1.8.9-recommended": "1.8.9-r1.1.0",
102 | "1.7.10-latest": "r1.0.8",
103 | "1.7.10-recommended": "r1.0.8"
104 | }
105 | }
106 |
--------------------------------------------------------------------------------