Compare commits
18 Commits
1.21.4-1eb
...
dev/1.21.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d6d9119a8 | ||
|
|
40a455c92f | ||
|
|
23b9e44ff3 | ||
|
|
da25676332 | ||
|
|
3d60c6c0fc | ||
|
|
9a6720e5f1 | ||
|
|
1d88056195 | ||
|
|
3a7d1bd81d | ||
|
|
e84a8a5c18 | ||
|
|
92928ee93d | ||
|
|
61c3cc8c74 | ||
|
|
8e697a3dd6 | ||
|
|
c46c70db18 | ||
|
|
4692867da8 | ||
|
|
aacb2cd631 | ||
|
|
897ee50d29 | ||
|
|
72f49cfafe | ||
|
|
5b6d1ee061 |
21
LICENSE
21
LICENSE
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 LuminolMC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
31
LICENSE.md
Normal file
31
LICENSE.md
Normal file
@@ -0,0 +1,31 @@
|
||||
Luminol inherits its licensing from the included upstream projects.
|
||||
|
||||
Luminol从上游继承了许可证。
|
||||
|
||||
As such, Luminol is licensed under the
|
||||
[GNU General Public License version 3](licenses/GPL.md); as it inherits it from Folia,
|
||||
who in turn inherits it from the original Paper, Spigot, Bukkit and CraftBukkit projects.
|
||||
|
||||
因此,Luminol中应当遵守[GNU通用公共许可证-第3版](licenses/GPL.md) 的许可;
|
||||
因为Luminol从上游Folia继承了它,而Folia又从其上游的Paper、Spigot、Bukkit和Craftbukkit项目中继承了它。
|
||||
|
||||
Any author who is _not_ listed below should be presumed to have released their work
|
||||
under the original [GPL](licenses/GPL.md) license.
|
||||
|
||||
任何 _未在下面列出_ 的作者都应该被认为他们的修改基于[原始GPL许可证](licenses/GPL.md)。
|
||||
|
||||
In the interest of promoting a better Minecraft platform for everyone, contributors
|
||||
may choose to release their code under the more permissive [MIT License](licenses/MIT.md).
|
||||
|
||||
为了向所有人推广一个更好的Minecraft平台,贡献者可以选择在更宽松的[MIT许可证](licenses/MIT.md)下发布他们的代码。
|
||||
|
||||
The authors listed below have chosen to release their code under that more permissive
|
||||
[MIT License](licenses/MIT.md). Any contributor who wants their name added below
|
||||
should submit a pull request to this project to add their name.
|
||||
|
||||
下面列出的作者选择在更宽松的[MIT许可证](licenses/MIT.md)下发布他们的代码。
|
||||
任何希望使用[MIT许可证](licenses/MIT.md)发布的作者都应该向此项目提交一个拉取请求以在下方添加他们的名字。
|
||||
|
||||
```text
|
||||
Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
```
|
||||
@@ -3,7 +3,7 @@
|
||||
# Luminol
|
||||
<h4>Luminol 是一个基于Folia的分支,具有许多有用的优化、可配置的原版特性和更多的API支持,它专为生存和无政府服务器设计</h4>
|
||||
|
||||
[](LICENSE)
|
||||
[](LICENSE.md)
|
||||
[](https://github.com/LuminolMC/Luminol/issues)
|
||||

|
||||

|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Luminol
|
||||
<h4>Luminol is a Folia fork with many useful optimizations, configurable vanilla features, and more API supports, and it was designed for survival and anarchy servers</h4>
|
||||
|
||||
[](LICENSE)
|
||||
[](LICENSE.md)
|
||||
[](https://github.com/LuminolMC/Luminol/issues)
|
||||

|
||||

|
||||
|
||||
@@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
|
||||
plugins {
|
||||
java // TODO java launcher tasks
|
||||
id("io.papermc.paperweight.patcher") version "2.0.0-SNAPSHOT"
|
||||
id("io.papermc.paperweight.patcher") version "2.0.0-beta.14"
|
||||
}
|
||||
|
||||
paperweight {
|
||||
|
||||
@@ -2,7 +2,7 @@ group = me.earthme.luminol
|
||||
version=1.21.4-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.4
|
||||
|
||||
foliaRef=cd49d650b27aa329358593a84ef77444538ef014
|
||||
foliaRef=b785bccd6fd270b4897a165772124eef55d58c6c
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
675
licenses/GPL.md
Normal file
675
licenses/GPL.md
Normal file
@@ -0,0 +1,675 @@
|
||||
### GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
<https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
### Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom
|
||||
to share and change all versions of a program--to make sure it remains
|
||||
free software for all its users. We, the Free Software Foundation, use
|
||||
the GNU General Public License for most of our software; it applies
|
||||
also to any other work released this way by its authors. You can apply
|
||||
it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you
|
||||
have certain responsibilities if you distribute copies of the
|
||||
software, or if you modify it: responsibilities to respect the freedom
|
||||
of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the
|
||||
manufacturer can do so. This is fundamentally incompatible with the
|
||||
aim of protecting users' freedom to change the software. The
|
||||
systematic pattern of such abuse occurs in the area of products for
|
||||
individuals to use, which is precisely where it is most unacceptable.
|
||||
Therefore, we have designed this version of the GPL to prohibit the
|
||||
practice for those products. If such problems arise substantially in
|
||||
other domains, we stand ready to extend this provision to those
|
||||
domains in future versions of the GPL, as needed to protect the
|
||||
freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish
|
||||
to avoid the special danger that patents applied to a free program
|
||||
could make it effectively proprietary. To prevent this, the GPL
|
||||
assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
### TERMS AND CONDITIONS
|
||||
|
||||
#### 0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds
|
||||
of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of
|
||||
an exact copy. The resulting work is called a "modified version" of
|
||||
the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user
|
||||
through a computer network, with no transfer of a copy, is not
|
||||
conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to
|
||||
the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
#### 1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work for
|
||||
making modifications to it. "Object code" means any non-source form of
|
||||
a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can
|
||||
regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same
|
||||
work.
|
||||
|
||||
#### 2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey,
|
||||
without conditions so long as your license otherwise remains in force.
|
||||
You may convey covered works to others for the sole purpose of having
|
||||
them make modifications exclusively for you, or provide you with
|
||||
facilities for running those works, provided that you comply with the
|
||||
terms of this License in conveying all material for which you do not
|
||||
control copyright. Those thus making or running the covered works for
|
||||
you must do so exclusively on your behalf, under your direction and
|
||||
control, on terms that prohibit them from making any copies of your
|
||||
copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the
|
||||
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||
it unnecessary.
|
||||
|
||||
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such
|
||||
circumvention is effected by exercising rights under this License with
|
||||
respect to the covered work, and you disclaim any intention to limit
|
||||
operation or modification of the work as a means of enforcing, against
|
||||
the work's users, your or third parties' legal rights to forbid
|
||||
circumvention of technological measures.
|
||||
|
||||
#### 4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
#### 5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these
|
||||
conditions:
|
||||
|
||||
- a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
- b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under
|
||||
section 7. This requirement modifies the requirement in section 4
|
||||
to "keep intact all notices".
|
||||
- c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
- d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
#### 6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of
|
||||
sections 4 and 5, provided that you also convey the machine-readable
|
||||
Corresponding Source under the terms of this License, in one of these
|
||||
ways:
|
||||
|
||||
- a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
- b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the Corresponding
|
||||
Source from a network server at no charge.
|
||||
- c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
- d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
- e) Convey the object code using peer-to-peer transmission,
|
||||
provided you inform other peers where the object code and
|
||||
Corresponding Source of the work are being offered to the general
|
||||
public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal,
|
||||
family, or household purposes, or (2) anything designed or sold for
|
||||
incorporation into a dwelling. In determining whether a product is a
|
||||
consumer product, doubtful cases shall be resolved in favor of
|
||||
coverage. For a particular product received by a particular user,
|
||||
"normally used" refers to a typical or common use of that class of
|
||||
product, regardless of the status of the particular user or of the way
|
||||
in which the particular user actually uses, or expects or is expected
|
||||
to use, the product. A product is a consumer product regardless of
|
||||
whether the product has substantial commercial, industrial or
|
||||
non-consumer uses, unless such uses represent the only significant
|
||||
mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to
|
||||
install and execute modified versions of a covered work in that User
|
||||
Product from a modified version of its Corresponding Source. The
|
||||
information must suffice to ensure that the continued functioning of
|
||||
the modified object code is in no case prevented or interfered with
|
||||
solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or
|
||||
updates for a work that has been modified or installed by the
|
||||
recipient, or for the User Product in which it has been modified or
|
||||
installed. Access to a network may be denied when the modification
|
||||
itself materially and adversely affects the operation of the network
|
||||
or violates the rules and protocols for communication across the
|
||||
network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
#### 7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders
|
||||
of that material) supplement the terms of this License with terms:
|
||||
|
||||
- a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
- b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
- c) Prohibiting misrepresentation of the origin of that material,
|
||||
or requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
- d) Limiting the use for publicity purposes of names of licensors
|
||||
or authors of the material; or
|
||||
- e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
- f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions
|
||||
of it) with contractual assumptions of liability to the recipient,
|
||||
for any liability that these contractual assumptions directly
|
||||
impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions; the
|
||||
above requirements apply either way.
|
||||
|
||||
#### 8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
#### 9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run
|
||||
a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
#### 10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
#### 11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned
|
||||
or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the
|
||||
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||
the non-exercise of one or more of the rights that are specifically
|
||||
granted under this License. You may not convey a covered work if you
|
||||
are a party to an arrangement with a third party that is in the
|
||||
business of distributing software, under which you make payment to the
|
||||
third party based on the extent of your activity of conveying the
|
||||
work, and under which the third party grants, to any of the parties
|
||||
who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by
|
||||
you (or copies made from those copies), or (b) primarily for and in
|
||||
connection with specific products or compilations that contain the
|
||||
covered work, unless you entered into that arrangement, or that patent
|
||||
license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
#### 12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under
|
||||
this License and any other pertinent obligations, then as a
|
||||
consequence you may not convey it at all. For example, if you agree to
|
||||
terms that obligate you to collect a royalty for further conveying
|
||||
from those to whom you convey the Program, the only way you could
|
||||
satisfy both those terms and this License would be to refrain entirely
|
||||
from conveying the Program.
|
||||
|
||||
#### 13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
#### 14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU 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 Program
|
||||
specifies that a certain numbered version of the GNU General Public
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that numbered version or
|
||||
of any later version published by the Free Software Foundation. If the
|
||||
Program does not specify a version number of the GNU General Public
|
||||
License, you may choose any version ever published by the Free
|
||||
Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions
|
||||
of the GNU General Public License can be used, that proxy's public
|
||||
statement of acceptance of a version permanently authorizes you to
|
||||
choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
#### 15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
#### 16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||
CONVEYS THE PROGRAM 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 PROGRAM (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 PROGRAM
|
||||
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
#### 17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
### How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively state
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper
|
||||
mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands \`show w' and \`show c' should show the
|
||||
appropriate parts of the General Public License. Of course, your
|
||||
program's commands might be different; for a GUI interface, you would
|
||||
use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. For more information on this, and how to apply and follow
|
||||
the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your
|
||||
program into proprietary programs. If your program is a subroutine
|
||||
library, you may consider it more useful to permit linking proprietary
|
||||
applications with the library. If this is what you want to do, use the
|
||||
GNU Lesser General Public License instead of this License. But first,
|
||||
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
23
licenses/MIT.md
Normal file
23
licenses/MIT.md
Normal file
@@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -7,7 +7,6 @@ Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
index ab7584873e46020148bceecbd42a43055684e6a0..f33ab20313310a113d6c88e0fc1fe1666218061e 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config for offline mode warning
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 3abe2881e8a80bd6c128e96b976deebe3ada4678..a0a8b0c7d091f63f023f15a2620b03ae2126782e 100644
|
||||
index 375f4a59333ee1d75fb1acb8c2cbada7866bd48e..f4b738b05ec9488e20402efb6c935ff55d86adf2 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -285,7 +285,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Wed, 21 May 2025 13:04:00 +0800
|
||||
Subject: [PATCH] Add config to disable end crystal check
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/dimension/end/EndDragonFight.java b/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 2e156694b337760be986fdf1cbf863b0d896ef2d..b55ac3c0d19cf9117368c17687fa34099bfe3533 100644
|
||||
--- a/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -546,6 +546,8 @@ public class EndDragonFight {
|
||||
|
||||
blockPos = this.portalLocation;
|
||||
}
|
||||
+ // Luminol start - Disable end crystal check
|
||||
+ if (!me.earthme.luminol.config.modules.misc.DisableEndCrystalCheckConfig.disableEndCrystalCheck) {
|
||||
// Paper start - Perf: Do crystal-portal proximity check before entity lookup
|
||||
if (placedEndCrystalPos != null) {
|
||||
// The end crystal must be 0 or 1 higher than the portal origin
|
||||
@@ -561,6 +563,7 @@ public class EndDragonFight {
|
||||
}
|
||||
}
|
||||
// Paper end - Perf: Do crystal-portal proximity check before entity lookup
|
||||
+ } // Luminol end - Disable end crystal check
|
||||
|
||||
|
||||
List<EndCrystal> list = Lists.newArrayList();
|
||||
@@ -97,10 +97,10 @@ index 7123b3eb2f2e52946b8ef9de993a6828eb0bb6f7..82948984404a183711588932a4a026dc
|
||||
this.scheduler.regionFailed(this, false, thr);
|
||||
// regionFailed will schedule a shutdown, so we should avoid letting this region tick further
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index cfb37f2e428605965a37dc1eb83f302fe1bd6299..8f7b28e5688252207ad8ce9f3fb6f9c3b65d1adc 100644
|
||||
index 009e6405a11a391adca41a7c4ecafbf3254d799d..779dfa95d91ec4661227c94b012cb63953d4ba96 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -213,7 +213,11 @@ public class Commands {
|
||||
@@ -211,7 +211,11 @@ public class Commands {
|
||||
//TeamMsgCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
||||
TeleportCommand.register(this.dispatcher);
|
||||
TellRawCommand.register(this.dispatcher, context);
|
||||
@@ -114,7 +114,7 @@ index cfb37f2e428605965a37dc1eb83f302fe1bd6299..8f7b28e5688252207ad8ce9f3fb6f9c3
|
||||
TitleCommand.register(this.dispatcher, context);
|
||||
//TriggerCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index ed00a29daccfee1d631bef27c0a3a4ae83140018..56f5568848d0f20b4d706c07dc8114594e0b5337 100644
|
||||
index 46375fa81b36b89b79c22f0a7ac6d610ab1183d4..2f0a1810e3ab4ff4376e893af7ceb2bf5849ba76 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -267,7 +267,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -31,10 +31,10 @@ index 9aace993c6c18f1a50610e4766225485984b8167..419c1c7e14691a472b70ed548ecb928c
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
index f96fc1391167dea48cac1caa464b9026657df89a..eb869e574cee0d206684d5585c664a5f1d01ab65 100644
|
||||
index f96fc1391167dea48cac1caa464b9026657df89a..29b286386546db9d809f1b1b5c98571d3058a0f5 100644
|
||||
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
@@ -27,15 +27,43 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
@@ -27,6 +27,11 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
// CraftBukkit end
|
||||
BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
|
||||
|
||||
@@ -46,9 +46,8 @@ index f96fc1391167dea48cac1caa464b9026657df89a..eb869e574cee0d206684d5585c664a5f
|
||||
for (int i = -2; i <= 2; i++) {
|
||||
for (int i1 = -2; i1 <= 2; i1++) {
|
||||
for (int i2 = -1; i2 < 3; i2++) {
|
||||
BlockPos blockPos = mutableBlockPos.set(pos).move(i1, i2, i);
|
||||
Block block = i2 == -1 ? Blocks.OBSIDIAN : Blocks.AIR;
|
||||
- // CraftBukkit start
|
||||
@@ -35,7 +40,29 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
// CraftBukkit start
|
||||
if (!blockList.getBlockState(blockPos).is(block)) {
|
||||
if (dropBlocks) {
|
||||
- blockList.destroyBlock(blockPos, true, null);
|
||||
@@ -70,9 +69,7 @@ index f96fc1391167dea48cac1caa464b9026657df89a..eb869e574cee0d206684d5585c664a5f
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ default: {
|
||||
+
|
||||
+ } // Luminol - 1.21 Logic - default empty
|
||||
+ default: {} // Luminol - 1.21 & default Logic - default empty
|
||||
+ }
|
||||
+ }
|
||||
+ if (flag) blockList1.add(blockPos.immutable());
|
||||
@@ -80,14 +77,14 @@ index f96fc1391167dea48cac1caa464b9026657df89a..eb869e574cee0d206684d5585c664a5f
|
||||
}
|
||||
|
||||
blockList.setBlock(blockPos, block.defaultBlockState(), 3);
|
||||
@@ -54,11 +82,39 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
@@ -54,11 +81,39 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
if (portalEvent.isCancelled()) return;
|
||||
}
|
||||
|
||||
- // SPIGOT-7856: End platform not dropping items after replacing blocks
|
||||
- if (dropBlocks) {
|
||||
- blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null));
|
||||
+ if (flag21 && !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
|
||||
+ if (flag21 || !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
|
||||
+ // Luminol start - When updated replace it with newer code
|
||||
+ if (dropBlocks) {
|
||||
+ java.util.function.Consumer<? super org.bukkit.craftbukkit.block.CraftBlockState> beforeRun = state -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null);
|
||||
@@ -21,7 +21,7 @@ index 80f17f33f670018240c854df589cf90cdeab6e70..8672757a4d5fb5c247599782fece6b8d
|
||||
if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) {
|
||||
serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier));
|
||||
diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java
|
||||
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618996cc5bc 100644
|
||||
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..190b9f46029ba0a0d69f68db2c56301f4ea21c94 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -325,7 +325,20 @@ public class Raid {
|
||||
@@ -30,7 +30,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
|
||||
if (flag1) {
|
||||
- this.waveSpawnPos = this.getValidSpawnPos();
|
||||
+ // Luminol Start - Raid revert
|
||||
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) {
|
||||
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.posRevert) {
|
||||
+ this.waveSpawnPos = this.getValidSpawnPos();
|
||||
+ } else {
|
||||
+ int n4 = 0;
|
||||
@@ -53,7 +53,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
|
||||
- BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
|
||||
+ // Luminol Start - Raid revert
|
||||
+ BlockPos blockPos;
|
||||
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) {
|
||||
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.posRevert) {
|
||||
+ blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
|
||||
+ } else {
|
||||
+ blockPos = this.waveSpawnPos.isPresent() ? this.waveSpawnPos.get() : this.findRandomSpawnPos(i, 20);
|
||||
@@ -67,7 +67,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
|
||||
}
|
||||
|
||||
- if (i > 5) {
|
||||
+ if (i > (me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert ? 3 : 5)) { // Luminol - Raid revert
|
||||
+ if (i > (me.earthme.luminol.config.modules.misc.RaidChangesConfig.posRevert ? 3 : 5)) { // Luminol - Raid revert
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit
|
||||
this.stop();
|
||||
break;
|
||||
@@ -94,7 +94,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
|
||||
int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
|
||||
int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3);
|
||||
- if (Mth.abs(height - this.center.getY()) <= 96) {
|
||||
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.height_check || Mth.abs(height - this.center.getY()) <= 96) { // Leaves - Disable height check
|
||||
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.heightCheck || Mth.abs(height - this.center.getY()) <= 96) { // Leaves - Disable height check
|
||||
mutableBlockPos.set(i2, height, i3);
|
||||
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
|
||||
int i4 = 10;
|
||||
@@ -126,7 +126,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618
|
||||
return this.addWaveMob(wave, raider, true);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
|
||||
index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7eab2a25c 100644
|
||||
index 7c385baae81b9a987c0e1e4deb017884600331bc..075563d83fadd85191117685fa3b97a9fad14488 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster {
|
||||
@@ -178,7 +178,7 @@ index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7
|
||||
|
||||
public boolean hasRaid() {
|
||||
- return this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null);
|
||||
+ return !me.earthme.luminol.config.modules.misc.RaidChangesConfig.self_check && (this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null)); // Leaves - Disable raid self check
|
||||
+ return !me.earthme.luminol.config.modules.misc.RaidChangesConfig.selfCheck && (this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null)); // Leaves - Disable raid self check
|
||||
}
|
||||
|
||||
public boolean hasActiveRaid() {
|
||||
@@ -22,7 +22,7 @@ index a814512fcfb85312474ae2c2c21443843bf57831..2e084a5b28cbe4737f48c25e10af5892
|
||||
public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite(
|
||||
final int chunkX, final int chunkZ, final CompoundTag compound
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
||||
index 98fbc5c8044bd945d64569f13412a6e7e49a4e7f..9709d60d3b2a5478cd6c711669e32f28ac105667 100644
|
||||
index b5c300f867f4f9670f51b6082982e9363e7a7326..8bafd7ac9706dbf6c43a136733a63ecc3ffb430d 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
||||
@@ -1260,7 +1260,7 @@ public final class MoonriseRegionFileIO {
|
||||
@@ -55,7 +55,7 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..c7d4d944eb198ac53a3eeae717a25c7d
|
||||
+ public void moonrise$write(final abomination.IRegionFile regionFile) throws IOException; // Luminol - Configurable region file format
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index f2124edb487b1d5f6bdc7fa086814f870724363a..ed00a29daccfee1d631bef27c0a3a4ae83140018 100644
|
||||
index 2f0a1810e3ab4ff4376e893af7ceb2bf5849ba76..27782d1096dc4c9c82c02c29e9b17e2bf8d3f4d3 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -986,10 +986,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add force the data command to be enabled config
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index 009e6405a11a391adca41a7c4ecafbf3254d799d..cfb37f2e428605965a37dc1eb83f302fe1bd6299 100644
|
||||
index 779dfa95d91ec4661227c94b012cb63953d4ba96..8f7b28e5688252207ad8ce9f3fb6f9c3b65d1adc 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -162,7 +162,9 @@ public class Commands {
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Mon, 27 Jan 2025 13:01:55 +0800
|
||||
Subject: [PATCH] Tick regions api
|
||||
Subject: [PATCH] Add tick regions api
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
@@ -17,7 +17,7 @@ index 8d67b4629c69d3039b199aaad45533d1acde114e..f7bfeca4b11b9860241d5eb80b6df420
|
||||
((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickServerLevel)(ServerLevel)chunk.getLevel()).moonrise$removeChunkForPlayerTicking(chunk); // Moonrise - chunk tick iteration
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 46375fa81b36b89b79c22f0a7ac6d610ab1183d4..f2124edb487b1d5f6bdc7fa086814f870724363a 100644
|
||||
index 27782d1096dc4c9c82c02c29e9b17e2bf8d3f4d3..56f5568848d0f20b4d706c07dc8114594e0b5337 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1665,7 +1665,44 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -66,7 +66,7 @@ index 46375fa81b36b89b79c22f0a7ac6d610ab1183d4..f2124edb487b1d5f6bdc7fa086814f87
|
||||
this.lastServerStatus = nanos;
|
||||
this.status = this.buildServerStatus();
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 375f4a59333ee1d75fb1acb8c2cbada7866bd48e..3abe2881e8a80bd6c128e96b976deebe3ada4678 100644
|
||||
index f4b738b05ec9488e20402efb6c935ff55d86adf2..a0a8b0c7d091f63f023f15a2620b03ae2126782e 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -766,6 +766,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -80,7 +80,7 @@ index 375f4a59333ee1d75fb1acb8c2cbada7866bd48e..3abe2881e8a80bd6c128e96b976deebe
|
||||
//Util.shutdownExecutors(); // Paper - Improved watchdog support; moved into super
|
||||
SkullBlockEntity.clear();
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index f2d2ddfd964bff914e41c0b4150fe1aad7866ebf..7defcd15c44601bfd2f7f55046038693264defee 100644
|
||||
index f884c707d4c1f36801018e15efb9adf91f5d6b33..210eba85ac1a50d993ef6e19b65b9f8afada00ba 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1339,6 +1339,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@@ -118,10 +118,10 @@ index f2d2ddfd964bff914e41c0b4150fe1aad7866ebf..7defcd15c44601bfd2f7f55046038693
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 42987d278bf4abbad9d63485a1050f4abc3e7367..3bc0fc1d411d3c5e206695510ec9288ffbf8c277 100644
|
||||
index 8a192bb24abca6d2ea90d70e12f14733658ed27b..6e3e872ba415e8e809cfbe5a4dc1441b39c45480 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -400,7 +400,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -393,7 +393,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
@@ -132,7 +132,7 @@ index 42987d278bf4abbad9d63485a1050f4abc3e7367..3bc0fc1d411d3c5e206695510ec9288f
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder();
|
||||
@@ -1013,8 +1015,35 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1006,8 +1008,35 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.trackEnteredOrExitedLavaOnVehicle();
|
||||
this.updatePlayerAttributes();
|
||||
this.advancements.flushDirty(this);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Correct player respawn place
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..b6df8df78105e08ca7be82524685d8b9422abf21 100644
|
||||
index 6e3e872ba415e8e809cfbe5a4dc1441b39c45480..40f3700c9bf56cfb26f0bca0dc6320fad8c75a65 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -472,8 +472,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -465,8 +465,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
double amountX = selectMaxX - selectMinX;
|
||||
double amountZ = selectMaxZ - selectMinZ;
|
||||
|
||||
@@ -21,7 +21,7 @@ index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..b6df8df78105e08ca7be82524685d8b9
|
||||
|
||||
return new BlockPos(selectX, 0, selectZ);
|
||||
}
|
||||
@@ -484,10 +486,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -477,10 +479,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
}
|
||||
|
||||
private static BlockPos findSpawnAround(ServerLevel world, ServerPlayer player, BlockPos selected) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Sat, 10 May 2025 19:46:16 +0800
|
||||
Subject: [PATCH] Fix creative item picking
|
||||
Subject: [PATCH] Fix creative player item pick
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 7587130e021d494ae5013f7992b8f3c96590cbd7..f6d537ce0549b3359462f238c39952fe855dfbc1 100644
|
||||
index 7587130e021d494ae5013f7992b8f3c96590cbd7..1116e2f00ea54f738535d7243fec6ad49b96f6ee 100644
|
||||
--- a/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -435,7 +435,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -13,8 +13,8 @@ index 7587130e021d494ae5013f7992b8f3c96590cbd7..f6d537ce0549b3359462f238c39952fe
|
||||
int count = item.getCount();
|
||||
// CraftBukkit start - fire PlayerPickupItemEvent
|
||||
- int canHold = entity.getInventory().canHold(item);
|
||||
+ int canHold;// = entity.getInventory().canHold(item); // Luminol - Fix creative item picking
|
||||
+ // Luminol start - Fix creative item picking
|
||||
+ int canHold;
|
||||
+ if (entity instanceof net.minecraft.server.level.ServerPlayer
|
||||
+ && ((net.minecraft.server.level.ServerPlayer) entity).gameMode.getGameModeForPlayer().equals(net.minecraft.world.level.GameType.CREATIVE)) {
|
||||
+ canHold = count;
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix incorrectly synced data after player teleportation
|
||||
Use vanilla's flag and logics to run some status sync after post teleportation, folia forgets send some packets after teleportation and which caused some desync between client and server
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index b6df8df78105e08ca7be82524685d8b9422abf21..10e3a54f3e7aa02a5c9986d3694c02bef07a66bf 100644
|
||||
index 40f3700c9bf56cfb26f0bca0dc6320fad8c75a65..b5d0eb5026067080a376b9c3f902dcdf40d5dc48 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1812,14 +1812,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1805,14 +1805,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.connection.send(new ClientboundChangeDifficultyPacket(
|
||||
worlddata.getDifficulty(), worlddata.isDifficultyLocked()
|
||||
));
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix uncorrected death check of folia
|
||||
In the new mc version, mojang changed some checks in A.C.M(AbstractContainerMenu) and there is a new death check of player which will be executed when player dead.But on folia, player entity cannot be discarded unless they disconnected from the server, so there is an obvious bug that when player dead, the logic depend on that dead check will not be executed correctly because the check logic is still asserting the player is alive by checking if the player is discarded, which caused some exploits can save items in the crafting slots(with InventoryTweaks turned on in meteor client) when keepInventory is set to false
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index acca8c51d2030c675c157b10d0bbc6af631afe61..d0b688e69979c5e7b8267ac96bd71bcd33444c41 100644
|
||||
index 50af953a4698a3c6e16b840fab764dd733b3fbc9..a9c058238819f3631d94ac306185e909821caf35 100644
|
||||
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -689,7 +689,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -679,7 +679,7 @@ public abstract class AbstractContainerMenu {
|
||||
}
|
||||
|
||||
private static void dropOrPlaceInInventory(Player player, ItemStack stack) {
|
||||
@@ -1,9 +1,13 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 11:03:09 +0800
|
||||
Subject: [PATCH] Merge Paper #11945 for temporary hopper behavior fix
|
||||
Subject: [PATCH] Paper: Hopper behavior fix
|
||||
|
||||
A hopper optimization fix on Paper's pr : https://github.com/PaperMC/Paper/pull/11945
|
||||
temporary fix
|
||||
Origin: https://github.com/PaperMC/Paper/pull/11945
|
||||
Co-authored by: Aikar <aikar@aikar.co>
|
||||
As part of: Paper (https://github.com/PaperMC/Paper/blob/d2d23118c151f11c00e42b5c60ab7e4a3a1be09c/paper-server/patches/features/0029-Optimize-Hoppers.patch)
|
||||
Licensed under: MIT (https://github.com/PaperMC/Paper/blob/fa360aa83657d15e8e803ce55800986f6bff8f70/licenses/MIT.md)
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index ae988c4910421fb720177178ef6136e595ae6946..72a81e29be6570fb119b159210453a86f003f893 100644
|
||||
@@ -1,11 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 8 Mar 2025 21:21:11 +0800
|
||||
Subject: [PATCH] Leaf Paper PR: Prevent zombie reinforcements loading chunks
|
||||
Subject: [PATCH] Paper: Prevent zombie reinforcements loading chunks
|
||||
|
||||
Origin: https://github.com/PaperMC/Paper/pull/11945
|
||||
Co-authored by: Newwind <support@newwindserver.com>
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0081-Paper-PR-Prevent-zombie-reinforcements-loading-chunk.patch)
|
||||
Original license: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
As part of: Paper (https://github.com/PaperMC/Paper/blob/2ae1f05336d0f13b646e6c284f83ded16aae84ff/patches/server/1045-Prevent-zombie-reinforcements-loading-chunks.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/PaperMC/Paper/blob/fa360aa83657d15e8e803ce55800986f6bff8f70/licenses/GPL.md)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index cf231380febd6d316eb902d43c636135ee0d7fa4..731473610e068a613d67efaee08ded810fe86cf0 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 11:03:59 +0800
|
||||
Subject: [PATCH] Kaiiju Don't pathfind outside region
|
||||
Subject: [PATCH] Kaiiju: Don't pathfind outside region
|
||||
|
||||
Co-authored by: Sofiane H. Djerbi <46628754+kugge@users.noreply.github.com>
|
||||
As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/patches/server/0028-Don-t-pathfind-outside-region.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
index 621ba76784f2b92790eca62be4d0688834335ab6..52b3f1795843f40fdb3298cfd1a570a211a08739 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 11:07:08 +0800
|
||||
Subject: [PATCH] Kaiiju Entity tick and removal limiter
|
||||
Subject: [PATCH] Kaiiju: Entity tick and removal limiter
|
||||
|
||||
Co-authored by: Xymb <xymb@endcrystal.me>
|
||||
As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/patches/server/0021-Entity-ticking-throttling-removal-to-prevent-lag.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index c6e487a4c14e6b82533881d01f32349b9ae28728..2c747cb8a724cd25c9d724908f92b320741600de 100644
|
||||
@@ -17,7 +20,7 @@ index c6e487a4c14e6b82533881d01f32349b9ae28728..2c747cb8a724cd25c9d724908f92b320
|
||||
// block ticking
|
||||
private final ObjectLinkedOpenHashSet<BlockEventData> blockEvents = new ObjectLinkedOpenHashSet<>();
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index 7defcd15c44601bfd2f7f55046038693264defee..5a87825606047f058df8de84bf933d216b5878b0 100644
|
||||
index 210eba85ac1a50d993ef6e19b65b9f8afada00ba..2763c3d87ef1f9fcbc01bdff7c0b266d46b8170a 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -808,6 +808,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 11:04:12 +0800
|
||||
Subject: [PATCH] Kaiiju Vanilla end portal teleportation
|
||||
Subject: [PATCH] Kaiiju: Vanilla end portal teleportation
|
||||
|
||||
Co-authored by: Sofiane H. Djerbi <46628754+kugge@users.noreply.github.com>
|
||||
As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/patches/server/0024-Vanilla-end-portal-teleportation.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 771744d4540fcd163efcde43c27111680b25c928..2efc715857d49f69a8289bcf50f422960c00c8bd 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 12:21:59 +0800
|
||||
Subject: [PATCH] Petal Reduce sensor work
|
||||
Subject: [PATCH] Petal: Reduce sensor work
|
||||
|
||||
Co-authored by: peaches94 <peachescu94@gmail.com>
|
||||
As part of: Petal (https://github.com/Bloom-host/Petal/blob/cc691540fb48240f38b376f3d94c8b0db2b60d99/patches/server/0005-feat-reduce-sensor-work.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/Bloom-host/Petal/blob/cc691540fb48240f38b376f3d94c8b0db2b60d99/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index 94a7b95f41c2954561f9c3cb0f61210c0c058f1d..dbe0fc0c46f66c61a2f286d521302719b28917c1 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Thu, 20 Feb 2025 01:00:28 +0800
|
||||
Subject: [PATCH] Purpur-Barrels-and-enderchests-6-rows
|
||||
Subject: [PATCH] Purpur: Barrels and enderchests 6 rows
|
||||
|
||||
Co-authored by: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch)
|
||||
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 751b011701d6ae373099226ea63ffbafcd24ce6a..e5e946462da9e56344428139768075b7bd228ec0 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Thu, 30 Jan 2025 08:42:29 +0800
|
||||
Subject: [PATCH] Purpur Lobotomize stuck villagers
|
||||
Subject: [PATCH] Purpur: Lobotomize stuck villagers
|
||||
|
||||
Co-authored by: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/features/0001-Ridables.patch)
|
||||
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
||||
index 7ea74aeb905b95e5919d74df5fbc5e8f7a9985e3..b61da3d0d7d24b674cae155b95f7fab0669f4a20 100644
|
||||
@@ -1,8 +1,10 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 11:43:15 +0800
|
||||
Subject: [PATCH] Purpur Use alternative keep alive
|
||||
Subject: [PATCH] Purpur: Use alternative keep alive
|
||||
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch)
|
||||
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 79fe336adf35f4f007461ed050e6301764fe7fc3..a5b805b98cf138eabfb06f4ff202462be60c2995 100644
|
||||
@@ -1,159 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 14:15:24 +0800
|
||||
Subject: [PATCH] Gale Use platform math functions
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Use Math.floor instead of fastfloor"
|
||||
By: Xymb <xymb@endcrystal.me>
|
||||
As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
* Comparison of floor methods used in Paper *
|
||||
|
||||
Measure shown is floored number of milliseconds
|
||||
(nanoseconds integer-divided by 1_000_000
|
||||
taken to get the floor of 1000 randomly chosen doubles
|
||||
(all in the range of [-Integer.MAX_VALUE + 10, Integer.MAX_VALUE - 10])
|
||||
100_000 times (making it 100_000_000 floor operations total)
|
||||
and adding it to a total.
|
||||
|
||||
We are testing the following methods:
|
||||
* net.minecraft.util.Mth.floor
|
||||
* java.lang.Math.floor
|
||||
* java.lang.StrictMath.floor
|
||||
* org.apache.commons.math3.util.FastMath.floor
|
||||
* org.apache.commons.math3.util.FastMath.floor, but with a hot start (see comment in code)
|
||||
* io.papermc.paper.util.MCUtil.fastFloor
|
||||
|
||||
The tests performed clearly show that Math.floor is the fastest.
|
||||
This is most likely due to java.lang.Math's usage of the @IntrinsicCandidate
|
||||
annotation, which allows the JVM to use a more optimized implementation at runtime.
|
||||
However, in the case that there is no intrinsic replacement for Math.floor,
|
||||
it defers to StrictMath.floor, which relies on a number of native methods, and is
|
||||
still much faster than the existing Minecraft utility functions.
|
||||
Therefore, using Math.floor instead of these functions is better regardless.
|
||||
In Apache Commons Math 4, FastMath.floor has also been removed in favor of Math.floor.
|
||||
|
||||
The versions used:
|
||||
* Windows 10 Home 21H2 19044.3086
|
||||
* OpenJDK Runtime Environment Temurin-19.0.2+7 (build 19.0.2+7)
|
||||
* Paper a3c760e6af1e8c7244ef75c6da6e6df278a79e14 on Minecraft 1.20.1
|
||||
* Apache Commons Math 3.6.1
|
||||
|
||||
Results:
|
||||
Total is of type int Total is of type double
|
||||
----------------------------------------------------------------------------------
|
||||
Mth.floor 2113 (double) Mth.floor 2658
|
||||
(int) Math.floor 130 Math.floor 194
|
||||
(int) StrictMath.floor 835 StrictMath.floor 381
|
||||
(int) FastMath.floor 412 FastMath.floor 376
|
||||
(int) FastMath.floor with hot start 359 FastMath.floor with hot start 321
|
||||
MCUtil.fastFloor 2284 (double) MCUtil.fastFloor 2469
|
||||
|
||||
Code is below:
|
||||
```java
|
||||
package somepackage;
|
||||
|
||||
import io.papermc.paper.util.MCUtil;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// IF FastMath.floor with a hot start:
|
||||
// FastMath.floor(37485.5);
|
||||
|
||||
var random = new Random(4889338);
|
||||
int size = 1000;
|
||||
var values = new double[size];
|
||||
double bound = Integer.MAX_VALUE - 10;
|
||||
for (int i = 0; i < size; i++) {
|
||||
values[i] = random.nextDouble(bound * 2) - bound;
|
||||
}
|
||||
int repeats = 100_000;
|
||||
|
||||
// int total = 0;
|
||||
// OR
|
||||
// double total = 0;
|
||||
|
||||
long start = System.nanoTime();
|
||||
for (int repeat = 0; repeat < repeats; repeat++) {
|
||||
for (int index = 0; index < size; index++) {
|
||||
total += insert_function_being_tested_here(values[index]);
|
||||
}
|
||||
}
|
||||
long diff = System.nanoTime() - start;
|
||||
System.out.println(total);
|
||||
System.out.println(diff / 1_000_000L);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java
|
||||
index d5d8134da9423cec199cf44762460104677194d6..e0eed27cb33348fcb46858c40014b5fe5dbaf426 100644
|
||||
--- a/net/minecraft/util/Mth.java
|
||||
+++ b/net/minecraft/util/Mth.java
|
||||
@@ -58,18 +58,15 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static int floor(float value) {
|
||||
- int i = (int)value;
|
||||
- return value < i ? i - 1 : i;
|
||||
+ return (int) Math.floor(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int floor(double value) {
|
||||
- int i = (int)value;
|
||||
- return value < i ? i - 1 : i;
|
||||
+ return (int) Math.floor(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static long lfloor(double value) {
|
||||
- long l = (long)value;
|
||||
- return value < l ? l - 1L : l;
|
||||
+ return (long) Math.floor(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static float abs(float value) {
|
||||
@@ -81,13 +78,11 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static int ceil(float value) {
|
||||
- int i = (int)value;
|
||||
- return value > i ? i + 1 : i;
|
||||
+ return (int) Math.ceil(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int ceil(double value) {
|
||||
- int i = (int)value;
|
||||
- return value > i ? i + 1 : i;
|
||||
+ return (int) Math.ceil(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int clamp(int value, int min, int max) {
|
||||
@@ -123,15 +118,7 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static double absMax(double x, double y) {
|
||||
- if (x < 0.0) {
|
||||
- x = -x;
|
||||
- }
|
||||
-
|
||||
- if (y < 0.0) {
|
||||
- y = -y;
|
||||
- }
|
||||
-
|
||||
- return Math.max(x, y);
|
||||
+ return Math.max(Math.abs(x), Math.abs(y)); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int floorDiv(int dividend, int divisor) {
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 12:25:44 +0800
|
||||
Subject: [PATCH] Pufferfish Cache climbing check for activation
|
||||
Subject: [PATCH] Pufferfish: Cache climbing check for activation
|
||||
|
||||
Co-authored by: Paul Sauve <paul@technove.co>
|
||||
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish/blob/04bc249f9eee6157338b6884113b6fa3192bf59b/patches/server/0017-Cache-climbing-check-for-activation.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/pufferfish-gg/Pufferfish/blob/04bc249f9eee6157338b6884113b6fa3192bf59b/PATCH-LICENSE)
|
||||
|
||||
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
index c260741a87513b89a5cc62c543fb9f990f86491e..beb9b3b3cd5ca60bd2cdada937bff8a1da639da5 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 12:27:17 +0800
|
||||
Subject: [PATCH] Pufferfish Reduce chunk loading & lookups
|
||||
Subject: [PATCH] Pufferfish: Reduce chunk loading & lookups
|
||||
|
||||
Co-authored by: Paul Sauve <paul@technove.co>
|
||||
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish/blob/04bc249f9eee6157338b6884113b6fa3192bf59b/patches/server/0014-Reduce-chunk-loading-lookups.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/pufferfish-gg/Pufferfish/blob/04bc249f9eee6157338b6884113b6fa3192bf59b/PATCH-LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 4b5ffd278e0e9d47100e5452949e8d757bbfece4..772ccc4dc66253a84a6d24d00e271d9b4916f052 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 22 Jan 2025 17:23:16 +0800
|
||||
Subject: [PATCH] Gale Optimize noise generation
|
||||
Subject: [PATCH] Gale: Optimize noise generation
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, ishland <ishlandmc@yeah.net>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0106-Optimize-noise-generation.patch) and C2ME (https://github.com/RelativityMC/C2ME-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
index fb11a2eea540d55e50eab59f9857ca5d99f556f8..dcc1a3f8b611c9f103b848db90b077b984b60ada 100644
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 22 Jan 2025 17:18:00 +0800
|
||||
Subject: [PATCH] Gale Replace AI attributes with optimized collections
|
||||
Subject: [PATCH] Gale: Replace AI attributes with optimized collections
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, 2No2Name <2No2Name@web.de>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0087-Replace-AI-attributes-with-optimized-collections.patch) and Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index 4c808c7ef336de74048f40bd1cc8b14131a9325d..8dfd32a8ec590c688dc8d64f18b6b59378c17880 100644
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 15:35:15 +0800
|
||||
Subject: [PATCH] Gale Skip entity move if movement is zero
|
||||
Subject: [PATCH] Gale: Skip entity move if movement is zero
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, ishland <ishlandmc@yeah.net>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0103-Skip-entity-move-if-movement-is-zero.patch) and VMP (https://github.com/RelativityMC/VMP-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 2efc715857d49f69a8289bcf50f422960c00c8bd..18e6e9fe39a559ae043fdafcf4e4db467144e309 100644
|
||||
@@ -1,216 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bacteriawa <A3167717663@hotmail.com>
|
||||
Date: Wed, 30 Nov 2022 21:51:16 +0100
|
||||
Subject: [PATCH] Gale Faster chunk serialization
|
||||
|
||||
|
||||
diff --git a/net/minecraft/util/BitStorage.java b/net/minecraft/util/BitStorage.java
|
||||
index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..322a1ba06d6aed44ec67dc3f1831ac6b05c82fe0 100644
|
||||
--- a/net/minecraft/util/BitStorage.java
|
||||
+++ b/net/minecraft/util/BitStorage.java
|
||||
@@ -21,6 +21,8 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti
|
||||
|
||||
BitStorage copy();
|
||||
|
||||
+ <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out); // Gale - Lithium - faster chunk serialization
|
||||
+
|
||||
// Paper start - block counting
|
||||
// provide default impl in case mods implement this...
|
||||
@Override
|
||||
diff --git a/net/minecraft/util/SimpleBitStorage.java b/net/minecraft/util/SimpleBitStorage.java
|
||||
index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..2a3d34733b61c73729daa4da61f33e2c2e7b6c72 100644
|
||||
--- a/net/minecraft/util/SimpleBitStorage.java
|
||||
+++ b/net/minecraft/util/SimpleBitStorage.java
|
||||
@@ -465,4 +465,36 @@ public class SimpleBitStorage implements BitStorage {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ @Override
|
||||
+ public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {
|
||||
+ if (this.size >= Short.MAX_VALUE) throw new IllegalStateException("Array too large");
|
||||
+ if (this.size != out.length) throw new IllegalStateException("Array size mismatch");
|
||||
+
|
||||
+ short[] mappings = new short[(int) (this.mask + 1)];
|
||||
+
|
||||
+ int idx = 0;
|
||||
+
|
||||
+ for (long word : this.data) {
|
||||
+ long bits = word;
|
||||
+
|
||||
+ for (int elementIdx = 0; elementIdx < this.valuesPerLong; ++elementIdx) {
|
||||
+ int value = (int) (bits & this.mask);
|
||||
+ int remappedId = mappings[value];
|
||||
+
|
||||
+ if (remappedId == 0) {
|
||||
+ remappedId = dstPalette.idFor(srcPalette.valueFor(value)) + 1;
|
||||
+ mappings[value] = (short) remappedId;
|
||||
+ }
|
||||
+
|
||||
+ out[idx] = (short) (remappedId - 1);
|
||||
+ bits >>= this.bits;
|
||||
+
|
||||
+ ++idx;
|
||||
+
|
||||
+ if (idx >= this.size) return;
|
||||
+ }
|
||||
+ }
|
||||
+ } // Gale end - Lithium - faster chunk serialization
|
||||
}
|
||||
diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java
|
||||
index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..90a85a00c6208d2db65cafb164cd95e6128b6dc4 100644
|
||||
--- a/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -19,6 +19,8 @@ public class ZeroBitStorage implements BitStorage {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ @Override public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {} // Gale - Lithium - faster chunk serialization
|
||||
+
|
||||
@Override
|
||||
public final void set(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
|
||||
//Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
|
||||
diff --git a/net/minecraft/world/level/chunk/PaletteResize.java b/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
index c723606fa0be811e580ba47de8c9c575583cc930..60d3176477c201643e1657751fcffad511b2994f 100644
|
||||
--- a/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
+++ b/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
@@ -1,5 +1,5 @@
|
||||
package net.minecraft.world.level.chunk;
|
||||
|
||||
-interface PaletteResize<T> {
|
||||
+public interface PaletteResize<T> { // Gale - Lithium - faster chunk serialization - package -> public
|
||||
int onResize(int bits, T objectAdded);
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index f5da433050fd3060e0335d4002d520ebe8cd691f..5a6e699df0a177ea6a919cad609a508678bff823 100644
|
||||
--- a/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -25,6 +25,21 @@ import net.minecraft.util.ThreadingDetector;
|
||||
import net.minecraft.util.ZeroBitStorage;
|
||||
|
||||
public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainerRO<T> {
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]);
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]);
|
||||
+ private Optional<LongStream> asOptional(long[] data) {
|
||||
+ return Optional.of(Arrays.stream(data));
|
||||
+ }
|
||||
+ private short[] getOrCreate(int size) {
|
||||
+ return switch (size) {
|
||||
+ case 64 -> CACHED_ARRAY_64.get();
|
||||
+ case 4096 -> CACHED_ARRAY_4096.get();
|
||||
+ default -> new short[size];
|
||||
+ };
|
||||
+ }
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
+
|
||||
private static final int MIN_PALETTE_BITS = 0;
|
||||
private final PaletteResize<T> dummyPaletteResize = (bits, objectAdded) -> 0;
|
||||
public final IdMap<T> registry;
|
||||
@@ -344,28 +359,53 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> registry, PalettedContainer.Strategy strategy) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
- PalettedContainerRO.PackedData var12;
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ Optional<LongStream> data = Optional.empty();
|
||||
+ List<T> elements = null;
|
||||
try {
|
||||
- HashMapPalette<T> hashMapPalette = new HashMapPalette<>(registry, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
- int size = strategy.size();
|
||||
- int[] ints = new int[size];
|
||||
- this.data.storage.unpack(ints);
|
||||
- swapPalette(ints, id -> hashMapPalette.idFor(this.data.palette.valueFor(id)));
|
||||
- int i = strategy.calculateBitsForSerialization(registry, hashMapPalette.getSize());
|
||||
- Optional<LongStream> optional;
|
||||
- if (i != 0) {
|
||||
- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(i, size, ints);
|
||||
- optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw()));
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
+ // The palette that will be serialized
|
||||
+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> hashPalette = null;
|
||||
+
|
||||
+ final Palette<T> palette = this.data.palette();
|
||||
+ final BitStorage storage = this.data.storage();
|
||||
+ if (storage instanceof ZeroBitStorage || palette.getSize() == 1) {
|
||||
+ // If the palette only contains one entry, don't attempt to repack it.
|
||||
+ elements = List.of(palette.valueFor(0));
|
||||
+ } else if (palette instanceof net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
|
||||
+ hashPalette = lithiumHashPalette;
|
||||
}
|
||||
|
||||
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
|
||||
+ if (elements == null) {
|
||||
+ var compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize);
|
||||
+ short[] array = this.getOrCreate(strategy.size());
|
||||
+
|
||||
+ storage.compact(this.data.palette(), compactedPalette, array);
|
||||
+
|
||||
+ // If the palette didn't change during compaction, do a simple copy of the data array
|
||||
+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.calculateBitsForSerialization(registry, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279
|
||||
+ data = this.asOptional(storage.getRaw().clone());
|
||||
+ elements = hashPalette.getElements();
|
||||
+ } else {
|
||||
+ int bits = strategy.calculateBitsForSerialization(registry, compactedPalette.getSize());
|
||||
+ if (bits != 0) {
|
||||
+ // Re-pack the integer array as the palette has changed size
|
||||
+ SimpleBitStorage copy = new SimpleBitStorage(bits, array.length);
|
||||
+ for (int i = 0; i < array.length; ++i)
|
||||
+ copy.set(i, array[i]);
|
||||
+
|
||||
+ // We don't need to clone the data array as we are the sole owner of it
|
||||
+ data = this.asOptional(copy.getRaw());
|
||||
+ }
|
||||
+
|
||||
+ elements = compactedPalette.getElements();
|
||||
+ }
|
||||
+ }
|
||||
} finally {
|
||||
this.release();
|
||||
}
|
||||
|
||||
- return var12;
|
||||
+ return new PalettedContainerRO.PackedData<>(elements, data);
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
}
|
||||
|
||||
private static <T> void swapPalette(int[] bits, IntUnaryOperator operator) {
|
||||
@@ -405,13 +445,30 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> countConsumer) {
|
||||
- if (this.data.palette.getSize() == 1) {
|
||||
- countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
- } else {
|
||||
- Int2IntOpenHashMap map = new Int2IntOpenHashMap();
|
||||
- this.data.storage.getAll(id -> map.addTo(id, 1));
|
||||
- map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue()));
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ int len = this.data.palette().getSize();
|
||||
+
|
||||
+ // Do not allocate huge arrays if we're using a large palette
|
||||
+ if (len > 4096) {
|
||||
+ // VanillaCopy
|
||||
+ if (this.data.palette.getSize() == 1) {
|
||||
+ countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
+ } else {
|
||||
+ Int2IntOpenHashMap map = new Int2IntOpenHashMap();
|
||||
+ this.data.storage.getAll(id -> map.addTo(id, 1));
|
||||
+ map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue()));
|
||||
+ }
|
||||
+ }
|
||||
+ short[] counts = new short[len];
|
||||
+ this.data.storage().getAll(i -> counts[i]++);
|
||||
+
|
||||
+ for (int i = 0; i < counts.length; i++) {
|
||||
+ T obj = this.data.palette().valueFor(i);
|
||||
+
|
||||
+ if (obj != null)
|
||||
+ countConsumer.accept(obj, counts[i]);
|
||||
}
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
}
|
||||
|
||||
record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 14:15:24 +0800
|
||||
Subject: [PATCH] Gale: Use platform math functions
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, Xymb <xymb@endcrystal.me>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0019-Use-platform-math-functions.patch) and Kaiiju(https://github.com/KaiijuMC/Kaiiju)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java
|
||||
index d5d8134da9423cec199cf44762460104677194d6..e0eed27cb33348fcb46858c40014b5fe5dbaf426 100644
|
||||
--- a/net/minecraft/util/Mth.java
|
||||
+++ b/net/minecraft/util/Mth.java
|
||||
@@ -58,18 +58,15 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static int floor(float value) {
|
||||
- int i = (int)value;
|
||||
- return value < i ? i - 1 : i;
|
||||
+ return (int) Math.floor(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int floor(double value) {
|
||||
- int i = (int)value;
|
||||
- return value < i ? i - 1 : i;
|
||||
+ return (int) Math.floor(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static long lfloor(double value) {
|
||||
- long l = (long)value;
|
||||
- return value < l ? l - 1L : l;
|
||||
+ return (long) Math.floor(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static float abs(float value) {
|
||||
@@ -81,13 +78,11 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static int ceil(float value) {
|
||||
- int i = (int)value;
|
||||
- return value > i ? i + 1 : i;
|
||||
+ return (int) Math.ceil(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int ceil(double value) {
|
||||
- int i = (int)value;
|
||||
- return value > i ? i + 1 : i;
|
||||
+ return (int) Math.ceil(value); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int clamp(int value, int min, int max) {
|
||||
@@ -123,15 +118,7 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static double absMax(double x, double y) {
|
||||
- if (x < 0.0) {
|
||||
- x = -x;
|
||||
- }
|
||||
-
|
||||
- if (y < 0.0) {
|
||||
- y = -y;
|
||||
- }
|
||||
-
|
||||
- return Math.max(x, y);
|
||||
+ return Math.max(Math.abs(x), Math.abs(y)); // Gale - use platform math functions
|
||||
}
|
||||
|
||||
public static int floorDiv(int dividend, int divisor) {
|
||||
@@ -1,8 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 15:31:52 +0800
|
||||
Subject: [PATCH] Gale Variable entity wake-up duration
|
||||
Subject: [PATCH] Gale: Variable entity wake-up duration
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0054-Variable-entity-wake-up-duration.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
index beb9b3b3cd5ca60bd2cdada937bff8a1da639da5..3c9fc433155dd235668ded700d51d95434ba745f 100644
|
||||
@@ -1,8 +1,10 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 15:35:43 +0800
|
||||
Subject: [PATCH] SparklyPaper Optimize canSee checks
|
||||
Subject: [PATCH] SparklyPaper: Optimize canSee checks
|
||||
|
||||
Co-authored by: MrPowerGamerBR <git@mrpowergamerbr.com>
|
||||
As part of: SparklyPaper (https://github.com/SparklyPower/SparklyPaper/blob/a69d3690472c9967772ffd4d4bd1f41403b7ea6f/sparklypaper-server/paper-patches/features/0005-Optimize-canSee-checks.patch)
|
||||
|
||||
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
|
||||
index 5c507be097051de9a43a31bbc6190c3db7688667..7eff847790394aecd058e7a61905da86163b4c6e 100644
|
||||
@@ -1,9 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 15:37:25 +0800
|
||||
Subject: [PATCH] SparklyPaper Skip "distanceToSqr" call in
|
||||
Subject: [PATCH] SparklyPaper: Skip "distanceToSqr" call in
|
||||
"ServerEntity#sendChanges" if the delta movement hasn't changed
|
||||
|
||||
Co-authored by: MrPowerGamerBR <git@mrpowergamerbr.com>
|
||||
As part of: SparklyPaper (https://github.com/SparklyPower/SparklyPaper/blob/a69d3690472c9967772ffd4d4bd1f41403b7ea6f/sparklypaper-server/minecraft-patches/features/0002-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch)
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
|
||||
index 0fb253aa55a24b56b17f524b3261c5b75c7d7e59..1de43a4969a2a4535239b15a7bc30d99eb6934c6 100644
|
||||
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 8 Mar 2025 21:20:11 +0800
|
||||
Subject: [PATCH] Leaf Replace brain maps with optimized collection
|
||||
Subject: [PATCH] Leaf: Replace brain maps with optimized collection
|
||||
|
||||
Co-authored by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0070-Replace-brain-maps-with-optimized-collection.patch)
|
||||
Licensed under: MIT
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/leaf-server/minecraft-patches/features/0070-Replace-brain-maps-with-optimized-collection.patch)
|
||||
Licensed under: MIT (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/MIT.txt)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
|
||||
index 52b08be8b37117edc38dddf6d1919178b1f86271..d98eae5ee8a69a89e37751594dfff636831c8016 100644
|
||||
@@ -1,12 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 8 Mar 2025 21:14:53 +0800
|
||||
Subject: [PATCH] Leaf Remove useless creating stats json bases on player name
|
||||
Subject: [PATCH] Leaf: Remove useless creating stats json bases on player name
|
||||
logic
|
||||
|
||||
Co-authored by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0043-Remove-useless-creating-stats-json-bases-on-player-n.patch)
|
||||
Licensed under: MIT
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/leaf-server/minecraft-patches/features/0043-Remove-useless-creating-stats-json-bases-on-player-n.patch)
|
||||
Licensed under: MIT (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/MIT.txt)
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index e5e946462da9e56344428139768075b7bd228ec0..9777a5b7ba9916e426ba87d6ee7cd56f0e43c195 100644
|
||||
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Tue, 28 Jan 2025 18:56:53 +0800
|
||||
Subject: [PATCH] Leaf Secure seed and matter seed command
|
||||
Subject: [PATCH] Leaf: Secure seed and matter seed command
|
||||
|
||||
Co-authored by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0049-Matter-Secure-Seed.patch and https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0050-Matter-Secure-Seed-command.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Co-authored by: Apehum <apehumchik@gmail.com>
|
||||
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/leaf-server/paper-patches/features/0019-Matter-Secure-Seed.patch and https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/leaf-server/minecraft-patches/features/0050-Matter-Secure-Seed-command.patch)
|
||||
Licensed under: GPL-3.0 (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/GPL-3.0.txt)
|
||||
|
||||
diff --git a/net/minecraft/server/commands/SeedCommand.java b/net/minecraft/server/commands/SeedCommand.java
|
||||
index a65affc41a4fc299bc2281f0f53f2e075633899d..f071e469468b768bd9c063d78c222b1b3e3b13bd 100644
|
||||
@@ -65,7 +65,7 @@ index ac06b8a4813716a8d136be5731cbd96113976a7e..82d95005fc67336458b50c47d44ec404
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index 5a87825606047f058df8de84bf933d216b5878b0..d8e1febfa14be1c0f4869ae647bd17113660432b 100644
|
||||
index 2763c3d87ef1f9fcbc01bdff7c0b266d46b8170a..0cec31be4733ad330b09e3d2e81c696c396cac3c 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -620,6 +620,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add missing teleportation apis for folia
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 10e3a54f3e7aa02a5c9986d3694c02bef07a66bf..ca67950e35c7f420846337e885d95b8eabca3f37 100644
|
||||
index b5d0eb5026067080a376b9c3f902dcdf40d5dc48..62634b5c29a3333fd8f39927f4d0a3258835c891 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1673,6 +1673,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1666,6 +1666,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
if (respawnComplete != null) {
|
||||
respawnComplete.accept(ServerPlayer.this);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Portal Behavior Modifiers
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index d8e1febfa14be1c0f4869ae647bd17113660432b..9b8325a55889155766e034ff8847751ac551b2d2 100644
|
||||
index 0cec31be4733ad330b09e3d2e81c696c396cac3c..de3042c1cad21c55b19ed12da0f4cbd99068540f 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1353,7 +1353,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: adabugra <57899270+adabugra@users.noreply.github.com>
|
||||
Date: Fri, 31 Jan 2025 19:17:01 +0300
|
||||
Subject: [PATCH] Leaves Disable moved wrongly threshold
|
||||
Subject: [PATCH] Leaves: Disable moved wrongly threshold
|
||||
|
||||
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/patches/removed/server/0099-Disable-moved-wrongly-threshold.patch)
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/f553c53e4230aa032e54a69b6479f1959ed24a60/patches/removed/server/0099-Disable-moved-wrongly-threshold.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index a107d9ee24d0e39ce3e3e09bf27af1ea4ae35b96..225045400f152a9a8f030d6fe367764b00d99b24 100644
|
||||
index da45200818ef4f495c90517c234a41725f709b85..bf617d2ca5e66bbcd244e4f290a7b101a967d18b 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -581,7 +581,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -29,7 +29,7 @@ index a107d9ee24d0e39ce3e3e09bf27af1ea4ae35b96..225045400f152a9a8f030d6fe367764b
|
||||
flag2 = true; // Paper - diff on change, this should be moved wrongly
|
||||
LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7));
|
||||
}
|
||||
@@ -1437,7 +1437,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -1438,7 +1438,7 @@ public class ServerGamePacketListenerImpl
|
||||
|
||||
if (this.shouldCheckPlayerMovement(isFallFlying)) {
|
||||
float f2 = isFallFlying ? 300.0F : 100.0F;
|
||||
@@ -38,7 +38,7 @@ index a107d9ee24d0e39ce3e3e09bf27af1ea4ae35b96..225045400f152a9a8f030d6fe367764b
|
||||
// CraftBukkit end
|
||||
// Paper start - Add fail move event
|
||||
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY,
|
||||
@@ -1509,7 +1509,8 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -1510,7 +1510,8 @@ public class ServerGamePacketListenerImpl
|
||||
d5 = d2 - this.player.getZ();
|
||||
d7 = d3 * d3 + d4 * d4 + d5 * d5;
|
||||
boolean movedWrongly = false; // Paper - Add fail move event; rename
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sat, 8 Feb 2025 14:25:16 +0800
|
||||
Subject: [PATCH] Leaves Fix Incorrect Collision Behavior for Block Shape
|
||||
Subject: [PATCH] Leaves: Fix Incorrect Collision Behavior for Block Shape
|
||||
|
||||
Co-authored by: Fortern <blueten.ki@gmail.com>
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-server/minecraft-patches/features/0110-Fix-Incorrect-Collision-Behavior-for-Block-Shape.patch)
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/f553c53e4230aa032e54a69b6479f1959ed24a60/leaves-server/minecraft-patches/features/0110-Fix-Incorrect-Collision-Behavior-for-Block-Shape.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sun, 6 Apr 2025 10:42:45 +0800
|
||||
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Mon, 28 Apr 2025 22:51:32 +0800
|
||||
Subject: [PATCH] Leaves: Fix SculkCatalyst exp skip
|
||||
|
||||
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-server/paper-patches/features/0016-Fix-SculkCatalyst-exp-skip.patch)
|
||||
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/f553c53e4230aa032e54a69b6479f1959ed24a60/leaves-server/paper-patches/features/0016-Fix-SculkCatalyst-exp-skip.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index ca67950e35c7f420846337e885d95b8eabca3f37..d9ea3db817878ff56a2772ce983ff95431e1326c 100644
|
||||
index 62634b5c29a3333fd8f39927f4d0a3258835c891..74e5fc8686042525dd79d773832ec0a88a135293 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1358,7 +1358,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1351,7 +1351,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
}
|
||||
|
||||
// SPIGOT-5478 must be called manually now
|
||||
@@ -20,7 +20,7 @@ index ca67950e35c7f420846337e885d95b8eabca3f37..d9ea3db817878ff56a2772ce983ff954
|
||||
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
||||
if (!event.getKeepInventory()) {
|
||||
// Paper start - PlayerDeathEvent#getItemsToKeep
|
||||
@@ -1392,6 +1392,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1385,6 +1385,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.setClientLoaded(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add config to enable Cross Region Damage trace
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index d9ea3db817878ff56a2772ce983ff95431e1326c..fd4e37719baced819100f7ad2d1cf0350950cb60 100644
|
||||
index 74e5fc8686042525dd79d773832ec0a88a135293..221efd21385edb6656b37f7fb672539e92790805 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1378,6 +1378,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1371,6 +1371,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.awardStat(Stats.ENTITY_KILLED_BY.get(killCredit.getType()));
|
||||
killCredit.awardKillScore(this, cause);
|
||||
this.createWitherRose(killCredit);
|
||||
@@ -22,7 +22,7 @@ index d9ea3db817878ff56a2772ce983ff95431e1326c..fd4e37719baced819100f7ad2d1cf035
|
||||
}
|
||||
|
||||
this.level().broadcastEntityEvent(this, (byte)3);
|
||||
@@ -1392,6 +1399,24 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1385,6 +1392,24 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.setClientLoaded(false);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 5 Feb 2025 15:22:19 +0800
|
||||
Subject: [PATCH] Add config to enable Raytracing tracker
|
||||
|
||||
Based on the framework of EntityCulling(((((((
|
||||
|
||||
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
|
||||
index 7eff847790394aecd058e7a61905da86163b4c6e..9099457f55a2829297ac1db8a69a98ff717d9a86 100644
|
||||
@@ -22,10 +22,10 @@ index de8b9048c8395c05b8688bc9d984b8ad680f15b3..f42692cd4f0154705c3d5b030d281cfc
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc5e869da3 100644
|
||||
index f7ceb89d9b908f02fc9e90e426e8e14e330ac041..b6e451c8a41a1d25bac679d18156d6e813efda2a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2401,6 +2401,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2400,6 +2400,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
handle.expToDrop = data.getInt("expToDrop");
|
||||
handle.keepLevel = data.getBoolean("keepLevel");
|
||||
}
|
||||
@@ -41,7 +41,7 @@ index ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2422,6 +2431,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2421,6 +2430,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
data.putLong("lastPlayed", System.currentTimeMillis());
|
||||
data.putString("lastKnownName", handle.getScoreboardName());
|
||||
|
||||
@@ -57,11 +57,10 @@ index ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc
|
||||
// Paper start - persist for use in offline save data
|
||||
if (!nbttagcompound.contains("Paper")) {
|
||||
nbttagcompound.put("Paper", new CompoundTag());
|
||||
@@ -3631,4 +3649,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setSimplifyContainerDesyncCheck(final boolean simplifyContainerDesyncCheck) {
|
||||
this.simplifyContainerDesyncCheck = simplifyContainerDesyncCheck;
|
||||
@@ -3614,4 +3632,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setDeathScreenScore(final int score) {
|
||||
getHandle().setScore(score);
|
||||
}
|
||||
+
|
||||
+ // KioCG start - ChunkHot
|
||||
+ @Override
|
||||
+ public long getNearbyChunkHot() {
|
||||
|
||||
@@ -18,10 +18,10 @@ index a0b84535a9d3833d4df692b85b272f145559dd80..c2ba46408b5ad727d7a17f21d47b2898
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ae7ee8c67a71b0bc319d8079094b1806fc3e305a..07e59bbfa94103d610ec63e695e51a961cd6eec5 100644
|
||||
index a60e6ed437764ebeaab64e9ae7b87a177119e436..7ffdc9a50c41adcac5d2b8ac84036aacc789ece6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -314,7 +314,7 @@ public final class CraftServer implements Server {
|
||||
@@ -315,7 +315,7 @@ public final class CraftServer implements Server {
|
||||
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
||||
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
|
||||
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
|
||||
@@ -30,7 +30,7 @@ index ae7ee8c67a71b0bc319d8079094b1806fc3e305a..07e59bbfa94103d610ec63e695e51a96
|
||||
|
||||
// Paper start - Folia region threading API
|
||||
private final io.papermc.paper.threadedregions.scheduler.FoliaRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaRegionScheduler(); // Folia - region threading
|
||||
@@ -492,7 +492,7 @@ public final class CraftServer implements Server {
|
||||
@@ -493,7 +493,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
@@ -39,7 +39,7 @@ index ae7ee8c67a71b0bc319d8079094b1806fc3e305a..07e59bbfa94103d610ec63e695e51a96
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1156,7 +1156,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1157,7 +1157,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
@@ -48,7 +48,7 @@ index ae7ee8c67a71b0bc319d8079094b1806fc3e305a..07e59bbfa94103d610ec63e695e51a96
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -1185,7 +1185,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1186,7 +1186,7 @@ public final class CraftServer implements Server {
|
||||
this.loadPlugins();
|
||||
this.enablePlugins(PluginLoadOrder.STARTUP);
|
||||
this.enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] SparklyPaper Optimize canSee checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index af20bc3b9cfb056beca0a341e209a4cc5e869da3..91dd18a874ea83bed83983ecfa52decce2b163a5 100644
|
||||
index b6e451c8a41a1d25bac679d18156d6e813efda2a..48c85729a6de20b554325ca29c2448d515bbc7a7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -210,7 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -17,7 +17,7 @@ index af20bc3b9cfb056beca0a341e209a4cc5e869da3..91dd18a874ea83bed83983ecfa52decc
|
||||
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
|
||||
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
|
||||
private int hash = 0;
|
||||
@@ -2265,9 +2265,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2264,9 +2264,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
|
||||
@@ -23,10 +23,10 @@ index f42692cd4f0154705c3d5b030d281cfc333803ed..39cc976f65f826a00e2e637c139f9134
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 07e59bbfa94103d610ec63e695e51a961cd6eec5..9c7a5d0a94417a65788330b7239aa746006407fa 100644
|
||||
index 7ffdc9a50c41adcac5d2b8ac84036aacc789ece6..292f32c935767b54098290eea8a512b82f962caf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1423,7 +1423,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1424,7 +1424,11 @@ public final class CraftServer implements Server {
|
||||
registryAccess = levelDataAndDimensions.dimensions().dimensionsRegistryAccess();
|
||||
} else {
|
||||
LevelSettings levelSettings;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/BasicTransferLogic.java
|
||||
+++ b/src/main/java/me/earthme/luminol/config/DefaultTransformLogic.java
|
||||
@@ -1,0 +_,7 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+public class BasicTransferLogic {
|
||||
+public class DefaultTransformLogic {
|
||||
+ public Object transform(Object obj) {
|
||||
+ return obj;
|
||||
+ }
|
||||
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/EnumConfigCategory.java
|
||||
@@ -1,0 +_,19 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+public enum EnumConfigCategory {
|
||||
@@ -8,7 +8,8 @@
|
||||
+ FIXES("fixes"),
|
||||
+ MISC("misc"),
|
||||
+ GAMEPLAY("gameplay"),
|
||||
+ EXPERIMENT("experiment");
|
||||
+ EXPERIMENT("experiment"),
|
||||
+ REMOVED("removed");
|
||||
+
|
||||
+ private final String baseKeyName;
|
||||
+
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
@@ -1,0 +_,268 @@
|
||||
@@ -1,0 +_,271 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import io.papermc.paper.threadedregions.RegionizedServer;
|
||||
+import me.earthme.luminol.commands.LuminolConfigCommand;
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.Logger;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.Field;
|
||||
@@ -23,16 +26,14 @@
|
||||
+import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.jar.JarEntry;
|
||||
+import java.util.jar.JarFile;
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.Logger;
|
||||
+
|
||||
+public class LuminolConfig {
|
||||
+ public static final Logger logger = LogManager.getLogger();
|
||||
+ private static final File baseConfigFolder = new File("luminol_config");
|
||||
+ private static final File baseConfigFile = new File(baseConfigFolder, "luminol_global_config.toml");
|
||||
+ private static final Set<IConfigModule> allInstanced = new HashSet<>();
|
||||
+ private static CommentedFileConfig configFileInstance;
|
||||
+ public static boolean alreadyInited = false;
|
||||
+ private static CommentedFileConfig configFileInstance;
|
||||
+
|
||||
+ public static void setupLatch() {
|
||||
+ Bukkit.getCommandMap().register("luminolconfig", "luminol", new LuminolConfigCommand());
|
||||
@@ -127,32 +128,32 @@
|
||||
+
|
||||
+ field.setAccessible(true);
|
||||
+ final Object currentValue = field.get(null);
|
||||
+ boolean removed = fullConfigKeyName.equals("removed.removed_config.removed");
|
||||
+
|
||||
+ if (!configFileInstance.contains(fullConfigKeyName)){
|
||||
+ for (RemovedConfig removedConfig : field.getAnnotationsByType(RemovedConfig.class)) {
|
||||
+ final String oldConfigKeyName = String.join(".", removedConfig.category()) + "." + removedConfig.name();
|
||||
+ if (!configFileInstance.contains(fullConfigKeyName) || removed) {
|
||||
+ for (TransformedConfig transformedConfig : field.getAnnotationsByType(TransformedConfig.class)) {
|
||||
+ final String oldConfigKeyName = String.join(".", transformedConfig.category()) + "." + transformedConfig.name();
|
||||
+ Object oldValue = configFileInstance.get(oldConfigKeyName);
|
||||
+ if (oldValue != null) {
|
||||
+ boolean success = true;
|
||||
+ if (removedConfig.transfer()) {
|
||||
+ if (transformedConfig.transform() && !removed) {
|
||||
+ try {
|
||||
+ Object oldValueTransferred = ((BasicTransferLogic)removedConfig.transferLogic().getDeclaredConstructor().newInstance()).transform(oldValue);
|
||||
+ configFileInstance.add(fullConfigKeyName, oldValueTransferred);
|
||||
+ for (Class<? extends DefaultTransformLogic> logic : transformedConfig.transformLogic()) {
|
||||
+ oldValue = logic.getDeclaredConstructor().newInstance().transform(oldValue);
|
||||
+ }
|
||||
+ configFileInstance.add(fullConfigKeyName, oldValue);
|
||||
+ } catch (Exception e) {
|
||||
+ success = false;
|
||||
+ logger.error("Failed to transfer removed config {}!", removedConfig.name());
|
||||
+ logger.error("Failed to transform removed config {}!", transformedConfig.name());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (success) {
|
||||
+ removeConfig(oldConfigKeyName, removedConfig.category());
|
||||
+ }
|
||||
+ if (success) removeConfig(oldConfigKeyName, transformedConfig.category());
|
||||
+ final String comments = configInfo.comments();
|
||||
+
|
||||
+ if (!comments.isBlank()){
|
||||
+ configFileInstance.setComment(fullConfigKeyName,comments);
|
||||
+ }
|
||||
+ if (configFileInstance.get(fullConfigKeyName) != null) break;
|
||||
+ if (!comments.isBlank()) configFileInstance.setComment(fullConfigKeyName, comments);
|
||||
+
|
||||
+ if (!removed && configFileInstance.get(fullConfigKeyName) != null) break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (configFileInstance.get(fullConfigKeyName) != null) continue;
|
||||
@@ -178,14 +179,16 @@
|
||||
+
|
||||
+ public static void removeConfig(String name, String[] keys) {
|
||||
+ configFileInstance.remove(name);
|
||||
+ if (configFileInstance.get(String.join(".", keys)) instanceof UnmodifiableConfig) {
|
||||
+ Object configAtPath = configFileInstance.get(String.join(".", keys));
|
||||
+ if (configAtPath instanceof UnmodifiableConfig && ((UnmodifiableConfig) configAtPath).isEmpty()) {
|
||||
+ removeConfig(keys);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void removeConfig(String[] keys) {
|
||||
+ configFileInstance.remove(String.join(".", keys));
|
||||
+ if (configFileInstance.get(String.join(".", Arrays.copyOfRange(keys, 1, keys.length))) instanceof UnmodifiableConfig) {
|
||||
+ Object configAtPath = configFileInstance.get(String.join(".", Arrays.copyOfRange(keys, 1, keys.length)));
|
||||
+ if (configAtPath instanceof UnmodifiableConfig && ((UnmodifiableConfig) configAtPath).isEmpty()) {
|
||||
+ removeConfig(Arrays.copyOfRange(keys, 1, keys.length));
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/RemovedConfig.java
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import java.lang.annotation.*;
|
||||
+
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Repeatable(RemovedConfig.List.class)
|
||||
+public @interface RemovedConfig {
|
||||
+ String name() default "";
|
||||
+
|
||||
+ String[] category() default "";
|
||||
+
|
||||
+ boolean transfer() default true;
|
||||
+
|
||||
+ Class<?> transferLogic() default BasicTransferLogic.class;
|
||||
+
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ @interface List {
|
||||
+ RemovedConfig[] value();
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,25 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/TransformedConfig.java
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import java.lang.annotation.Repeatable;
|
||||
+import java.lang.annotation.Retention;
|
||||
+import java.lang.annotation.RetentionPolicy;
|
||||
+
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Repeatable(TransformedConfig.List.class)
|
||||
+public @interface TransformedConfig {
|
||||
+ String name() default "";
|
||||
+
|
||||
+ String[] category() default "";
|
||||
+
|
||||
+ boolean transform() default true;
|
||||
+
|
||||
+ Class<? extends DefaultTransformLogic>[] transformLogic() default {DefaultTransformLogic.class};
|
||||
+
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ @interface List {
|
||||
+ TransformedConfig[] value();
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,26 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/DisableEndCrystalCheckConfig.java
|
||||
@@ -1,0 +_,23 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class DisableEndCrystalCheckConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "disable_end_crystal_check", comments =
|
||||
+ """
|
||||
+ Disable paper's End Crystal position check.
|
||||
+ It reverts to vanilla respawn dragon logic.""")
|
||||
+ public static boolean disableEndCrystalCheck = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "end_crystal";
|
||||
+ }
|
||||
+}
|
||||
@@ -31,19 +31,19 @@
|
||||
+ Disable y <= 96 check.
|
||||
+ If you enabled revert_274911, this config will useless
|
||||
+ and always behavior of enabled""")
|
||||
+ public static boolean height_check = false;
|
||||
+ public static boolean heightCheck = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "skip-self-raid-check", comments =
|
||||
+ """
|
||||
+ Disable raid self check\s
|
||||
+ --- this config is not old version's function""")
|
||||
+ public static boolean self_check = false;
|
||||
+ public static boolean selfCheck = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "revert-274911", comments =
|
||||
+ """
|
||||
+ Revert Old raid's find spawn position logic
|
||||
+ --- This revert MC-274911""")
|
||||
+ public static boolean pos_revert = false;
|
||||
+ public static boolean posRevert = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/removed/RemovedConfig.java
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.removed;
|
||||
+
|
||||
+import me.earthme.luminol.config.*;
|
||||
+
|
||||
+public class RemovedConfig implements IConfigModule {
|
||||
+ @TransformedConfig(name = "example", category = {"removed", "example"}, transform = false)
|
||||
+ @DoNotLoad
|
||||
+ @ConfigInfo(baseName = "removed", comments =
|
||||
+ """
|
||||
+ RemovedConfig redirect to here, no any function.""")
|
||||
+ public static boolean enabled = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.REMOVED;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "removed_config";
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,621 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/data/BufferedLinearRegionFile.java
|
||||
@@ -1,0 +_,618 @@
|
||||
+package me.earthme.luminol.data;
|
||||
+
|
||||
+import abomination.IRegionFile;
|
||||
+import ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO;
|
||||
+import me.earthme.luminol.utils.DirectBufferReleaser;
|
||||
+import net.jpountz.xxhash.XXHash32;
|
||||
+import net.jpountz.xxhash.XXHashFactory;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.world.level.ChunkPos;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.io.*;
|
||||
+import java.nio.ByteBuffer;
|
||||
+import java.nio.channels.FileChannel;
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import java.nio.file.StandardOpenOption;
|
||||
+import java.util.concurrent.locks.ReadWriteLock;
|
||||
+import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
+
|
||||
+public class BufferedLinearRegionFile implements IRegionFile {
|
||||
+ private static final double AUTO_COMPACT_PERCENT = 3.0 / 5.0; // 60 %
|
||||
+ private static final long AUTO_COMPACT_SIZE = 1024 * 1024; // 1 MiB
|
||||
+
|
||||
+ private static final long SUPER_BLOCK = 0x1145141919810L;
|
||||
+ private static final int HASH_SEED = 0x0721;
|
||||
+ private static final byte VERSION = 0x01;
|
||||
+
|
||||
+ private final Path filePath;
|
||||
+
|
||||
+ private final ReadWriteLock fileAccessLock = new ReentrantReadWriteLock();
|
||||
+ private final XXHash32 xxHash32 = XXHashFactory.fastestInstance().hash32();
|
||||
+ private final Sector[] sectors = new Sector[1024];
|
||||
+ private long currentAcquiredIndex = this.headerSize();
|
||||
+ private byte compressionLevel = 6;
|
||||
+ private int xxHash32Seed = HASH_SEED;
|
||||
+ private FileChannel channel;
|
||||
+
|
||||
+ public BufferedLinearRegionFile(Path filePath, int compressionLevel) throws IOException {
|
||||
+ this(filePath);
|
||||
+ this.compressionLevel = (byte) compressionLevel;
|
||||
+ }
|
||||
+
|
||||
+ public BufferedLinearRegionFile(Path filePath) throws IOException {
|
||||
+ this.channel = FileChannel.open(
|
||||
+ filePath,
|
||||
+ StandardOpenOption.CREATE,
|
||||
+ StandardOpenOption.WRITE,
|
||||
+ StandardOpenOption.READ
|
||||
+ );
|
||||
+ this.filePath = filePath;
|
||||
+
|
||||
+ for (int i = 0; i < 1024; i++) {
|
||||
+ this.sectors[i] = new Sector(i, this.headerSize(), 0);
|
||||
+ }
|
||||
+
|
||||
+ this.readHeaders();
|
||||
+ }
|
||||
+
|
||||
+ private void readHeaders() throws IOException {
|
||||
+ if (this.channel.size() < this.headerSize()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final ByteBuffer buffer = ByteBuffer.allocateDirect(this.headerSize());
|
||||
+ this.channel.read(buffer, 0);
|
||||
+ buffer.flip();
|
||||
+
|
||||
+ if (buffer.getLong() != SUPER_BLOCK || buffer.get() != VERSION) {
|
||||
+ throw new IOException("Invalid file format or version mismatch");
|
||||
+ }
|
||||
+
|
||||
+ this.compressionLevel = buffer.get(); // Compression level (not used)
|
||||
+ this.xxHash32Seed = buffer.getInt(); // XXHash32 seed
|
||||
+ this.currentAcquiredIndex = buffer.getLong(); // Acquired index
|
||||
+
|
||||
+ for (Sector sector : this.sectors) {
|
||||
+ sector.restoreFrom(buffer);
|
||||
+ if (sector.hasData()) {
|
||||
+ this.currentAcquiredIndex = Math.max(this.currentAcquiredIndex, sector.offset + sector.length);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ DirectBufferReleaser.clean(buffer);
|
||||
+ }
|
||||
+
|
||||
+ private void writeHeaders() throws IOException {
|
||||
+ final ByteBuffer buffer = ByteBuffer.allocateDirect(this.headerSize());
|
||||
+
|
||||
+ buffer.putLong(SUPER_BLOCK); // Magic
|
||||
+ buffer.put(VERSION); // Version
|
||||
+ buffer.put(this.compressionLevel); // Compression level
|
||||
+ buffer.putInt(this.xxHash32Seed); // XXHash32 seed
|
||||
+ buffer.putLong(this.currentAcquiredIndex); // Acquired index
|
||||
+
|
||||
+ for (Sector sector : this.sectors) {
|
||||
+ buffer.put(sector.getEncoded());
|
||||
+ }
|
||||
+
|
||||
+ buffer.flip();
|
||||
+
|
||||
+ long offset = 0;
|
||||
+ while (buffer.hasRemaining()) {
|
||||
+ offset += this.channel.write(buffer, offset);
|
||||
+ }
|
||||
+
|
||||
+ DirectBufferReleaser.clean(buffer);
|
||||
+ }
|
||||
+
|
||||
+ private int sectorSize() {
|
||||
+ return this.sectors.length * Sector.sizeOfSingle();
|
||||
+ }
|
||||
+
|
||||
+ private int headerSize() {
|
||||
+ int result = 0;
|
||||
+
|
||||
+ result += Long.BYTES; // Magic
|
||||
+ result += Byte.BYTES; // Version
|
||||
+ result += Byte.BYTES; // Compression level
|
||||
+ result += Integer.BYTES; // XXHash32 seed
|
||||
+ result += Long.BYTES; // Acquired index
|
||||
+ result += this.sectorSize(); // Sectors
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ private void flushInternal() throws IOException {
|
||||
+ this.writeHeaders();
|
||||
+
|
||||
+ long spareSize = this.channel.size();
|
||||
+
|
||||
+ spareSize -= this.headerSize();
|
||||
+ for (Sector sector : this.sectors) {
|
||||
+ spareSize -= sector.length;
|
||||
+ }
|
||||
+
|
||||
+ long sectorSize = 0;
|
||||
+ for (Sector sector : this.sectors) {
|
||||
+ sectorSize += sector.length;
|
||||
+ }
|
||||
+
|
||||
+ if (spareSize > AUTO_COMPACT_SIZE && (double)spareSize > ((double)sectorSize) * AUTO_COMPACT_PERCENT) {
|
||||
+ this.compact();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void closeInternal() throws IOException {
|
||||
+ this.writeHeaders();
|
||||
+ this.channel.force(true);
|
||||
+ this.compact();
|
||||
+ this.channel.close();
|
||||
+ }
|
||||
+
|
||||
+ private void compact() throws IOException {
|
||||
+ this.writeHeaders(); // save headers for compact
|
||||
+ this.channel.force(true);
|
||||
+ try (FileChannel tempChannel = FileChannel.open(
|
||||
+ new File(this.filePath.toString() + ".tmp").toPath(),
|
||||
+ StandardOpenOption.CREATE,
|
||||
+ StandardOpenOption.WRITE,
|
||||
+ StandardOpenOption.READ
|
||||
+ )){
|
||||
+ // get the latest head in file
|
||||
+ final ByteBuffer headerBuffer = ByteBuffer.allocateDirect(this.headerSize());
|
||||
+ this.channel.read(headerBuffer, 0);
|
||||
+ headerBuffer.flip();
|
||||
+
|
||||
+ long offsetHeader = 0;
|
||||
+ while (headerBuffer.hasRemaining()) {
|
||||
+ offsetHeader += tempChannel.write(headerBuffer, offsetHeader);
|
||||
+ }
|
||||
+ DirectBufferReleaser.clean(headerBuffer);
|
||||
+
|
||||
+ int offsetPointer = this.headerSize();
|
||||
+ for (Sector sector : this.sectors) {
|
||||
+ if (!sector.hasData()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final ByteBuffer sectorData = sector.read(this.channel);
|
||||
+ final int length = sectorData.remaining();
|
||||
+
|
||||
+ final Sector newRecalculated = new Sector(sector.index, offsetPointer, length);
|
||||
+ offsetPointer += length;
|
||||
+ this.sectors[sector.index] = newRecalculated; // update sector infos
|
||||
+
|
||||
+ newRecalculated.hasData = true;
|
||||
+
|
||||
+ long offset = newRecalculated.offset;
|
||||
+ while (sectorData.hasRemaining()) {
|
||||
+ offset += tempChannel.write(sectorData, offset);
|
||||
+ }
|
||||
+
|
||||
+ DirectBufferReleaser.clean(sectorData);
|
||||
+ }
|
||||
+
|
||||
+ tempChannel.force(true);
|
||||
+ this.currentAcquiredIndex = tempChannel.size();
|
||||
+ }
|
||||
+
|
||||
+ Files.move(
|
||||
+ new File(this.filePath.toString() + ".tmp").toPath(),
|
||||
+ this.filePath,
|
||||
+ java.nio.file.StandardCopyOption.REPLACE_EXISTING
|
||||
+ );
|
||||
+
|
||||
+ this.reopenChannel();
|
||||
+ this.writeHeaders();
|
||||
+ }
|
||||
+
|
||||
+ private void reopenChannel() throws IOException {
|
||||
+ if (this.channel.isOpen()) {
|
||||
+ this.channel.close();
|
||||
+ }
|
||||
+
|
||||
+ this.channel = FileChannel.open(
|
||||
+ filePath,
|
||||
+ StandardOpenOption.CREATE,
|
||||
+ StandardOpenOption.WRITE,
|
||||
+ StandardOpenOption.READ
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private void writeChunkDataRaw(int chunkOrdinal, ByteBuffer chunkData) throws IOException {
|
||||
+ final Sector sector = this.sectors[chunkOrdinal];
|
||||
+
|
||||
+ sector.store(chunkData, this.channel);
|
||||
+ }
|
||||
+
|
||||
+ private @Nullable ByteBuffer readChunkDataRaw(int chunkOrdinal) throws IOException {
|
||||
+ final Sector sector = this.sectors[chunkOrdinal];
|
||||
+
|
||||
+ if (!sector.hasData()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ return sector.read(this.channel);
|
||||
+ }
|
||||
+
|
||||
+ private void clearChunkData(int chunkOrdinal) throws IOException {
|
||||
+ final Sector sector = this.sectors[chunkOrdinal];
|
||||
+
|
||||
+ sector.clear();
|
||||
+
|
||||
+ this.writeHeaders();
|
||||
+ }
|
||||
+
|
||||
+ private static int getChunkIndex(int x, int z) {
|
||||
+ return (x & 31) + ((z & 31) << 5);
|
||||
+ }
|
||||
+
|
||||
+ private boolean hasData(int chunkOriginal) {
|
||||
+ return this.sectors[chunkOriginal].hasData();
|
||||
+ }
|
||||
+
|
||||
+ private void writeChunk(int x, int z, @NotNull ByteBuffer data) throws IOException {
|
||||
+ final int chunkIndex = getChunkIndex(x, z);
|
||||
+
|
||||
+ final int oldPositionOfData = data.position();
|
||||
+ final int xxHash32OfData = this.xxHash32.hash(data, this.xxHash32Seed);
|
||||
+ data.position(oldPositionOfData);
|
||||
+
|
||||
+ final ByteBuffer compressedData = this.compress(this.ensureDirectBuffer(data));
|
||||
+ // uncompressed length + timestamp + xxhash32
|
||||
+ final ByteBuffer chunkSectionBuilder = ByteBuffer.allocateDirect(compressedData.remaining() + 4 + 8 + 4);
|
||||
+
|
||||
+ chunkSectionBuilder.putInt(data.remaining()); // Uncompressed length
|
||||
+ chunkSectionBuilder.putLong(System.nanoTime()); // Timestamp
|
||||
+ chunkSectionBuilder.putInt(xxHash32OfData); // xxHash32 of the original data
|
||||
+ chunkSectionBuilder.put(compressedData); // Compressed data
|
||||
+ chunkSectionBuilder.flip();
|
||||
+
|
||||
+ this.writeChunkDataRaw(chunkIndex, chunkSectionBuilder);
|
||||
+ DirectBufferReleaser.clean(chunkSectionBuilder);
|
||||
+ }
|
||||
+
|
||||
+ private @Nullable ByteBuffer readChunk(int x, int z) throws IOException {
|
||||
+ final ByteBuffer compressed = this.readChunkDataRaw(getChunkIndex(x, z));
|
||||
+
|
||||
+ if (compressed == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ final int uncompressedLength = compressed.getInt();
|
||||
+ final long timestamp = compressed.getLong();
|
||||
+ final int dataXXHash32 = compressed.getInt();
|
||||
+
|
||||
+ final ByteBuffer decompressed = this.decompress(this.ensureDirectBuffer(compressed), uncompressedLength);
|
||||
+
|
||||
+ DirectBufferReleaser.clean(compressed);
|
||||
+
|
||||
+ final IOException xxHash32CheckFailedEx = this.checkXXHash32(dataXXHash32, decompressed);
|
||||
+ if (xxHash32CheckFailedEx != null) {
|
||||
+ throw xxHash32CheckFailedEx;
|
||||
+ }
|
||||
+
|
||||
+ return decompressed;
|
||||
+ }
|
||||
+
|
||||
+ private @NotNull ByteBuffer ensureDirectBuffer(@NotNull ByteBuffer buffer) {
|
||||
+ if (buffer.isDirect()) {
|
||||
+ return buffer;
|
||||
+ }
|
||||
+
|
||||
+ ByteBuffer direct = ByteBuffer.allocateDirect(buffer.remaining());
|
||||
+ int originalPosition = buffer.position();
|
||||
+ direct.put(buffer);
|
||||
+ direct.flip();
|
||||
+ buffer.position(originalPosition);
|
||||
+
|
||||
+ return direct;
|
||||
+ }
|
||||
+
|
||||
+ private @NotNull ByteBuffer compress(@NotNull ByteBuffer input) throws IOException {
|
||||
+ final int originalPosition = input.position();
|
||||
+ final int originalLimit = input.limit();
|
||||
+
|
||||
+ try {
|
||||
+ byte[] inputArray;
|
||||
+ int inputLength = input.remaining();
|
||||
+ if (input.hasArray()) {
|
||||
+ inputArray = input.array();
|
||||
+ int arrayOffset = input.arrayOffset() + input.position();
|
||||
+ if (arrayOffset != 0 || inputLength != inputArray.length) {
|
||||
+ byte[] temp = new byte[inputLength];
|
||||
+ System.arraycopy(inputArray, arrayOffset, temp, 0, inputLength);
|
||||
+ inputArray = temp;
|
||||
+ }
|
||||
+ } else {
|
||||
+ inputArray = new byte[inputLength];
|
||||
+ input.get(inputArray);
|
||||
+ input.position(originalPosition);
|
||||
+ }
|
||||
+
|
||||
+ byte[] compressed = com.github.luben.zstd.Zstd.compress(inputArray, this.compressionLevel);
|
||||
+
|
||||
+ ByteBuffer result = ByteBuffer.allocateDirect(compressed.length);
|
||||
+ result.put(compressed);
|
||||
+ result.flip();
|
||||
+
|
||||
+ return result;
|
||||
+
|
||||
+ } catch (Exception e) {
|
||||
+ throw new IOException("Compression failed for input size: " + input.remaining(), e);
|
||||
+ } finally {
|
||||
+ input.position(originalPosition);
|
||||
+ input.limit(originalLimit);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private @NotNull ByteBuffer decompress(@NotNull ByteBuffer input, int originalSize) throws IOException {
|
||||
+ final int originalPosition = input.position();
|
||||
+ final int originalLimit = input.limit();
|
||||
+
|
||||
+ try {
|
||||
+ byte[] inputArray;
|
||||
+ int inputLength = input.remaining();
|
||||
+
|
||||
+ if (input.hasArray()) {
|
||||
+ inputArray = input.array();
|
||||
+ int arrayOffset = input.arrayOffset() + input.position();
|
||||
+ if (arrayOffset != 0 || inputLength != inputArray.length) {
|
||||
+ byte[] temp = new byte[inputLength];
|
||||
+ System.arraycopy(inputArray, arrayOffset, temp, 0, inputLength);
|
||||
+ inputArray = temp;
|
||||
+ }
|
||||
+ } else {
|
||||
+ inputArray = new byte[inputLength];
|
||||
+ input.get(inputArray);
|
||||
+ input.position(originalPosition);
|
||||
+ }
|
||||
+
|
||||
+ byte[] decompressed = com.github.luben.zstd.Zstd.decompress(inputArray, originalSize);
|
||||
+
|
||||
+ if (decompressed.length != originalSize) {
|
||||
+ throw new IOException("Decompression size mismatch: expected " +
|
||||
+ originalSize + ", got " + decompressed.length);
|
||||
+ }
|
||||
+
|
||||
+ ByteBuffer result = ByteBuffer.allocateDirect(originalSize);
|
||||
+ result.put(decompressed);
|
||||
+ result.flip();
|
||||
+
|
||||
+ return result;
|
||||
+
|
||||
+ } catch (Exception e) {
|
||||
+ throw new IOException("Decompression failed", e);
|
||||
+ } finally {
|
||||
+ input.position(originalPosition);
|
||||
+ input.limit(originalLimit);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private @Nullable IOException checkXXHash32(long originalXXHash32, @NotNull ByteBuffer input) {
|
||||
+ final int oldPositionOfInput = input.position();
|
||||
+ final int currentXXHash32 = this.xxHash32.hash(input, this.xxHash32Seed);
|
||||
+ input.position(oldPositionOfInput);
|
||||
+
|
||||
+ if (originalXXHash32 != currentXXHash32) {
|
||||
+ return new IOException("XXHash32 check failed ! Expected: " + originalXXHash32 + ",but got: " + currentXXHash32);
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Path getPath() {
|
||||
+ return this.filePath;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public DataInputStream getChunkDataInputStream(@NotNull ChunkPos pos) throws IOException {
|
||||
+ this.fileAccessLock.readLock().lock();
|
||||
+ try {
|
||||
+ final ByteBuffer data = this.readChunk(pos.x, pos.z);
|
||||
+
|
||||
+ if (data == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ final byte[] dataBytes = new byte[data.remaining()];
|
||||
+ data.get(dataBytes);
|
||||
+
|
||||
+ DirectBufferReleaser.clean(data);
|
||||
+
|
||||
+ return new DataInputStream(new ByteArrayInputStream(dataBytes));
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.readLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doesChunkExist(@NotNull ChunkPos pos) {
|
||||
+ this.fileAccessLock.readLock().lock();
|
||||
+ try {
|
||||
+ return this.hasData(getChunkIndex(pos.x, pos.z));
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.readLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public DataOutputStream getChunkDataOutputStream(ChunkPos pos) {
|
||||
+ return new DataOutputStream(new ChunkBufferHelper(pos));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void clear(@NotNull ChunkPos pos) throws IOException {
|
||||
+ this.fileAccessLock.writeLock().lock();
|
||||
+ try {
|
||||
+ this.clearChunkData(getChunkIndex(pos.x, pos.z));
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.writeLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasChunk(@NotNull ChunkPos pos) {
|
||||
+ this.fileAccessLock.readLock().lock();
|
||||
+ try {
|
||||
+ return this.hasData(getChunkIndex(pos.x, pos.z));
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.readLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(@NotNull ChunkPos pos, ByteBuffer buf) throws IOException {
|
||||
+ this.fileAccessLock.writeLock().lock();
|
||||
+ try {
|
||||
+ this.writeChunk(pos.x, pos.z, buf);
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.writeLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // MCC 的玩意,这东西也用不上给Linear了()
|
||||
+ @Override
|
||||
+ public CompoundTag getOversizedData(int x, int z) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isOversized(int x, int z) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean recalculateHeader() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setOversized(int x, int z, boolean oversized) {
|
||||
+
|
||||
+ }
|
||||
+ // MCC end
|
||||
+
|
||||
+ @Override
|
||||
+ public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite(CompoundTag data, ChunkPos pos) {
|
||||
+ final DataOutputStream out = this.getChunkDataOutputStream(pos);
|
||||
+
|
||||
+ return new ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData(
|
||||
+ data, ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.WRITE,
|
||||
+ out, regionFile -> out.close()
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void flush() throws IOException {
|
||||
+ this.fileAccessLock.writeLock().lock();
|
||||
+ try {
|
||||
+ this.flushInternal();
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.writeLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void close() throws IOException {
|
||||
+ this.fileAccessLock.writeLock().lock();
|
||||
+ try {
|
||||
+ this.closeInternal();
|
||||
+ }finally {
|
||||
+ this.fileAccessLock.writeLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private class Sector{
|
||||
+ private final int index;
|
||||
+ private long offset;
|
||||
+ private long length;
|
||||
+ private boolean hasData = false;
|
||||
+
|
||||
+ private Sector(int index, long offset, long length) {
|
||||
+ this.index = index;
|
||||
+ this.offset = offset;
|
||||
+ this.length = length;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull ByteBuffer read(@NotNull FileChannel channel) throws IOException {
|
||||
+ final ByteBuffer result = ByteBuffer.allocateDirect((int) this.length);
|
||||
+
|
||||
+ channel.read(result, this.offset);
|
||||
+ result.flip();
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ public void store(@NotNull ByteBuffer newData, @NotNull FileChannel channel) throws IOException {
|
||||
+ this.hasData = true;
|
||||
+ this.length = newData.remaining();
|
||||
+ this.offset = currentAcquiredIndex;
|
||||
+
|
||||
+ BufferedLinearRegionFile.this.currentAcquiredIndex += this.length;
|
||||
+
|
||||
+ long offset = this.offset;
|
||||
+ while (newData.hasRemaining()) {
|
||||
+ offset += channel.write(newData, offset);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private @NotNull ByteBuffer getEncoded() {
|
||||
+ final ByteBuffer buffer = ByteBuffer.allocateDirect(sizeOfSingle());
|
||||
+
|
||||
+ buffer.putLong(this.offset);
|
||||
+ buffer.putLong(this.length);
|
||||
+ buffer.put((byte) (this.hasData ? 1 : 0));
|
||||
+ buffer.flip();
|
||||
+
|
||||
+ return buffer;
|
||||
+ }
|
||||
+
|
||||
+ public void restoreFrom(@NotNull ByteBuffer buffer) {
|
||||
+ this.offset = buffer.getLong();
|
||||
+ this.length = buffer.getLong();
|
||||
+ this.hasData = buffer.get() == 1;
|
||||
+
|
||||
+ if (this.length < 0 || this.offset < 0) {
|
||||
+ throw new IllegalStateException("Invalid sector data: " + this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void clear() {
|
||||
+ this.hasData = false;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasData() {
|
||||
+ return this.hasData;
|
||||
+ }
|
||||
+
|
||||
+ static int sizeOfSingle() {
|
||||
+ // offset + length hasData
|
||||
+ return Long.BYTES * 2 + 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private class ChunkBufferHelper extends ByteArrayOutputStream {
|
||||
+ private final ChunkPos pos;
|
||||
+
|
||||
+ private ChunkBufferHelper(ChunkPos pos) {
|
||||
+ this.pos = pos;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void close() throws IOException {
|
||||
+ BufferedLinearRegionFile.this.fileAccessLock.writeLock().lock();
|
||||
+ try {
|
||||
+ ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count);
|
||||
+
|
||||
+ BufferedLinearRegionFile.this.writeChunk(this.pos.x, this.pos.z, bytebuffer);
|
||||
+ }finally {
|
||||
+ BufferedLinearRegionFile.this.fileAccessLock.writeLock().unlock();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,37 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/utils/DirectBufferReleaser.java
|
||||
@@ -1,0 +_,34 @@
|
||||
+package me.earthme.luminol.utils;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.lang.reflect.Field;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.nio.ByteBuffer;
|
||||
+
|
||||
+public class DirectBufferReleaser {
|
||||
+ private static final Method CLEANER_METHOD;
|
||||
+ private static final Object UNSAFE;
|
||||
+
|
||||
+ static {
|
||||
+ try {
|
||||
+ Class<?> unsafeClass = Class.forName("sun.misc.Unsafe");
|
||||
+ Field theUnsafe = unsafeClass.getDeclaredField("theUnsafe");
|
||||
+ theUnsafe.setAccessible(true);
|
||||
+ UNSAFE = theUnsafe.get(null);
|
||||
+ CLEANER_METHOD = unsafeClass.getMethod("invokeCleaner", ByteBuffer.class);
|
||||
+ } catch (Exception ex) {
|
||||
+ throw new RuntimeException("Unsafe init failed", ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean clean(@NotNull ByteBuffer buffer) {
|
||||
+ if (!buffer.isDirect()) return false;
|
||||
+ try {
|
||||
+ CLEANER_METHOD.invoke(UNSAFE, buffer);
|
||||
+ return true;
|
||||
+ } catch (Exception e) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -1,16 +1,18 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/utils/EnumRegionFormat.java
|
||||
@@ -1,0 +_,40 @@
|
||||
@@ -1,0 +_,42 @@
|
||||
+package me.earthme.luminol.utils;
|
||||
+
|
||||
+import abomination.LinearRegionFile;
|
||||
+import me.earthme.luminol.config.modules.misc.RegionFormatConfig;
|
||||
+import me.earthme.luminol.data.BufferedLinearRegionFile;
|
||||
+import net.minecraft.world.level.chunk.storage.RegionFile;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public enum EnumRegionFormat {
|
||||
+ MCA("mca", "mca" , (info) -> new RegionFile(info.info(), info.filePath(), info.folder(), info.sync())),
|
||||
+ LINEAR_V2("linear_v2", "linear" ,(info) -> new LinearRegionFile(info.info(), info.filePath(), info.folder(), info.sync(), RegionFormatConfig.linearCompressionLevel));
|
||||
+ LINEAR_V2("linear_v2", "linear" ,(info) -> new LinearRegionFile(info.info(), info.filePath(), info.folder(), info.sync(), RegionFormatConfig.linearCompressionLevel)),
|
||||
+ B_LINEAR("b_linear", "b_linear", (info) -> new BufferedLinearRegionFile(info.filePath(), RegionFormatConfig.linearCompressionLevel));
|
||||
+
|
||||
+ private final String name;
|
||||
+ private final String argument;
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
@@ -1,0 +_,209 @@
|
||||
+// Lithium - faster chunk serialization
|
||||
+
|
||||
+package net.caffeinemc.mods.lithium.common.world.chunk;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.HashCommon;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
+import net.minecraft.CrashReport;
|
||||
+import net.minecraft.CrashReportCategory;
|
||||
+import net.minecraft.ReportedException;
|
||||
+import net.minecraft.core.IdMap;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.VarInt;
|
||||
+import net.minecraft.world.level.chunk.MissingPaletteEntryException;
|
||||
+import net.minecraft.world.level.chunk.Palette;
|
||||
+import net.minecraft.world.level.chunk.PaletteResize;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
+import static it.unimi.dsi.fastutil.Hash.FAST_LOAD_FACTOR;
|
||||
+
|
||||
+/**
|
||||
+ * Generally provides better performance over the vanilla {@link net.minecraft.world.level.chunk.HashMapPalette} when calling
|
||||
+ * {@link LithiumHashPalette#idFor(Object)} through using a faster backing map and reducing pointer chasing.
|
||||
+ */
|
||||
+public class LithiumHashPalette<T> implements Palette<T> {
|
||||
+ private static final int ABSENT_VALUE = -1;
|
||||
+
|
||||
+ private final IdMap<T> idList;
|
||||
+ private final PaletteResize<T> resizeHandler;
|
||||
+ private final int indexBits;
|
||||
+
|
||||
+ private final Reference2IntOpenHashMap<T> table;
|
||||
+ private T[] entries;
|
||||
+ private int size = 0;
|
||||
+
|
||||
+ private LithiumHashPalette(IdMap<T> idList, PaletteResize<T> resizeHandler, int indexBits, T[] entries, Reference2IntOpenHashMap<T> table, int size) {
|
||||
+ this.idList = idList;
|
||||
+ this.resizeHandler = resizeHandler;
|
||||
+ this.indexBits = indexBits;
|
||||
+ this.entries = entries;
|
||||
+ this.table = table;
|
||||
+ this.size = size;
|
||||
+ }
|
||||
+
|
||||
+ public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler, List<T> list) {
|
||||
+ this(idList, bits, resizeHandler);
|
||||
+
|
||||
+ for (T t : list) {
|
||||
+ this.addEntry(t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler) {
|
||||
+ this.idList = idList;
|
||||
+ this.indexBits = bits;
|
||||
+ this.resizeHandler = resizeHandler;
|
||||
+
|
||||
+ int capacity = 1 << bits;
|
||||
+
|
||||
+ this.entries = (T[]) new Object[capacity];
|
||||
+ this.table = new Reference2IntOpenHashMap<>(capacity, FAST_LOAD_FACTOR);
|
||||
+ this.table.defaultReturnValue(ABSENT_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int idFor(@NotNull T obj) {
|
||||
+ int id = this.table.getInt(obj);
|
||||
+
|
||||
+ if (id == ABSENT_VALUE) {
|
||||
+ id = this.computeEntry(obj);
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean maybeHas(@NotNull Predicate<T> predicate) {
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ if (predicate.test(this.entries[i])) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private int computeEntry(T obj) {
|
||||
+ int id = this.addEntry(obj);
|
||||
+
|
||||
+ if (id >= 1 << this.indexBits) {
|
||||
+ if (this.resizeHandler == null) {
|
||||
+ throw new IllegalStateException("Cannot grow");
|
||||
+ } else {
|
||||
+ id = this.resizeHandler.onResize(this.indexBits + 1, obj);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ private int addEntry(T obj) {
|
||||
+ int nextId = this.size;
|
||||
+
|
||||
+ if (nextId >= this.entries.length) {
|
||||
+ this.resize(this.size);
|
||||
+ }
|
||||
+
|
||||
+ this.table.put(obj, nextId);
|
||||
+ this.entries[nextId] = obj;
|
||||
+
|
||||
+ this.size++;
|
||||
+
|
||||
+ return nextId;
|
||||
+ }
|
||||
+
|
||||
+ private void resize(int neededCapacity) {
|
||||
+ this.entries = Arrays.copyOf(this.entries, HashCommon.nextPowerOfTwo(neededCapacity + 1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull T valueFor(int id) {
|
||||
+ T[] entries = this.entries;
|
||||
+
|
||||
+ T entry = null;
|
||||
+ if (id >= 0 && id < entries.length) {
|
||||
+ entry = entries[id];
|
||||
+ }
|
||||
+
|
||||
+ if (entry != null) {
|
||||
+ return entry;
|
||||
+ } else {
|
||||
+ throw this.missingPaletteEntryCrash(id);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private ReportedException missingPaletteEntryCrash(int id) {
|
||||
+ try {
|
||||
+ throw new MissingPaletteEntryException(id);
|
||||
+ } catch (MissingPaletteEntryException e) {
|
||||
+ CrashReport crashReport = CrashReport.forThrowable(e, "[Lithium] Getting Palette Entry");
|
||||
+ CrashReportCategory crashReportCategory = crashReport.addCategory("Chunk section");
|
||||
+ crashReportCategory.setDetail("IndexBits", this.indexBits);
|
||||
+ crashReportCategory.setDetail("Entries", this.entries.length + " Elements: " + Arrays.toString(this.entries));
|
||||
+ crashReportCategory.setDetail("Table", this.table.size() + " Elements: " + this.table);
|
||||
+ return new ReportedException(crashReport);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void read(FriendlyByteBuf buf) {
|
||||
+ this.clear();
|
||||
+
|
||||
+ int entryCount = buf.readVarInt();
|
||||
+
|
||||
+ for (int i = 0; i < entryCount; ++i) {
|
||||
+ this.addEntry(this.idList.byIdOrThrow(buf.readVarInt()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(FriendlyByteBuf buf) {
|
||||
+ int size = this.size;
|
||||
+ buf.writeVarInt(size);
|
||||
+
|
||||
+ for (int i = 0; i < size; ++i) {
|
||||
+ buf.writeVarInt(this.idList.getId(this.valueFor(i)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getSerializedSize() {
|
||||
+ int size = VarInt.getByteSize(this.size);
|
||||
+
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ size += VarInt.getByteSize(this.idList.getId(this.valueFor(i)));
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getSize() {
|
||||
+ return this.size;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Palette<T> copy(@NotNull PaletteResize<T> resizeHandler) {
|
||||
+ return new LithiumHashPalette<>(this.idList, resizeHandler, this.indexBits, this.entries.clone(), this.table.clone(), this.size);
|
||||
+ }
|
||||
+
|
||||
+ private void clear() {
|
||||
+ Arrays.fill(this.entries, null);
|
||||
+ this.table.clear();
|
||||
+ this.size = 0;
|
||||
+ }
|
||||
+
|
||||
+ public List<T> getElements() {
|
||||
+ T[] copy = Arrays.copyOf(this.entries, this.size);
|
||||
+ return Arrays.asList(copy);
|
||||
+ }
|
||||
+
|
||||
+ public static <A> Palette<A> create(int bits, IdMap<A> idList, PaletteResize<A> listener, List<A> list) {
|
||||
+ return new LithiumHashPalette<>(idList, bits, listener, list);
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user