Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6bb10f06d | ||
|
|
bc6bebe387 | ||
|
|
a7961c22a6 | ||
|
|
96e9e9bb3b | ||
|
|
4b22cea9ab | ||
|
|
d440325b2a | ||
|
|
4bab684369 | ||
|
|
804ed4354b | ||
|
|
31f3cf3233 | ||
|
|
e22ad0c311 |
520
LICENSE.txt
Normal file
520
LICENSE.txt
Normal file
@@ -0,0 +1,520 @@
|
||||
Unless noted below, Minecraft Forge, Forge Mod Loader, and all
|
||||
parts herein are licensed under the terms of the LGPL 2.1 found
|
||||
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and
|
||||
copied below.
|
||||
|
||||
Homepage: http://minecraftforge.net/
|
||||
https://github.com/MinecraftForge/MinecraftForge
|
||||
|
||||
|
||||
A note on authorship:
|
||||
All source artifacts are property of their original author, with
|
||||
the exclusion of the contents of the patches directory and others
|
||||
copied from it from time to time. Authorship of the contents of
|
||||
the patches directory is retained by the Minecraft Forge project.
|
||||
This is because the patches are partially machine generated
|
||||
artifacts, and are changed heavily due to the way forge works.
|
||||
Individual attribution within them is impossible.
|
||||
|
||||
Consent:
|
||||
All contributions to Forge must consent to the release of any
|
||||
patch content to the Forge project.
|
||||
|
||||
A note on infectivity:
|
||||
The LGPL is chosen specifically so that projects may depend on Forge
|
||||
features without being infected with its license. That is the
|
||||
purpose of the LGPL. Mods and others using this code via ordinary
|
||||
Java mechanics for referencing libraries are specifically not bound
|
||||
by Forge's license for the Mod code.
|
||||
|
||||
|
||||
=== MCP Data ===
|
||||
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
|
||||
from them. The license to MCP data is not transitive - distribution of this data by
|
||||
third parties requires independent licensing from the MCP team. This data is not
|
||||
redistributable without permission from the MCP team.
|
||||
|
||||
=== Sharing ===
|
||||
I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of
|
||||
the minecraft modding community. All contributions to these parts should be licensed under the same additional grant.
|
||||
|
||||
-- Runtime patcher --
|
||||
License is granted to redistribute the runtime patcher code (src/main/java/net/minecraftforge/fml/common/patcher
|
||||
and subdirectories) under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||
|
||||
-- ASM transformers --
|
||||
License is granted to redistribute the ASM transformer code (src/main/java/net/minecraftforge/common/asm/ and subdirectories)
|
||||
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||
|
||||
=========================================================================
|
||||
This software includes portions from the Apache Maven project at
|
||||
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
||||
included based on guidelines at
|
||||
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
||||
with notices intact. The only change is a non-functional change of package name.
|
||||
|
||||
This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating
|
||||
binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/
|
||||
authored by genman, heikok, pivot.
|
||||
The only changes are to replace some Trove collection types with standard Java collections, and repackaged.
|
||||
=========================================================================
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -1 +0,0 @@
|
||||
The 1.12 repository can be found here: https://bitbucket.org/Requios/effortless-building/src/master/
|
||||
21
build.gradle
21
build.gradle
@@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.14.4-2.18'
|
||||
version = '1.15.2-2.21'
|
||||
group = 'nl.requios.effortlessbuilding' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'effortlessbuilding'
|
||||
|
||||
@@ -25,7 +25,7 @@ minecraft {
|
||||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'snapshot', version: '20190719-1.14.3'
|
||||
mappings channel: 'snapshot', version: '20200514-1.15.1'
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
@@ -89,7 +89,7 @@ dependencies {
|
||||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft 'net.minecraftforge:forge:1.14.4-28.1.102'
|
||||
minecraft 'net.minecraftforge:forge:1.15.2-31.2.0'
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
@@ -127,18 +127,15 @@ jar {
|
||||
}
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish task
|
||||
// we define a custom artifact that is sourced from the reobfJar output task
|
||||
// and then declare that to be published
|
||||
// Note you'll need to add a repository here
|
||||
def reobfFile = file("$buildDir/reobfJar/output.jar")
|
||||
def reobfArtifact = artifacts.add('default', reobfFile) {
|
||||
type 'jar'
|
||||
builtBy 'reobfJar'
|
||||
}
|
||||
// This is the preferred method to reobfuscate your jar file
|
||||
jar.finalizedBy('reobfJar')
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
|
||||
//publish.dependsOn('reobfJar')
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact reobfArtifact
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class EffortlessBuilding
|
||||
{
|
||||
public static final String MODID = "effortlessbuilding";
|
||||
public static final String NAME = "Effortless Building";
|
||||
public static final String VERSION = "1.14.4-2.18";
|
||||
public static final String VERSION = "1.15.2-2.21";
|
||||
|
||||
public static EffortlessBuilding instance;
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class EventHandler
|
||||
//Disable if config says so
|
||||
if (!BuildConfig.survivalBalancers.increasedMiningTime.get()) return;
|
||||
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
World world = player.world;
|
||||
BlockPos pos = event.getPos();
|
||||
|
||||
@@ -202,7 +202,7 @@ public class EventHandler
|
||||
PlayerEntity oldPlayer = event.getOriginal();
|
||||
oldPlayer.revive();
|
||||
|
||||
PlayerEntity newPlayer = event.getEntityPlayer();
|
||||
PlayerEntity newPlayer = event.getPlayer();
|
||||
ModifierSettingsManager.setModifierSettings(newPlayer, ModifierSettingsManager.getModifierSettings(oldPlayer));
|
||||
ModeSettingsManager.setModeSettings(newPlayer, ModeSettingsManager.getModeSettings(oldPlayer));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package nl.requios.effortlessbuilding;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -20,6 +21,7 @@ public class ModClientEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTextureStitch(final TextureStitchEvent.Pre event) {
|
||||
EffortlessBuilding.log("Stitching textures");
|
||||
//register icon textures
|
||||
for (final BuildModes.BuildModeEnum mode : BuildModes.BuildModeEnum.values())
|
||||
{
|
||||
@@ -37,10 +39,10 @@ public class ModClientEventHandler {
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite getBuildModeIcon(BuildModes.BuildModeEnum mode) {
|
||||
return Minecraft.getInstance().getTextureMap().getSprite(buildModeIcons.get(mode));
|
||||
return Minecraft.getInstance().getModelManager().getAtlasTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).getSprite(buildModeIcons.get(mode));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite getModeOptionIcon(ModeOptions.ActionEnum action) {
|
||||
return Minecraft.getInstance().getTextureMap().getSprite(modeOptionIcons.get(action));
|
||||
return Minecraft.getInstance().getModelManager().getAtlasTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).getSprite(modeOptionIcons.get(action));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +229,31 @@ public class BuildModes {
|
||||
return new Vec3d(x, y, z);
|
||||
}
|
||||
|
||||
//Use this instead of player.getLookVec() in any buildmodes code
|
||||
public static Vec3d getPlayerLookVec(PlayerEntity player){
|
||||
Vec3d lookVec = player.getLookVec();
|
||||
double x = lookVec.x;
|
||||
double y = lookVec.y;
|
||||
double z = lookVec.z;
|
||||
|
||||
//Further calculations (findXBound etc) don't like any component being 0 or 1 (e.g. dividing by 0)
|
||||
//isCriteriaValid below will take up to 2 minutes to raytrace blocks towards infinity if that is the case
|
||||
//So make sure they are close to but never exactly 0 or 1
|
||||
if (Math.abs(x) < 0.0001) x = 0.0001;
|
||||
if (Math.abs(x - 1.0) < 0.0001) x = 0.9999;
|
||||
if (Math.abs(x + 1.0) < 0.0001) x = -0.9999;
|
||||
|
||||
if (Math.abs(y) < 0.0001) y = 0.0001;
|
||||
if (Math.abs(y - 1.0) < 0.0001) y = 0.9999;
|
||||
if (Math.abs(y + 1.0) < 0.0001) y = -0.9999;
|
||||
|
||||
if (Math.abs(z) < 0.0001) z = 0.0001;
|
||||
if (Math.abs(z - 1.0) < 0.0001) z = 0.9999;
|
||||
if (Math.abs(z + 1.0) < 0.0001) z = -0.9999;
|
||||
|
||||
return new Vec3d(x, y, z);
|
||||
}
|
||||
|
||||
public static boolean isCriteriaValid(Vec3d start, Vec3d look, int reach, PlayerEntity player, boolean skipRaytrace, Vec3d lineBound, Vec3d planeBound, double distToPlayerSq) {
|
||||
boolean intersects = false;
|
||||
if (!skipRaytrace) {
|
||||
|
||||
@@ -14,6 +14,7 @@ public class ModeOptions {
|
||||
REDO("effortlessbuilding.action.redo"),
|
||||
REPLACE("effortlessbuilding.action.replace"),
|
||||
OPEN_MODIFIER_SETTINGS("effortlessbuilding.action.open_modifier_settings"),
|
||||
OPEN_PLAYER_SETTINGS("effortlessbuilding.action.open_player_settings"),
|
||||
|
||||
NORMAL_SPEED("effortlessbuilding.action.normal_speed"),
|
||||
FAST_SPEED("effortlessbuilding.action.fast_speed"),
|
||||
@@ -130,6 +131,10 @@ public class ModeOptions {
|
||||
if (player.world.isRemote)
|
||||
ClientProxy.openModifierSettings();
|
||||
break;
|
||||
case OPEN_PLAYER_SETTINGS:
|
||||
if (player.world.isRemote)
|
||||
ClientProxy.openPlayerSettings();
|
||||
break;
|
||||
|
||||
case NORMAL_SPEED:
|
||||
buildSpeed = ActionEnum.NORMAL_SPEED;
|
||||
@@ -175,7 +180,11 @@ public class ModeOptions {
|
||||
break;
|
||||
}
|
||||
|
||||
if (player.world.isRemote && action != ActionEnum.REPLACE && action != ActionEnum.OPEN_MODIFIER_SETTINGS) {
|
||||
if (player.world.isRemote &&
|
||||
action != ActionEnum.REPLACE &&
|
||||
action != ActionEnum.OPEN_MODIFIER_SETTINGS &&
|
||||
action != ActionEnum.OPEN_PLAYER_SETTINGS) {
|
||||
|
||||
EffortlessBuilding.logTranslate(player, "", action.name, "", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@ public abstract class ThreeClicksBuildMode extends BaseBuildMode {
|
||||
|
||||
//Finds height after floor has been chosen in buildmodes with 3 clicks
|
||||
public static BlockPos findHeight(PlayerEntity player, BlockPos secondPos, boolean skipRaytrace) {
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||
Vec3d start = new Vec3d(player.getPosX(), player.getPosY() + player.getEyeHeight(), player.getPosZ());
|
||||
|
||||
List<HeightCriteria> criteriaList = new ArrayList<>(3);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,8 +35,8 @@ public class Floor extends TwoClicksBuildMode {
|
||||
}
|
||||
|
||||
public static BlockPos findFloor(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||
Vec3d start = new Vec3d(player.getPosX(), player.getPosY() + player.getEyeHeight(), player.getPosZ());
|
||||
|
||||
List<Criteria> criteriaList = new ArrayList<>(3);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package nl.requios.effortlessbuilding.buildmode.buildmodes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.buildmode.BuildModes;
|
||||
import nl.requios.effortlessbuilding.buildmode.TwoClicksBuildMode;
|
||||
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||
@@ -60,8 +61,8 @@ public class Line extends TwoClicksBuildMode {
|
||||
}
|
||||
|
||||
public static BlockPos findLine(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||
Vec3d start = new Vec3d(player.getPosX(), player.getPosY() + player.getEyeHeight(), player.getPosZ());
|
||||
|
||||
List<Criteria> criteriaList = new ArrayList<>(3);
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public class Wall extends TwoClicksBuildMode {
|
||||
}
|
||||
|
||||
public static BlockPos findWall(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||
Vec3d start = new Vec3d(player.getPosX(), player.getPosY() + player.getEyeHeight(), player.getPosZ());
|
||||
|
||||
List<Criteria> criteriaList = new ArrayList<>(3);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package nl.requios.effortlessbuilding.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -36,7 +37,7 @@ public class RandomizerBagScreen extends ContainerScreen<RandomizerBagContainer>
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GlStateManager.color3f(1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
|
||||
minecraft.getTextureManager().bindTexture(guiTextures);
|
||||
int marginHorizontal = (width - xSize) / 2;
|
||||
int marginVertical = (height - ySize) / 2;
|
||||
|
||||
@@ -0,0 +1,304 @@
|
||||
package nl.requios.effortlessbuilding.gui.buildmode;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.IGuiEventListener;
|
||||
import net.minecraft.client.gui.screen.LanguageScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.gui.widget.list.ExtendedList;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.gui.widget.ExtendedButton;
|
||||
import net.minecraftforge.fml.client.gui.widget.Slider;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
|
||||
public class PlayerSettingsGui extends Screen {
|
||||
|
||||
protected int left, right, top, bottom;
|
||||
|
||||
private Button shaderTypeButton;
|
||||
private ShaderTypeList shaderTypeList;
|
||||
private Button closeButton;
|
||||
|
||||
protected boolean showShaderList = false;
|
||||
|
||||
public enum ShaderType {
|
||||
DISSOLVE_BLUE("Dissolve Blue"),
|
||||
DISSOLVE_ORANGE("Dissolve Orange");
|
||||
|
||||
public String name;
|
||||
ShaderType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerSettingsGui() {
|
||||
super(new TranslationTextComponent("effortlessbuilding.screen.player_settings"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
left = this.width / 2 - 140;
|
||||
right = this.width / 2 + 140;
|
||||
top = this.height / 2 - 100;
|
||||
bottom = this.height / 2 + 100;
|
||||
|
||||
int yy = top;
|
||||
shaderTypeList = new ShaderTypeList(this.minecraft);
|
||||
this.children.add(shaderTypeList);
|
||||
//TODO set selected name
|
||||
String currentShaderName = ShaderType.DISSOLVE_BLUE.name;
|
||||
shaderTypeButton = new ExtendedButton(right - 180, yy, 180, 20, currentShaderName, (button) -> {
|
||||
showShaderList = !showShaderList;
|
||||
});
|
||||
addButton(shaderTypeButton);
|
||||
|
||||
yy += 50;
|
||||
Slider slider = new Slider(right - 200, yy, 200, 20, "", "", 0.5, 2.0, 1.0, true, true, (button) -> {
|
||||
|
||||
});
|
||||
addButton(slider);
|
||||
|
||||
closeButton = new ExtendedButton(left + 50, bottom - 20, 180, 20, "Done", (button) -> {
|
||||
this.minecraft.player.closeScreen();
|
||||
});
|
||||
addButton(closeButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
this.renderBackground();
|
||||
|
||||
int yy = top;
|
||||
font.drawString("Shader type", left, yy + 5, 0xFFFFFF);
|
||||
|
||||
yy += 50;
|
||||
font.drawString("Shader speed", left, yy + 5, 0xFFFFFF);
|
||||
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
if (showShaderList)
|
||||
this.shaderTypeList.render(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
if (showShaderList) {
|
||||
if (!shaderTypeList.isMouseOver(mouseX, mouseY) && !shaderTypeButton.isMouseOver(mouseX, mouseY))
|
||||
showShaderList = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removed() {
|
||||
ShaderTypeList.ShaderTypeEntry selectedShader = shaderTypeList.getSelected();
|
||||
//TODO save
|
||||
}
|
||||
|
||||
//Inspired by LanguageScreen
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
class ShaderTypeList extends ExtendedList<PlayerSettingsGui.ShaderTypeList.ShaderTypeEntry> {
|
||||
|
||||
public ShaderTypeList(Minecraft mcIn) {
|
||||
super(mcIn, 180, 140, top + 20, top + 100, 18);
|
||||
this.setLeftPos(right - width);
|
||||
|
||||
for (int i = 0; i < 40; i++) {
|
||||
|
||||
for (ShaderType shaderType : ShaderType.values()) {
|
||||
ShaderTypeEntry shaderTypeEntry = new ShaderTypeEntry(shaderType);
|
||||
addEntry(shaderTypeEntry);
|
||||
//TODO setSelected to this if appropriate
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.getSelected() != null) {
|
||||
this.centerScrollOn(this.getSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(PlayerSettingsGui.ShaderTypeList.ShaderTypeEntry selected) {
|
||||
super.setSelected(selected);
|
||||
Minecraft.getInstance().getSoundHandler().play(SimpleSound.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
EffortlessBuilding.log("Selected shader " + selected.shaderType.name);
|
||||
shaderTypeButton.setMessage(selected.shaderType.name);
|
||||
// showShaderList = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
|
||||
if (!showShaderList) return false;
|
||||
return super.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
|
||||
if (!showShaderList) return false;
|
||||
return super.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged(double p_mouseDragged_1_, double p_mouseDragged_3_, int p_mouseDragged_5_, double p_mouseDragged_6_, double p_mouseDragged_8_) {
|
||||
if (!showShaderList) return false;
|
||||
return super.mouseDragged(p_mouseDragged_1_, p_mouseDragged_3_, p_mouseDragged_5_, p_mouseDragged_6_, p_mouseDragged_8_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double p_mouseScrolled_1_, double p_mouseScrolled_3_, double p_mouseScrolled_5_) {
|
||||
if (!showShaderList) return false;
|
||||
return super.mouseScrolled(p_mouseScrolled_1_, p_mouseScrolled_3_, p_mouseScrolled_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(double p_isMouseOver_1_, double p_isMouseOver_3_) {
|
||||
if (!showShaderList) return false;
|
||||
return super.isMouseOver(p_isMouseOver_1_, p_isMouseOver_3_);
|
||||
}
|
||||
|
||||
protected boolean isFocused() {
|
||||
return PlayerSettingsGui.this.getFocused() == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrollbarPosition() {
|
||||
return right - 6;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ShaderTypeEntry extends ExtendedList.AbstractListEntry<ShaderTypeEntry> {
|
||||
private final ShaderType shaderType;
|
||||
|
||||
public ShaderTypeEntry(ShaderType shaderType) {
|
||||
this.shaderType = shaderType;
|
||||
}
|
||||
|
||||
public void render(int itemIndex, int rowTop, int rowLeft, int rowWidth, int rowHeight, int mouseX, int mouseY, boolean hovered, float partialTicks) {
|
||||
if (rowTop + 10 > ShaderTypeList.this.y0 && rowTop + rowHeight - 5 < ShaderTypeList.this.y1)
|
||||
drawString(font, shaderType.name, ShaderTypeList.this.x0 + 8, rowTop + 4, 0xFFFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
|
||||
if (p_mouseClicked_5_ == 0) {
|
||||
setSelected(this);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//From AbstractList, disabled parts
|
||||
public void render(int p_render_1_, int p_render_2_, float p_render_3_) {
|
||||
this.renderBackground();
|
||||
int i = this.getScrollbarPosition();
|
||||
int j = i + 6;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||
// this.minecraft.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f = 32.0F;
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
bufferbuilder.pos((double)this.x0, (double)this.y1, 0.0D).color(20, 20, 20, 180).endVertex();
|
||||
bufferbuilder.pos((double)this.x1, (double)this.y1, 0.0D).color(20, 20, 20, 180).endVertex();
|
||||
bufferbuilder.pos((double)this.x1, (double)this.y0, 0.0D).color(20, 20, 20, 180).endVertex();
|
||||
bufferbuilder.pos((double)this.x0, (double)this.y0, 0.0D).color(20, 20, 20, 180).endVertex();
|
||||
tessellator.draw();
|
||||
int k = this.getRowLeft();
|
||||
int l = this.y0 + 4 - (int)this.getScrollAmount();
|
||||
if (this.renderHeader) {
|
||||
this.renderHeader(k, l, tessellator);
|
||||
}
|
||||
|
||||
this.renderList(k, l, p_render_1_, p_render_2_, p_render_3_);
|
||||
RenderSystem.disableDepthTest();
|
||||
// this.renderHoleBackground(0, this.y0, 255, 255);
|
||||
// this.renderHoleBackground(this.y1, this.height, 255, 255);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.shadeModel(7425);
|
||||
RenderSystem.disableTexture();
|
||||
// int i1 = 4;
|
||||
// bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
// bufferbuilder.pos((double)this.x0, (double)(this.y0 + 4), 0.0D).tex(0.0F, 1.0F).color(0, 0, 0, 0).endVertex();
|
||||
// bufferbuilder.pos((double)this.x1, (double)(this.y0 + 4), 0.0D).tex(1.0F, 1.0F).color(0, 0, 0, 0).endVertex();
|
||||
// bufferbuilder.pos((double)this.x1, (double)this.y0, 0.0D).tex(1.0F, 0.0F).color(0, 0, 0, 255).endVertex();
|
||||
// bufferbuilder.pos((double)this.x0, (double)this.y0, 0.0D).tex(0.0F, 0.0F).color(0, 0, 0, 255).endVertex();
|
||||
// tessellator.draw();
|
||||
// bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
// bufferbuilder.pos((double)this.x0, (double)this.y1, 0.0D).tex(0.0F, 1.0F).color(0, 0, 0, 255).endVertex();
|
||||
// bufferbuilder.pos((double)this.x1, (double)this.y1, 0.0D).tex(1.0F, 1.0F).color(0, 0, 0, 255).endVertex();
|
||||
// bufferbuilder.pos((double)this.x1, (double)(this.y1 - 4), 0.0D).tex(1.0F, 0.0F).color(0, 0, 0, 0).endVertex();
|
||||
// bufferbuilder.pos((double)this.x0, (double)(this.y1 - 4), 0.0D).tex(0.0F, 0.0F).color(0, 0, 0, 0).endVertex();
|
||||
// tessellator.draw();
|
||||
|
||||
//SCROLLBAR
|
||||
int j1 = this.getMaxScroll();
|
||||
if (j1 > 0) {
|
||||
int k1 = (int)((float)((this.y1 - this.y0) * (this.y1 - this.y0)) / (float)this.getMaxPosition());
|
||||
k1 = MathHelper.clamp(k1, 32, this.y1 - this.y0 - 8);
|
||||
int l1 = (int)this.getScrollAmount() * (this.y1 - this.y0 - k1) / j1 + this.y0;
|
||||
if (l1 < this.y0) {
|
||||
l1 = this.y0;
|
||||
}
|
||||
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
bufferbuilder.pos((double)i, (double)this.y1, 0.0D).tex(0.0F, 1.0F).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double)j, (double)this.y1, 0.0D).tex(1.0F, 1.0F).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double)j, (double)this.y0, 0.0D).tex(1.0F, 0.0F).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double)i, (double)this.y0, 0.0D).tex(0.0F, 0.0F).color(0, 0, 0, 255).endVertex();
|
||||
tessellator.draw();
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
bufferbuilder.pos((double)i, (double)(l1 + k1), 0.0D).tex(0.0F, 1.0F).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double)j, (double)(l1 + k1), 0.0D).tex(1.0F, 1.0F).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double)j, (double)l1, 0.0D).tex(1.0F, 0.0F).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double)i, (double)l1, 0.0D).tex(0.0F, 0.0F).color(128, 128, 128, 255).endVertex();
|
||||
tessellator.draw();
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
bufferbuilder.pos((double)i, (double)(l1 + k1 - 1), 0.0D).tex(0.0F, 1.0F).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double)(j - 1), (double)(l1 + k1 - 1), 0.0D).tex(1.0F, 1.0F).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double)(j - 1), (double)l1, 0.0D).tex(1.0F, 0.0F).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double)i, (double)l1, 0.0D).tex(0.0F, 0.0F).color(192, 192, 192, 255).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
// this.renderDecorations(p_render_1_, p_render_2_);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.shadeModel(7424);
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
private int getMaxScroll() {
|
||||
return Math.max(0, this.getMaxPosition() - (this.y1 - this.y0 - 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@ package nl.requios.effortlessbuilding.gui.buildmode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
@@ -119,19 +121,19 @@ public class RadialMenu extends Screen {
|
||||
|
||||
BuildModeEnum currentBuildMode = ModeSettingsManager.getModeSettings(Minecraft.getInstance().player).getBuildMode();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef( 0.0F, 0.0F, 200.0F );
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef( 0.0F, 0.0F, 200.0F );
|
||||
|
||||
final int startColor = (int) ( visibility * 98 ) << 24;
|
||||
final int endColor = (int) ( visibility * 128 ) << 24;
|
||||
|
||||
fillGradient(0, 0, width, height, startColor, endColor);
|
||||
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
RenderSystem.shadeModel(GL11.GL_SMOOTH);
|
||||
final Tessellator tessellator = Tessellator.getInstance();
|
||||
final BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
@@ -140,8 +142,14 @@ public class RadialMenu extends Screen {
|
||||
final double middleX = width / 2.0;
|
||||
final double middleY = height / 2.0;
|
||||
|
||||
final double mouseXCenter = mouseX - middleX;
|
||||
final double mouseYCenter = -mouseY + middleY;
|
||||
//Fix for high def (retina) displays: use custom mouse coordinates
|
||||
//Borrowed from GameRenderer::updateCameraAndRender
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int mouseXX = (int)(mc.mouseHelper.getMouseX() * (double)mc.getMainWindow().getScaledWidth() / (double)mc.getMainWindow().getWidth());
|
||||
int mouseYY = (int)(mc.mouseHelper.getMouseY() * (double)mc.getMainWindow().getScaledHeight() / (double)mc.getMainWindow().getHeight());
|
||||
|
||||
final double mouseXCenter = mouseXX - middleX;
|
||||
final double mouseYCenter = mouseYY - middleY;
|
||||
double mouseRadians = Math.atan2(mouseYCenter, mouseXCenter);
|
||||
|
||||
final double ringInnerEdge = 30;
|
||||
@@ -165,8 +173,9 @@ public class RadialMenu extends Screen {
|
||||
//Add actions
|
||||
buttons.add(new MenuButton(ActionEnum.UNDO.name, ActionEnum.UNDO, -buttonDistance - 26, -13, Direction.UP));
|
||||
buttons.add(new MenuButton(ActionEnum.REDO.name, ActionEnum.REDO, -buttonDistance, -13, Direction.UP));
|
||||
buttons.add(new MenuButton(ActionEnum.OPEN_MODIFIER_SETTINGS.name, ActionEnum.OPEN_MODIFIER_SETTINGS, -buttonDistance - 26, 13, Direction.DOWN));
|
||||
buttons.add(new MenuButton(ActionEnum.REPLACE.name, ActionEnum.REPLACE, -buttonDistance, 13, Direction.DOWN));
|
||||
buttons.add(new MenuButton(ActionEnum.OPEN_PLAYER_SETTINGS.name, ActionEnum.OPEN_PLAYER_SETTINGS, -buttonDistance - 26 - 13, 13, Direction.DOWN));
|
||||
buttons.add(new MenuButton(ActionEnum.OPEN_MODIFIER_SETTINGS.name, ActionEnum.OPEN_MODIFIER_SETTINGS, -buttonDistance - 13, 13, Direction.DOWN));
|
||||
buttons.add(new MenuButton(ActionEnum.REPLACE.name, ActionEnum.REPLACE, -buttonDistance + 13, 13, Direction.DOWN));
|
||||
|
||||
//Add buildmode dependent options
|
||||
OptionEnum[] options = currentBuildMode.options;
|
||||
@@ -236,10 +245,10 @@ public class RadialMenu extends Screen {
|
||||
switchTo = menuRegion.mode;
|
||||
}
|
||||
|
||||
buffer.pos(middleX + x1m1, middleY + y1m1, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x2m1, middleY + y2m1, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x2m2, middleY + y2m2, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x1m2, middleY + y1m2, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x1m1, middleY + y1m1, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x2m1, middleY + y2m1, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x2m2, middleY + y2m2, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + x1m2, middleY + y1m2, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
|
||||
currentMode++;
|
||||
}
|
||||
@@ -275,22 +284,22 @@ public class RadialMenu extends Screen {
|
||||
doAction = btn.action;
|
||||
}
|
||||
|
||||
buffer.pos(middleX + btn.x1, middleY + btn.y1, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x1, middleY + btn.y2, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x2, middleY + btn.y2, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x2, middleY + btn.y1, blitOffset).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x1, middleY + btn.y1, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x1, middleY + btn.y2, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x2, middleY + btn.y2, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
buffer.pos(middleX + btn.x2, middleY + btn.y1, getBlitOffset()).color(r, g, b, a).endVertex();
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
RenderSystem.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
GlStateManager.translatef(0f, 0f, 5f);
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.color3f(1f, 1f, 1f);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.bindTexture(Minecraft.getInstance().getTextureMap().getGlTextureId());
|
||||
RenderSystem.translatef(0f, 0f, 5f);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.color3f(1f, 1f, 1f);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.enableAlphaTest();
|
||||
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
|
||||
@@ -315,10 +324,10 @@ public class RadialMenu extends Screen {
|
||||
final double v1 = 0;
|
||||
final double v2 = 16;
|
||||
|
||||
buffer.pos(middleX + x1, middleY + y1, blitOffset).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x1, middleY + y2, blitOffset).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x2, middleY + y2, blitOffset).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x2, middleY + y1, blitOffset).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x1, middleY + y1, getBlitOffset()).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x1, middleY + y2, getBlitOffset()).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x2, middleY + y2, getBlitOffset()).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + x2, middleY + y1, getBlitOffset()).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
}
|
||||
|
||||
//Draw action icons
|
||||
@@ -341,10 +350,10 @@ public class RadialMenu extends Screen {
|
||||
final double btny1 = btnmiddleY - 8;
|
||||
final double btny2 = btnmiddleY + 8;
|
||||
|
||||
buffer.pos(middleX + btnx1, middleY + btny1, blitOffset).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx1, middleY + btny2, blitOffset).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx2, middleY + btny2, blitOffset).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx2, middleY + btny1, blitOffset).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx1, middleY + btny1, getBlitOffset()).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx1, middleY + btny2, getBlitOffset()).tex(sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx2, middleY + btny2, getBlitOffset()).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v2)).color(f, f, f, a).endVertex();
|
||||
buffer.pos(middleX + btnx2, middleY + btny1, getBlitOffset()).tex(sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v1)).color(f, f, f, a).endVertex();
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
@@ -444,7 +453,7 @@ public class RadialMenu extends Screen {
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
private boolean inTriangle(final double x1, final double y1, final double x2, final double y2,
|
||||
@@ -466,16 +475,16 @@ public class RadialMenu extends Screen {
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
|
||||
EffortlessBuilding.log("mouse clicked");
|
||||
|
||||
// KeyBinding.updateKeyBindState();
|
||||
// KeyBinding.setKeyBindState(ClientProxy.keyBindings[3].getKeyCode(), true);
|
||||
KeyBinding.updateKeyBindState();
|
||||
KeyBinding.setKeyBindState(ClientProxy.keyBindings[3].getKey(), true);
|
||||
|
||||
// if (mouseButton == 0) {
|
||||
// this.mc.displayGuiScreen(null);
|
||||
//
|
||||
// if (this.mc.currentScreen == null) {
|
||||
// this.mc.setIngameFocus();
|
||||
// }
|
||||
// }
|
||||
if (mouseButton == 0) {
|
||||
this.minecraft.displayGuiScreen(null);
|
||||
|
||||
if (this.minecraft.currentScreen == null) {
|
||||
this.minecraft.setGameFocused(true);
|
||||
}
|
||||
}
|
||||
return super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public class MirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
y = top + 72;
|
||||
buttonCurrentPosition = new GuiIconButton(left + 5, y, 0, 0, BUILDING_ICONS, button -> {
|
||||
Vec3d pos = new Vec3d(Math.floor(mc.player.posX) + 0.5, Math.floor(mc.player.posY) + 0.5, Math.floor(mc.player.posZ) + 0.5);
|
||||
Vec3d pos = new Vec3d(Math.floor(mc.player.getPosX()) + 0.5, Math.floor(mc.player.getPosY()) + 0.5, Math.floor(mc.player.getPosZ()) + 0.5);
|
||||
textMirrorPosX.setNumber(pos.x);
|
||||
textMirrorPosY.setNumber(pos.y);
|
||||
textMirrorPosZ.setNumber(pos.z);
|
||||
|
||||
@@ -137,7 +137,6 @@ public class ModifierSettingsGui extends Screen {
|
||||
//Send to server
|
||||
PacketHandler.INSTANCE.sendToServer(new ModifierSettingsMessage(modifierSettings));
|
||||
|
||||
//TODO fix not being able to scroll after this gui has opened
|
||||
Minecraft.getInstance().mouseHelper.grabMouse();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class RadialMirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
y = top + 72;
|
||||
buttonCurrentPosition = new GuiIconButton(left + 5, y, 0, 0, BUILDING_ICONS, button -> {
|
||||
Vec3d pos = new Vec3d(Math.floor(mc.player.posX) + 0.5, Math.floor(mc.player.posY) + 0.5, Math.floor(mc.player.posZ) + 0.5);
|
||||
Vec3d pos = new Vec3d(Math.floor(mc.player.getPosX()) + 0.5, Math.floor(mc.player.getPosY()) + 0.5, Math.floor(mc.player.getPosZ()) + 0.5);
|
||||
textRadialMirrorPosX.setNumber(pos.x);
|
||||
textRadialMirrorPosY.setNumber(pos.y);
|
||||
textRadialMirrorPosZ.setNumber(pos.z);
|
||||
|
||||
@@ -2,7 +2,7 @@ package nl.requios.effortlessbuilding.gui.elements;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
/**
|
||||
* This class provides a checkbox style control.
|
||||
@@ -28,7 +28,7 @@ public class GuiCheckBoxFixed extends Button
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.boxWidth && mouseY < this.y + this.height;
|
||||
GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x, this.y, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.blitOffset);
|
||||
GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x, this.y, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.renderBg(mc, mouseX, mouseY);
|
||||
int color = 14737632;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package nl.requios.effortlessbuilding.gui.elements;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.*;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -77,8 +77,6 @@ public class GuiScrollPane extends SlotGui {
|
||||
int scrollbarLeft = this.getScrollbarPosition();
|
||||
int scrollbarRight = scrollbarLeft + 6;
|
||||
this.capYPosition();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableFog();
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||
@@ -91,17 +89,17 @@ public class GuiScrollPane extends SlotGui {
|
||||
|
||||
//All entries
|
||||
this.renderList(insideLeft, insideTop, mouseXIn, mouseYIn, partialTicks);
|
||||
GlStateManager.disableDepthTest();
|
||||
RenderSystem.disableDepthTest();
|
||||
|
||||
//Dirt overlays on top and bottom
|
||||
// this.renderHoleBackground(0, this.y0, 255, 255);
|
||||
// this.renderHoleBackground(this.y1, this.height, 255, 255);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.shadeModel(7425);
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.shadeModel(7425);
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
//top
|
||||
// bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
@@ -130,29 +128,30 @@ public class GuiScrollPane extends SlotGui {
|
||||
}
|
||||
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) this.y1, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) this.y1, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) this.y0, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) this.y0, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) this.y1, 0.0F).tex(0.0F, 1.0F).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) this.y1, 0.0F).tex(1.0F, 1.0F).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) this.y0, 0.0F).tex(1.0F, 0.0F).color(0, 0, 0, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) this.y0, 0.0F).tex(0.0F, 0.0F).color(0, 0, 0, 255).endVertex();
|
||||
tessellator.draw();
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) (l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) (l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) (l1 + k1), 0.0F).tex(0.0F, 1.0F).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) (l1 + k1), 0.0F).tex(1.0F, 1.0F).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarRight, (double) l1, 0.0F).tex(1.0F, 0.0F).color(128, 128, 128, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) l1, 0.0F).tex(0.0F, 0.0F).color(128, 128, 128, 255).endVertex();
|
||||
tessellator.draw();
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) (l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) (scrollbarRight - 1), (double) (l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) (scrollbarRight - 1), (double) l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) (l1 + k1 - 1), 0.0F).tex(0.0F, 1.0F).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) (scrollbarRight - 1), (double) (l1 + k1 - 1), 0.0F).tex(1.0F, 1.0F).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) (scrollbarRight - 1), (double) l1, 0.0F).tex(1.0F, 0.0F).color(192, 192, 192, 255).endVertex();
|
||||
bufferbuilder.pos((double) scrollbarLeft, (double) l1, 0.0F).tex(0.0F, 0.0F).color(192, 192, 192, 255).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.shadeModel(7424);
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
//this.renderDecorations(mouseXIn, mouseYIn);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.shadeModel(7424);
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,23 +353,23 @@ public class GuiScrollPane extends SlotGui {
|
||||
if (this.renderSelection && this.isSelectedItem(i)) {
|
||||
int i1 = this.x0 + this.width / 2 - this.getRowWidth() / 2;
|
||||
int j1 = this.x0 + this.width / 2 + this.getRowWidth() / 2;
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.disableTexture();
|
||||
float f = this.isFocused() ? 1.0F : 0.5F;
|
||||
GlStateManager.color4f(f, f, f, 1.0F);
|
||||
RenderSystem.color4f(f, f, f, 1.0F);
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION);
|
||||
bufferbuilder.pos((double)i1, (double)(y + entryHeight2 + 2), 0.0D).endVertex();
|
||||
bufferbuilder.pos((double)j1, (double)(y + entryHeight2 + 2), 0.0D).endVertex();
|
||||
bufferbuilder.pos((double)j1, (double)(y - 2), 0.0D).endVertex();
|
||||
bufferbuilder.pos((double)i1, (double)(y - 2), 0.0D).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.color4f(0.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.color4f(0.0F, 0.0F, 0.0F, 1.0F);
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION);
|
||||
bufferbuilder.pos((double)(i1 + 1), (double)(y + entryHeight2 + 1), 0.0D).endVertex();
|
||||
bufferbuilder.pos((double)(j1 - 1), (double)(y + entryHeight2 + 1), 0.0D).endVertex();
|
||||
bufferbuilder.pos((double)(j1 - 1), (double)(y - 1), 0.0D).endVertex();
|
||||
bufferbuilder.pos((double)(i1 + 1), (double)(y - 1), 0.0D).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
|
||||
this.renderItem(i, insideLeft, y, entryHeight2, mouseXIn, mouseYIn, partialTicks);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package nl.requios.effortlessbuilding.helper;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.SlabBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -57,21 +59,15 @@ public class SurvivalHelper {
|
||||
//Drop existing block
|
||||
dropBlock(world, player, pos);
|
||||
|
||||
//TryPlace sets block with offset, so we only do world.setBlockState now
|
||||
//Remember count of itemstack before tryPlace, and set it back after.
|
||||
//TryPlace reduces stack even in creative so it is not usable here.
|
||||
// int origCount = itemstack.getCount();
|
||||
//TryPlace sets block with offset and reduces itemstack count in creative, so we copy only parts of it
|
||||
// BlockItemUseContext blockItemUseContext = new BlockItemUseContext(world, player, itemstack, pos, facing, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z);
|
||||
// EnumActionResult result = ((ItemBlock) itemstack.getItem()).tryPlace(blockItemUseContext);
|
||||
// itemstack.setCount(origCount);
|
||||
|
||||
//Set our (rotated) blockstate
|
||||
world.setBlockState(pos, blockState, 3);
|
||||
// blockState.onBlockAdded(world, pos, blockState);
|
||||
// block.onBlockPlacedBy(world, pos, blockState, player, itemstack);
|
||||
// world.notifyBlockUpdate(pos, blockState, world.getBlockState(pos), 3);
|
||||
|
||||
// if (result != EnumActionResult.SUCCESS) return false;
|
||||
if (!world.setBlockState(pos, blockState, 3)) return false;
|
||||
BlockItem.setTileEntityNBT(world, player, pos, itemstack); //Actually BlockItem::onBlockPlaced but that is protected
|
||||
block.onBlockPlacedBy(world, pos, blockState, player, itemstack);
|
||||
if (player instanceof ServerPlayerEntity) {
|
||||
CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayerEntity)player, pos, itemstack);
|
||||
}
|
||||
|
||||
BlockState afterState = world.getBlockState(pos);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ItemRandomizerBag extends Item {
|
||||
|
||||
if (player == null) return ActionResultType.FAIL;
|
||||
|
||||
if (ctx.isPlacerSneaking()) {
|
||||
if (ctx.func_225518_g_()) { //ctx.isPlacerSneaking()
|
||||
if (world.isRemote) return ActionResultType.SUCCESS;
|
||||
//Open inventory
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, new ContainerProvider(item));
|
||||
|
||||
@@ -41,6 +41,7 @@ import nl.requios.effortlessbuilding.buildmode.ModeSettingsManager;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.ModifierSettingsManager;
|
||||
import nl.requios.effortlessbuilding.compatibility.CompatHelper;
|
||||
import nl.requios.effortlessbuilding.gui.RandomizerBagScreen;
|
||||
import nl.requios.effortlessbuilding.gui.buildmode.PlayerSettingsGui;
|
||||
import nl.requios.effortlessbuilding.gui.buildmode.RadialMenu;
|
||||
import nl.requios.effortlessbuilding.gui.buildmodifier.ModifierSettingsGui;
|
||||
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||
@@ -68,9 +69,6 @@ public class ClientProxy implements IProxy {
|
||||
|
||||
@Override
|
||||
public void clientSetup(FMLClientSetupEvent event) {
|
||||
//Crashes in 1.13, do it elsewhere
|
||||
// ShaderHandler.init();
|
||||
|
||||
// register key bindings
|
||||
keyBindings = new KeyBinding[7];
|
||||
|
||||
@@ -337,6 +335,20 @@ public class ClientProxy implements IProxy {
|
||||
}
|
||||
}
|
||||
|
||||
public static void openPlayerSettings() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ClientPlayerEntity player = mc.player;
|
||||
|
||||
RadialMenu.instance.setVisibility(0f);
|
||||
|
||||
//Disabled if max reach is 0, might be set in the config that way.
|
||||
if (mc.currentScreen == null) {
|
||||
mc.displayGuiScreen(new PlayerSettingsGui());
|
||||
} else {
|
||||
player.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onGuiOpen(GuiOpenEvent event) {
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
@@ -353,8 +365,8 @@ public class ClientProxy implements IProxy {
|
||||
float raytraceRange = ReachHelper.getPlacementReach(player);
|
||||
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
Vec3d end = new Vec3d(player.posX + look.x * raytraceRange, player.posY + player.getEyeHeight() + look.y * raytraceRange, player.posZ + look.z * raytraceRange);
|
||||
Vec3d start = new Vec3d(player.getPosX(), player.getPosY() + player.getEyeHeight(), player.getPosZ());
|
||||
Vec3d end = new Vec3d(player.getPosX() + look.x * raytraceRange, player.getPosY() + player.getEyeHeight() + look.y * raytraceRange, player.getPosZ() + look.z * raytraceRange);
|
||||
// return player.rayTrace(raytraceRange, 1f, RayTraceFluidMode.NEVER);
|
||||
//TODO 1.14 check if correct
|
||||
return world.rayTraceBlocks(new RayTraceContext(start, end, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, player));
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package nl.requios.effortlessbuilding.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -68,25 +71,20 @@ public class BlockPreviewRenderer {
|
||||
|
||||
private static List<PlacedData> placedDataList = new ArrayList<>();
|
||||
|
||||
private static final int primaryTextureUnit = 0;
|
||||
private static final int secondaryTextureUnit = 2;
|
||||
|
||||
public static void render(PlayerEntity player, ModifierSettings modifierSettings, ModeSettings modeSettings) {
|
||||
public static void render(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, PlayerEntity player, ModifierSettings modifierSettings, ModeSettings modeSettings) {
|
||||
|
||||
//Render placed blocks with dissolve effect
|
||||
//Use fancy shader if config allows, otherwise no dissolve
|
||||
if (BuildConfig.visuals.useShaders.get()) {
|
||||
RenderHandler.beginBlockPreviews();
|
||||
for (int i = 0; i < placedDataList.size(); i++) {
|
||||
PlacedData placed = placedDataList.get(i);
|
||||
if (placed.coordinates != null && !placed.coordinates.isEmpty()) {
|
||||
|
||||
double totalTime = MathHelper.clampedLerp(30, 60, placed.firstPos.distanceSq(placed.secondPos) / 100.0) * BuildConfig.visuals.dissolveTimeMultiplier.get();
|
||||
float dissolve = (ClientProxy.ticksInGame - placed.time) / (float) totalTime;
|
||||
renderBlockPreviews(placed.coordinates, placed.blockStates, placed.itemStacks, dissolve, placed.firstPos, placed.secondPos, false, placed.breaking);
|
||||
renderBlockPreviews(matrixStack, renderTypeBuffer, placed.coordinates, placed.blockStates, placed.itemStacks, dissolve, placed.firstPos, placed.secondPos, false, placed.breaking);
|
||||
}
|
||||
}
|
||||
RenderHandler.endBlockPreviews();
|
||||
}
|
||||
//Expire
|
||||
placedDataList.removeIf(placed -> {
|
||||
@@ -211,25 +209,19 @@ public class BlockPreviewRenderer {
|
||||
|
||||
//Use fancy shader if config allows, otherwise outlines
|
||||
if (BuildConfig.visuals.useShaders.get() && newCoordinates.size() < BuildConfig.visuals.shaderTreshold.get()) {
|
||||
|
||||
RenderHandler.beginBlockPreviews();
|
||||
|
||||
blockCount = renderBlockPreviews(newCoordinates, blockStates, itemStacks, 0f, firstPos, secondPos, !breaking, breaking);
|
||||
|
||||
RenderHandler.endBlockPreviews();
|
||||
blockCount = renderBlockPreviews(matrixStack, renderTypeBuffer, newCoordinates, blockStates, itemStacks, 0f, firstPos, secondPos, !breaking, breaking);
|
||||
} else {
|
||||
|
||||
RenderHandler.beginLines();
|
||||
IVertexBuilder buffer = RenderHandler.beginLines(renderTypeBuffer);
|
||||
|
||||
Vec3d color = new Vec3d(1f, 1f, 1f);
|
||||
if (breaking) color = new Vec3d(1f, 0f, 0f);
|
||||
|
||||
for (int i = newCoordinates.size() - 1; i >= 0; i--) {
|
||||
VoxelShape collisionShape = blockStates.get(i).getCollisionShape(player.world, newCoordinates.get(i));
|
||||
RenderHandler.renderBlockOutline(newCoordinates.get(i), collisionShape, color);
|
||||
RenderHandler.renderBlockOutline(matrixStack, buffer, newCoordinates.get(i), collisionShape, color);
|
||||
}
|
||||
|
||||
RenderHandler.endLines();
|
||||
RenderHandler.endLines(renderTypeBuffer);
|
||||
|
||||
blockCount = newCoordinates.size();
|
||||
}
|
||||
@@ -265,7 +257,7 @@ public class BlockPreviewRenderer {
|
||||
|
||||
}
|
||||
|
||||
RenderHandler.beginLines();
|
||||
IVertexBuilder buffer = RenderHandler.beginLines(renderTypeBuffer);
|
||||
//Draw outlines if tool in hand
|
||||
//Find proper raytrace: either normal range or increased range depending on canBreakFar
|
||||
RayTraceResult objectMouseOver = Minecraft.getInstance().objectMouseOver;
|
||||
@@ -283,12 +275,12 @@ public class BlockPreviewRenderer {
|
||||
if (!blockState.getBlock().isAir(blockState, player.world, coordinate)) {
|
||||
if (SurvivalHelper.canBreak(player.world, player, coordinate) || i == 0) {
|
||||
VoxelShape collisionShape = blockState.getCollisionShape(player.world, coordinate);
|
||||
RenderHandler.renderBlockOutline(coordinate, collisionShape, new Vec3d(0f, 0f, 0f));
|
||||
RenderHandler.renderBlockOutline(matrixStack, buffer, coordinate, collisionShape, new Vec3d(0f, 0f, 0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderHandler.endLines();
|
||||
RenderHandler.endLines(renderTypeBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +291,7 @@ public class BlockPreviewRenderer {
|
||||
BuildConfig.visuals.alwaysShowBlockPreview.get();
|
||||
}
|
||||
|
||||
protected static int renderBlockPreviews(List<BlockPos> coordinates, List<BlockState> blockStates,
|
||||
protected static int renderBlockPreviews(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, List<BlockPos> coordinates, List<BlockState> blockStates,
|
||||
List<ItemStack> itemStacks, float dissolve, BlockPos firstPos,
|
||||
BlockPos secondPos, boolean checkCanPlace, boolean red) {
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
@@ -318,13 +310,10 @@ public class BlockPreviewRenderer {
|
||||
|
||||
//Check if can place
|
||||
//If check is turned off, check if blockstate is the same (for dissolve effect)
|
||||
if ((!checkCanPlace /*&& player.world.getNewBlockState(blockPos) == blockState*/) || //TODO enable (breaks breaking shader)
|
||||
if ((!checkCanPlace /*&& player.world.getNewBlockState(blockPos) == blockState*/) || //TODO enable (breaks the breaking shader)
|
||||
SurvivalHelper.canPlace(player.world, player, blockPos, blockState, itemstack, modifierSettings.doQuickReplace(), Direction.UP)) {
|
||||
|
||||
ShaderHandler.useShader(ShaderHandler.dissolve, generateShaderCallback(dissolve,
|
||||
new Vec3d(blockPos), new Vec3d(firstPos), new Vec3d(secondPos),
|
||||
blockPos == secondPos, red));
|
||||
RenderHandler.renderBlockPreview(dispatcher, blockPos, blockState);
|
||||
RenderHandler.renderBlockPreview(matrixStack, renderTypeBuffer, dispatcher, blockPos, blockState, dissolve, firstPos, secondPos, red);
|
||||
blocksValid++;
|
||||
}
|
||||
}
|
||||
@@ -381,55 +370,6 @@ public class BlockPreviewRenderer {
|
||||
|
||||
}
|
||||
|
||||
private static Consumer<Integer> generateShaderCallback(final float dissolve, final Vec3d blockpos,
|
||||
final Vec3d firstpos, final Vec3d secondpos,
|
||||
final boolean highlight, final boolean red) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
return (Integer shader) -> {
|
||||
int percentileUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "dissolve");
|
||||
int highlightUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "highlight");
|
||||
int redUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "red");
|
||||
int blockposUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "blockpos");
|
||||
int firstposUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "firstpos");
|
||||
int secondposUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "secondpos");
|
||||
int imageUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "image");
|
||||
int maskUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "mask");
|
||||
|
||||
GlStateManager.enableTexture();
|
||||
GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
|
||||
//mask
|
||||
ARBShaderObjects.glUniform1iARB(maskUniform, secondaryTextureUnit);
|
||||
glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + secondaryTextureUnit);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.getTextureManager().getTexture(ShaderHandler.shaderMaskTextureLocation).getGlTextureId());
|
||||
|
||||
//image
|
||||
ARBShaderObjects.glUniform1iARB(imageUniform, primaryTextureUnit);
|
||||
glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + primaryTextureUnit);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.getTextureManager().getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).getGlTextureId());
|
||||
|
||||
//blockpos
|
||||
ARBShaderObjects.glUniform3fARB(blockposUniform, (float) blockpos.x, (float) blockpos.y, (float) blockpos.z);
|
||||
ARBShaderObjects.glUniform3fARB(firstposUniform, (float) firstpos.x, (float) firstpos.y, (float) firstpos.z);
|
||||
ARBShaderObjects.glUniform3fARB(secondposUniform, (float) secondpos.x, (float) secondpos.y, (float) secondpos.z);
|
||||
|
||||
//dissolve
|
||||
ARBShaderObjects.glUniform1fARB(percentileUniform, dissolve);
|
||||
//highlight
|
||||
ARBShaderObjects.glUniform1iARB(highlightUniform, highlight ? 1 : 0);
|
||||
//red
|
||||
ARBShaderObjects.glUniform1iARB(redUniform, red ? 1 : 0);
|
||||
};
|
||||
}
|
||||
|
||||
public static void glActiveTexture(int texture) {
|
||||
if (GL.getCapabilities().GL_ARB_multitexture && !GL.getCapabilities().OpenGL13) {
|
||||
ARBMultitexture.glActiveTextureARB(texture);
|
||||
} else {
|
||||
GL13.glActiveTexture(texture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void sortOnDistanceToPlayer(List<BlockPos> coordinates, PlayerEntity player) {
|
||||
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
package nl.requios.effortlessbuilding.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class BuildRenderTypes {
|
||||
public static final RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY;
|
||||
public static final RenderState.TransparencyState NO_TRANSPARENCY;
|
||||
|
||||
public static final RenderState.DiffuseLightingState DIFFUSE_LIGHTING_ENABLED;
|
||||
public static final RenderState.DiffuseLightingState DIFFUSE_LIGHTING_DISABLED;
|
||||
|
||||
public static final RenderState.LayerState PROJECTION_LAYERING;
|
||||
|
||||
public static final RenderState.CullState CULL_DISABLED;
|
||||
|
||||
public static final RenderState.AlphaState DEFAULT_ALPHA;
|
||||
|
||||
public static final RenderState.WriteMaskState WRITE_TO_DEPTH_AND_COLOR;
|
||||
public static final RenderState.WriteMaskState COLOR_WRITE;
|
||||
|
||||
public static final RenderType LINES;
|
||||
public static final RenderType PLANES;
|
||||
|
||||
private static final int primaryTextureUnit = 0;
|
||||
private static final int secondaryTextureUnit = 2;
|
||||
|
||||
static {
|
||||
TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
NO_TRANSPARENCY = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228510_b_");
|
||||
|
||||
DIFFUSE_LIGHTING_ENABLED = new RenderState.DiffuseLightingState(true);
|
||||
DIFFUSE_LIGHTING_DISABLED = new RenderState.DiffuseLightingState(false);
|
||||
|
||||
PROJECTION_LAYERING = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228500_J_");
|
||||
|
||||
CULL_DISABLED = new RenderState.CullState(false);
|
||||
|
||||
DEFAULT_ALPHA = new RenderState.AlphaState(0.003921569F);
|
||||
|
||||
final boolean ENABLE_DEPTH_WRITING = true;
|
||||
final boolean ENABLE_COLOUR_COMPONENTS_WRITING = true;
|
||||
WRITE_TO_DEPTH_AND_COLOR = new RenderState.WriteMaskState(ENABLE_COLOUR_COMPONENTS_WRITING, ENABLE_DEPTH_WRITING);
|
||||
COLOR_WRITE = new RenderState.WriteMaskState(true, false);
|
||||
|
||||
final int INITIAL_BUFFER_SIZE = 128;
|
||||
RenderType.State renderState;
|
||||
|
||||
//LINES
|
||||
// RenderSystem.pushLightingAttributes();
|
||||
// RenderSystem.pushTextureAttributes();
|
||||
// RenderSystem.disableCull();
|
||||
// RenderSystem.disableLighting();
|
||||
// RenderSystem.disableTexture();
|
||||
//
|
||||
// RenderSystem.enableBlend();
|
||||
// RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
//
|
||||
// RenderSystem.lineWidth(2);
|
||||
renderState = RenderType.State.getBuilder()
|
||||
.line(new RenderState.LineState(OptionalDouble.of(2)))
|
||||
.layer(PROJECTION_LAYERING)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.writeMask(WRITE_TO_DEPTH_AND_COLOR)
|
||||
.cull(CULL_DISABLED)
|
||||
.build(false);
|
||||
LINES = RenderType.makeType("eb_lines",
|
||||
DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, INITIAL_BUFFER_SIZE, renderState);
|
||||
|
||||
renderState = RenderType.State.getBuilder()
|
||||
.line(new RenderState.LineState(OptionalDouble.of(2)))
|
||||
.layer(PROJECTION_LAYERING)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.writeMask(COLOR_WRITE)
|
||||
.cull(CULL_DISABLED)
|
||||
.build(false);
|
||||
PLANES = RenderType.makeType("eb_planes",
|
||||
DefaultVertexFormats.POSITION_COLOR, GL11.GL_TRIANGLE_STRIP, INITIAL_BUFFER_SIZE, renderState);
|
||||
|
||||
}
|
||||
|
||||
private class ShaderInfo {
|
||||
float dissolve;
|
||||
Vec3d blockPos;
|
||||
Vec3d firstPos;
|
||||
Vec3d secondPos;
|
||||
boolean red;
|
||||
|
||||
public ShaderInfo(float dissolve, Vec3d blockPos, Vec3d firstPos, Vec3d secondPos, boolean red) {
|
||||
this.dissolve = dissolve;
|
||||
this.blockPos = blockPos;
|
||||
this.firstPos = firstPos;
|
||||
this.secondPos = secondPos;
|
||||
this.red = red;
|
||||
}
|
||||
}
|
||||
|
||||
public static RenderType getBlockPreviewRenderType(float dissolve, BlockPos blockPos, BlockPos firstPos,
|
||||
BlockPos secondPos, boolean red) {
|
||||
// RenderSystem.pushLightingAttributes();
|
||||
// RenderSystem.pushTextureAttributes();
|
||||
// RenderSystem.enableCull();
|
||||
// RenderSystem.enableTexture();
|
||||
// Minecraft.getInstance().textureManager.bindTexture(ShaderHandler.shaderMaskTextureLocation);
|
||||
//
|
||||
// RenderSystem.enableBlend();
|
||||
// RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
// RenderSystem.blendColor(1f, 1f, 1f, 0.8f);
|
||||
//end
|
||||
// ShaderHandler.releaseShader();
|
||||
|
||||
//highjacking texturing state (which does nothing by default) to do my own things
|
||||
|
||||
String stateName = "eb_texturing_" + dissolve + "_" + blockPos + "_" + firstPos + "_" + secondPos + "_" + red;
|
||||
RenderState.TexturingState MY_TEXTURING = new RenderState.TexturingState(stateName, () -> {
|
||||
// RenderSystem.pushLightingAttributes();
|
||||
// RenderSystem.pushTextureAttributes();
|
||||
|
||||
ShaderHandler.useShader(ShaderHandler.dissolve, generateShaderCallback(dissolve, new Vec3d(blockPos), new Vec3d(firstPos), new Vec3d(secondPos), blockPos == secondPos, red));
|
||||
RenderSystem.blendColor(1f, 1f, 1f, 0.8f);
|
||||
}, () -> {
|
||||
ShaderHandler.releaseShader();
|
||||
});
|
||||
|
||||
RenderType.State renderState = RenderType.State.getBuilder()
|
||||
.texture(new RenderState.TextureState(ShaderHandler.shaderMaskTextureLocation, false, false))
|
||||
.texturing(MY_TEXTURING)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.diffuseLighting(DIFFUSE_LIGHTING_DISABLED)
|
||||
.alpha(DEFAULT_ALPHA)
|
||||
.cull(new RenderState.CullState(true))
|
||||
.lightmap(new RenderState.LightmapState(false))
|
||||
.overlay(new RenderState.OverlayState(false))
|
||||
.build(true);
|
||||
//Unique name for every combination, otherwise it will reuse the previous one
|
||||
String name = "eb_block_previews_" + dissolve + "_" + blockPos + "_" + firstPos + "_" + secondPos + "_" + red;
|
||||
return RenderType.makeType(name,
|
||||
DefaultVertexFormats.BLOCK, GL11.GL_QUADS, 256, true, true, renderState);
|
||||
}
|
||||
|
||||
|
||||
private static Consumer<Integer> generateShaderCallback(final float dissolve, final Vec3d blockpos,
|
||||
final Vec3d firstpos, final Vec3d secondpos,
|
||||
final boolean highlight, final boolean red) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
return (Integer shader) -> {
|
||||
int percentileUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "dissolve");
|
||||
int highlightUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "highlight");
|
||||
int redUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "red");
|
||||
int blockposUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "blockpos");
|
||||
int firstposUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "firstpos");
|
||||
int secondposUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "secondpos");
|
||||
int imageUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "image");
|
||||
int maskUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "mask");
|
||||
|
||||
RenderSystem.enableTexture();
|
||||
GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
|
||||
//mask
|
||||
ARBShaderObjects.glUniform1iARB(maskUniform, secondaryTextureUnit);
|
||||
glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + secondaryTextureUnit);
|
||||
mc.getTextureManager().bindTexture(ShaderHandler.shaderMaskTextureLocation);//getTexture(ShaderHandler.shaderMaskTextureLocation).bindTexture();
|
||||
//GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.getTextureManager().getTexture(ShaderHandler.shaderMaskTextureLocation).getGlTextureId());
|
||||
|
||||
//image
|
||||
ARBShaderObjects.glUniform1iARB(imageUniform, primaryTextureUnit);
|
||||
glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + primaryTextureUnit);
|
||||
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);//.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).bindTexture();
|
||||
//GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.getTextureManager().getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).getGlTextureId());
|
||||
|
||||
//blockpos
|
||||
ARBShaderObjects.glUniform3fARB(blockposUniform, (float) blockpos.x, (float) blockpos.y, (float) blockpos.z);
|
||||
ARBShaderObjects.glUniform3fARB(firstposUniform, (float) firstpos.x, (float) firstpos.y, (float) firstpos.z);
|
||||
ARBShaderObjects.glUniform3fARB(secondposUniform, (float) secondpos.x, (float) secondpos.y, (float) secondpos.z);
|
||||
|
||||
//dissolve
|
||||
ARBShaderObjects.glUniform1fARB(percentileUniform, dissolve);
|
||||
//highlight
|
||||
ARBShaderObjects.glUniform1iARB(highlightUniform, highlight ? 1 : 0);
|
||||
//red
|
||||
ARBShaderObjects.glUniform1iARB(redUniform, red ? 1 : 0);
|
||||
};
|
||||
}
|
||||
|
||||
public static void glActiveTexture(int texture) {
|
||||
if (GL.getCapabilities().GL_ARB_multitexture && !GL.getCapabilities().OpenGL13) {
|
||||
ARBMultitexture.glActiveTextureARB(texture);
|
||||
} else {
|
||||
GL13.glActiveTexture(texture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// public static class MyTexturingState extends RenderState.TexturingState {
|
||||
//
|
||||
// public float dissolve;
|
||||
// public Vec3d blockPos;
|
||||
// public Vec3d firstPos;
|
||||
// public Vec3d secondPos;
|
||||
// public boolean highlight;
|
||||
// public boolean red;
|
||||
//
|
||||
// public MyTexturingState(String p_i225989_1_, float dissolve, Vec3d blockPos, Vec3d firstPos,
|
||||
// Vec3d secondPos, boolean highlight, boolean red, Runnable p_i225989_2_, Runnable p_i225989_3_) {
|
||||
// super(p_i225989_1_, p_i225989_2_, p_i225989_3_);
|
||||
// this.dissolve = dissolve;
|
||||
// this.blockPos = blockPos;
|
||||
// this.firstPos = firstPos;
|
||||
// this.secondPos = secondPos;
|
||||
// this.highlight = highlight;
|
||||
// this.red = red;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean equals(Object p_equals_1_) {
|
||||
// if (this == p_equals_1_) {
|
||||
// return true;
|
||||
// } else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) {
|
||||
// MyTexturingState other = (MyTexturingState)p_equals_1_;
|
||||
// return this.dissolve == other.dissolve && this.blockPos == other.blockPos && this.firstPos == other.firstPos
|
||||
// && this.secondPos == other.secondPos && this.highlight == other.highlight && this.red == other.red;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int hashCode() {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package nl.requios.effortlessbuilding.render;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -24,9 +28,7 @@ public class ModifierRenderer {
|
||||
protected static final int planeAlpha = 75;
|
||||
protected static final Vec3d epsilon = new Vec3d(0.001, 0.001, 0.001); //prevents z-fighting
|
||||
|
||||
public static void render(ModifierSettingsManager.ModifierSettings modifierSettings) {
|
||||
RenderHandler.beginLines();
|
||||
|
||||
public static void render(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, ModifierSettingsManager.ModifierSettings modifierSettings) {
|
||||
//Mirror lines and areas
|
||||
Mirror.MirrorSettings m = modifierSettings.getMirrorSettings();
|
||||
if (m != null && m.enabled && (m.mirrorX || m.mirrorY || m.mirrorZ))
|
||||
@@ -39,28 +41,28 @@ public class ModifierRenderer {
|
||||
Vec3d posA = new Vec3d(pos.x, pos.y - radius, pos.z - radius);
|
||||
Vec3d posB = new Vec3d(pos.x, pos.y + radius, pos.z + radius);
|
||||
|
||||
drawMirrorPlane(posA, posB, colorX, m.drawLines, m.drawPlanes, true);
|
||||
drawMirrorPlane(matrixStack, renderTypeBuffer, posA, posB, colorX, m.drawLines, m.drawPlanes, true);
|
||||
}
|
||||
if (m.mirrorY)
|
||||
{
|
||||
Vec3d posA = new Vec3d(pos.x - radius, pos.y, pos.z - radius);
|
||||
Vec3d posB = new Vec3d(pos.x + radius, pos.y, pos.z + radius);
|
||||
|
||||
drawMirrorPlaneY(posA, posB, colorY, m.drawLines, m.drawPlanes);
|
||||
drawMirrorPlaneY(matrixStack, renderTypeBuffer, posA, posB, colorY, m.drawLines, m.drawPlanes);
|
||||
}
|
||||
if (m.mirrorZ)
|
||||
{
|
||||
Vec3d posA = new Vec3d(pos.x - radius, pos.y - radius, pos.z);
|
||||
Vec3d posB = new Vec3d(pos.x + radius, pos.y + radius, pos.z);
|
||||
|
||||
drawMirrorPlane(posA, posB, colorZ, m.drawLines, m.drawPlanes, true);
|
||||
drawMirrorPlane(matrixStack, renderTypeBuffer, posA, posB, colorZ, m.drawLines, m.drawPlanes, true);
|
||||
}
|
||||
|
||||
//Draw axis coordinated colors if two or more axes are enabled
|
||||
//(If only one is enabled the lines are that planes color)
|
||||
if (m.drawLines && ((m.mirrorX && m.mirrorY) || (m.mirrorX && m.mirrorZ) || (m.mirrorY && m.mirrorZ)))
|
||||
{
|
||||
drawMirrorLines(m);
|
||||
drawMirrorLines(matrixStack, renderTypeBuffer, m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,96 +83,95 @@ public class ModifierRenderer {
|
||||
|
||||
Vec3d posA = new Vec3d(pos.x, pos.y - radius, pos.z);
|
||||
Vec3d posB = new Vec3d(newVec.x, pos.y + radius, newVec.z);
|
||||
drawMirrorPlane(posA, posB, colorRadial, r.drawLines, r.drawPlanes, false);
|
||||
drawMirrorPlane(matrixStack, renderTypeBuffer, posA, posB, colorRadial, r.drawLines, r.drawPlanes, false);
|
||||
}
|
||||
}
|
||||
|
||||
RenderHandler.endLines();
|
||||
}
|
||||
|
||||
|
||||
//----Mirror----
|
||||
|
||||
protected static void drawMirrorPlane(Vec3d posA, Vec3d posB, Color c, boolean drawLines, boolean drawPlanes, boolean drawVerticalLines) {
|
||||
protected static void drawMirrorPlane(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, Vec3d posA, Vec3d posB, Color c, boolean drawLines, boolean drawPlanes, boolean drawVerticalLines) {
|
||||
|
||||
GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
// GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha);
|
||||
Matrix4f matrixPos = matrixStack.getLast().getMatrix();
|
||||
|
||||
if (drawPlanes) {
|
||||
bufferBuilder.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
|
||||
IVertexBuilder buffer = RenderHandler.beginPlanes(renderTypeBuffer);
|
||||
|
||||
bufferBuilder.pos(posA.x, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
bufferBuilder.pos(posA.x, posB.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
bufferBuilder.pos(posB.x, posA.y, posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
bufferBuilder.pos(posB.x, posB.y, posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posA.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posB.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posB.x, (float) posA.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posB.x, (float) posB.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
//backface (using triangle strip)
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posA.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posB.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
RenderHandler.endPlanes(renderTypeBuffer);
|
||||
}
|
||||
|
||||
if (drawLines) {
|
||||
Vec3d middle = posA.add(posB).scale(0.5);
|
||||
bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
|
||||
IVertexBuilder buffer = RenderHandler.beginLines(renderTypeBuffer);
|
||||
|
||||
bufferBuilder.pos(posA.x, middle.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(posB.x, middle.y, posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
Vec3d middle = posA.add(posB).scale(0.5);
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) middle.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posB.x, (float) middle.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
if (drawVerticalLines) {
|
||||
bufferBuilder.pos(middle.x, posA.y, middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(middle.x, posB.y, middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) middle.x, (float) posA.y, (float) middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) middle.x, (float) posB.y, (float) middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
RenderHandler.endLines(renderTypeBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void drawMirrorPlaneY(Vec3d posA, Vec3d posB, Color c, boolean drawLines, boolean drawPlanes) {
|
||||
protected static void drawMirrorPlaneY(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, Vec3d posA, Vec3d posB, Color c, boolean drawLines, boolean drawPlanes) {
|
||||
|
||||
GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
// GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
|
||||
Matrix4f matrixPos = matrixStack.getLast().getMatrix();
|
||||
|
||||
if (drawPlanes) {
|
||||
bufferBuilder.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
|
||||
IVertexBuilder buffer = RenderHandler.beginPlanes(renderTypeBuffer);
|
||||
|
||||
bufferBuilder.pos(posA.x, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
bufferBuilder.pos(posA.x, posA.y, posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
bufferBuilder.pos(posB.x, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
bufferBuilder.pos(posB.x, posA.y, posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posA.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posA.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posB.x, (float) posA.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posB.x, (float) posA.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
//backface (using triangle strip)
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posA.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) posA.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), planeAlpha).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
RenderHandler.endPlanes(renderTypeBuffer);
|
||||
}
|
||||
|
||||
if (drawLines) {
|
||||
IVertexBuilder buffer = RenderHandler.beginLines(renderTypeBuffer);
|
||||
|
||||
Vec3d middle = posA.add(posB).scale(0.5);
|
||||
bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
|
||||
buffer.pos(matrixPos, (float) middle.x, (float) middle.y, (float) posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) middle.x, (float) middle.y, (float) posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posA.x, (float) middle.y, (float) middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) posB.x, (float) middle.y, (float) middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
|
||||
bufferBuilder.pos(middle.x, middle.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(middle.x, middle.y, posB.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(posA.x, middle.y, middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(posB.x, middle.y, middle.z).color(c.getRed(), c.getGreen(), c.getBlue(), lineAlpha).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
RenderHandler.endLines(renderTypeBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void drawMirrorLines(Mirror.MirrorSettings m) {
|
||||
protected static void drawMirrorLines(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, Mirror.MirrorSettings m) {
|
||||
|
||||
// GL11.glColor4d(100, 100, 100, 255);
|
||||
IVertexBuilder buffer = RenderHandler.beginLines(renderTypeBuffer);
|
||||
Matrix4f matrixPos = matrixStack.getLast().getMatrix();
|
||||
|
||||
Vec3d pos = m.position.add(epsilon);
|
||||
|
||||
GL11.glColor4d(100, 100, 100, 255);
|
||||
GL11.glLineWidth(2);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
buffer.pos(matrixPos, (float) pos.x - m.radius, (float) pos.y, (float) pos.z).color(colorX.getRed(), colorX.getGreen(), colorX.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) pos.x + m.radius, (float) pos.y, (float) pos.z).color(colorX.getRed(), colorX.getGreen(), colorX.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) pos.x, (float) pos.y - m.radius, (float) pos.z).color(colorY.getRed(), colorY.getGreen(), colorY.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) pos.x, (float) pos.y + m.radius, (float) pos.z).color(colorY.getRed(), colorY.getGreen(), colorY.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) pos.x, (float) pos.y, (float) pos.z - m.radius).color(colorZ.getRed(), colorZ.getGreen(), colorZ.getBlue(), lineAlpha).endVertex();
|
||||
buffer.pos(matrixPos, (float) pos.x, (float) pos.y, (float) pos.z + m.radius).color(colorZ.getRed(), colorZ.getGreen(), colorZ.getBlue(), lineAlpha).endVertex();
|
||||
|
||||
bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
bufferBuilder.pos(pos.x - m.radius, pos.y, pos.z).color(colorX.getRed(), colorX.getGreen(), colorX.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(pos.x + m.radius, pos.y, pos.z).color(colorX.getRed(), colorX.getGreen(), colorX.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(pos.x, pos.y - m.radius, pos.z).color(colorY.getRed(), colorY.getGreen(), colorY.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(pos.x, pos.y + m.radius, pos.z).color(colorY.getRed(), colorY.getGreen(), colorY.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(pos.x, pos.y, pos.z - m.radius).color(colorZ.getRed(), colorZ.getGreen(), colorZ.getBlue(), lineAlpha).endVertex();
|
||||
bufferBuilder.pos(pos.x, pos.y, pos.z + m.radius).color(colorZ.getRed(), colorZ.getGreen(), colorZ.getBlue(), lineAlpha).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
RenderHandler.endLines(renderTypeBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,34 @@
|
||||
package nl.requios.effortlessbuilding.render;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
@@ -33,7 +42,6 @@ import nl.requios.effortlessbuilding.network.ModeSettingsMessage;
|
||||
import nl.requios.effortlessbuilding.network.PacketHandler;
|
||||
import nl.requios.effortlessbuilding.proxy.ClientProxy;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
|
||||
/***
|
||||
* Main render class for Effortless Building
|
||||
@@ -43,19 +51,29 @@ public class RenderHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRender(RenderWorldLastEvent event) {
|
||||
if(event.getPhase() != EventPriority.NORMAL)
|
||||
return;
|
||||
|
||||
MatrixStack matrixStack = event.getMatrixStack();
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
IRenderTypeBuffer.Impl renderTypeBuffer = IRenderTypeBuffer.getImpl(bufferBuilder);
|
||||
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
ModeSettingsManager.ModeSettings modeSettings = ModeSettingsManager.getModeSettings(player);
|
||||
ModifierSettingsManager.ModifierSettings modifierSettings = ModifierSettingsManager.getModifierSettings(player);
|
||||
|
||||
begin(event.getPartialTicks());
|
||||
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||
|
||||
matrixStack.push();
|
||||
matrixStack.translate(-projectedView.x, -projectedView.y, -projectedView.z);
|
||||
|
||||
//Mirror and radial mirror lines and areas
|
||||
ModifierRenderer.render(modifierSettings);
|
||||
ModifierRenderer.render(matrixStack, renderTypeBuffer, modifierSettings);
|
||||
|
||||
//Render block previews
|
||||
BlockPreviewRenderer.render(player, modifierSettings, modeSettings);
|
||||
BlockPreviewRenderer.render(matrixStack, renderTypeBuffer, player, modifierSettings, modeSettings);
|
||||
|
||||
end();
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -108,8 +126,8 @@ public class RenderHandler {
|
||||
|
||||
if (RadialMenu.instance.isVisible()) {
|
||||
|
||||
int scaledWidth = mc.mainWindow.getScaledWidth();
|
||||
int scaledHeight = mc.mainWindow.getScaledHeight();
|
||||
int scaledWidth = mc.getMainWindow().getScaledWidth();
|
||||
int scaledHeight = mc.getMainWindow().getScaledHeight();
|
||||
RadialMenu.instance.configure(scaledWidth, scaledHeight);
|
||||
|
||||
if (!wasVisible) {
|
||||
@@ -120,12 +138,14 @@ public class RenderHandler {
|
||||
KeyBinding.unPressAllKeys();
|
||||
}
|
||||
|
||||
final int mouseX = ((int) mc.mouseHelper.getMouseX()) * scaledWidth / mc.mainWindow.getFramebufferWidth();
|
||||
final int mouseY = scaledHeight - ((int) mc.mouseHelper.getMouseY()) * scaledHeight / mc.mainWindow.getFramebufferHeight() - 1;
|
||||
final int mouseX = ((int) mc.mouseHelper.getMouseX()) * scaledWidth / mc.getMainWindow().getFramebufferWidth();
|
||||
final int mouseY = scaledHeight - ((int) mc.mouseHelper.getMouseY()) * scaledHeight / mc.getMainWindow().getFramebufferHeight() - 1;
|
||||
|
||||
net.minecraftforge.client.ForgeHooksClient.drawScreen(RadialMenu.instance, mouseX, mouseY, event.getPartialTicks());
|
||||
} else {
|
||||
if (wasVisible && RadialMenu.instance.doAction != ModeOptions.ActionEnum.OPEN_MODIFIER_SETTINGS) {
|
||||
if (wasVisible &&
|
||||
RadialMenu.instance.doAction != ModeOptions.ActionEnum.OPEN_MODIFIER_SETTINGS &&
|
||||
RadialMenu.instance.doAction != ModeOptions.ActionEnum.OPEN_PLAYER_SETTINGS) {
|
||||
mc.mouseHelper.grabMouse();
|
||||
}
|
||||
}
|
||||
@@ -140,108 +160,78 @@ public class RenderHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void begin(float partialTicks) {
|
||||
// PlayerEntity player = Minecraft.getInstance().player;
|
||||
// double playerX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
|
||||
// double playerY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
|
||||
// double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;
|
||||
// Vec3d playerPos = new Vec3d(playerX, playerY, playerZ);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
// GL11.glTranslated(-playerPos.x, -playerPos.y, -playerPos.z);
|
||||
GlStateManager.translated(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ);
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
protected static IVertexBuilder beginLines(IRenderTypeBuffer.Impl renderTypeBuffer) {
|
||||
return renderTypeBuffer.getBuffer(BuildRenderTypes.LINES);
|
||||
}
|
||||
|
||||
protected static void beginLines() {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glLineWidth(2);
|
||||
protected static void endLines(IRenderTypeBuffer.Impl renderTypeBuffer) {
|
||||
renderTypeBuffer.finish();
|
||||
}
|
||||
|
||||
protected static void endLines() {
|
||||
GL11.glPopAttrib();
|
||||
protected static IVertexBuilder beginPlanes(IRenderTypeBuffer.Impl renderTypeBuffer){
|
||||
return renderTypeBuffer.getBuffer(BuildRenderTypes.PLANES);
|
||||
}
|
||||
|
||||
protected static void beginBlockPreviews() {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
// Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().textureManager.bindTexture(ShaderHandler.shaderMaskTextureLocation);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL14.glBlendColor(1F, 1F, 1F, 0.8f);
|
||||
protected static void endPlanes(IRenderTypeBuffer.Impl renderTypeBuffer){
|
||||
renderTypeBuffer.finish();
|
||||
}
|
||||
|
||||
protected static void endBlockPreviews() {
|
||||
ShaderHandler.releaseShader();
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void end() {
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected static void renderBlockPreview(BlockRendererDispatcher dispatcher, BlockPos blockPos, BlockState blockState) {
|
||||
protected static void renderBlockPreview(MatrixStack matrixStack, IRenderTypeBuffer.Impl renderTypeBuffer, BlockRendererDispatcher dispatcher,
|
||||
BlockPos blockPos, BlockState blockState, float dissolve, BlockPos firstPos, BlockPos secondPos, boolean red) {
|
||||
if (blockState == null) return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
GlStateManager.rotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translatef(-0.01f, -0.01f, 0.01f);
|
||||
GlStateManager.scalef(1.02f, 1.02f, 1.02f);
|
||||
matrixStack.push();
|
||||
matrixStack.translate(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
// matrixStack.rotate(Vector3f.YP.rotationDegrees(-90f));
|
||||
matrixStack.translate(-0.01f, -0.01f, -0.01f);
|
||||
matrixStack.scale(1.02f, 1.02f, 1.02f);
|
||||
|
||||
//Begin block preview rendering
|
||||
RenderType blockPreviewRenderType = BuildRenderTypes.getBlockPreviewRenderType(dissolve, blockPos, firstPos, secondPos, red);
|
||||
IVertexBuilder buffer = renderTypeBuffer.getBuffer(blockPreviewRenderType);
|
||||
|
||||
// MinecraftServer server = Minecraft.getInstance().getIntegratedServer();
|
||||
// World world = DimensionManager.getWorld(server, DimensionType.OVERWORLD, false, true);
|
||||
|
||||
try {
|
||||
dispatcher.renderBlockBrightness(blockState, 0.85f);
|
||||
IBakedModel model = dispatcher.getModelForState(blockState);
|
||||
dispatcher.getBlockModelRenderer().renderModelBrightnessColor(matrixStack.getLast(), buffer,
|
||||
blockState, model, 1f, 1f, 1f, 0, OverlayTexture.NO_OVERLAY);
|
||||
// blockRendererDispatcher.getBlockModelRenderer().renderModel(world, blockRendererDispatcher.getModelForState(blockState),
|
||||
// blockState, logicPos, matrixStack, renderTypeBuffer.getBuffer(renderType), true, new Random(), blockState.getPositionRandom(logicPos), i);
|
||||
} catch (NullPointerException e) {
|
||||
EffortlessBuilding.logger.warn("RenderHandler::renderBlockPreview cannot render " + blockState.getBlock().toString());
|
||||
|
||||
//Render outline as backup
|
||||
GlStateManager.popMatrix();
|
||||
// ShaderHandler.releaseShader();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
renderBlockOutline(blockPos, new Vec3d(1f, 1f, 1f));
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GlStateManager.pushMatrix();
|
||||
//Render outline as backup, escape out of the current renderstack
|
||||
matrixStack.pop();
|
||||
renderTypeBuffer.finish();
|
||||
IVertexBuilder lineBuffer = beginLines(renderTypeBuffer);
|
||||
renderBlockOutline(matrixStack, lineBuffer, blockPos, new Vec3d(1f, 1f, 1f));
|
||||
endLines(renderTypeBuffer);
|
||||
buffer = renderTypeBuffer.getBuffer(Atlases.getTranslucentBlockType()); //any type will do, as long as we have something on the stack
|
||||
matrixStack.push();
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
renderTypeBuffer.finish();
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
||||
protected static void renderBlockOutline(BlockPos pos, Vec3d color) {
|
||||
renderBlockOutline(pos, pos, color);
|
||||
protected static void renderBlockOutline(MatrixStack matrixStack, IVertexBuilder buffer, BlockPos pos, Vec3d color) {
|
||||
renderBlockOutline(matrixStack, buffer, pos, pos, color);
|
||||
}
|
||||
|
||||
//Renders outline. Pos1 has to be minimal x,y,z and pos2 maximal x,y,z
|
||||
protected static void renderBlockOutline(BlockPos pos1, BlockPos pos2, Vec3d color) {
|
||||
GL11.glLineWidth(2);
|
||||
|
||||
protected static void renderBlockOutline(MatrixStack matrixStack, IVertexBuilder buffer, BlockPos pos1, BlockPos pos2, Vec3d color) {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(pos1, pos2.add(1, 1, 1)).grow(0.0020000000949949026);
|
||||
|
||||
WorldRenderer.drawSelectionBoundingBox(aabb, (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
WorldRenderer.drawBoundingBox(matrixStack, buffer, aabb, (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
// WorldRenderer.drawSelectionBoundingBox(aabb, (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
}
|
||||
|
||||
//Renders outline with given bounding box
|
||||
protected static void renderBlockOutline(BlockPos pos, VoxelShape collisionShape, Vec3d color) {
|
||||
GL11.glLineWidth(2);
|
||||
|
||||
// AxisAlignedBB aabb = boundingBox.offset(pos).grow(0.0020000000949949026);
|
||||
// VoxelShape voxelShape = collisionShape.withOffset(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
// WorldRenderer.drawSelectionBoundingBox(aabb, (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
WorldRenderer.drawShape(collisionShape, pos.getX(), pos.getY(), pos.getZ(), (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
protected static void renderBlockOutline(MatrixStack matrixStack, IVertexBuilder buffer, BlockPos pos, VoxelShape collisionShape, Vec3d color) {
|
||||
// WorldRenderer.drawShape(collisionShape, pos.getX(), pos.getY(), pos.getZ(), (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
WorldRenderer.drawVoxelShapeParts(matrixStack, buffer, collisionShape, pos.getX(), pos.getY(), pos.getZ(), (float) color.x, (float) color.y, (float) color.z, 0.4f);
|
||||
}
|
||||
|
||||
//TODO 1.14
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[25,)" #mandatory (24 is current forge version)
|
||||
loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
issueTrackerURL="https://bitbucket.org/Requios/effortless-building/issues?status=new&status=open" #optional
|
||||
issueTrackerURL="http://my.issue.tracker/" #optional
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
@@ -18,7 +18,7 @@ version="${file.jarVersion}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="Effortless Building" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||
updateJSONURL="http://myurl.me/" #optional
|
||||
#updateJSONURL="example.com" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
displayURL="https://minecraft.curseforge.com/projects/effortless-building" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
@@ -32,21 +32,21 @@ description='''
|
||||
Makes building easier by providing tools like mirrors, arrays, QuickReplace and a block randomizer. For survival and creative mode.
|
||||
'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
#[[dependencies.examplemod]] #optional
|
||||
# # the modid of the dependency
|
||||
# modId="forge" #mandatory
|
||||
# # Does this dependency have to exist - if not, ordering below must be specified
|
||||
# mandatory=true #mandatory
|
||||
# # The version range of the dependency
|
||||
# versionRange="[25,)" #mandatory
|
||||
# # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
# ordering="NONE"
|
||||
# # Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
# side="BOTH"
|
||||
## Here's another dependency
|
||||
#[[dependencies.examplemod]]
|
||||
# modId="minecraft"
|
||||
# mandatory=true
|
||||
# versionRange="[1.13.2]"
|
||||
# ordering="NONE"
|
||||
# side="BOTH"
|
||||
[[dependencies.examplemod]] #optional
|
||||
# the modid of the dependency
|
||||
modId="forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[31,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
side="BOTH"
|
||||
# Here's another dependency
|
||||
[[dependencies.examplemod]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.15.2]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"effortlessbuilding.screen.modifier_settings": "Modifier Settings",
|
||||
"effortlessbuilding.screen.radial_menu": "Build Modes",
|
||||
"effortlessbuilding.screen.randomizer_bag": "Randomizer Bag",
|
||||
"effortlessbuilding.screen.player_settings": "Player Settings",
|
||||
|
||||
"key.effortlessbuilding.category": "Effortless Building",
|
||||
"key.effortlessbuilding.hud.desc": "Modifier Menu",
|
||||
@@ -34,6 +35,7 @@
|
||||
"effortlessbuilding.action.redo": "Redo",
|
||||
"effortlessbuilding.action.replace": "Replace",
|
||||
"effortlessbuilding.action.open_modifier_settings": "Open Modifier Settings",
|
||||
"effortlessbuilding.action.open_player_settings": "Open Settings",
|
||||
|
||||
"effortlessbuilding.action.build_speed": "Build Speed",
|
||||
"effortlessbuilding.action.filling": "Filling",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"pack_format": 4,
|
||||
"_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods."
|
||||
"pack_format": 5,
|
||||
"_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods."
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user