3
0

Initial commit (Forge 1291).

This commit is contained in:
gamerforEA 2015-03-22 20:38:04 +03:00
commit 16773ead6a
611 changed files with 64826 additions and 0 deletions

12
.gitattributes vendored Normal file
View File

@ -0,0 +1,12 @@
* text eol=lf
*.bat text eol=crlf
*.patch text eol=lf
*.cfg text eol=lf
*.py text eol=lf
*.png binary
*.exe binary
*.dll binary
*.zip binary
*.pyd binary
*.jar binary
*.lzma binary

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
!.gitignore
# eclipse
/eclipse
# gradle
build
.gradle
*.DS_Store

7
.gitmodules vendored Normal file
View File

@ -0,0 +1,7 @@
[submodule "bukkit"]
path = bukkit
url = https://github.com/gamerforEA/Bukkit.git
[submodule "forge"]
path = forge
url = https://github.com/gamerforEA/MinecraftForge.git
branch = 1.7.10

165
LGPL.txt Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

674
LICENCE.txt Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
<http://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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

92
README.md Normal file
View File

@ -0,0 +1,92 @@
Cauldron
===========
Note: 1.7.2 repository has been moved to [branch v172](https://github.com/MinecraftPortCentral/Cauldron/tree/v172)
A Forge/Bukkit/Spigot Minecraft Server
Compilation
-----------
We use Gradle to handle our dependencies.
1. Checkout project.
2. Init submodules : git submodule update --init --recursive -- depth 1
3. Setup workspace : gradlew setupCauldron
4. Build binaries : gradlew buildPackages
Note: all binaries will be in distributions folder
Supporting Cauldron
--------
Click here to [Donate to bloodmc](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YNCKCALNQKFAS)
Click here to [Become a Patreon] (http://www.patreon.com/bloodmc)
Top Patron Supporters
-----------
* isiliden
* eonic
* trab
* jamescowens
* SFTMedia
* Shmeeb
Profiling
---------
We use YourKit as our Java Profiler.
YourKit is kindly supporting open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of innovative and intelligent tools for profiling
Java and .NET applications. Take a look at YourKit's leading software products:
* [YourKit Java Profiler](http://www.yourkit.com/java/profiler/index.jsp)
* [YourKit .NET Profiler](http://www.yourkit.com/.net/profiler/index.jsp)
Coding and Pull Request Conventions
-----------
* We generally follow the Sun/Oracle coding standards.
* No tabs; use 4 spaces instead.
* No trailing whitespaces.
* No CRLF line endings, LF only; will be converted automatically by git
* No 80 column limit or 'weird' midstatement newlines.
* The number of commits in a pull request should be kept to a minimum (squish them into one most of the time - use common sense!).
* No merges should be included in pull requests unless the pull request's purpose is a merge.
* Pull requests should be tested (does it compile? AND does it work?) before submission.
* Any major additions should have documentation ready and provided if applicable (this is usually the case).
* Most pull requests should be accompanied by a corresponding GitHub ticket so we can associate commits with GitHub issues (this is primarily for changelog generation on ci.md-5.net).
* Try to follow test driven development where applicable.
If you make changes to or add upstream classes (net.minecraft, net.minecraftforge, cpw.mods.fml, org.bukkit, org.spigotmc) it is mandatory to:
* Make a separate commit adding the new net.minecraft classes (commit message: "Added x for diff visibility" or so).
* Then make further commits with your changes.
* Mark your changes with:
* 1 line; add a trailing: `// Cauldron [- Optional reason]`
* 2+ lines; add
* Before: `// Cauldron start [- Optional comment]`
* After: `// Cauldron end`
* Keep the diffs to a minimum (*somewhat* important)
Tips to get your pull request accepted
-----------
Making sure you follow the above conventions is important, but just the beginning. Follow these tips to better the chances of your pull request being accepted and pulled.
* Make sure you follow all of our conventions to the letter.
* Make sure your code compiles under Java 6.
* Provide proper JavaDocs where appropriate.
* Provide proper accompanying documentation where appropriate.
* Test your code.
* Make sure to follow coding best practices.
* Provide a test plugin/mod binary and source for us to test your code with.
* Your pull request should link to accompanying pull requests.
* The description of your pull request should provide detailed information on the pull along with justification of the changes where applicable.
Credits
-------
* [MCP](http://mcp.ocean-labs.de) - permission to use data to make Cauldron.
* [Forge](http://www.minecraftforge.net) - mod support.
* [CraftBukkit](http://bukkit.org) - plugin support.
* [Spigot](http://www.spigotmc.org) - performance optimizations.

73
build.gradle Normal file
View File

@ -0,0 +1,73 @@
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'maven'
apply plugin: 'cauldron'
minecraft {
version = '1.7.10'
mcpVersion = '9.05'
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4"
subprojects {
repositories {
mavenLocal()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
flatDir {
name "fileRepo"
dirs "repo"
}
}
}
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4"
}
group = 'net.minecraftforge'
ext.mcVersion = "1.7.10"
ext.cauldronVersion = "1"
ext.forgeVersion = "1291"
ext.bukkitVersion = "01"
version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${bukkitVersion}.0"
jenkins {
job = 'Cauldron'
}
launch4j {
jreMinVersion = '1.6.0'
}
tasks.packageUniversal {
classifier = 'server'
}
tasks.packageUniversal.manifest {
attributes([
'Implementation-Vendor': 'Cauldron',
'Implementation-Title': 'Cauldron',
'Implementation-Version': 'git-Cauldron-Reloaded-'+project.version,
'Forge-Version': '10.13.2.1291',
'Specification-Vendor': 'Bukkit Team',
'Specification-Title': 'Bukkit',
'Specification-Version': '1.7.10-R0.1-SNAPSHOT'
])
}

BIN
eclipse-workspace-dev.zip Normal file

Binary file not shown.

164
gradlew vendored Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/forge/fml/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\forge\fml\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

298
jsons/1.7.10-dev.json Normal file
View File

@ -0,0 +1,298 @@
{
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"minecraftArguments": "--version FML_DEV --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
"minimumLauncherVersion": 13,
"assets": "1.7.10",
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.11"
},
{
"name": "com.google.code.findbugs:jsr305:1.3.9",
"children": ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.ow2.asm:asm-debug-all:5.0.3",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "com.typesafe.akka:akka-actor_2.11:2.3.3",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "com.typesafe:config:1.2.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-actors-migration_2.11:1.1.0",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-compiler:2.11.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-library:2.11.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-parser-combinators_2.11:1.0.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-reflect:2.11.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-swing_2.11:1.0.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-xml_2.11:1.0.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "lzma:lzma:0.0.1"
},
{
"name": "com.mojang:realms:1.3.5"
},
{
"name": "org.apache.commons:commons-compress:1.8.1"
},
{
"name": "org.apache.httpcomponents:httpclient:4.3.3"
},
{
"name": "commons-logging:commons-logging:1.1.3"
},
{
"name": "org.apache.httpcomponents:httpcore:4.3.2"
},
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:16.0"
},
{
"name": "org.apache.commons:commons-lang3:3.2.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.16"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.yaml:snakeyaml:1.9",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "commons-lang:commons-lang:2.6",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.avaje:ebean:2.7.3",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "jline:jline:2.6",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "net.md-5:SpecialSource:1.7-SNAPSHOT",
"url" : "https://raw.github.com/MinecraftPortCentral/mcpc-mvn-repo/master/snapshots",
"serverreq":true
},
{
"name": "net.sourceforge.argo:argo:2.25",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.fusesource.jansi:jansi:1.8",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "com.googlecode.json-simple:json-simple:1.1",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.xerial:sqlite-jdbc:3.7.2",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "mysql:mysql-connector-java:5.1.14",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "javax.persistence:persistence-api:1.0.2",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:5.16"
},
{
"name": "tv.twitch:twitch-platform:5.16",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.launchwrapper.Launch"
}

327
jsons/1.7.10-rel.json Normal file
View File

@ -0,0 +1,327 @@
{
"install": {
"profileName": "@project@",
"target":"@minecraft_version@-@project@@version@",
"path":"@artifact@",
"version":"@project@ @version@",
"filePath":"@universal_jar@",
"welcome":"Welcome to the simple @project@ installer.",
"minecraft":"@minecraft_version@",
"logo":"/big_logo.png",
"hideClient":true
},
"versionInfo": {
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
"minimumLauncherVersion": 13,
"assets": "1.7.10",
"libraries": [
{
"name": "@artifact@",
"url": "http://files.minecraftforge.net/maven/"
},
{
"name": "net.minecraft:launchwrapper:1.11",
"serverreq":true
},
{
"name": "org.ow2.asm:asm-all:5.0.3",
"serverreq":true
},
{
"name": "com.typesafe.akka:akka-actor_2.11:2.3.3",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "ed62e9fc709ca0f2ff1a3220daa8b70a2870078e", "25a86ccfdb6f6dfe08971f4825d0a01be83a6f2e" ],
"serverreq":true,
"clientreq":true
},
{
"name": "com.typesafe:config:1.2.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "f771f71fdae3df231bcd54d5ca2d57f0bf93f467", "7d7bc36df0989d72f2d5d057309675777acc528b" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-actors-migration_2.11:1.1.0",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "dfa8bc42b181d5b9f1a5dd147f8ae308b893eb6f", "8c9aaeeb68487ca519411a14068e1b4d69739207" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-compiler:2.11.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "56ea2e6c025e0821f28d73ca271218b8dd04926a", "1444992390544ba3780867a13ff696a89d7d1639" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "87213338cd5a153a7712cb574c0ddd2edfee0386", "0b4c1bf8d48993f138d6e10c0c144e50acfff581" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "1f7371605d4ba42aa26d3443440c0083c587b4e9", "1ea655dda4504ae0a367327e2340cd3beaee6c73" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-library:2.11.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "0e11da23da3eabab9f4777b9220e60d44c1aab6a", "1e4df76e835201c6eabd43adca89ab11f225f134" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-parser-combinators_2.11:1.0.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "f05d7345bf5a58924f2837c6c1f4d73a938e1ff0", "a1cbbcbde1dcc614f4253ed1aa0b320bc78d8f1d" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-reflect:2.11.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "6580347e61cc7f8e802941e7fde40fa83b8badeb", "91ce0f0be20f4a536321724b4b3bbc6530ddcd88" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-swing_2.11:1.0.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "b1cdd92bd47b1e1837139c1c53020e86bb9112ae", "d77152691dcf5bbdb00529af37aa7d3d887b3e63" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-xml_2.11:1.0.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "7a80ec00aec122fba7cd4e0d4cdd87ff7e4cb6d0", "62736b01689d56b6d09a0164b7ef9da2b0b9633d" ],
"serverreq":true,
"clientreq":true
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"serverreq":true
},
{
"name": "lzma:lzma:0.0.1",
"serverreq":true
},
{
"name": "com.mojang:realms:1.3.5"
},
{
"name": "org.apache.commons:commons-compress:1.8.1"
},
{
"name": "org.apache.httpcomponents:httpclient:4.3.3"
},
{
"name": "commons-logging:commons-logging:1.1.3"
},
{
"name": "org.apache.httpcomponents:httpcore:4.3.2"
},
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:16.0"
},
{
"name": "org.apache.commons:commons-lang3:3.2.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.16"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.yaml:snakeyaml:1.9",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "commons-lang:commons-lang:2.6",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.avaje:ebean:2.7.3",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "jline:jline:2.6",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "net.md-5:SpecialSource:1.7-SNAPSHOT",
"url" : "https://raw.github.com/MinecraftPortCentral/mcpc-mvn-repo/master/snapshots",
"serverreq":true
},
{
"name": "org.fusesource.jansi:jansi:1.8",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "net.sourceforge.argo:argo:2.25",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "com.googlecode.json-simple:json-simple:1.1",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.xerial:sqlite-jdbc:3.7.2",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "mysql:mysql-connector-java:5.1.14",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "javax.persistence:persistence-api:1.0.2",
"url" : "http://repo.maven.apache.org/maven2",
"serverreq":true
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:5.16"
},
{
"name": "tv.twitch:twitch-platform:5.16",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.launchwrapper.Launch"
}
}

191
jsons/1.7.10.json Normal file
View File

@ -0,0 +1,191 @@
{
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"minecraftArguments": "--version FML_DEV --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
"minimumLauncherVersion": 13,
"assets": "1.7.10",
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.11"
},
{
"name": "org.ow2.asm:asm-debug-all:5.0.3",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-library:2.10.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-compiler:2.10.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "lzma:lzma:0.0.1"
},
{
"name": "com.mojang:realms:1.3.5"
},
{
"name": "org.apache.commons:commons-compress:1.8.1"
},
{
"name": "org.apache.httpcomponents:httpclient:4.3.3"
},
{
"name": "commons-logging:commons-logging:1.1.3"
},
{
"name": "org.apache.httpcomponents:httpcore:4.3.2"
},
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:16.0"
},
{
"name": "org.apache.commons:commons-lang3:3.2.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.16"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:5.16"
},
{
"name": "tv.twitch:twitch-platform:5.16",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.launchwrapper.Launch"
}

View File

@ -0,0 +1,58 @@
--- ../src-base/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
@@ -37,6 +37,10 @@
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
@@ -385,10 +389,11 @@
{
return;
}
- if (handlerSet.contains(handler))
+ if (handlerSet.contains(handler) || worldInfo.getDimension() != 0) // Cauldron - Only check FML data in main world
{
return;
}
+ // Cauldron - logic below should only be run for overworld as Forge/Vanilla only use 1 SaveHandler
handlerSet.add(handler);
handlerToCheck = new WeakReference<SaveHandler>(handler); // for confirmBackupLevelDatUse
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
@@ -496,7 +501,12 @@
public String getModName()
{
- List<String> modNames = Lists.newArrayListWithExpectedSize(3);
+ // Cauldron start
+ List<String> modNames = Lists.newArrayListWithExpectedSize(6);
+ modNames.add("cauldron");
+ modNames.add("craftbukkit");
+ modNames.add("mcpc");
+ // Cauldron end
modNames.add("fml");
if (!noForge)
{
@@ -540,8 +550,17 @@
bus().post(new InputEvent.KeyInputEvent());
}
+ // Cauldron start - wrapper to notify plugins for mods that bypass ServerConfigurationManager
public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)
{
+ this.firePlayerChangedDimensionEvent(player, fromDim, toDim, player.worldObj.getWorld());
+ }
+
+ public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim, CraftWorld fromWorld)
+ {
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) player.getBukkitEntity(), fromWorld);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ // Cauldron end
bus().post(new PlayerEvent.PlayerChangedDimensionEvent(player, fromDim, toDim));
}

View File

@ -0,0 +1,17 @@
--- ../src-base/minecraft/cpw/mods/fml/common/asm/FMLSanityChecker.java
+++ ../src-work/minecraft/cpw/mods/fml/common/asm/FMLSanityChecker.java
@@ -164,10 +164,12 @@
FMLRelaunchLog.severe("Technical information: ClientBrandRetriever was at %s, there were %d certificates for it", codeSource.getLocation(), certCount);
}
}
- if (!goodFML)
+ // Cauldron start - disable message
+ /*if (!goodFML)
{
FMLRelaunchLog.severe("FML appears to be missing any signature data. This is not a good thing");
- }
+ }*/
+ // Cauldron end
return null;
}

View File

@ -0,0 +1,19 @@
--- ../src-base/minecraft/cpw/mods/fml/common/asm/transformers/SideTransformer.java
+++ ../src-work/minecraft/cpw/mods/fml/common/asm/transformers/SideTransformer.java
@@ -32,6 +32,7 @@
{
private static String SIDE = FMLLaunchHandler.side().name();
private static final boolean DEBUG = false;
+ public static boolean allowInvalidSide = false; // Cauldron
@Override
public byte[] transform(String name, String transformedName, byte[] bytes)
{
@@ -41,7 +42,7 @@
ClassReader classReader = new ClassReader(bytes);
classReader.accept(classNode, 0);
- if (remove((List<AnnotationNode>)classNode.visibleAnnotations, SIDE))
+ if (remove((List<AnnotationNode>)classNode.visibleAnnotations, SIDE) && !allowInvalidSide) // Cauldron
{
if (DEBUG)
{

View File

@ -0,0 +1,23 @@
--- ../src-base/minecraft/cpw/mods/fml/common/event/FMLServerStartingEvent.java
+++ ../src-work/minecraft/cpw/mods/fml/common/event/FMLServerStartingEvent.java
@@ -16,6 +16,7 @@
import net.minecraft.command.ICommand;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.LoaderState.ModState;
+import org.bukkit.command.Command; // Cauldron
public class FMLServerStartingEvent extends FMLStateEvent
{
@@ -43,4 +44,12 @@
CommandHandler ch = (CommandHandler) getServer().getCommandManager();
ch.registerCommand(command);
}
+
+ // Cauldron start - used for mods to register a Bukkit command
+ public void registerServerCommand(String fallbackPrefix, Command command)
+ {
+ org.bukkit.command.SimpleCommandMap commandMap = getServer().server.getCommandMap();
+ commandMap.register(fallbackPrefix, command);
+ }
+ // Cauldron end
}

View File

@ -0,0 +1,35 @@
--- ../src-base/minecraft/cpw/mods/fml/common/network/handshake/ChannelRegistrationHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/network/handshake/ChannelRegistrationHandler.java
@@ -2,6 +2,8 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
+
+import java.io.UnsupportedEncodingException;
import java.util.Set;
import net.minecraft.network.NetworkManager;
import org.apache.logging.log4j.Level;
@@ -24,6 +26,23 @@
msg.payload().readBytes(data);
String channels = new String(data,Charsets.UTF_8);
String[] split = channels.split("\0");
+ // Cauldron start - register bukkit channels for players
+ NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
+ if (msg.channel().equals("REGISTER"))
+ {
+ for (String channel : split)
+ {
+ dispatcher.player.getBukkitEntity().addChannel(channel);
+ }
+ }
+ else
+ {
+ for (String channel : split)
+ {
+ dispatcher.player.getBukkitEntity().removeChannel(channel);
+ }
+ }
+ // Cauldron end
Set<String> channelSet = ImmutableSet.copyOf(split);
FMLCommonHandler.instance().fireNetRegistrationEvent(manager, channelSet, msg.channel(), side);
}

View File

@ -0,0 +1,45 @@
--- ../src-base/minecraft/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java
+++ ../src-work/minecraft/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java
@@ -72,7 +72,7 @@
public static final AttributeKey<Boolean> IS_LOCAL = new AttributeKey<Boolean>("fml:isLocal");
public final NetworkManager manager;
private final ServerConfigurationManager scm;
- private EntityPlayerMP player;
+ public EntityPlayerMP player; // Cauldron
private ConnectionState state;
private ConnectionType connectionType;
private final Side side;
@@ -202,7 +202,7 @@
}
else
{
- FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName());
+ //FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName()); // Cauldron - unneeded spam
}
return false;
}
@@ -287,6 +287,7 @@
state = ConnectionState.HANDSHAKING;
}
String channelName = msg.func_149559_c();
+ player.getBukkitEntity().addChannel(channelName); // Cauldron - register channel for bukkit player
if ("FML|HS".equals(channelName) || "REGISTER".equals(channelName) || "UNREGISTER".equals(channelName))
{
FMLProxyPacket proxy = new FMLProxyPacket(msg);
@@ -308,6 +309,7 @@
else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.SERVER))
{
FMLProxyPacket proxy = new FMLProxyPacket(msg);
+ serverHandler.getCraftServer().getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), msg.func_149559_c(), msg.func_149558_e()); // pass msg to bukkit
proxy.setDispatcher(this);
context.fireChannelRead(proxy);
return true;
@@ -465,7 +467,7 @@
// Stop the epic channel closed spam at close
if (!(cause instanceof ClosedChannelException))
{
- FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception");
+ //FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception"); // Cauldron - disable unneeded spam
}
super.exceptionCaught(ctx, cause);
}

View File

@ -0,0 +1,51 @@
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/FMLNetworkHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/FMLNetworkHandler.java
@@ -47,6 +47,16 @@
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+//Cauldron start
+import net.minecraft.inventory.IInventory;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.tileentity.TileEntity;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.event.inventory.InventoryType;
+// Cauldron end
public class FMLNetworkHandler
{
@@ -75,6 +85,31 @@
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
if (remoteGuiContainer != null)
{
+ // Cauldron start - create bukkitView for passed container then fire open event.
+ if (entityPlayer != null)
+ {
+ if (remoteGuiContainer.getBukkitView() == null)
+ {
+ TileEntity te = entityPlayer.worldObj.getTileEntity(x, y, z);
+ if (te != null && te instanceof IInventory)
+ {
+ IInventory teInv = (IInventory)te;
+ CraftInventory inventory = new CraftInventory(teInv);
+ remoteGuiContainer.bukkitView = new CraftInventoryView(entityPlayer.getBukkitEntity(), inventory, remoteGuiContainer);
+ }
+ else
+ {
+ remoteGuiContainer.bukkitView = new CraftInventoryView(entityPlayer.getBukkitEntity(), MinecraftServer.getServer().server.createInventory(entityPlayer.getBukkitEntity(), InventoryType.CHEST), remoteGuiContainer);
+ }
+
+ remoteGuiContainer = CraftEventFactory.callInventoryOpenEvent((EntityPlayerMP)entityPlayer, remoteGuiContainer, false);
+ if (remoteGuiContainer == null)
+ {
+ return;
+ }
+ }
+ }
+ // Cauldron end
entityPlayerMP.getNextWindowId();
entityPlayerMP.closeContainer();
int windowId = entityPlayerMP.currentWindowId;

View File

@ -0,0 +1,18 @@
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
@@ -13,9 +13,15 @@
@Override
protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception
{
+ // Cauldron start - attempt to fix race condition with attr being null
+ Object attr = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER);
+ if (attr != null)
+ {
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove();
dispatcher.completeHandshake(msg.target);
}
+ // Cauldron end
+ }
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

View File

@ -0,0 +1,79 @@
--- ../src-base/minecraft/cpw/mods/fml/common/registry/EntityRegistry.java
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/EntityRegistry.java
@@ -41,6 +41,12 @@
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
+// Cauldron start
+import net.minecraftforge.common.util.EnumHelper;
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.entity.EntityType;
+// Cauldron end
+
public class EntityRegistry
{
public class EntityRegistration
@@ -118,6 +124,8 @@
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
private Map<String,ModContainer> entityNames = Maps.newHashMap();
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
+ public static Map<Class <? extends Entity>, String> entityTypeMap = Maps.newHashMap(); // Cauldron - used by CraftCustomEntity
+ public static Map<String, Class <? extends Entity>> entityClassMap = Maps.newHashMap(); // Cauldron - used by CraftWorld
public static EntityRegistry instance()
{
return INSTANCE;
@@ -147,6 +155,7 @@
public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
{
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
}
@SuppressWarnings("unchecked")
@@ -197,6 +206,7 @@
}
id = instance().validateAndClaimId(id);
EntityList.addMapping(entityClass, entityName, id);
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
}
private int validateAndClaimId(int id)
@@ -249,8 +259,38 @@
}
instance().validateAndClaimId(id);
EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
}
+ // Cauldron start
+ private static void registerBukkitType(Class <? extends Entity > entityClass, String entityName)
+ {
+ ModContainer activeModContainer = Loader.instance().activeModContainer();
+ String modId = "unknown";
+ // fixup bad entity names from mods
+ if (entityName.contains("."))
+ {
+ if ((entityName.indexOf(".") + 1) < entityName.length())
+ entityName = entityName.substring(entityName.indexOf(".") + 1, entityName.length());
+ }
+ entityName.replace("entity", "");
+ if (entityName.startsWith("ent"))
+ entityName.replace("ent", "");
+ entityName = entityName.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric
+ if (activeModContainer != null)
+ modId = activeModContainer.getModId();
+ entityName = modId + "-" + entityName;
+ entityTypeMap.put(entityClass, entityName);
+ entityClassMap.put(entityName, entityClass);
+ }
+
+ // used by CraftCustomEntity
+ public static String getCustomEntityTypeName(Class <? extends Entity > entityClass)
+ {
+ return entityTypeMap.get(entityClass);
+ }
+ // Cauldron end
+
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
{
for (BiomeGenBase biome : biomes)

View File

@ -0,0 +1,69 @@
--- ../src-base/minecraft/cpw/mods/fml/common/registry/GameData.java
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/GameData.java
@@ -14,7 +14,9 @@
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.BitSet;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -1024,4 +1026,56 @@
throw new RuntimeException("WHAT?");
}
}
+
+ // Cauldron start
+ public static void injectItemBukkitMaterials()
+ {
+ FMLControlledNamespacedRegistry<Item> itemRegistry = getItemRegistry();
+ List<Integer> ids = new ArrayList<Integer>();
+
+ for (Item thing : itemRegistry.typeSafeIterable())
+ {
+ ids.add(itemRegistry.getId(thing));
+ }
+
+ // sort by id
+ Collections.sort(ids);
+
+ for (int id : ids)
+ {
+ Item item = itemRegistry.getRaw(id);
+ // inject item materials into Bukkit for FML
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(id, itemRegistry.getNameForObject(item), false);
+ if (material != null)
+ {
+ FMLLog.info("Injected new Forge item material %s with ID %d.", material.name(), material.getId());
+ }
+ }
+ }
+
+ public static void injectBlockBukkitMaterials()
+ {
+ FMLControlledNamespacedRegistry<Block> blockRegistry = getBlockRegistry();
+ List<Integer> ids = new ArrayList<Integer>();
+
+ for (Block block : blockRegistry.typeSafeIterable())
+ {
+ ids.add(blockRegistry.getId(block));
+ }
+
+ // sort by id
+ Collections.sort(ids);
+
+ for (int id : ids)
+ {
+ Block block = blockRegistry.getRaw(id);
+ // inject block materials into Bukkit for FML
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(id, blockRegistry.getNameForObject(block), true);
+ if (material != null)
+ {
+ FMLLog.info("Injected new Forge block material %s with ID %d.", material.name(), material.getId());
+ }
+ }
+ }
+ // Cauldron end
}

View File

@ -0,0 +1,71 @@
--- ../src-base/minecraft/cpw/mods/fml/common/registry/GameRegistry.java
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/GameRegistry.java
@@ -53,6 +53,7 @@
import cpw.mods.fml.common.LoaderException;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
+import java.util.HashMap; // Cauldron
public class GameRegistry
{
@@ -60,6 +61,10 @@
private static Map<IWorldGenerator, Integer> worldGeneratorIndex = Maps.newHashMap();
private static List<IFuelHandler> fuelHandlers = Lists.newArrayList();
private static List<IWorldGenerator> sortedGeneratorList;
+ // Cauldron start
+ private static Map<String, Boolean> configWorldGenCache = new HashMap<String, Boolean>();
+ private static Map<String, String> worldGenMap = new HashMap<String, String>();
+ // Cauldron end
/**
* Register a world generator - something that inserts new block types into the world
@@ -70,12 +75,18 @@
*/
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight)
{
+ // Cauldron start - mod id's are not available during generateWorld so we must capture them here
+ String modId = Loader.instance().activeModContainer().getModId();
+ modId = modId.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric
+ modId.replace(" ", "_");
worldGenerators.add(generator);
worldGeneratorIndex.put(generator, modGenerationWeight);
if (sortedGeneratorList != null)
{
sortedGeneratorList = null;
}
+ worldGenMap.put(generator.getClass().getName(), modId);
+ // Cauldron end
}
/**
@@ -100,11 +111,27 @@
long zSeed = fmlRandom.nextLong() >> 2 + 1L;
long chunkSeed = (xSeed * chunkX + zSeed * chunkZ) ^ worldSeed;
- for (IWorldGenerator generator : sortedGeneratorList)
+ boolean before = ((net.minecraft.world.WorldServer) world).theChunkProviderServer.loadChunkOnProvideRequest; // Cauldron store value
+ ((net.minecraft.world.WorldServer) world).theChunkProviderServer.loadChunkOnProvideRequest = true; // Cauldron load chunks on provide requests
+ for (IWorldGenerator generator : worldGenerators)
{
- fmlRandom.setSeed(chunkSeed);
- generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
+ // Cauldron start
+ if (!configWorldGenCache.containsKey(generator.getClass().getName()))
+ {
+ String modId = worldGenMap.get(generator.getClass().getName());
+ String generatorName = "";
+ generatorName = modId + "-" + generator.getClass().getSimpleName();
+ boolean generatorEnabled = world.cauldronConfig.getBoolean("worldgen-" + generatorName, true);
+ configWorldGenCache.put(generator.getClass().getName(), generatorEnabled);
+ }
+ if (configWorldGenCache.get(generator.getClass().getName()))
+ {
+ fmlRandom.setSeed(chunkSeed);
+ generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
+ }
}
+ ((net.minecraft.world.WorldServer)world).theChunkProviderServer.loadChunkOnProvideRequest = before; // reset
+ // Cauldron end
}
private static void computeSortedGeneratorList()

View File

@ -0,0 +1,47 @@
--- ../src-base/minecraft/cpw/mods/fml/relauncher/CoreModManager.java
+++ ../src-work/minecraft/cpw/mods/fml/relauncher/CoreModManager.java
@@ -153,6 +153,9 @@
}
+ // Cauldron - group output of @MCVersion warnings
+ private static List<String> noVersionAnnotationCoreMods = new ArrayList<String>();
+
public static void handleLaunch(File mcDir, LaunchClassLoader classLoader, FMLTweaker tweaker)
{
CoreModManager.mcDir = mcDir;
@@ -212,7 +215,19 @@
loadCoreMod(classLoader, coreModClassName, null);
}
discoverCoreMods(mcDir, classLoader);
-
+ // Cauldron start - group output of @MCVersion warnings
+ if (!noVersionAnnotationCoreMods.isEmpty())
+ {
+ FMLRelaunchLog
+ .warning("The following coremods do not have a @MCVersion annotation. They may cause problems if this is not the correct version of Minecraft for them.");
+ StringBuilder sb = new StringBuilder("Missing @MCVersion: ");
+ for (String className : noVersionAnnotationCoreMods)
+ {
+ sb.append(className).append(" ");
+ }
+ FMLRelaunchLog.warning(sb.toString());
+ }
+ // Cauldron end
}
private static void discoverCoreMods(File mcDir, LaunchClassLoader classLoader)
@@ -424,8 +439,11 @@
MCVersion requiredMCVersion = coreModClazz.getAnnotation(IFMLLoadingPlugin.MCVersion.class);
if (!Arrays.asList(rootPlugins).contains(coreModClass) && (requiredMCVersion == null || Strings.isNullOrEmpty(requiredMCVersion.value())))
{
- FMLRelaunchLog.log(Level.WARN, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
- coreModClass);
+ // Cauldron start - group output of @MCVersion warnings
+ // FMLRelaunchLog.log(Level.WARN, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
+ // coreModClass);
+ noVersionAnnotationCoreMods.add(coreModClass);
+ // Cauldron end
}
else if (requiredMCVersion != null && !FMLInjectionData.mccversion.equals(requiredMCVersion.value()))
{

View File

@ -0,0 +1,52 @@
--- ../src-base/minecraft/net/minecraft/block/Block.java
+++ ../src-work/minecraft/net/minecraft/block/Block.java
@@ -122,6 +122,7 @@
private String unlocalizedName;
@SideOnly(Side.CLIENT)
protected IIcon blockIcon;
+ public boolean isForgeBlock; // Cauldron
private static final String __OBFID = "CL_00000199";
public final cpw.mods.fml.common.registry.RegistryDelegate<Block> delegate =
@@ -650,7 +651,7 @@
public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
- if (!p_149690_1_.isRemote && !p_149690_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
+ if (!p_149690_1_.isRemote && (!p_149690_1_.restoringBlockSnapshots || !p_149690_1_.restoringBlockStates)) // do not drop items while restoring blockstates, prevents item dupe
{
ArrayList<ItemStack> items = getDrops(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_);
p_149690_6_ = ForgeEventFactory.fireBlockHarvesting(items, p_149690_1_, this, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_, p_149690_6_, false, harvesters.get());
@@ -667,7 +668,7 @@
protected void dropBlockAsItem(World p_149642_1_, int p_149642_2_, int p_149642_3_, int p_149642_4_, ItemStack p_149642_5_)
{
- if (!p_149642_1_.isRemote && p_149642_1_.getGameRules().getGameRuleBooleanValue("doTileDrops") && !p_149642_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
+ if (!p_149642_1_.isRemote && p_149642_1_.getGameRules().getGameRuleBooleanValue("doTileDrops") && (!p_149642_1_.restoringBlockSnapshots || !p_149642_1_.restoringBlockStates)) // do not drop items while restoring blockstates, prevents item dupe
{
if (captureDrops.get())
{
@@ -1131,6 +1132,23 @@
return this;
}
+ // Spigot start
+ public static float range(float min, float value, float max)
+ {
+ if (value < min)
+ {
+ return min;
+ }
+
+ if (value > max)
+ {
+ return max;
+ }
+
+ return value;
+ }
+ // Spigot end
+
@SideOnly(Side.CLIENT)
protected String getTextureName()
{

View File

@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBasePressurePlate.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBasePressurePlate.java
@@ -11,6 +11,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public abstract class BlockBasePressurePlate extends Block
{
private String field_150067_a;
@@ -122,7 +124,20 @@
int i1 = this.func_150065_e(p_150062_1_, p_150062_2_, p_150062_3_, p_150062_4_);
boolean flag = p_150062_5_ > 0;
boolean flag1 = i1 > 0;
+ // CraftBukkit start - Interact Pressure Plate
+ org.bukkit.World bworld = p_150062_1_.getWorld();
+ org.bukkit.plugin.PluginManager manager = p_150062_1_.getServer().getPluginManager();
+ if (flag != flag1)
+ {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(p_150062_2_, p_150062_3_, p_150062_4_), p_150062_5_, i1);
+ manager.callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ i1 = eventRedstone.getNewCurrent();
+ }
+
+ // CraftBukkit end
+
if (p_150062_5_ != i1)
{
p_150062_1_.setBlockMetadataWithNotify(p_150062_2_, p_150062_3_, p_150062_4_, this.func_150066_d(i1), 2);

View File

@ -0,0 +1,89 @@
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
@@ -16,6 +16,10 @@
import net.minecraftforge.common.util.ForgeDirection;
import static net.minecraftforge.common.util.ForgeDirection.*;
+// CraftBukkit start
+import org.bukkit.event.block.BlockRedstoneEvent;
+import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
public abstract class BlockButton extends Block
{
@@ -209,6 +213,19 @@
}
else
{
+ // CraftBukkit start
+ org.bukkit.block.Block block = p_149727_1_.getWorld().getBlockAt(p_149727_2_, p_149727_3_, p_149727_4_);
+ int old = (k1 != 8) ? 15 : 0;
+ int current = (k1 == 8) ? 15 : 0;
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
+ p_149727_1_.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8))
+ {
+ return true;
+ }
+
+ // CraftBukkit end
p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1 + k1, 3);
p_149727_1_.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_);
p_149727_1_.playSoundEffect((double)p_149727_2_ + 0.5D, (double)p_149727_3_ + 0.5D, (double)p_149727_4_ + 0.5D, "random.click", 0.3F, 0.6F);
@@ -262,6 +279,18 @@
if ((l & 8) != 0)
{
+ // CraftBukkit start
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ p_149674_1_.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0)
+ {
+ return;
+ }
+
+ // CraftBukkit end
+
if (this.field_150047_a)
{
this.func_150046_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
@@ -309,6 +338,36 @@
List list = p_150046_1_.getEntitiesWithinAABB(EntityArrow.class, AxisAlignedBB.getBoundingBox((double)p_150046_2_ + this.minX, (double)p_150046_3_ + this.minY, (double)p_150046_4_ + this.minZ, (double)p_150046_2_ + this.maxX, (double)p_150046_3_ + this.maxY, (double)p_150046_4_ + this.maxZ));
boolean flag1 = !list.isEmpty();
+ // CraftBukkit start - Call interact event when arrows turn on wooden buttons
+ if (flag != flag1 && flag1)
+ {
+ org.bukkit.block.Block block = p_150046_1_.getWorld().getBlockAt(p_150046_2_, p_150046_3_, p_150046_4_);
+ boolean allowed = false;
+
+ // If all of the events are cancelled block the button press, else allow
+ for (Object object : list)
+ {
+ if (object != null)
+ {
+ EntityInteractEvent event = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
+ p_150046_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ allowed = true;
+ break;
+ }
+ }
+ }
+
+ if (!allowed)
+ {
+ return;
+ }
+ }
+
+ // CraftBukkit end
+
if (flag1 && !flag)
{
p_150046_1_.setBlockMetadataWithNotify(p_150046_2_, p_150046_3_, p_150046_4_, i1 | 8, 3);

View File

@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -17,6 +17,8 @@
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.IPlantable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockCactus extends Block implements IPlantable
{
@SideOnly(Side.CLIENT)
@@ -47,9 +49,9 @@
{
int i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
- if (i1 == 15)
+ if (i1 >= (byte) range(3, (p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().cactusModifier * 15) + 0.5F, 15)) // Spigot // Cauldron
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, 0); // CraftBukkit
p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4);
this.onNeighborBlockChange(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
}
@@ -135,6 +137,7 @@
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_)
{
+ // Cauldron - moved CraftBukkit hook to func_145775_I() - doBlockCollisions
p_149670_5_.attackEntityFrom(DamageSource.cactus, 1.0F);
}

View File

@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCake.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCake.java
@@ -12,6 +12,10 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+// CraftBukkit start
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.network.play.server.S06PacketUpdateHealth;
+// CraftBukkit end
public class BlockCake extends Block
{
@@ -104,7 +108,17 @@
{
if (p_150036_5_.canEat(false))
{
- p_150036_5_.getFoodStats().addStats(2, 0.1F);
+ // CraftBukkit start
+ int oldFoodLevel = p_150036_5_.getFoodStats().foodLevel;
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(p_150036_5_, 2 + oldFoodLevel);
+
+ if (!event.isCancelled())
+ {
+ p_150036_5_.getFoodStats().addStats(event.getFoodLevel() - oldFoodLevel, 0.1F);
+ }
+
+ ((EntityPlayerMP) p_150036_5_).playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(((EntityPlayerMP) p_150036_5_).getBukkitEntity().getScaledHealth(), p_150036_5_.getFoodStats().foodLevel, p_150036_5_.getFoodStats().foodSaturationLevel));
+ // CraftBukkit end
int l = p_150036_1_.getBlockMetadata(p_150036_2_, p_150036_3_, p_150036_4_) + 1;
if (l >= 6)

View File

@ -0,0 +1,12 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -51,7 +51,8 @@
if (i1 < 2)
{
++i1;
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, i1 << 2 | getDirection(l), 2);
+ // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, i1 << 2 | getDirection(l));
}
}
}

View File

@ -0,0 +1,34 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCommandBlock.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCommandBlock.java
@@ -10,6 +10,8 @@
import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockCommandBlock extends BlockContainer
{
private static final String __OBFID = "CL_00000219";
@@ -31,13 +33,20 @@
boolean flag = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_);
int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_);
boolean flag1 = (l & 1) != 0;
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = p_149695_1_.getWorld().getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
+ // CraftBukkit end
- if (flag && !flag1)
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) // CraftBukkit
{
p_149695_1_.setBlockMetadataWithNotify(p_149695_2_, p_149695_3_, p_149695_4_, l | 1, 4);
p_149695_1_.scheduleBlockUpdate(p_149695_2_, p_149695_3_, p_149695_4_, this, this.tickRate(p_149695_1_));
}
- else if (!flag && flag1)
+ else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) // CraftBukkit
{
p_149695_1_.setBlockMetadataWithNotify(p_149695_2_, p_149695_3_, p_149695_4_, l & -2, 4);
}

View File

@ -0,0 +1,15 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -49,10 +49,9 @@
{
float f = this.func_149864_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
- if (p_149674_5_.nextInt((int)(25.0F / f) + 1) == 0)
+ if (p_149674_5_.nextInt((int)(p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().wheatModifier * (25.0F / f)) + 1) == 0) // Spigot // Cauldron
{
- ++l;
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, ++l); // CraftBukkit
}
}
}

View File

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDaylightDetector.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDaylightDetector.java
@@ -73,6 +73,7 @@
if (l != i1)
{
+ i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(p_149957_1_, p_149957_2_, p_149957_3_, p_149957_4_, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
p_149957_1_.setBlockMetadataWithNotify(p_149957_2_, p_149957_3_, p_149957_4_, i1, 3);
}
}

View File

@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDispenser.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDispenser.java
@@ -30,6 +30,7 @@
{
public static final IRegistry dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem());
protected Random field_149942_b = new Random();
+ public static boolean eventFired = false; // CraftBukkit
@SideOnly(Side.CLIENT)
protected IIcon field_149944_M;
@SideOnly(Side.CLIENT)
@@ -124,7 +125,8 @@
}
}
- protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
+ // CraftBukkit - protected -> public
+ public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
@@ -145,6 +147,7 @@
if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
{
ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
+ eventFired = false; // CraftBukkit - reset event status
tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1);
}
}

View File

@ -0,0 +1,48 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
@@ -16,6 +16,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockDoor extends Block
{
@SideOnly(Side.CLIENT)
@@ -329,15 +331,32 @@
{
this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0);
}
+
+ // CraftBukkit start
}
- else
+ else if (p_149695_5_.canProvidePower())
{
- boolean flag1 = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_) || p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
+ org.bukkit.World bworld = p_149695_1_.getWorld();
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
+ org.bukkit.block.Block blockTop = bworld.getBlockAt(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
+ int power = bukkitBlock.getBlockPower();
+ int powerTop = blockTop.getBlockPower();
- if ((flag1 || p_149695_5_.canProvidePower()) && p_149695_5_ != this)
+ if (powerTop > power)
{
- this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag1);
+ power = powerTop;
}
+
+ int oldPower = (p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 4) > 0 ? 15 : 0;
+
+ if (oldPower == 0 ^ power == 0)
+ {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
+ this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, eventRedstone.getNewCurrent() > 0);
+ }
+
+ // CraftBukkit end
}
}
else

View File

@ -0,0 +1,44 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java
@@ -10,6 +10,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
+
public class BlockDragonEgg extends Block
{
private static final String __OBFID = "CL_00000232";
@@ -43,7 +45,8 @@
if (!BlockFalling.fallInstantly && p_150018_1_.checkChunksExist(p_150018_2_ - b0, p_150018_3_ - b0, p_150018_4_ - b0, p_150018_2_ + b0, p_150018_3_ + b0, p_150018_4_ + b0))
{
- EntityFallingBlock entityfallingblock = new EntityFallingBlock(p_150018_1_, (double)((float)p_150018_2_ + 0.5F), (double)((float)p_150018_3_ + 0.5F), (double)((float)p_150018_4_ + 0.5F), this);
+ // CraftBukkit - added data
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(p_150018_1_, (double)((float) p_150018_2_ + 0.5F), (double)((float) p_150018_3_ + 0.5F), (double)((float) p_150018_4_ + 0.5F), this, p_150018_1_.getBlockMetadata(p_150018_2_, p_150018_3_, p_150018_4_));
p_150018_1_.spawnEntityInWorld(entityfallingblock);
}
else
@@ -86,6 +89,22 @@
if (p_150019_1_.getBlock(i1, j1, k1).blockMaterial == Material.air)
{
+ // CraftBukkit start
+ org.bukkit.block.Block from = p_150019_1_.getWorld().getBlockAt(p_150019_2_, p_150019_3_, p_150019_4_);
+ org.bukkit.block.Block to = p_150019_1_.getWorld().getBlockAt(i1, j1, k1);
+ BlockFromToEvent event = new BlockFromToEvent(from, to);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ i1 = event.getToBlock().getX();
+ j1 = event.getToBlock().getY();
+ k1 = event.getToBlock().getZ();
+ // CraftBukkit end
+
if (!p_150019_1_.isRemote)
{
p_150019_1_.setBlock(i1, j1, k1, this, p_150019_1_.getBlockMetadata(p_150019_2_, p_150019_3_, p_150019_4_), 2);

View File

@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java
@@ -13,6 +13,11 @@
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.Facing;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
+import net.minecraft.inventory.InventoryLargeChest;
+// CraftBukkit end
public class BlockDropper extends BlockDispenser
{
@@ -38,7 +43,7 @@
return new TileEntityDropper();
}
- protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
+ public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_) // CraftBukkit - protected -> public
{
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
@@ -60,10 +65,33 @@
if (iinventory != null)
{
- itemstack1 = TileEntityHopper.func_145889_a(iinventory, itemstack.copy().splitStack(1), Facing.oppositeSide[i1]);
+ // CraftBukkit start - Fire event when pushing items into other inventories
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copy().splitStack(1));
+ org.bukkit.inventory.Inventory destinationInventory;
- if (itemstack1 == null)
+ // Have to special case large chests as they work oddly
+ if (iinventory instanceof InventoryLargeChest)
{
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
+ }
+ else
+ {
+ destinationInventory = iinventory.getOwner().getInventory();
+ }
+
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
+ p_149941_1_.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ itemstack1 = TileEntityHopper.func_145889_a(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.oppositeSide[i1]);
+
+ if (event.getItem().equals(oitemstack) && itemstack1 == null)
+ {
+ // CraftBukkit end
itemstack1 = itemstack.copy();
if (--itemstack1.stackSize == 0)

View File

@ -0,0 +1,162 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDynamicLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDynamicLiquid.java
@@ -5,6 +5,11 @@
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.block.BlockFace;
+import org.bukkit.event.block.BlockFromToEvent;
+// CraftBukkit end
+
public class BlockDynamicLiquid extends BlockLiquid
{
int field_149815_a;
@@ -37,6 +42,12 @@
int i1 = this.tickRate(p_149674_1_);
int j1;
+ // Cauldron - move CB edit to after variable initialization for coremod compatibility
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ org.bukkit.Server server = p_149674_1_.getServer();
+ org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+ // CraftBukkit end
if (l > 0)
{
byte b1 = -100;
@@ -66,17 +77,22 @@
}
}
- if (this.field_149815_a >= 2 && this.blockMaterial == Material.water)
+ // Cauldron start - allow disabling infinite water sources
+ if(net.minecraft.server.MinecraftServer.getServer().cauldronConfig.infiniteWaterSource.getValue())
{
- if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial().isSolid())
+ if (this.field_149815_a >= 2 && this.blockMaterial == Material.water)
{
- j1 = 0;
+ if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial().isSolid())
+ {
+ j1 = 0;
+ }
+ else if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == this.blockMaterial && p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == 0)
+ {
+ j1 = 0;
+ }
}
- else if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == this.blockMaterial && p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == 0)
- {
- j1 = 0;
- }
}
+ // Cauldron end
if (this.blockMaterial == Material.lava && l < 8 && j1 < 8 && j1 > l && p_149674_5_.nextInt(4) != 0)
{
@@ -89,6 +105,13 @@
{
this.func_149811_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
}
+ // Cauldron start - allow lava decaying at a 'natural' rate - see https://mojang.atlassian.net/browse/MC-4631 Lava decay fails to schedule block update
+ else if (net.minecraft.server.MinecraftServer.getServer().cauldronConfig.flowingLavaDecay.getValue())
+ {
+ // Ensure that even if the flow decay was skipped, it will retry at the material's natural flow period.
+ p_149674_1_.scheduleBlockUpdate(p_149674_2_, p_149674_3_, p_149674_4_, this, this.tickRate(p_149674_1_));
+ }
+ // Cauldron end
}
else
{
@@ -113,21 +136,34 @@
if (this.func_149809_q(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_))
{
- if (this.blockMaterial == Material.lava && p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == Material.water)
+ // CraftBukkit start - Send "down" to the server
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
+
+ if (server != null)
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, Blocks.stone);
- this.func_149799_m(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_);
- return;
+ server.getPluginManager().callEvent(event);
}
- if (l >= 8)
+ if (!event.isCancelled())
{
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l);
+ if (this.blockMaterial == Material.lava && p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == Material.water)
+ {
+ p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, Blocks.stone);
+ this.func_149799_m(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_);
+ return;
+ }
+
+ if (l >= 8)
+ {
+ this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l);
+ }
+ else
+ {
+ this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l + 8);
+ }
}
- else
- {
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l + 8);
- }
+
+ // CraftBukkit end
}
else if (l >= 0 && (l == 0 || this.func_149807_p(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_)))
{
@@ -144,25 +180,31 @@
return;
}
- if (aboolean[0])
- {
- this.func_149813_h(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, j1);
- }
+ // CraftBukkit start - All four cardinal directions. Do not change the order!
+ BlockFace[] faces = new BlockFace[] { BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH };
+ int index = 0;
- if (aboolean[1])
+ for (BlockFace currentFace : faces)
{
- this.func_149813_h(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, j1);
- }
+ if (aboolean[index])
+ {
+ BlockFromToEvent event = new BlockFromToEvent(source, currentFace);
- if (aboolean[2])
- {
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, j1);
- }
+ if (server != null)
+ {
+ server.getPluginManager().callEvent(event);
+ }
- if (aboolean[3])
- {
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, j1);
+ if (!event.isCancelled())
+ {
+ this.func_149813_h(p_149674_1_, p_149674_2_ + currentFace.getModX(), p_149674_3_, p_149674_4_ + currentFace.getModZ(), j1);
+ }
+ }
+
+ index++;
}
+
+ // CraftBukkit end
}
}

View File

@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockEndPortal.java
+++ ../src-work/minecraft/net/minecraft/block/BlockEndPortal.java
@@ -15,6 +15,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
+
public class BlockEndPortal extends BlockContainer
{
public static boolean field_149948_a;
@@ -64,6 +66,10 @@
{
if (p_149670_5_.ridingEntity == null && p_149670_5_.riddenByEntity == null && !p_149670_1_.isRemote)
{
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(p_149670_5_.getBukkitEntity(), new org.bukkit.Location(p_149670_1_.getWorld(), p_149670_2_, p_149670_3_, p_149670_4_));
+ p_149670_1_.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
p_149670_5_.travelToDimension(1);
}
}

View File

@ -0,0 +1,57 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -15,6 +15,11 @@
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityInteractEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class BlockFarmland extends Block
{
@SideOnly(Side.CLIENT)
@@ -64,6 +69,15 @@
}
else if (!this.func_149822_e(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
{
+ // CraftBukkit start
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+
+ if (CraftEventFactory.callBlockFadeEvent(block, Blocks.dirt).isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
}
}
@@ -82,6 +96,26 @@
return;
}
+ // CraftBukkit start - Interact soil
+ // Cauldron start - validate data before sending event
+ org.bukkit.event.Cancellable cancellable = null;
+
+ if (p_149746_5_ instanceof EntityPlayer)
+ {
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityPlayer) p_149746_5_, org.bukkit.event.block.Action.PHYSICAL, p_149746_2_, p_149746_3_, p_149746_4_, -1, null);
+ }
+ else if (p_149746_1_ != null && p_149746_1_.getWorld() != null && p_149746_5_ != null)
+ {
+ cancellable = new EntityInteractEvent(p_149746_5_.getBukkitEntity(), p_149746_1_.getWorld().getBlockAt(p_149746_2_, p_149746_3_, p_149746_4_));
+ p_149746_1_.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ if (cancellable != null && cancellable.isCancelled())
+ {
+ return;
+ }
+ // Cauldron end
+ // CraftBukkit end
p_149746_1_.setBlock(p_149746_2_, p_149746_3_, p_149746_4_, Blocks.dirt);
}
}

View File

@ -0,0 +1,129 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -17,6 +17,11 @@
import net.minecraft.world.WorldProviderEnd;
import net.minecraftforge.common.util.ForgeDirection;
import static net.minecraftforge.common.util.ForgeDirection.*;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.block.BlockBurnEvent;
+import org.bukkit.event.block.BlockSpreadEvent;
+// CraftBukkit end
public class BlockFire extends Block
{
@@ -105,12 +110,12 @@
if (!this.canPlaceBlockAt(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
{
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - invalid place location
}
if (!flag && p_149674_1_.isRaining() && (p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ - 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ + 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ - 1) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ + 1)))
{
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - extinguished by rain
}
else
{
@@ -127,12 +132,12 @@
{
if (!World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || l > 3)
{
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - burn out of inflammable block
}
}
else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
{
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - burn out
}
else
{
@@ -186,7 +191,29 @@
k2 = 15;
}
- p_149674_1_.setBlock(i1, k1, j1, this, k2, 3);
+ // CraftBukkit start - Call to stop spread of fire
+ if (p_149674_1_.getBlock(i1, k1, j1) != Blocks.fire)
+ {
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, i1, k1, j1, p_149674_2_, p_149674_3_, p_149674_4_).isCancelled())
+ {
+ continue;
+ }
+
+ org.bukkit.Server server = p_149674_1_.getServer();
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
+ blockState.setTypeId(Block.getIdFromBlock(this));
+ blockState.setData(new org.bukkit.material.MaterialData(Block.getIdFromBlock(this), (byte) k2));
+ BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
+ server.getPluginManager().callEvent(spreadEvent);
+
+ if (!spreadEvent.isCancelled())
+ {
+ blockState.update(true);
+ }
+ }
+
+ // CraftBukkit end
}
}
}
@@ -216,7 +243,18 @@
if (p_149841_6_.nextInt(p_149841_5_) < j1)
{
boolean flag = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt;
+ // CraftBukkit start
+ org.bukkit.block.Block theBlock = p_149841_1_.getWorld().getBlockAt(p_149841_2_, p_149841_3_, p_149841_4_);
+ BlockBurnEvent event = new BlockBurnEvent(theBlock);
+ p_149841_1_.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
+
if (p_149841_6_.nextInt(p_149841_7_ + 10) < 5 && !p_149841_1_.canLightningStrikeAt(p_149841_2_, p_149841_3_, p_149841_4_))
{
int k1 = p_149841_7_ + p_149841_6_.nextInt(5) / 4;
@@ -297,7 +335,7 @@
{
if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && !this.canNeighborBurn(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_))
{
- p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
+ fireExtinguished(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); // CraftBukkit - fuel block gone
}
}
@@ -307,7 +345,7 @@
{
if (!World.doesBlockHaveSolidTopSurface(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_) && !this.canNeighborBurn(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
{
- p_149726_1_.setBlockToAir(p_149726_2_, p_149726_3_, p_149726_4_);
+ fireExtinguished(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); // CraftBukkit - fuel block broke
}
else
{
@@ -398,6 +436,16 @@
}
}
+ // CraftBukkit start
+ private void fireExtinguished(World world, int x, int y, int z)
+ {
+ if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), Blocks.air).isCancelled())
+ {
+ world.setBlockToAir(x, y, z);
+ }
+ }
+ // CraftBukkit end
+
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister p_149651_1_)
{

View File

@ -0,0 +1,64 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -15,6 +15,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import org.bukkit.block.BlockState;
+import org.bukkit.event.block.BlockSpreadEvent;
+import org.bukkit.event.block.BlockFadeEvent;
+// CraftBukkit end
+
public class BlockGrass extends Block implements IGrowable
{
private static final Logger logger = LogManager.getLogger();
@@ -45,11 +51,25 @@
{
if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ BlockState blockState = bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_).getState();
+ blockState.setTypeId(Block.getIdFromBlock(Blocks.dirt));
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ blockState.update(true);
+ }
+
+ // CraftBukkit end
}
else if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9)
{
- for (int l = 0; l < 4; ++l)
+ int numGrowth = Math.min(4, Math.max(20, (int)(4 * 100F / p_149674_1_.growthOdds))); // Spigot
+
+ for (int l = 0; l < numGrowth; ++l) // Spigot
{
int i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
int j1 = p_149674_3_ + p_149674_5_.nextInt(5) - 3;
@@ -58,7 +78,19 @@
if (p_149674_1_.getBlock(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
{
- p_149674_1_.setBlock(i1, j1, k1, Blocks.grass);
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
+ blockState.setTypeId(Block.getIdFromBlock(Blocks.grass));
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ blockState.update(true);
+ }
+
+ // CraftBukkit end
}
}
}

View File

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockHopper.java
+++ ../src-work/minecraft/net/minecraft/block/BlockHopper.java
@@ -22,6 +22,7 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraft.inventory.IInventory; // CraftBukkit
public class BlockHopper extends BlockContainer
{
@@ -210,7 +211,7 @@
public static int getDirectionFromMetadata(int p_149918_0_)
{
- return p_149918_0_ & 7;
+ return Math.min(p_149918_0_ & 7, 5); // CraftBukkit - Fix AIOOBE in callers
}
public static boolean func_149917_c(int p_149917_0_)

View File

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -86,6 +86,14 @@
{
if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11 - this.getLightOpacity())
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), Blocks.water).isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
+
if (p_149674_1_.provider.isHellWorld)
{
p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);

View File

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/block/BlockJukebox.java
+++ ../src-work/minecraft/net/minecraft/block/BlockJukebox.java
@@ -163,8 +163,23 @@
public void func_145857_a(ItemStack p_145857_1_)
{
+ // CraftBukkit start - There can only be one
+ if (p_145857_1_ != null)
+ {
+ p_145857_1_.stackSize = 1;
+ }
+
+ // CraftBukkit end
this.field_145858_a = p_145857_1_;
this.markDirty();
}
+
+ // Cauldron start
+ @Override
+ public boolean canUpdate()
+ {
+ return false;
+ }
+ // Cauldron end
}
}

View File

@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -18,6 +18,8 @@
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
{
int[] field_150128_a;
@@ -222,6 +224,16 @@
private void removeLeaves(World p_150126_1_, int p_150126_2_, int p_150126_3_, int p_150126_4_)
{
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(p_150126_1_.getWorld().getBlockAt(p_150126_2_, p_150126_3_, p_150126_4_));
+ p_150126_1_.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
this.dropBlockAsItem(p_150126_1_, p_150126_2_, p_150126_3_, p_150126_4_, p_150126_1_.getBlockMetadata(p_150126_2_, p_150126_3_, p_150126_4_), 0);
p_150126_1_.setBlockToAir(p_150126_2_, p_150126_3_, p_150126_4_);
}

View File

@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
@@ -13,6 +13,8 @@
import net.minecraftforge.common.util.ForgeDirection;
import static net.minecraftforge.common.util.ForgeDirection.*;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockLever extends Block
{
private static final String __OBFID = "CL_00000264";
@@ -270,6 +272,19 @@
int i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_);
int j1 = i1 & 7;
int k1 = 8 - (i1 & 8);
+ // CraftBukkit start - Interact Lever
+ org.bukkit.block.Block block = p_149727_1_.getWorld().getBlockAt(p_149727_2_, p_149727_3_, p_149727_4_);
+ int old = (k1 != 8) ? 15 : 0;
+ int current = (k1 == 8) ? 15 : 0;
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
+ p_149727_1_.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8))
+ {
+ return true;
+ }
+
+ // CraftBukkit end
p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1 + k1, 3);
p_149727_1_.playSoundEffect((double)p_149727_2_ + 0.5D, (double)p_149727_3_ + 0.5D, (double)p_149727_4_ + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
p_149727_1_.notifyBlocksOfNeighborChange(p_149727_2_, p_149727_3_, p_149727_4_, this);

View File

@ -0,0 +1,60 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -6,6 +6,12 @@
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
import net.minecraftforge.common.util.ForgeDirection;
+// CraftBukkit start
+import org.bukkit.block.BlockState;
+import org.bukkit.event.block.BlockSpreadEvent;
+import org.bukkit.TreeType;
+// CraftBukkit end
+
public class BlockMushroom extends BlockBush implements IGrowable
{
private static final String __OBFID = "CL_00000272";
@@ -19,7 +25,9 @@
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
- if (p_149674_5_.nextInt(25) == 0)
+ final int sourceX = p_149674_2_, sourceY = p_149674_3_, sourceZ = p_149674_4_; // CraftBukkit
+
+ if (p_149674_5_.nextInt(Math.max(1, (int) p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().mushroomModifier * 25)) == 0) // Spigot // Cauldron
{
byte b0 = 4;
int l = 5;
@@ -66,7 +74,19 @@
if (p_149674_1_.isAirBlock(i1, j1, k1) && this.canBlockStay(p_149674_1_, i1, j1, k1))
{
- p_149674_1_.setBlock(i1, j1, k1, this, 0, 2);
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
+ blockState.setTypeId(Block.getIdFromBlock(this)); // nms: this.id, 0, 2
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ blockState.update(true);
+ }
+
+ // CraftBukkit end
}
}
}
@@ -102,10 +122,12 @@
if (this == Blocks.brown_mushroom)
{
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
worldgenbigmushroom = new WorldGenBigMushroom(0);
}
else if (this == Blocks.red_mushroom)
{
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
worldgenbigmushroom = new WorldGenBigMushroom(1);
}

View File

@ -0,0 +1,64 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -12,6 +12,12 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.block.BlockState;
+import org.bukkit.event.block.BlockFadeEvent;
+import org.bukkit.event.block.BlockSpreadEvent;
+// CraftBukkit end
+
public class BlockMycelium extends Block
{
@SideOnly(Side.CLIENT)
@@ -39,11 +45,25 @@
{
if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ BlockState blockState = bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_).getState();
+ blockState.setTypeId(Block.getIdFromBlock(Blocks.dirt));
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ blockState.update(true);
+ }
+
+ // CraftBukkit end
}
else if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9)
{
- for (int l = 0; l < 4; ++l)
+ int numGrowth = Math.min(4, Math.max(20, (int)(4 * 100F / p_149674_1_.growthOdds))); // Spigot
+
+ for (int l = 0; l < numGrowth; ++l) // Spigot
{
int i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
int j1 = p_149674_3_ + p_149674_5_.nextInt(5) - 3;
@@ -52,7 +72,19 @@
if (p_149674_1_.getBlock(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
{
- p_149674_1_.setBlock(i1, j1, k1, this);
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149674_1_.getWorld();
+ BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
+ blockState.setTypeId(Block.getIdFromBlock(this));
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ blockState.update(true);
+ }
+
+ // CraftBukkit end
}
}
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -45,7 +45,7 @@
if (l < 3 && p_149674_5_.nextInt(10) == 0)
{
++l;
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, l); // CraftBukkit
}
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);

View File

@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherrack.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherrack.java
@@ -4,6 +4,11 @@
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
+// CraftBukkit start
+import org.bukkit.event.block.BlockRedstoneEvent;
+import net.minecraft.world.World;
+// CraftBukkit end
+
public class BlockNetherrack extends Block
{
private static final String __OBFID = "CL_00000275";
@@ -18,4 +23,17 @@
{
return MapColor.netherrackColor;
}
+
+ // CraftBukkit start
+ public void doPhysics(World world, int i, int j, int k, int l)
+ {
+ if (Block.getBlockById(l) != null && Block.getBlockById(l).canProvidePower())
+ {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
+ int power = block.getBlockPower();
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, power, power);
+ world.getServer().getPluginManager().callEvent(event);
+ }
+ }
+ // CraftBukkit end
}

View File

@ -0,0 +1,116 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -21,6 +21,12 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockPistonRetractEvent;
+import org.bukkit.event.block.BlockPistonExtendEvent;
+// CraftBukkit end
+
public class BlockPistonBase extends Block
{
private final boolean isSticky;
@@ -128,13 +134,37 @@
if (flag && !isExtended(l))
{
- if (canExtend(p_150078_1_, p_150078_2_, p_150078_3_, p_150078_4_, i1))
+ // CraftBukkit start
+ int length = canExtend_IntCB(p_150078_1_, p_150078_2_, p_150078_3_, p_150078_4_, i1);
+
+ if (length >= 0)
{
+ org.bukkit.block.Block block = p_150078_1_.getWorld().getBlockAt(p_150078_2_, p_150078_3_, p_150078_4_);
+ BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
+ p_150078_1_.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_150078_1_.addBlockEvent(p_150078_2_, p_150078_3_, p_150078_4_, this, 0, i1);
}
}
else if (!flag && isExtended(l))
{
+ // CraftBukkit start
+ org.bukkit.block.Block block = p_150078_1_.getWorld().getBlockAt(p_150078_2_, p_150078_3_, p_150078_4_);
+ BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
+ p_150078_1_.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_150078_1_.setBlockMetadataWithNotify(p_150078_2_, p_150078_3_, p_150078_4_, i1, 2);
p_150078_1_.addBlockEvent(p_150078_2_, p_150078_3_, p_150078_4_, this, 1, i1);
}
@@ -297,6 +327,11 @@
public static int getPistonOrientation(int p_150076_0_)
{
+ if ((p_150076_0_ & 7) >= Facing.oppositeSide.length)
+ {
+ return 7; // CraftBukkit - check for AIOOB on piston data
+ }
+
return p_150076_0_ & 7;
}
@@ -366,7 +401,13 @@
}
}
- private static boolean canExtend(World p_150077_0_, int p_150077_1_, int p_150077_2_, int p_150077_3_, int p_150077_4_)
+ // Cauldron start - vanilla compatibility
+ private static boolean canExtend(World world, int i, int j, int k, int l) {
+ return canExtend_IntCB(world, i, j, k, l) >= 0;
+ }
+ // Cauldron end
+
+ private static int canExtend_IntCB(World p_150077_0_, int p_150077_1_, int p_150077_2_, int p_150077_3_, int p_150077_4_) // CraftBukkit int -> boolean
{
int i1 = p_150077_1_ + Facing.offsetsXForSide[p_150077_4_];
int j1 = p_150077_2_ + Facing.offsetsYForSide[p_150077_4_];
@@ -379,7 +420,7 @@
{
if (j1 <= 0 || j1 >= p_150077_0_.getHeight())
{
- return false;
+ return -1; // CraftBukkit
}
Block block = p_150077_0_.getBlock(i1, j1, k1);
@@ -388,14 +429,14 @@
{
if (!canPushBlock(block, p_150077_0_, i1, j1, k1, true))
{
- return false;
+ return -1; // CraftBukkit
}
if (block.getMobilityFlag() != 1)
{
if (l1 == 12)
{
- return false;
+ return -1; // CraftBukkit
}
i1 += Facing.offsetsXForSide[p_150077_4_];
@@ -407,7 +448,7 @@
}
}
- return true;
+ return l1; // CraftBukkit
}
}

View File

@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonExtension.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonExtension.java
@@ -55,6 +55,12 @@
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
+
+ if ((p_149749_6_ & 7) >= Facing.oppositeSide.length)
+ {
+ return; // CraftBukkit - fix a piston AIOOBE issue
+ }
+
int i1 = Facing.oppositeSide[getDirectionMeta(p_149749_6_)];
p_149749_2_ += Facing.offsetsXForSide[i1];
p_149749_3_ += Facing.offsetsYForSide[i1];
@@ -200,6 +206,12 @@
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
{
int l = getDirectionMeta(p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_));
+
+ if ((l & 7) >= Facing.oppositeSide.length)
+ {
+ return; // CraftBukkit - fix a piston AIOOBE issue
+ }
+
Block block1 = p_149695_1_.getBlock(p_149695_2_ - Facing.offsetsXForSide[l], p_149695_3_ - Facing.offsetsYForSide[l], p_149695_4_ - Facing.offsetsZForSide[l]);
if (block1 != Blocks.piston && block1 != Blocks.sticky_piston)

View File

@ -0,0 +1,383 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPortal.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPortal.java
@@ -14,6 +14,11 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityPortalEnterEvent;
+import org.bukkit.event.world.PortalCreateEvent;
+// CraftBukkit end
+
public class BlockPortal extends BlockBreakable
{
public static final int[][] field_150001_a = new int[][] {new int[0], {3, 1}, {2, 0}};
@@ -29,7 +34,7 @@
{
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
- if (p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId())
+ if (p_149674_1_.getSpigotConfig().enableZombiePigmenPortalSpawns && p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId()) // Spigot // Cauldron
{
int l;
@@ -104,13 +109,15 @@
if (size.func_150860_b() && size.field_150864_e == 0)
{
- size.func_150859_c();
- return true;
+ // CraftBukkit start - return portalcreator
+ return size.CB_func_150859_c(); // Cauldron
+ //return true;
}
else if (size1.func_150860_b() && size1.field_150864_e == 0)
{
- size1.func_150859_c();
- return true;
+ return size1.CB_func_150859_c(); // Cauldron
+ //return true;
+ // CraftBukkit end
}
else
{
@@ -181,6 +188,10 @@
{
if (p_149670_5_.ridingEntity == null && p_149670_5_.riddenByEntity == null)
{
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(p_149670_5_.getBukkitEntity(), new org.bukkit.Location(p_149670_1_.getWorld(), p_149670_2_, p_149670_3_, p_149670_4_));
+ p_149670_1_.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
p_149670_5_.setInPortal();
}
}
@@ -239,175 +250,223 @@
}
public static class Size
+ {
+ private final World field_150867_a;
+ private final int field_150865_b;
+ private final int field_150866_c;
+ private final int field_150863_d;
+ private int field_150864_e = 0;
+ private ChunkCoordinates field_150861_f;
+ private int field_150862_g;
+ private int field_150868_h;
+ java.util.Collection<org.bukkit.block.Block> blocks; // CraftBukkit
+ private static final String __OBFID = "CL_00000285";
+
+ public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, int p_i45415_4_, int p_i45415_5_)
{
- private final World field_150867_a;
- private final int field_150865_b;
- private final int field_150866_c;
- private final int field_150863_d;
- private int field_150864_e = 0;
- private ChunkCoordinates field_150861_f;
- private int field_150862_g;
- private int field_150868_h;
- private static final String __OBFID = "CL_00000285";
+ this.field_150867_a = p_i45415_1_;
+ this.field_150865_b = p_i45415_5_;
+ this.field_150863_d = BlockPortal.field_150001_a[p_i45415_5_][0];
+ this.field_150866_c = BlockPortal.field_150001_a[p_i45415_5_][1];
- public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, int p_i45415_4_, int p_i45415_5_)
+ for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_ > 0 && this.func_150857_a(p_i45415_1_.getBlock(p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_)
{
- this.field_150867_a = p_i45415_1_;
- this.field_150865_b = p_i45415_5_;
- this.field_150863_d = BlockPortal.field_150001_a[p_i45415_5_][0];
- this.field_150866_c = BlockPortal.field_150001_a[p_i45415_5_][1];
+ ;
+ }
- for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_ > 0 && this.func_150857_a(p_i45415_1_.getBlock(p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_)
+ int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_, p_i45415_4_, this.field_150863_d) - 1;
+
+ if (j1 >= 0)
+ {
+ this.field_150861_f = new ChunkCoordinates(p_i45415_2_ + j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_, p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]);
+ this.field_150868_h = this.func_150853_a(this.field_150861_f.posX, this.field_150861_f.posY, this.field_150861_f.posZ, this.field_150866_c);
+
+ if (this.field_150868_h < 2 || this.field_150868_h > 21)
{
- ;
+ this.field_150861_f = null;
+ this.field_150868_h = 0;
}
+ }
- int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_, p_i45415_4_, this.field_150863_d) - 1;
+ if (this.field_150861_f != null)
+ {
+ this.field_150862_g = this.func_150858_a();
+ }
+ }
- if (j1 >= 0)
- {
- this.field_150861_f = new ChunkCoordinates(p_i45415_2_ + j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_, p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]);
- this.field_150868_h = this.func_150853_a(this.field_150861_f.posX, this.field_150861_f.posY, this.field_150861_f.posZ, this.field_150866_c);
+ protected int func_150853_a(int p_150853_1_, int p_150853_2_, int p_150853_3_, int p_150853_4_)
+ {
+ int j1 = Direction.offsetX[p_150853_4_];
+ int k1 = Direction.offsetZ[p_150853_4_];
+ int i1;
+ Block block;
- if (this.field_150868_h < 2 || this.field_150868_h > 21)
- {
- this.field_150861_f = null;
- this.field_150868_h = 0;
- }
+ for (i1 = 0; i1 < 22; ++i1)
+ {
+ block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
+
+ if (!this.func_150857_a(block))
+ {
+ break;
}
- if (this.field_150861_f != null)
+ Block block1 = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_ - 1, p_150853_3_ + k1 * i1);
+
+ if (block1 != Blocks.obsidian)
{
- this.field_150862_g = this.func_150858_a();
+ break;
}
}
- protected int func_150853_a(int p_150853_1_, int p_150853_2_, int p_150853_3_, int p_150853_4_)
+ block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
+ return block == Blocks.obsidian ? i1 : 0;
+ }
+
+ protected int func_150858_a()
+ {
+ this.blocks = new java.util.HashSet<org.bukkit.block.Block>(); // CraftBukkit
+ org.bukkit.World bworld = this.field_150867_a.getWorld();
+ int i;
+ int j;
+ int k;
+ int l;
+ label56:
+
+ for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
{
- int j1 = Direction.offsetX[p_150853_4_];
- int k1 = Direction.offsetZ[p_150853_4_];
- int i1;
- Block block;
+ i = this.field_150861_f.posY + this.field_150862_g;
- for (i1 = 0; i1 < 22; ++i1)
+ for (j = 0; j < this.field_150868_h; ++j)
{
- block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
+ k = this.field_150861_f.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
+ l = this.field_150861_f.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
+ Block block = this.field_150867_a.getBlock(k, i, l);
if (!this.func_150857_a(block))
{
- break;
+ break label56;
}
- Block block1 = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_ - 1, p_150853_3_ + k1 * i1);
-
- if (block1 != Blocks.obsidian)
+ if (block == Blocks.portal)
{
- break;
+ ++this.field_150864_e;
}
- }
- block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
- return block == Blocks.obsidian ? i1 : 0;
- }
-
- protected int func_150858_a()
- {
- int i;
- int j;
- int k;
- int l;
- label56:
-
- for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
- {
- i = this.field_150861_f.posY + this.field_150862_g;
-
- for (j = 0; j < this.field_150868_h; ++j)
+ if (j == 0)
{
- k = this.field_150861_f.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
- l = this.field_150861_f.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
- Block block = this.field_150867_a.getBlock(k, i, l);
+ block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][0]]);
- if (!this.func_150857_a(block))
+ if (block != Blocks.obsidian)
{
break label56;
+ // CraftBukkit start - add the block to our list
}
-
- if (block == Blocks.portal)
+ else
{
- ++this.field_150864_e;
+ blocks.add(bworld.getBlockAt(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][0]]));
+ // CraftBukkit end
}
+ }
+ else if (j == this.field_150868_h - 1)
+ {
+ block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]]);
- if (j == 0)
+ if (block != Blocks.obsidian)
{
- block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][0]]);
-
- if (block != Blocks.obsidian)
- {
- break label56;
- }
+ break label56;
+ // CraftBukkit start - add the block to our list
}
- else if (j == this.field_150868_h - 1)
+ else
{
- block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]]);
-
- if (block != Blocks.obsidian)
- {
- break label56;
- }
+ blocks.add(bworld.getBlockAt(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]]));
+ // CraftBukkit end
}
}
}
+ }
- for (i = 0; i < this.field_150868_h; ++i)
- {
- j = this.field_150861_f.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
- k = this.field_150861_f.posY + this.field_150862_g;
- l = this.field_150861_f.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
+ for (i = 0; i < this.field_150868_h; ++i)
+ {
+ j = this.field_150861_f.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
+ k = this.field_150861_f.posY + this.field_150862_g;
+ l = this.field_150861_f.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
- if (this.field_150867_a.getBlock(j, k, l) != Blocks.obsidian)
- {
- this.field_150862_g = 0;
- break;
- }
- }
-
- if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
+ if (this.field_150867_a.getBlock(j, k, l) != Blocks.obsidian)
{
- return this.field_150862_g;
- }
- else
- {
- this.field_150861_f = null;
- this.field_150868_h = 0;
this.field_150862_g = 0;
- return 0;
+ break;
}
}
- protected boolean func_150857_a(Block p_150857_1_)
+ if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
{
- return p_150857_1_.blockMaterial == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal;
+ return this.field_150862_g;
}
+ else
+ {
+ this.field_150861_f = null;
+ this.field_150868_h = 0;
+ this.field_150862_g = 0;
+ return 0;
+ }
+ }
- public boolean func_150860_b()
+ protected boolean func_150857_a(Block p_150857_1_)
+ {
+ return p_150857_1_.blockMaterial == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal;
+ }
+
+ public boolean func_150860_b()
+ {
+ return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21;
+ }
+
+ // Cauldron start - vanilla compatibility
+ public void func_150859_c()
+ {
+ this.CB_func_150859_c();
+ }
+ // Cauldron end
+
+ public boolean CB_func_150859_c()
+ {
+ org.bukkit.World bworld = this.field_150867_a.getWorld();
+
+ // Copy below for loop
+ for (int i = 0; i < this.field_150868_h; ++i)
{
- return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21;
+ int j = this.field_150861_f.posX + Direction.offsetX[this.field_150866_c] * i;
+ int k = this.field_150861_f.posZ + Direction.offsetZ[this.field_150866_c] * i;
+
+ for (int l = 0; l < this.field_150862_g; ++l)
+ {
+ int i1 = this.field_150861_f.posY + l;
+ bworld.getBlockAt(j, i1, k);
+ }
}
- public void func_150859_c()
+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
+ this.field_150867_a.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
{
+ return false;
+ }
+ // CraftBukkit end
+
for (int i = 0; i < this.field_150868_h; ++i)
{
int j = this.field_150861_f.posX + Direction.offsetX[this.field_150866_c] * i;
int k = this.field_150861_f.posZ + Direction.offsetZ[this.field_150866_c] * i;
-
+
for (int l = 0; l < this.field_150862_g; ++l)
{
int i1 = this.field_150861_f.posY + l;
this.field_150867_a.setBlock(j, i1, k, Blocks.portal, this.field_150865_b, 2);
}
}
+
+ return true; // CraftBukkit
}
}
}

View File

@ -0,0 +1,47 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPressurePlate.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPressurePlate.java
@@ -8,6 +8,8 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+
public class BlockPressurePlate extends BlockBasePressurePlate
{
private BlockPressurePlate.Sensitivity field_150069_a;
@@ -54,8 +56,34 @@
while (iterator.hasNext())
{
- Entity entity = (Entity)iterator.next();
+ Entity entity = (Entity) iterator.next();
+ // CraftBukkit start - Call interact event when turning on a pressure plate
+ if (this.func_150060_c(p_150065_1_.getBlockMetadata(p_150065_2_, p_150065_3_, p_150065_4_)) == 0)
+ {
+ org.bukkit.World bworld = p_150065_1_.getWorld();
+ org.bukkit.plugin.PluginManager manager = p_150065_1_.getServer().getPluginManager();
+ org.bukkit.event.Cancellable cancellable;
+
+ if (entity instanceof EntityPlayer)
+ {
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) entity, org.bukkit.event.block.Action.PHYSICAL, p_150065_2_, p_150065_3_, p_150065_4_, -1, null);
+ }
+ else
+ {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(p_150065_2_, p_150065_3_, p_150065_4_));
+ manager.callEvent((EntityInteractEvent) cancellable);
+ }
+
+ // We only want to block turning the plate on if all events are cancelled
+ if (cancellable.isCancelled())
+ {
+ continue;
+ }
+ }
+
+ // CraftBukkit end
+
if (!entity.doesEntityNotTriggerPressurePlate())
{
return 15;

View File

@ -0,0 +1,63 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java
@@ -5,6 +5,12 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+// CraftBukkit start
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
+
public class BlockPressurePlateWeighted extends BlockBasePressurePlate
{
private final int field_150068_a;
@@ -18,18 +24,43 @@
protected int func_150065_e(World p_150065_1_, int p_150065_2_, int p_150065_3_, int p_150065_4_)
{
- int l = Math.min(p_150065_1_.getEntitiesWithinAABB(Entity.class, this.func_150061_a(p_150065_2_, p_150065_3_, p_150065_4_)).size(), this.field_150068_a);
+ // CraftBukkit start
+ int l = 0;
+ java.util.Iterator iterator = p_150065_1_.getEntitiesWithinAABB(Entity.class, this.func_150061_a(p_150065_2_, p_150065_3_, p_150065_4_)).iterator();
- if (l <= 0)
+ while (iterator.hasNext())
{
- return 0;
+ Entity entity = (Entity) iterator.next();
+ org.bukkit.event.Cancellable cancellable;
+
+ if (entity instanceof EntityPlayer)
+ {
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) entity, org.bukkit.event.block.Action.PHYSICAL, p_150065_2_, p_150065_3_, p_150065_4_, -1, null);
}
else
{
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), p_150065_1_.getWorld().getBlockAt(p_150065_2_, p_150065_3_, p_150065_4_));
+ p_150065_1_.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ // We only want to block turning the plate on if all events are cancelled
+ if (!cancellable.isCancelled())
+ {
+ l++;
+ }
+ }
+
+ l = Math.min(l, this.field_150068_a);
+ // CraftBukkit end
+
+ if (l <= 0)
+ {
+ return 0;
+ }
+
float f = (float)Math.min(this.field_150068_a, l) / (float)this.field_150068_a;
return MathHelper.ceiling_float_int(f * 15.0F);
}
- }
protected int func_150060_c(int p_150060_1_)
{

View File

@ -0,0 +1,126 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
@@ -14,6 +14,12 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
+import org.bukkit.event.block.BlockRedstoneEvent;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockPumpkin extends BlockDirectional
{
private boolean field_149985_a;
@@ -45,15 +51,18 @@
{
if (!p_149726_1_.isRemote)
{
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0), 0, 2);
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0), 0, 2);
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149726_1_.getWorld());
+ blockList.setTypeId(p_149726_2_, p_149726_3_, p_149726_4_, 0);
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_, 0);
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 2, p_149726_4_, 0);
EntitySnowman entitysnowman = new EntitySnowman(p_149726_1_);
- entitysnowman.setLocationAndAngles((double)p_149726_2_ + 0.5D, (double)p_149726_3_ - 1.95D, (double)p_149726_4_ + 0.5D, 0.0F, 0.0F);
- p_149726_1_.spawnEntityInWorld(entitysnowman);
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0));
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0));
+ entitysnowman.setLocationAndAngles((double) p_149726_2_ + 0.5D, (double) p_149726_3_ - 1.95D, (double) p_149726_4_ + 0.5D, 0.0F, 0.0F);
+
+ if (p_149726_1_.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN))
+ {
+ blockList.updateList();
+ }
}
for (int i1 = 0; i1 < 120; ++i1)
@@ -68,45 +77,38 @@
if (flag || flag1)
{
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0), 0, 2);
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0), 0, 2);
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149726_1_.getWorld());
+ blockList.setTypeId(p_149726_2_, p_149726_3_, p_149726_4_, 0);
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_, 0);
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 2, p_149726_4_, 0);
if (flag)
{
- p_149726_1_.setBlock(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
- p_149726_1_.setBlock(p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
+ blockList.setTypeId(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_, 0);
+ blockList.setTypeId(p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_, 0);
}
else
{
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1, getBlockById(0), 0, 2);
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1, getBlockById(0), 0, 2);
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1, 0);
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1, 0);
}
EntityIronGolem entityirongolem = new EntityIronGolem(p_149726_1_);
entityirongolem.setPlayerCreated(true);
- entityirongolem.setLocationAndAngles((double)p_149726_2_ + 0.5D, (double)p_149726_3_ - 1.95D, (double)p_149726_4_ + 0.5D, 0.0F, 0.0F);
- p_149726_1_.spawnEntityInWorld(entityirongolem);
+ entityirongolem.setLocationAndAngles((double) p_149726_2_ + 0.5D, (double) p_149726_3_ - 1.95D, (double) p_149726_4_ + 0.5D, 0.0F, 0.0F);
- for (int l = 0; l < 120; ++l)
+ if (p_149726_1_.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM))
{
- p_149726_1_.spawnParticle("snowballpoof", (double)p_149726_2_ + p_149726_1_.rand.nextDouble(), (double)(p_149726_3_ - 2) + p_149726_1_.rand.nextDouble() * 3.9D, (double)p_149726_4_ + p_149726_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
- }
+ for (int i1 = 0; i1 < 120; ++i1)
+ {
+ p_149726_1_.spawnParticle("snowballpoof", (double) p_149726_2_ + p_149726_1_.rand.nextDouble(), (double)(p_149726_3_ - 2) + p_149726_1_.rand.nextDouble() * 3.9D, (double) p_149726_4_ + p_149726_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
+ }
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0));
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0));
-
- if (flag)
- {
- p_149726_1_.notifyBlockChange(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
- p_149726_1_.notifyBlockChange(p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
+ blockList.updateList();
}
- else
- {
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1, getBlockById(0));
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1, getBlockById(0));
- }
+
+ // CraftBukkit end
}
}
}
@@ -122,6 +124,19 @@
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, l, 2);
}
+ // CraftBukkit start
+ public void onNeighborBlockChange(World world, int i, int j, int k, Block block)
+ {
+ if (block != null && block.canProvidePower())
+ {
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
+ int power = bukkitBlock.getBlockPower();
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ }
+ }
+ // CraftBukkit end
+
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister p_149651_1_)
{

View File

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailDetector.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailDetector.java
@@ -16,6 +16,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRailDetector extends BlockRailBase
{
@SideOnly(Side.CLIENT)
@@ -86,6 +88,17 @@
flag1 = true;
}
+ // CraftBukkit start
+ if (flag != flag1)
+ {
+ org.bukkit.block.Block block = p_150054_1_.getWorld().getBlockAt(p_150054_2_, p_150054_3_, p_150054_4_);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
+ p_150054_1_.getServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ }
+
+ // CraftBukkit end
+
if (flag1 && !flag)
{
p_150054_1_.setBlockMetadataWithNotify(p_150054_2_, p_150054_3_, p_150054_4_, p_150054_5_ | 8, 3);

View File

@ -0,0 +1,43 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java
@@ -13,6 +13,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public abstract class BlockRedstoneDiode extends BlockDirectional
{
protected final boolean isRepeaterPowered;
@@ -44,16 +46,30 @@
{
int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
- if (!this.func_149910_g(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, l))
+ if (!this.func_149910_g((IBlockAccess) p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, l)) // CraftBukkit - Cast world to IBlockAccess to call the right method.
{
boolean flag = this.isGettingInput(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, l);
if (this.isRepeaterPowered && !flag)
{
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, 15, 0).getNewCurrent() != 0)
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, this.getBlockUnpowered(), l, 2);
}
else if (!this.isRepeaterPowered)
{
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, 0, 15).getNewCurrent() != 15)
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, this.getBlockPowered(), l, 2);
if (!flag)

View File

@ -0,0 +1,53 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneLight.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneLight.java
@@ -9,6 +9,8 @@
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLight extends Block
{
private final boolean field_150171_a;
@@ -35,6 +37,13 @@
}
else if (!this.field_150171_a && p_149726_1_.isBlockIndirectlyGettingPowered(p_149726_2_, p_149726_3_, p_149726_4_))
{
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, 0, 15).getNewCurrent() != 15)
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, Blocks.lit_redstone_lamp, 0, 2);
}
}
@@ -50,6 +59,13 @@
}
else if (!this.field_150171_a && p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_))
{
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, 0, 15).getNewCurrent() != 15)
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_149695_1_.setBlock(p_149695_2_, p_149695_3_, p_149695_4_, Blocks.lit_redstone_lamp, 0, 2);
}
}
@@ -59,6 +75,13 @@
{
if (!p_149674_1_.isRemote && this.field_150171_a && !p_149674_1_.isBlockIndirectlyGettingPowered(p_149674_2_, p_149674_3_, p_149674_4_))
{
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, 15, 0).getNewCurrent() != 0)
+ {
+ return;
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.redstone_lamp, 0, 2);
}
}

View File

@ -0,0 +1,44 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java
@@ -13,6 +13,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+
public class BlockRedstoneOre extends Block
{
private boolean field_150187_a;
@@ -43,8 +45,30 @@
public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity p_149724_5_)
{
- this.func_150185_e(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_);
- super.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
+ // CraftBukkit start
+ if (p_149724_5_ instanceof EntityPlayer)
+ {
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) p_149724_5_, org.bukkit.event.block.Action.PHYSICAL, p_149724_2_, p_149724_3_, p_149724_4_, -1, null);
+
+ if (!event.isCancelled())
+ {
+ this.func_150185_e(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_);
+ super.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
+ }
+ }
+ else
+ {
+ EntityInteractEvent event = new EntityInteractEvent(p_149724_5_.getBukkitEntity(), p_149724_1_.getWorld().getBlockAt(p_149724_2_, p_149724_3_, p_149724_4_));
+ p_149724_1_.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ this.func_150185_e(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_);
+ super.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
+ }
+ }
+
+ // CraftBukkit end
}
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)

View File

@ -0,0 +1,62 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneTorch.java
@@ -13,6 +13,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneTorch extends BlockTorch
{
private boolean field_150113_a;
@@ -125,10 +127,30 @@
list.remove(0);
}
+ // CraftBukkit start
+ org.bukkit.plugin.PluginManager manager = p_149674_1_.getServer().getPluginManager();
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+ int oldCurrent = this.field_150113_a ? 15 : 0;
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
+ // CraftBukkit end
+
if (this.field_150113_a)
{
if (flag)
{
+ // CraftBukkit start
+ if (oldCurrent != 0)
+ {
+ event.setNewCurrent(0);
+ manager.callEvent(event);
+
+ if (event.getNewCurrent() != 0)
+ {
+ return;
+ }
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.unlit_redstone_torch, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 3);
if (this.func_150111_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, true))
@@ -147,6 +169,19 @@
}
else if (!flag && !this.func_150111_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, false))
{
+ // CraftBukkit start
+ if (oldCurrent != 15)
+ {
+ event.setNewCurrent(15);
+ manager.callEvent(event);
+
+ if (event.getNewCurrent() != 15)
+ {
+ return;
+ }
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.redstone_torch, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 3);
}
}

View File

@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -18,6 +18,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneWire extends Block
{
private boolean field_150181_a = true;
@@ -159,8 +161,17 @@
i3 = l1;
}
+ // CraftBukkit start
if (k1 != i3)
{
+ BlockRedstoneEvent event = new BlockRedstoneEvent(p_150175_1_.getWorld().getBlockAt(p_150175_2_, p_150175_3_, p_150175_4_), k1, i3);
+ p_150175_1_.getServer().getPluginManager().callEvent(event);
+ i3 = event.getNewCurrent();
+ }
+
+ // CraftBukkit end
+ if (k1 != i3)
+ {
p_150175_1_.setBlockMetadataWithNotify(p_150175_2_, p_150175_3_, p_150175_4_, i3, 2);
this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_));
this.field_150179_b.add(new ChunkPosition(p_150175_2_ - 1, p_150175_3_, p_150175_4_));
@@ -294,7 +305,8 @@
}
}
- private int func_150178_a(World p_150178_1_, int p_150178_2_, int p_150178_3_, int p_150178_4_, int p_150178_5_)
+ // CraftBukkit - private -> public
+ public int func_150178_a(World p_150178_1_, int p_150178_2_, int p_150178_3_, int p_150178_4_, int p_150178_5_)
{
if (p_150178_1_.getBlock(p_150178_2_, p_150178_3_, p_150178_4_) != this)
{

View File

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
@@ -44,9 +44,9 @@
{
int i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
- if (i1 == 15)
+ if (i1 >= (byte) range(3, (p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().caneModifier * 15) + 0.5F, 15)) // Spigot // Cauldron
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, 0); // CraftBukkit
p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4);
}
else

View File

@ -0,0 +1,122 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java
@@ -22,10 +22,18 @@
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.TreeType;
+import org.bukkit.block.BlockState;
+import org.bukkit.event.world.StructureGrowEvent;
+// CraftBukkit end
+
public class BlockSapling extends BlockBush implements IGrowable
{
public static final String[] field_149882_a = new String[] {"oak", "spruce", "birch", "jungle", "acacia", "roofed_oak"};
private static final IIcon[] field_149881_b = new IIcon[field_149882_a.length];
+ public static TreeType treeType; // CraftBukkit
private static final String __OBFID = "CL_00000305";
protected BlockSapling()
@@ -41,9 +49,31 @@
{
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
- if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9 && p_149674_5_.nextInt(7) == 0)
+ if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9 && (p_149674_5_.nextInt(Math.max(2, (int)((p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().saplingModifier * 7) + 0.5F))) == 0)) // Spigot // Cauldron
{
+ // Cauldron start
+ p_149674_1_.captureTreeGeneration = true;
this.func_149879_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
+ p_149674_1_.captureTreeGeneration = false;
+ if (p_149674_1_.capturedBlockStates.size() > 0)
+ {
+ TreeType treeType = BlockSapling.treeType;
+ BlockSapling.treeType = null;
+ Location location = new Location(p_149674_1_.getWorld(), p_149674_2_, p_149674_3_, p_149674_4_);
+ List<BlockState> blocks = (List<BlockState>) p_149674_1_.capturedBlockStates.clone();
+ p_149674_1_.capturedBlockStates.clear();
+ StructureGrowEvent event = null;
+ if (treeType != null) {
+ event = new StructureGrowEvent(location, treeType, false, null, blocks);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ }
+ if (event == null || !event.isCancelled()) {
+ for (BlockState blockstate : blocks) {
+ blockstate.update(true);
+ }
+ }
+ }
+ //Cauldron end
}
}
}
@@ -73,7 +103,20 @@
{
if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_149878_1_, p_149878_5_, p_149878_2_, p_149878_3_, p_149878_4_)) return;
int l = p_149878_1_.getBlockMetadata(p_149878_2_, p_149878_3_, p_149878_4_) & 7;
- Object object = p_149878_5_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
+ // CraftBukkit start
+ Object object = null;
+ if (p_149878_5_.nextInt(10) == 0)
+ {
+ treeType = TreeType.BIG_TREE; // CraftBukkit
+ object = new WorldGenBigTree(true);
+ }
+ else
+ {
+ treeType = TreeType.TREE; // CraftBukkit
+ object = new WorldGenTrees(true);
+ }
+ // CraftBukkit end
+
int i1 = 0;
int j1 = 0;
boolean flag = false;
@@ -84,6 +127,7 @@
default:
break;
case 1:
+ treeType = TreeType.REDWOOD; // CraftBukkit
label78:
for (i1 = 0; i1 >= -1; --i1)
@@ -108,6 +152,7 @@
break;
case 2:
+ treeType = TreeType.BIRCH; // CraftBukkit
object = new WorldGenForest(true, false);
break;
case 3:
@@ -119,6 +164,7 @@
{
if (this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, 3) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, 3) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, 3) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, 3))
{
+ treeType = TreeType.JUNGLE; // CraftBukkit
object = new WorldGenMegaJungle(true, 10, 20, 3, 3);
flag = true;
break label93;
@@ -130,11 +176,13 @@
{
j1 = 0;
i1 = 0;
+ treeType = TreeType.SMALL_JUNGLE; // CraftBukkit
object = new WorldGenTrees(true, 4 + p_149878_5_.nextInt(7), 3, 3, false);
}
break;
case 4:
+ treeType = TreeType.ACACIA; // CraftBukkit
object = new WorldGenSavannaTree(true);
break;
case 5:
@@ -147,6 +195,7 @@
if (this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, 5) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, 5) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, 5) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, 5))
{
object = new WorldGenCanopyTree(true);
+ treeType = TreeType.DARK_OAK; // CraftBukkit
flag = true;
break label108;
}

View File

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSign.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSign.java
@@ -14,6 +14,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockSign extends BlockContainer
{
private Class field_149968_a;
@@ -163,6 +165,17 @@
}
super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);
+
+ // CraftBukkit start
+ if (p_149695_5_ != null && p_149695_5_.canProvidePower())
+ {
+ org.bukkit.block.Block bukkitBlock = p_149695_1_.getWorld().getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
+ int power = bukkitBlock.getBlockPower();
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
+ }
+
+ // CraftBukkit end
}
@SideOnly(Side.CLIENT)

View File

@ -0,0 +1,156 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
@@ -27,6 +27,11 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockSkull extends BlockContainer
{
private static final String __OBFID = "CL_00000307";
@@ -172,16 +177,18 @@
{
if (p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2) == Blocks.soul_sand && this.func_149966_a(p_149965_1_, p_149965_2_, p_149965_3_, p_149965_4_ + l, 1) && this.func_149966_a(p_149965_1_, p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, 1) && this.func_149966_a(p_149965_1_, p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, 1))
{
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149965_1_.getWorld());
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_, p_149965_3_, p_149965_4_ + l, 8, 2);
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, 8, 2);
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, 8, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_, p_149965_4_ + l, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_, p_149965_4_ + l, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
if (!p_149965_1_.isRemote)
{
@@ -190,18 +197,21 @@
entitywither.renderYawOffset = 90.0F;
entitywither.func_82206_m();
- if (!p_149965_1_.isRemote)
+ if (p_149965_1_.addEntity(entitywither, SpawnReason.BUILD_WITHER))
{
- iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
-
- while (iterator.hasNext())
+ if (!p_149965_1_.isRemote)
{
- entityplayer = (EntityPlayer)iterator.next();
- entityplayer.triggerAchievement(AchievementList.field_150963_I);
+ iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
+
+ while (iterator.hasNext())
+ {
+ entityplayer = (EntityPlayer) iterator.next();
+ entityplayer.triggerAchievement(AchievementList.field_150963_I);
+ }
}
- }
- p_149965_1_.spawnEntityInWorld(entitywither);
+ blockList.updateList();
+ }
}
for (i1 = 0; i1 < 120; ++i1)
@@ -209,13 +219,7 @@
p_149965_1_.spawnParticle("snowballpoof", (double)p_149965_2_ + p_149965_1_.rand.nextDouble(), (double)(p_149965_3_ - 2) + p_149965_1_.rand.nextDouble() * 3.9D, (double)(p_149965_4_ + l + 1) + p_149965_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
}
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_, p_149965_4_ + l, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1, getBlockById(0));
+ // CraftBukkit end
return;
}
}
@@ -224,16 +228,18 @@
{
if (p_149965_1_.getBlock(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_) == Blocks.soul_sand && this.func_149966_a(p_149965_1_, p_149965_2_ + l, p_149965_3_, p_149965_4_, 1) && this.func_149966_a(p_149965_1_, p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, 1) && this.func_149966_a(p_149965_1_, p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, 1))
{
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149965_1_.getWorld());
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_ + l, p_149965_3_, p_149965_4_, 8, 2);
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, 8, 2);
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, 8, 2);
- p_149965_1_.setBlock(p_149965_2_ + l, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
- p_149965_1_.setBlock(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
+ blockList.setTypeAndData(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_, getBlockById(0), 0, 2);
if (!p_149965_1_.isRemote)
{
@@ -241,18 +247,21 @@
entitywither.setLocationAndAngles((double)(p_149965_2_ + l) + 1.5D, (double)p_149965_3_ - 1.45D, (double)p_149965_4_ + 0.5D, 0.0F, 0.0F);
entitywither.func_82206_m();
- if (!p_149965_1_.isRemote)
+ if (p_149965_1_.addEntity(entitywither, SpawnReason.BUILD_WITHER))
{
- iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
-
- while (iterator.hasNext())
+ if (!p_149965_1_.isRemote)
{
- entityplayer = (EntityPlayer)iterator.next();
- entityplayer.triggerAchievement(AchievementList.field_150963_I);
+ iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
+
+ while (iterator.hasNext())
+ {
+ entityplayer = (EntityPlayer) iterator.next();
+ entityplayer.triggerAchievement(AchievementList.field_150963_I);
+ }
}
- }
- p_149965_1_.spawnEntityInWorld(entitywither);
+ blockList.updateList();
+ }
}
for (i1 = 0; i1 < 120; ++i1)
@@ -260,13 +269,7 @@
p_149965_1_.spawnParticle("snowballpoof", (double)(p_149965_2_ + l + 1) + p_149965_1_.rand.nextDouble(), (double)(p_149965_3_ - 2) + p_149965_1_.rand.nextDouble() * 3.9D, (double)p_149965_4_ + p_149965_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
}
- p_149965_1_.notifyBlockChange(p_149965_2_ + l, p_149965_3_, p_149965_4_, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_, getBlockById(0));
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_, getBlockById(0));
+ // CraftBukkit end
return;
}
}

View File

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -114,6 +114,14 @@
{
if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11)
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), Blocks.air).isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
+ this.dropBlockAsItem(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 0);
p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
}
}

View File

@ -0,0 +1,57 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java
@@ -5,6 +5,8 @@
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockStaticLiquid extends BlockLiquid
{
private static final String __OBFID = "CL_00000315";
@@ -43,6 +45,11 @@
{
int l = p_149674_5_.nextInt(3);
int i1;
+ // CraftBukkit start - Prevent lava putting something on fire, remember igniter block coords
+ int x = p_149674_2_;
+ int y = p_149674_3_;
+ int z = p_149674_4_;
+ // CraftBukkit end
for (i1 = 0; i1 < l; ++i1)
{
@@ -55,6 +62,16 @@
{
if (this.isFlammable(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_) || this.isFlammable(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_))
{
+ // CraftBukkit start - Prevent lava putting something on fire
+ if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_) != Blocks.fire)
+ {
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, x, y, z).isCancelled())
+ {
+ continue;
+ }
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.fire);
return;
}
@@ -77,6 +94,16 @@
if (p_149674_1_.isAirBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_) && this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
{
+ // CraftBukkit start - Prevent lava putting something on fire
+ if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_) != Blocks.fire)
+ {
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, x, y, z).isCancelled())
+ {
+ continue;
+ }
+ }
+
+ // CraftBukkit end
p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, Blocks.fire);
}
}

View File

@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -17,6 +17,8 @@
import net.minecraft.world.World;
import static net.minecraftforge.common.util.ForgeDirection.*;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockStem extends BlockBush implements IGrowable
{
private final Block field_149877_a;
@@ -46,14 +48,14 @@
{
float f = this.func_149875_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
- if (p_149674_5_.nextInt((int)(25.0F / f) + 1) == 0)
+ if (p_149674_5_.nextInt((int)(p_149674_1_.growthOdds / (this == Blocks.pumpkin_stem ? p_149674_1_.getSpigotConfig().pumpkinModifier : p_149674_1_.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) // Spigot // Cauldron
{
int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
if (l < 7)
{
++l;
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, l); // CraftBukkit
}
else
{
@@ -105,7 +107,7 @@
if (p_149674_1_.isAirBlock(j1, p_149674_3_, k1) && (block.canSustainPlant(p_149674_1_, j1, p_149674_3_ - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass))
{
- p_149674_1_.setBlock(j1, p_149674_3_, k1, this.field_149877_a);
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, j1, p_149674_3_, k1, this.field_149877_a, 0); // CraftBukkit
}
}
}

View File

@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java
@@ -13,6 +13,8 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockTrapDoor extends Block
{
/** Set this to allow trapdoors to remain free-floating */
@@ -176,6 +178,20 @@
if (flag || p_149695_5_.canProvidePower())
{
+ // CraftBukkit start
+ org.bukkit.World bworld = p_149695_1_.getWorld();
+ org.bukkit.block.Block bblock = bworld.getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
+ int power = bblock.getBlockPower();
+ int oldPower = (p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 4) > 0 ? 15 : 0;
+
+ if (oldPower == 0 ^ power == 0 || p_149695_5_.canProvidePower())
+ {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
+ flag = eventRedstone.getNewCurrent() > 0;
+ }
+
+ // CraftBukkit end
this.func_150120_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag);
}
}

View File

@ -0,0 +1,63 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWire.java
@@ -16,6 +16,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+
public class BlockTripWire extends Block
{
private static final String __OBFID = "CL_00000328";
@@ -208,6 +210,51 @@
}
}
+ // CraftBukkit start - Call interact even when triggering connected tripwire
+ if (flag != flag1 && flag1 && (p_150140_1_.getBlockMetadata(p_150140_2_, p_150140_3_, p_150140_4_) & 4) == 4)
+ {
+ org.bukkit.World bworld = p_150140_1_.getWorld();
+ org.bukkit.plugin.PluginManager manager = p_150140_1_.getServer().getPluginManager();
+ org.bukkit.block.Block block = bworld.getBlockAt(p_150140_2_, p_150140_3_, p_150140_4_);
+ boolean allowed = false;
+
+ // If all of the events are cancelled block the tripwire trigger, else allow
+ for (Object object : list)
+ {
+ if (object != null)
+ {
+ org.bukkit.event.Cancellable cancellable;
+
+ if (object instanceof EntityPlayer)
+ {
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) object, org.bukkit.event.block.Action.PHYSICAL, p_150140_2_, p_150140_3_, p_150140_4_, -1, null);
+ }
+ else if (object instanceof Entity)
+ {
+ cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
+ manager.callEvent((EntityInteractEvent) cancellable);
+ }
+ else
+ {
+ continue;
+ }
+
+ if (!cancellable.isCancelled())
+ {
+ allowed = true;
+ break;
+ }
+ }
+ }
+
+ if (!allowed)
+ {
+ return;
+ }
+ }
+
+ // CraftBukkit end
+
if (flag1 && !flag)
{
l |= 1;

View File

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
@@ -12,6 +12,8 @@
import net.minecraftforge.common.util.ForgeDirection;
import static net.minecraftforge.common.util.ForgeDirection.*;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockTripWireHook extends Block
{
private static final String __OBFID = "CL_00000329";
@@ -210,6 +212,17 @@
this.func_150135_a(p_150136_1_, l2, p_150136_3_, i3, flag4, flag5, flag2, flag3);
}
+ // CraftBukkit start
+ org.bukkit.block.Block block = p_150136_1_.getWorld().getBlockAt(p_150136_2_, p_150136_3_, p_150136_4_);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ p_150136_1_.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0)
+ {
+ return;
+ }
+
+ // CraftBukkit end
this.func_150135_a(p_150136_1_, p_150136_2_, p_150136_3_, p_150136_4_, flag4, flag5, flag2, flag3);
if (!p_150136_5_)

View File

@ -0,0 +1,77 @@
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
@@ -21,6 +21,8 @@
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IShearable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockVine extends Block implements IShearable
{
private static final String __OBFID = "CL_00000330";
@@ -268,7 +270,11 @@
if (j2 > 0)
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, j2, 2);
+ // CraftBukkit start - Call BlockSpreadEvent
+ org.bukkit.block.Block source = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_ + 1, p_149674_4_);
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, l1);
+ // CraftBukkit end
}
}
}
@@ -290,27 +296,34 @@
{
l1 = k1 + 1 & 3;
i2 = k1 + 3 & 3;
+ // CraftBukkit start - Call BlockSpreadEvent
+ org.bukkit.block.Block source = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+ org.bukkit.block.Block bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1]);
if ((i1 & 1 << l1) != 0 && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1])))
{
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1], this, 1 << l1, 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << l1);
}
else if ((i1 & 1 << i2) != 0 && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2])))
{
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1], this, 1 << i2, 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << i2);
}
else if ((i1 & 1 << l1) != 0 && p_149674_1_.isAirBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1]) && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[l1])))
{
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1], this, 1 << (k1 + 2 & 3), 2);
+ bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1]);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
}
else if ((i1 & 1 << i2) != 0 && p_149674_1_.isAirBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2]) && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[i2])))
{
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2], this, 1 << (k1 + 2 & 3), 2);
+ bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2]);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
}
else if (this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_ + 1, p_149674_4_ + Direction.offsetZ[k1])))
{
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1], this, 0, 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 0);
}
+
+ // CraftBukkit end
}
else if (block.blockMaterial.isOpaque() && block.renderAsNormalBlock())
{
@@ -327,7 +340,11 @@
if (l1 > 0)
{
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, this, l1, 2);
+ // CraftBukkit start - Call BlockSpreadEvent
+ org.bukkit.block.Block source = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
+ org.bukkit.block.Block bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_ - 1, p_149674_4_);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, l1);
+ // CraftBukkit end
}
}
else if (block == this)

View File

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -148,6 +148,7 @@
import net.minecraft.util.Timer;
import net.minecraft.util.Util;
import net.minecraft.world.EnumDifficulty;
+import net.minecraft.world.MinecraftException;
import net.minecraft.world.WorldProviderEnd;
import net.minecraft.world.WorldProviderHell;
import net.minecraft.world.WorldSettings;
@@ -2644,7 +2645,14 @@
if (integratedserver != null)
{
- integratedserver.stopServer();
+ try
+ {
+ integratedserver.stopServer();
+ }
+ catch (MinecraftException e)
+ {
+ e.printStackTrace();
+ }
}
}
}

View File

@ -0,0 +1,74 @@
--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java
+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java
@@ -16,6 +16,11 @@
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
+// Cauldron start
+import org.bukkit.craftbukkit.command.CraftSimpleCommandMap;
+import org.bukkit.craftbukkit.command.ModCustomCommand;
+import cpw.mods.fml.common.FMLCommonHandler;
+// Cauldron end
public class CommandHandler implements ICommandManager
{
@@ -48,7 +53,7 @@
throw new CommandNotFoundException();
}
- if (icommand.canCommandSenderUseCommand(p_71556_1_))
+ if (true || icommand.canCommandSenderUseCommand(p_71556_1_)) // Cauldron start - disable check for permissions since we handle it on Bukkit side
{
CommandEvent event = new CommandEvent(icommand, p_71556_1_, astring);
if (MinecraftForge.EVENT_BUS.post(event))
@@ -134,11 +139,30 @@
public ICommand registerCommand(ICommand p_71560_1_)
{
- List list = p_71560_1_.getCommandAliases();
- this.commandMap.put(p_71560_1_.getCommandName(), p_71560_1_);
- this.commandSet.add(p_71560_1_);
+ // Cauldron start - register commands with permission nodes, defaulting to class name
+ return registerCommand(p_71560_1_, p_71560_1_.getClass().getName());
+ }
+ public ICommand registerCommand(String permissionGroup, ICommand par1ICommand)
+ {
+ return registerCommand(par1ICommand, permissionGroup + "." + par1ICommand.getCommandName());
+ }
+
+ public ICommand registerCommand(ICommand par1ICommand, String permissionNode)
+ {
+ List list = par1ICommand.getCommandAliases();
+ this.commandMap.put(par1ICommand.getCommandName(), par1ICommand);
+ this.commandSet.add(par1ICommand);
+ // register vanilla commands with Bukkit to support permissions.
+ CraftSimpleCommandMap commandMap = FMLCommonHandler.instance().getMinecraftServerInstance().server.getCraftCommandMap();
+ ModCustomCommand customCommand = new ModCustomCommand(par1ICommand.getCommandName());
+ customCommand.setPermission(permissionNode);
if (list != null)
+ customCommand.setAliases(list);
+ commandMap.register(par1ICommand.getCommandName(), customCommand);
+ LogManager.getLogger().info("Registered command " + par1ICommand.getCommandName() + " with permission node " + permissionNode);
+
+ if (list != null)
{
Iterator iterator = list.iterator();
@@ -149,13 +173,14 @@
if (icommand1 == null || !icommand1.getCommandName().equals(s))
{
- this.commandMap.put(s, p_71560_1_);
+ this.commandMap.put(s, par1ICommand);
}
}
}
- return p_71560_1_;
+ return par1ICommand;
}
+ // Cauldron end
private static String[] dropFirstString(String[] p_71559_0_)
{

View File

@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/command/PlayerSelector.java
+++ ../src-work/minecraft/net/minecraft/command/PlayerSelector.java
@@ -7,6 +7,7 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChunkCoordinates;
@@ -51,6 +52,13 @@
public static EntityPlayerMP[] matchPlayers(ICommandSender p_82380_0_, String p_82380_1_)
{
+ // CraftBukkit start
+ if (!(p_82380_0_ instanceof CommandBlockLogic))
+ {
+ return null;
+ }
+
+ // CraftBukkit end
Matcher matcher = tokenPattern.matcher(p_82380_1_);
if (matcher.matches())

View File

@ -0,0 +1,76 @@
--- ../src-base/minecraft/net/minecraft/command/ServerCommandManager.java
+++ ../src-work/minecraft/net/minecraft/command/ServerCommandManager.java
@@ -39,8 +39,16 @@
{
private static final String __OBFID = "CL_00000922";
+ // Cauldron start - moved commands to it's own method to be executed further in server startup + changed to registerVanillaCommand
public ServerCommandManager()
{
+ CommandBase.setAdminCommander(this);
+ }
+
+ public void registerVanillaCommands()
+ {
+ // Cauldron - do not register vanilla commands replaced by Bukkit
+ /*
this.registerCommand(new CommandTime());
this.registerCommand(new CommandGameMode());
this.registerCommand(new CommandDifficulty());
@@ -56,7 +64,6 @@
this.registerCommand(new CommandEmote());
this.registerCommand(new CommandShowSeed());
this.registerCommand(new CommandHelp());
- this.registerCommand(new CommandDebug());
this.registerCommand(new CommandMessage());
this.registerCommand(new CommandBroadcast());
this.registerCommand(new CommandSetSpawnpoint());
@@ -64,17 +71,23 @@
this.registerCommand(new CommandGameRule());
this.registerCommand(new CommandClearInventory());
this.registerCommand(new CommandTestFor());
- this.registerCommand(new CommandSpreadPlayers());
- this.registerCommand(new CommandPlaySound());
- this.registerCommand(new CommandScoreboard());
- this.registerCommand(new CommandAchievement());
- this.registerCommand(new CommandSummon());
- this.registerCommand(new CommandSetBlock());
- this.registerCommand(new CommandTestForBlock());
- this.registerCommand(new CommandMessageRaw());
+ */
+ // Cauldron start - add permission nodes for rest of vanilla commands
+ this.registerCommand("vanilla.command", new CommandDebug());
+ this.registerCommand("vanilla.command", new CommandSpreadPlayers());
+ this.registerCommand("vanilla.command", new CommandPlaySound());
+ this.registerCommand("vanilla.command", new CommandScoreboard());
+ this.registerCommand("vanilla.command", new CommandAchievement());
+ this.registerCommand("vanilla.command", new CommandSummon());
+ this.registerCommand("vanilla.command", new CommandSetBlock());
+ this.registerCommand("vanilla.command", new CommandTestForBlock());
+ this.registerCommand("vanilla.command", new CommandMessageRaw());
+ this.registerCommand("vanilla.command", new CommandNetstat());
+ // Cauldron end
if (MinecraftServer.getServer().isDedicatedServer())
{
+ /*
this.registerCommand(new CommandOp());
this.registerCommand(new CommandDeOp());
this.registerCommand(new CommandStop());
@@ -90,7 +103,7 @@
this.registerCommand(new CommandListPlayers());
this.registerCommand(new CommandWhitelist());
this.registerCommand(new CommandSetPlayerTimeout());
- this.registerCommand(new CommandNetstat());
+ */
}
else
{
@@ -98,6 +111,7 @@
}
CommandBase.setAdminCommander(this);
+ // Cauldron end
}
public void func_152372_a(ICommandSender p_152372_1_, ICommand p_152372_2_, int p_152372_3_, String p_152372_4_, Object ... p_152372_5_)

View File

@ -0,0 +1,212 @@
--- ../src-base/minecraft/net/minecraft/command/server/CommandBlockLogic.java
+++ ../src-work/minecraft/net/minecraft/command/server/CommandBlockLogic.java
@@ -9,18 +9,30 @@
import net.minecraft.command.ICommandSender;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.tileentity.TileEntityCommandBlockListener;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
+// CraftBukkit start
+import java.util.ArrayList;
+import org.apache.logging.log4j.Level;
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
+import com.google.common.base.Joiner;
+import net.minecraft.command.PlayerSelector;
+import net.minecraft.entity.EntityMinecartCommandBlockListener;
+import net.minecraft.entity.player.EntityPlayerMP;
+// CraftBukkit end
+
public abstract class CommandBlockLogic implements ICommandSender
{
private static final SimpleDateFormat field_145766_a = new SimpleDateFormat("HH:mm:ss");
private int field_145764_b;
private boolean field_145765_c = true;
private IChatComponent field_145762_d = null;
- private String field_145763_e = "";
+ public String field_145763_e = ""; // CraftBukkit - private -> public
private String field_145761_f = "@";
+ protected org.bukkit.command.CommandSender sender; // CraftBukkit - add sender;
private static final String __OBFID = "CL_00000128";
public int func_145760_g()
@@ -94,8 +106,143 @@
if (minecraftserver != null && minecraftserver.isCommandBlockEnabled())
{
- ICommandManager icommandmanager = minecraftserver.getCommandManager();
- this.field_145764_b = icommandmanager.executeCommand(this, this.field_145763_e);
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
+ org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
+ Joiner joiner = Joiner.on(" ");
+ String command = this.field_145763_e;
+
+ if (this.field_145763_e.startsWith("/"))
+ {
+ command = this.field_145763_e.substring(1);
+ }
+
+ String[] args = command.split(" ");
+ ArrayList<String[]> commands = new ArrayList<String[]>();
+
+ // Block disallowed commands
+ if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
+ args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
+ args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload"))
+ {
+ this.field_145764_b = 0;
+ return;
+ }
+
+ // If the world has no players don't run
+ if (this.getEntityWorld().playerEntities.isEmpty())
+ {
+ this.field_145764_b = 0;
+ return;
+ }
+
+ // Handle vanilla commands;
+ if (minecraftserver.server.getCommandBlockOverride(args[0]))
+ {
+ org.bukkit.command.Command commandBlockCommand = commandMap.getCommand("minecraft:" + args[0]);
+
+ if (commandBlockCommand instanceof VanillaCommandWrapper)
+ {
+ this.field_145764_b = ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommandBlock(this, this.field_145763_e);
+ return;
+ }
+ }
+
+ // Make sure this is a valid command
+ if (commandMap.getCommand(args[0]) == null)
+ {
+ // Cauldron start - execute command using the vanilla command manager if it isn't in the bukkit command map
+ net.minecraft.command.ICommandManager icommandmanager = minecraftserver.getCommandManager();
+ icommandmanager.executeCommand(this, this.field_145763_e);
+ return;
+ // Cauldron end
+ }
+
+ // testfor command requires special handling
+ if (args[0].equalsIgnoreCase("testfor"))
+ {
+ if (args.length < 2)
+ {
+ this.field_145764_b = 0;
+ return;
+ }
+
+ EntityPlayerMP[] players = PlayerSelector.matchPlayers(this, args[1]);
+
+ if (players != null && players.length > 0)
+ {
+ this.field_145764_b = players.length;
+ return;
+ }
+ else
+ {
+ EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
+
+ if (player == null)
+ {
+ this.field_145764_b = 0;
+ return;
+ }
+ else
+ {
+ this.field_145764_b = 1;
+ return;
+ }
+ }
+ }
+
+ commands.add(args);
+ // Find positions of command block syntax, if any
+ ArrayList<String[]> newCommands = new ArrayList<String[]>();
+
+ for (int i = 0; i < args.length; i++)
+ {
+ if (PlayerSelector.hasArguments(args[i]))
+ {
+ for (int j = 0; j < commands.size(); j++)
+ {
+ newCommands.addAll(this.buildCommands(commands.get(j), i));
+ }
+
+ ArrayList<String[]> temp = commands;
+ commands = newCommands;
+ newCommands = temp;
+ newCommands.clear();
+ }
+ }
+
+ int completed = 0;
+
+ // Now dispatch all of the commands we ended up with
+ for (int i = 0; i < commands.size(); i++)
+ {
+ try
+ {
+ if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i)))))
+ {
+ completed++;
+ }
+ }
+ catch (Throwable exception)
+ {
+ if (this instanceof TileEntityCommandBlockListener)
+ {
+ TileEntityCommandBlockListener listener = (TileEntityCommandBlockListener) this;
+ MinecraftServer.getLogger().log(Level.WARN, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getPlayerCoordinates().posX, listener.getPlayerCoordinates().posY, listener.getPlayerCoordinates().posZ), exception);
+ }
+ else if (this instanceof EntityMinecartCommandBlockListener)
+ {
+ EntityMinecartCommandBlockListener listener = (EntityMinecartCommandBlockListener) this;
+ MinecraftServer.getLogger().log(Level.WARN, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", listener.getPlayerCoordinates().posX, listener.getPlayerCoordinates().posY, listener.getPlayerCoordinates().posZ), exception);
+ }
+ else
+ {
+ MinecraftServer.getLogger().log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), exception);
+ }
+ }
+ }
+
+ this.field_145764_b = completed;
+ // CraftBukkit end
}
else
{
@@ -103,6 +250,31 @@
}
}
+ // CraftBukkit start
+ private ArrayList<String[]> buildCommands(String[] args, int pos)
+ {
+ ArrayList<String[]> commands = new ArrayList<String[]>();
+ EntityPlayerMP[] players = PlayerSelector.matchPlayers(this, args[pos]);
+
+ if (players != null)
+ {
+ for (EntityPlayerMP player : players)
+ {
+ if (player.worldObj != this.getEntityWorld())
+ {
+ continue;
+ }
+
+ String[] command = args.clone();
+ command[pos] = player.getCommandSenderName();
+ commands.add(command);
+ }
+ }
+
+ return commands;
+ }
+ // CraftBukkit end
+
public String getCommandSenderName()
{
return this.field_145761_f;

View File

@ -0,0 +1,101 @@
--- ../src-base/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java
+++ ../src-work/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java
@@ -6,6 +6,11 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.block.BlockDispenseEvent;
+// CraftBukkit end
+
public class BehaviorDefaultDispenseItem implements IBehaviorDispenseItem
{
private static final String __OBFID = "CL_00001195";
@@ -23,10 +28,17 @@
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
ItemStack itemstack1 = p_82487_2_.splitStack(1);
- doDispense(p_82487_1_.getWorld(), itemstack1, 6, enumfacing, iposition);
+ // CraftBukkit start
+ if (!doDispense(p_82487_1_.getWorld(), itemstack1, 6, enumfacing, p_82487_1_))
+ {
+ p_82487_2_.stackSize++;
+ }
+
+ // CraftBukkit end
return p_82487_2_;
}
+ // Cauldron start - vanilla compatibility
public static void doDispense(World p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, EnumFacing p_82486_3_, IPosition p_82486_4_)
{
double d0 = p_82486_4_.getX();
@@ -42,7 +54,67 @@
entityitem.motionZ += p_82486_0_.rand.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
p_82486_0_.spawnEntityInWorld(entityitem);
}
+ // Cauldron end
+ // CraftBukkit start - void -> boolean return, IPosition -> ISourceBlock last argument
+ public static boolean doDispense(World world, ItemStack itemstack, int i, EnumFacing enumfacing, IBlockSource iblocksource)
+ {
+ IPosition iposition = BlockDispenser.func_149939_a(iblocksource);
+ // CraftBukkit end
+ double d0 = iposition.getX();
+ double d1 = iposition.getY();
+ double d2 = iposition.getZ();
+ EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
+ double d3 = world.rand.nextDouble() * 0.1D + 0.2D;
+ entityitem.motionX = (double) enumfacing.getFrontOffsetX() * d3;
+ entityitem.motionY = 0.20000000298023224D;
+ entityitem.motionZ = (double) enumfacing.getFrontOffsetZ() * d3;
+ entityitem.motionX += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
+ entityitem.motionY += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
+ entityitem.motionZ += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
+ // CraftBukkit start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(iblocksource.getXInt(), iblocksource.getYInt(), iblocksource.getZInt());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(entityitem.motionX, entityitem.motionY, entityitem.motionZ));
+
+ if (!BlockDispenser.eventFired)
+ {
+ world.getServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled())
+ {
+ return false;
+ }
+
+ entityitem.setEntityItemStack(CraftItemStack.asNMSCopy(event.getItem()));
+ entityitem.motionX = event.getVelocity().getX();
+ entityitem.motionY = event.getVelocity().getY();
+ entityitem.motionZ = event.getVelocity().getZ();
+
+ if (!event.getItem().equals(craftItem))
+ {
+ // Chain to handler for new item
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+ IBehaviorDispenseItem ibehaviordispenseitem = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(eventStack.getItem());
+
+ if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider && ibehaviordispenseitem.getClass() != BehaviorDefaultDispenseItem.class)
+ {
+ ibehaviordispenseitem.dispense(iblocksource, eventStack);
+ }
+ else
+ {
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ return false;
+ }
+
+ world.spawnEntityInWorld(entityitem);
+ return true;
+ // CraftBukkit end
+ }
+
protected void playDispenseSound(IBlockSource p_82485_1_)
{
p_82485_1_.getWorld().playAuxSFX(1000, p_82485_1_.getXInt(), p_82485_1_.getYInt(), p_82485_1_.getZInt(), 0);

View File

@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/dispenser/BehaviorProjectileDispense.java
+++ ../src-work/minecraft/net/minecraft/dispenser/BehaviorProjectileDispense.java
@@ -7,6 +7,12 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
+// CraftBukkit start
+import net.minecraft.tileentity.TileEntityDispenser;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.block.BlockDispenseEvent;
+// CraftBukkit end
+
public abstract class BehaviorProjectileDispense extends BehaviorDefaultDispenseItem
{
private static final String __OBFID = "CL_00001394";
@@ -17,9 +23,42 @@
IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
IProjectile iprojectile = this.getProjectileEntity(world, iposition);
+ // CraftBukkit start
+ ItemStack itemstack1 = p_82487_2_.splitStack(1);
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(p_82487_1_.getXInt(), p_82487_1_.getYInt(), p_82487_1_.getZInt());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumfacing.getFrontOffsetX(), (double)((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ()));
+
+ if (!BlockDispenser.eventFired)
+ {
+ world.getServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled())
+ {
+ p_82487_2_.stackSize++;
+ return p_82487_2_;
+ }
+
+ if (!event.getItem().equals(craftItem))
+ {
+ p_82487_2_.stackSize++;
+ // Chain to handler for new item
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+ IBehaviorDispenseItem ibehaviordispenseitem = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(eventStack.getItem());
+
+ if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider && ibehaviordispenseitem != this)
+ {
+ ibehaviordispenseitem.dispense(p_82487_1_, eventStack);
+ return p_82487_2_;
+ }
+ }
+
iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
+ ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) p_82487_1_.getBlockTileEntity());
+ // CraftBukkit end
world.spawnEntityInWorld((Entity)iprojectile);
- p_82487_2_.splitStack(1);
+ // p_82487_2_.splitStack(1); // CraftBukkit - Handled during event processing
return p_82487_2_;
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java
+++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java
@@ -56,6 +56,8 @@
{
enchantmentsList[p_i1926_1_] = this;
}
+
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment(this)); // CraftBukkit
}
public int getWeight()

View File

@ -0,0 +1,775 @@
--- ../src-base/minecraft/net/minecraft/entity/Entity.java
+++ ../src-work/minecraft/net/minecraft/entity/Entity.java
@@ -45,13 +45,51 @@
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
+import net.minecraftforge.cauldron.CauldronHooks;
import net.minecraftforge.common.IExtendedEntityProperties;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.fluids.IFluidBlock;
+// CraftBukkit start
+import net.minecraft.entity.passive.EntityTameable;
+import net.minecraft.entity.player.EntityPlayerMP;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Server;
+import org.bukkit.TravelAgent;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Hanging;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Painting;
+import org.bukkit.entity.Vehicle;
+import org.spigotmc.CustomTimingsHandler; // Spigot
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.painting.PaintingBreakByEntityEvent;
+import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
+import org.bukkit.event.vehicle.VehicleEnterEvent;
+import org.bukkit.event.vehicle.VehicleExitEvent;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityPortalEvent;
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
+import org.bukkit.plugin.PluginManager;
+// CraftBukkit end
+import net.minecraft.world.Teleporter; // Cauldron
+
public abstract class Entity
{
+ // CraftBukkit start
+ private static final int CURRENT_LEVEL = 2;
+ static boolean isLevelAtLeast(NBTTagCompound tag, int level)
+ {
+ return tag.hasKey("Bukkit.updateLevel") && tag.getInteger("Bukkit.updateLevel") >= level;
+ }
+ // CraftBukkit end
+
private static int nextEntityID;
private int entityId;
public double renderDistanceWeight;
@@ -100,12 +138,12 @@
protected Random rand;
public int ticksExisted;
public int fireResistance;
- private int fire;
- protected boolean inWater;
+ public int fire; // CraftBukkit - private -> public
+ public boolean inWater; // Spigot - protected -> public
public int hurtResistantTime;
private boolean firstUpdate;
protected boolean isImmuneToFire;
- protected DataWatcher dataWatcher;
+ public DataWatcher dataWatcher; // CraftBukkit - protected -> public
private double entityRiderPitchDelta;
private double entityRiderYawDelta;
public boolean addedToChunk;
@@ -126,8 +164,10 @@
public int dimension;
protected int teleportDirection;
private boolean invulnerable;
- protected UUID entityUniqueID;
+ public UUID entityUniqueID; // CraftBukkit - protected -> public
public Entity.EnumEntitySize myEntitySize;
+ public boolean valid; // CraftBukkit
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
private static final String __OBFID = "CL_00001533";
/** Forge: Used to store custom data for each entity. */
private NBTTagCompound customEntityData;
@@ -135,7 +175,16 @@
public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
private UUID persistentID;
+ // Spigot start
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
+ public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
+ public final boolean defaultActivationState;
+ public long activatedTick = 0;
+ public boolean fromMobSpawner;
+ public void inactiveTick() { }
+ // Spigot end
protected HashMap<String, IExtendedEntityProperties> extendedProperties;
+ public String spawnReason; // Cauldron - used to handle CraftBukkit's SpawnReason with CustomSpawners
public int getEntityId()
{
@@ -159,7 +208,7 @@
this.rand = new Random();
this.fireResistance = 1;
this.firstUpdate = true;
- this.entityUniqueID = UUID.randomUUID();
+ this.entityUniqueID = new UUID(rand.nextLong(), rand.nextLong()); // Spigot
this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
this.worldObj = p_i1582_1_;
this.setPosition(0.0D, 0.0D, 0.0D);
@@ -167,8 +216,15 @@
if (p_i1582_1_ != null)
{
this.dimension = p_i1582_1_.provider.dimensionId;
+ // Spigot start
+ this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, p_i1582_1_.getSpigotConfig()); // Cauldron
}
+ else
+ {
+ this.defaultActivationState = false;
+ }
+ // Spigot end
this.dataWatcher = new DataWatcher(this);
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
this.dataWatcher.addObject(1, Short.valueOf((short)300));
@@ -277,6 +333,41 @@
protected void setRotation(float p_70101_1_, float p_70101_2_)
{
+ // CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0
+ if (Float.isNaN(p_70101_1_))
+ {
+ p_70101_1_ = 0;
+ }
+
+ if ((p_70101_1_ == Float.POSITIVE_INFINITY) || (p_70101_1_ == Float.NEGATIVE_INFINITY))
+ {
+ if (this instanceof EntityPlayerMP)
+ {
+ this.worldObj.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
+ }
+
+ p_70101_1_ = 0;
+ }
+
+ // pitch was sometimes set to NaN, so we need to set it back to 0.
+ if (Float.isNaN(p_70101_2_))
+ {
+ p_70101_2_ = 0;
+ }
+
+ if ((p_70101_2_ == Float.POSITIVE_INFINITY) || (p_70101_2_ == Float.NEGATIVE_INFINITY))
+ {
+ if (this instanceof EntityPlayerMP)
+ {
+ this.worldObj.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
+ }
+
+ p_70101_2_ = 0;
+ }
+
+ // CraftBukkit end
this.rotationYaw = p_70101_1_ % 360.0F;
this.rotationPitch = p_70101_2_ % 360.0F;
}
@@ -343,7 +434,7 @@
if (this.inPortal)
{
- if (minecraftserver.getAllowNether())
+ if (true || minecraftserver.getAllowNether()) // CraftBukkit
{
if (this.ridingEntity == null && this.portalCounter++ >= i)
{
@@ -457,7 +548,35 @@
{
if (!this.isImmuneToFire)
{
- this.attackEntityFrom(DamageSource.lava, 4.0F);
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
+ this.attackEntityFrom(DamageSource.lava, 4);
+
+ if (this instanceof EntityLivingBase)
+ {
+ if (this.fire <= 0)
+ {
+ // not on fire yet
+ // TODO: shouldn't be sending null for the block.
+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
+ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
+ this.worldObj.getServer().getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled())
+ {
+ this.setFire(combustEvent.getDuration());
+ }
+ }
+ else
+ {
+ // This will be called every single tick the entity is in lava, so don't throw an event
+ this.setFire(15);
+ }
+
+ return;
+ }
+
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
this.setFire(15);
}
}
@@ -492,6 +611,30 @@
public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_)
{
+ // CraftBukkit start - Don't do anything if we aren't moving
+ // We need to do this regardless of whether or not we are moving thanks to portals
+ try
+ {
+ this.func_145775_I();
+ }
+ catch (Throwable throwable)
+ {
+ CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Checking entity block collision");
+ CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being checked for collision");
+ this.addEntityCrashInfo(crashreportcategory);
+ throw new ReportedException(crashreport);
+ }
+
+ // Check if we're moving
+ if (p_70091_1_ == 0 && p_70091_3_ == 0 && p_70091_5_ == 0 && this.ridingEntity == null && this.riddenByEntity == null)
+ {
+ return;
+ }
+
+ // CraftBukkit end
+ if (!CauldronHooks.checkEntitySpeed(this, p_70091_1_, p_70091_3_, p_70091_5_)) return; // Check for entities violating the speed limit
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
+
if (this.noClip)
{
this.boundingBox.offset(p_70091_1_, p_70091_3_, p_70091_5_);
@@ -756,6 +899,35 @@
d10 = this.posY - d4;
d11 = this.posZ - d5;
+ // CraftBukkit start
+ if ((this.isCollidedHorizontally) && (this.getBukkitEntity() instanceof Vehicle))
+ {
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.block.Block block = this.worldObj.getWorld().getBlockAt(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - (double) this.yOffset), MathHelper.floor_double(this.posZ));
+
+ if (d6 > p_70091_1_)
+ {
+ block = block.getRelative(BlockFace.EAST);
+ }
+ else if (d6 < p_70091_1_)
+ {
+ block = block.getRelative(BlockFace.WEST);
+ }
+ else if (d8 > p_70091_5_)
+ {
+ block = block.getRelative(BlockFace.SOUTH);
+ }
+ else if (d8 < p_70091_5_)
+ {
+ block = block.getRelative(BlockFace.NORTH);
+ }
+
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+ }
+
+ // CraftBukkit end
+
if (this.canTriggerWalking() && !flag && this.ridingEntity == null)
{
int j1 = MathHelper.floor_double(this.posX);
@@ -798,6 +970,8 @@
}
}
+ // CraftBukkit start - Move to the top of the method
+ /*
try
{
this.func_145775_I();
@@ -809,7 +983,8 @@
this.addEntityCrashInfo(crashreportcategory);
throw new ReportedException(crashreport);
}
-
+ */
+ // CraftBukkit end
boolean flag2 = this.isWet();
if (this.worldObj.func_147470_e(this.boundingBox.contract(0.001D, 0.001D, 0.001D)))
@@ -820,8 +995,20 @@
{
++this.fire;
- if (this.fire == 0)
+ // CraftBukkit start - Not on fire yet
+ if (this.fire <= 0) // Only throw events on the first combust, otherwise it spams
{
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ this.setFire(event.getDuration());
+ }
+ }
+ else
+ {
+ // CraftBukkit end
this.setFire(8);
}
}
@@ -839,6 +1026,8 @@
this.worldObj.theProfiler.endSection();
}
+
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
}
protected String getSwimSound()
@@ -867,7 +1056,11 @@
try
{
+ // Cauldron start - damage hook for custom blocks
+ CraftEventFactory.blockDamage = this.worldObj.getWorld().getBlockAt(k1, l1, i2);
block.onEntityCollidedWithBlock(this.worldObj, k1, l1, i2, this);
+ CraftEventFactory.blockDamage = null;
+ // Cauldron end
}
catch (Throwable throwable)
{
@@ -928,6 +1121,7 @@
return null;
}
+ // Cauldron start - vanilla compatibility
protected void dealFireDamage(int p_70081_1_)
{
if (!this.isImmuneToFire)
@@ -935,7 +1129,16 @@
this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
}
}
+ // Cauldron end
+ protected void dealFireDamage(float par1) // CraftBukkit signature change
+ {
+ if (!this.isImmuneToFire)
+ {
+ this.attackEntityFrom(DamageSource.inFire, (float)par1);
+ }
+ }
+
public final boolean isImmuneToFire()
{
return this.isImmuneToFire;
@@ -1184,6 +1387,8 @@
public void onCollideWithPlayer(EntityPlayer p_70100_1_) {}
+ int numCollisions = 0; // Spigot
+
public void applyEntityCollision(Entity p_70108_1_)
{
if (p_70108_1_.riddenByEntity != this && p_70108_1_.ridingEntity != this)
@@ -1310,6 +1515,20 @@
{
p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
+
+ // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero
+ // TODO: make sure this is the best way to address this.
+ if (Float.isNaN(this.rotationYaw))
+ {
+ this.rotationYaw = 0;
+ }
+
+ if (Float.isNaN(this.rotationPitch))
+ {
+ this.rotationPitch = 0;
+ }
+
+ // CraftBukkit end
p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
p_70109_1_.setFloat("FallDistance", this.fallDistance);
p_70109_1_.setShort("Fire", (short)this.fire);
@@ -1320,6 +1539,12 @@
p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
+ // CraftBukkit start
+ p_70109_1_.setLong("WorldUUIDLeast", this.worldObj.getSaveHandler().getUUID().getLeastSignificantBits());
+ p_70109_1_.setLong("WorldUUIDMost", this.worldObj.getSaveHandler().getUUID().getMostSignificantBits());
+ p_70109_1_.setInteger("Bukkit.updateLevel", CURRENT_LEVEL);
+ p_70109_1_.setInteger("Spigot.ticksLived", this.ticksExisted);
+ // CraftBukkit end
if (customEntityData != null)
{
p_70109_1_.setTag("ForgeData", customEntityData);
@@ -1370,7 +1595,7 @@
this.motionX = nbttaglist1.func_150309_d(0);
this.motionY = nbttaglist1.func_150309_d(1);
this.motionZ = nbttaglist1.func_150309_d(2);
-
+ /* CraftBukkit start - Moved section down
if (Math.abs(this.motionX) > 10.0D)
{
this.motionX = 0.0D;
@@ -1385,7 +1610,7 @@
{
this.motionZ = 0.0D;
}
-
+ // CraftBukkit end */
this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.func_150309_d(0);
this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.func_150309_d(1);
this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.func_150309_d(2);
@@ -1436,6 +1661,76 @@
{
this.setPosition(this.posX, this.posY, this.posZ);
}
+
+ // CraftBukkit start
+ if (this instanceof EntityLivingBase)
+ {
+ EntityLivingBase entity = (EntityLivingBase) this;
+ this.ticksExisted = p_70020_1_.getInteger("Spigot.ticksLived");
+
+ // Reset the persistence for tamed animals
+ if (entity instanceof EntityTameable && !isLevelAtLeast(p_70020_1_, 2) && !p_70020_1_.getBoolean("PersistenceRequired"))
+ {
+ EntityLiving entityliving = (EntityLiving) entity;
+ entityliving.persistenceRequired = !entityliving.canDespawn();
+ }
+ }
+
+ // CraftBukkit end
+
+ // CraftBukkit start - Exempt Vehicles from notch's sanity check
+ if (!(this.getBukkitEntity() instanceof Vehicle))
+ {
+ if (Math.abs(this.motionX) > 10.0D)
+ {
+ this.motionX = 0.0D;
+ }
+
+ if (Math.abs(this.motionY) > 10.0D)
+ {
+ this.motionY = 0.0D;
+ }
+
+ if (Math.abs(this.motionZ) > 10.0D)
+ {
+ this.motionZ = 0.0D;
+ }
+ }
+
+ // CraftBukkit end
+
+ // CraftBukkit start - Reset world
+ if (this instanceof EntityPlayerMP)
+ {
+ Server server = Bukkit.getServer();
+ org.bukkit.World bworld = null;
+ // TODO: Remove World related checks, replaced with WorldUID.
+ String worldName = p_70020_1_.getString("World");
+
+ if (p_70020_1_.hasKey("WorldUUIDMost") && p_70020_1_.hasKey("WorldUUIDLeast"))
+ {
+ UUID uid = new UUID(p_70020_1_.getLong("WorldUUIDMost"), p_70020_1_.getLong("WorldUUIDLeast"));
+ bworld = server.getWorld(uid);
+ }
+ else
+ {
+ bworld = server.getWorld(worldName);
+ }
+
+ if (bworld == null)
+ {
+ EntityPlayerMP entityPlayer = (EntityPlayerMP) this;
+ // Cauldron start - use CraftBukkit's fallback world code if no valid world is found.
+ entityPlayer.setWorld(MinecraftServer.getServer().worldServerForDimension(entityPlayer.dimension));
+ }
+ else
+ {
+ this.setWorld(((CraftWorld) bworld).getHandle());
+ // Cauldron end
+ }
+ }
+
+ // CraftBukkit end
}
catch (Throwable throwable)
{
@@ -1653,6 +1948,31 @@
public void mountEntity(Entity p_70078_1_)
{
+ // CraftBukkit start
+ this.setPassengerOf(p_70078_1_);
+ }
+
+ protected CraftEntity bukkitEntity;
+
+ public CraftEntity getBukkitEntity()
+ {
+ if (this.bukkitEntity == null)
+ {
+ this.bukkitEntity = CraftEntity.getEntity(this.worldObj.getServer(), this);
+ }
+
+ return this.bukkitEntity;
+ }
+
+ public void setPassengerOf(Entity p_70078_1_)
+ {
+ // mountEntity(null) doesn't really fly for overloaded methods,
+ // so this method is needed
+ Entity originalVehicle = this.ridingEntity;
+ Entity originalPassenger = this.ridingEntity == null ? null : this.ridingEntity.riddenByEntity;
+ PluginManager pluginManager = Bukkit.getPluginManager();
+ this.getBukkitEntity(); // make sure bukkitEntity is initialised
+ // CraftBukkit end
this.entityRiderPitchDelta = 0.0D;
this.entityRiderYawDelta = 0.0D;
@@ -1660,6 +1980,20 @@
{
if (this.ridingEntity != null)
{
+ // CraftBukkit start
+ if ((this.bukkitEntity instanceof LivingEntity) && (this.ridingEntity.getBukkitEntity() instanceof Vehicle))
+ {
+ VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.ridingEntity.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ pluginManager.callEvent(event);
+
+ if (event.isCancelled() || this.ridingEntity != originalVehicle)
+ {
+ return;
+ }
+ }
+
+ // CraftBukkit end
+ pluginManager.callEvent(new org.spigotmc.event.entity.EntityDismountEvent(this.getBukkitEntity(), this.ridingEntity.getBukkitEntity())); // Spigot
this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch);
this.ridingEntity.riddenByEntity = null;
}
@@ -1668,22 +2002,61 @@
}
else
{
- if (this.ridingEntity != null)
+ // CraftBukkit start
+ if ((this.bukkitEntity instanceof LivingEntity) && (p_70078_1_.getBukkitEntity() instanceof Vehicle) && p_70078_1_.worldObj.chunkExists((int) p_70078_1_.posX >> 4, (int) p_70078_1_.posZ >> 4))
{
- this.ridingEntity.riddenByEntity = null;
- }
+ // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are.
+ VehicleExitEvent exitEvent = null;
- if (p_70078_1_ != null)
- {
- for (Entity entity1 = p_70078_1_.ridingEntity; entity1 != null; entity1 = entity1.ridingEntity)
+ if (this.ridingEntity != null && this.ridingEntity.getBukkitEntity() instanceof Vehicle)
{
- if (entity1 == this)
+ exitEvent = new VehicleExitEvent((Vehicle) this.ridingEntity.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ pluginManager.callEvent(exitEvent);
+
+ if (exitEvent.isCancelled() || this.ridingEntity != originalVehicle || (this.ridingEntity != null && this.ridingEntity.riddenByEntity != originalPassenger))
{
return;
}
}
+
+ VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) p_70078_1_.getBukkitEntity(), this.bukkitEntity);
+ pluginManager.callEvent(event);
+
+ // If a plugin messes with the vehicle or the vehicle's passenger
+ if (event.isCancelled() || this.ridingEntity != originalVehicle || (this.ridingEntity != null && this.ridingEntity.riddenByEntity != originalPassenger))
+ {
+ // If we only cancelled the enterevent then we need to put the player in a decent position.
+ if (exitEvent != null && this.ridingEntity == originalVehicle && this.ridingEntity != null && this.ridingEntity.riddenByEntity == originalPassenger)
+ {
+ this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double) this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch);
+ this.ridingEntity.riddenByEntity = null;
+ this.ridingEntity = null;
+ }
+
+ return;
+ }
}
+ // CraftBukkit end
+ // Spigot Start
+ if (p_70078_1_.worldObj.chunkExists((int) p_70078_1_.posX >> 4, (int) p_70078_1_.posZ >> 4))
+ {
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent(this.getBukkitEntity(), p_70078_1_.getBukkitEntity());
+ pluginManager.callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+ }
+
+ // Spigot End
+
+ if (this.ridingEntity != null)
+ {
+ this.ridingEntity.riddenByEntity = null;
+ }
+
this.ridingEntity = p_70078_1_;
p_70078_1_.riddenByEntity = this;
}
@@ -1860,12 +2233,59 @@
public void onStruckByLightning(EntityLightningBolt p_70077_1_)
{
- this.dealFireDamage(5);
+ // CraftBukkit start
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
+ if (thisBukkitEntity == null) return; // Cauldron - skip mod entities with no wrapper (TODO: create a wrapper)
+ if (p_70077_1_ == null) return; // Cauldron - skip null entities, see #392
+ final org.bukkit.entity.Entity stormBukkitEntity = p_70077_1_.getBukkitEntity();
+ if (stormBukkitEntity == null) return; // Cauldron - skip mod entities with no wrapper (TODO: create a wrapper)
+ final PluginManager pluginManager = Bukkit.getPluginManager();
+
+ if (thisBukkitEntity instanceof Hanging)
+ {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
+ PaintingBreakByEntityEvent paintingEvent = null;
+
+ if (thisBukkitEntity instanceof Painting) {
+ paintingEvent = new PaintingBreakByEntityEvent((Painting) thisBukkitEntity, stormBukkitEntity);
+ }
+
+ pluginManager.callEvent(hangingEvent);
+
+ if (paintingEvent != null) {
+ paintingEvent.setCancelled(hangingEvent.isCancelled());
+ pluginManager.callEvent(paintingEvent);
+ }
+
+ if (hangingEvent.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
+ return;
+ }
+ }
+
+ if (this.isImmuneToFire) {
+ return;
+ }
+ CraftEventFactory.entityDamage = p_70077_1_;
+ if (!this.attackEntityFrom(DamageSource.inFire, 5.0F)) {
+ CraftEventFactory.entityDamage = null;
+ return;
+ }
+
+ // CraftBukkit end
++this.fire;
if (this.fire == 0)
{
- this.setFire(8);
+ // CraftBukkit start - Call a combust event when lightning strikes
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
+ pluginManager.callEvent(entityCombustEvent);
+
+ if (!entityCombustEvent.isCancelled())
+ {
+ this.setFire(entityCombustEvent.getDuration());
+ }
+
+ // CraftBukkit end
}
}
@@ -2038,36 +2458,62 @@
{
this.worldObj.theProfiler.startSection("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer();
- int j = this.dimension;
- WorldServer worldserver = minecraftserver.worldServerForDimension(j);
- WorldServer worldserver1 = minecraftserver.worldServerForDimension(p_71027_1_);
- this.dimension = p_71027_1_;
+ // CraftBukkit start - Move logic into new function "teleportToLocation"
+ // int j = this.dimension;
+ // Cauldron start - Allow Forge hotloading on teleport
+ WorldServer exitWorld = minecraftserver.worldServerForDimension(p_71027_1_);
- if (j == 1 && p_71027_1_ == 1)
+ Location enter = this.getBukkitEntity().getLocation();
+ Location exit = exitWorld != null ? minecraftserver.getConfigurationManager().calculateTarget(enter, minecraftserver.worldServerForDimension(p_71027_1_)) : null;
+ boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
+ // Cauldron start - check if teleporter is instance of TravelAgent before attempting to cast to it
+ Teleporter teleporter = exit != null ? ((CraftWorld) exit.getWorld()).getHandle().getDefaultTeleporter() : null;
+ TravelAgent agent = (teleporter != null && teleporter instanceof TravelAgent) ? (TravelAgent)teleporter : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
+ // Cauldron end
+ EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent);
+ event.useTravelAgent(useTravelAgent);
+ event.getEntity().getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled() || event.getTo() == null || !this.isEntityAlive())
{
- worldserver1 = minecraftserver.worldServerForDimension(0);
- this.dimension = 0;
+ return;
}
+ exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
+ this.teleportTo(exit, true);
+ }
+ }
+
+ public void teleportTo(Location exit, boolean portal)
+ {
+ if (true)
+ {
+ WorldServer worldserver = ((CraftWorld) this.getBukkitEntity().getLocation().getWorld()).getHandle();
+ WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
+ int i = worldserver1.dimension;
+ // CraftBukkit end
+ this.dimension = i;
this.worldObj.removeEntity(this);
this.isDead = false;
this.worldObj.theProfiler.startSection("reposition");
- minecraftserver.getConfigurationManager().transferEntityToWorld(this, j, worldserver, worldserver1);
+ // CraftBukkit start - Ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create
+ // minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1);
+ boolean before = worldserver1.theChunkProviderServer.loadChunkOnProvideRequest; // Cauldron start - load chunks on provide request
+ worldserver1.theChunkProviderServer.loadChunkOnProvideRequest = true;
+ worldserver1.func_73046_m().getConfigurationManager().repositionEntity(this, exit, portal);
+ worldserver1.theChunkProviderServer.loadChunkOnProvideRequest = before; // Cauldron end
+ // CraftBukkit end
this.worldObj.theProfiler.endStartSection("reloading");
Entity entity = EntityList.createEntityByName(EntityList.getEntityString(this), worldserver1);
if (entity != null)
{
entity.copyDataFrom(this, true);
-
- if (j == 1 && p_71027_1_ == 1)
- {
- ChunkCoordinates chunkcoordinates = worldserver1.getSpawnPoint();
- chunkcoordinates.posY = this.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);
- entity.setLocationAndAngles((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
- }
-
worldserver1.spawnEntityInWorld(entity);
+ // CraftBukkit start - Forward the CraftEntity to the new entity
+ this.getBukkitEntity().setHandle(entity);
+ entity.bukkitEntity = this.getBukkitEntity();
+ // CraftBukkit end
}
this.isDead = true;
@@ -2077,7 +2523,6 @@
this.worldObj.theProfiler.endSection();
}
}
-
public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_)
{
return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_4_, p_145772_5_, posX, posY + getEyeHeight(), posZ);

View File

@ -0,0 +1,80 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java
@@ -10,6 +10,36 @@
{
private float field_98056_d = -1.0F;
private float field_98057_e;
+ public boolean ageLocked = false; // CraftBukkit
+
+ // Spigot start
+ @Override
+ public void inactiveTick()
+ {
+ super.inactiveTick();
+
+ if (this.worldObj.isRemote || this.ageLocked)
+ {
+ // CraftBukkit
+ this.setScaleForAge(this.isChild());
+ }
+ else
+ {
+ int i = this.getGrowingAge();
+
+ if (i < 0)
+ {
+ ++i;
+ this.setGrowingAge(i);
+ }
+ else if (i > 0)
+ {
+ --i;
+ this.setGrowingAge(i);
+ }
+ }
+ }
+ // Spigot end
private static final String __OBFID = "CL_00001530";
public EntityAgeable(World p_i1578_1_)
@@ -37,7 +67,7 @@
{
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
- this.worldObj.spawnEntityInWorld(entityageable);
+ this.worldObj.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
if (itemstack.hasDisplayName())
{
@@ -48,7 +78,7 @@
{
--itemstack.stackSize;
- if (itemstack.stackSize <= 0)
+ if (itemstack.stackSize == 0) // CraftBukkit - allow less than 0 stacks as "infinite"
{
p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack)null);
}
@@ -99,19 +129,21 @@
{
super.writeEntityToNBT(p_70014_1_);
p_70014_1_.setInteger("Age", this.getGrowingAge());
+ p_70014_1_.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
{
super.readEntityFromNBT(p_70037_1_);
this.setGrowingAge(p_70037_1_.getInteger("Age"));
+ this.ageLocked = p_70037_1_.getBoolean("AgeLocked"); // CraftBukkit
}
public void onLivingUpdate()
{
super.onLivingUpdate();
- if (this.worldObj.isRemote)
+ if (this.worldObj.isRemote || this.ageLocked) // CraftBukkit
{
this.setScaleForAge(this.isChild());
}

View File

@ -0,0 +1,105 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityCreature.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityCreature.java
@@ -13,12 +13,18 @@
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.entity.EntityUnleashEvent;
+// CraftBukkit end
+
public abstract class EntityCreature extends EntityLiving
{
public static final UUID field_110179_h = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
public static final AttributeModifier field_110181_i = (new AttributeModifier(field_110179_h, "Fleeing speed bonus", 2.0D, 2)).setSaved(false);
- private PathEntity pathToEntity;
- protected Entity entityToAttack;
+ public PathEntity pathToEntity; // CraftBukkit - private -> public
+ public Entity entityToAttack; // CraftBukkit - protected -> public
protected boolean hasAttacked;
protected int fleeingTick;
private ChunkCoordinates homePosition = new ChunkCoordinates(0, 0, 0);
@@ -52,8 +58,29 @@
if (this.entityToAttack == null)
{
- this.entityToAttack = this.findPlayerToAttack();
+ // CraftBukkit start
+ Entity target = this.findPlayerToAttack();
+ if (target != null)
+ {
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ if (event.getTarget() == null)
+ {
+ this.entityToAttack = null;
+ }
+ else
+ {
+ this.entityToAttack = ((CraftEntity) event.getTarget()).getHandle();
+ }
+ }
+ }
+
+ // CraftBukkit end
+
if (this.entityToAttack != null)
{
this.pathToEntity = this.worldObj.getPathEntityToEntity(this, this.entityToAttack, f4, true, false, false, true);
@@ -70,7 +97,23 @@
}
else
{
- this.entityToAttack = null;
+ // CraftBukkit start
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ if (event.getTarget() == null)
+ {
+ this.entityToAttack = null;
+ }
+ else
+ {
+ this.entityToAttack = ((CraftEntity) event.getTarget()).getHandle();
+ }
+ }
+
+ // CraftBukkit end
}
if (this.entityToAttack instanceof EntityPlayerMP && ((EntityPlayerMP)this.entityToAttack).theItemInWorldManager.isCreative())
@@ -122,7 +165,8 @@
double d1 = vec3.xCoord - this.posX;
double d2 = vec3.zCoord - this.posZ;
double d3 = vec3.yCoord - (double)i;
- float f1 = (float)(Math.atan2(d2, d1) * 180.0D / Math.PI) - 90.0F;
+ // CraftBukkit - Math -> TrigMath
+ float f1 = (float)(org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / Math.PI) - 90.0F;
float f2 = MathHelper.wrapAngleTo180_float(f1 - this.rotationYaw);
this.moveForward = (float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
@@ -303,6 +347,7 @@
{
if (f > 10.0F)
{
+ this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.clearLeashed(true, true);
}
@@ -335,6 +380,7 @@
if (f > 10.0F)
{
+ this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.clearLeashed(true, true);
}
}

View File

@ -0,0 +1,119 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java
@@ -10,6 +10,14 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+// CraftBukkit start
+import net.minecraft.entity.item.EntityPainting;
+import org.bukkit.entity.Hanging;
+import org.bukkit.entity.Painting;
+import org.bukkit.event.hanging.HangingBreakEvent;
+import org.bukkit.event.painting.PaintingBreakEvent;
+// CraftBukkit end
+
public abstract class EntityHanging extends Entity
{
private int tickCounter1;
@@ -125,6 +133,38 @@
if (!this.isDead && !this.onValidSurface())
{
+ // CraftBukkit start
+ Material material = this.worldObj.getBlock((int) this.posX, (int) this.posY, (int) this.posZ).getMaterial();
+ HangingBreakEvent.RemoveCause cause;
+
+ if (!material.equals(Material.air))
+ {
+ // TODO: This feels insufficient to catch 100% of suffocation cases
+ cause = HangingBreakEvent.RemoveCause.OBSTRUCTION;
+ }
+ else
+ {
+ cause = HangingBreakEvent.RemoveCause.PHYSICS;
+ }
+
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), cause);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+ PaintingBreakEvent paintingEvent = null;
+
+ if (this instanceof EntityPainting)
+ {
+ // Fire old painting event until it can be removed
+ paintingEvent = new PaintingBreakEvent((Painting) this.getBukkitEntity(), PaintingBreakEvent.RemoveCause.valueOf(cause.name()));
+ paintingEvent.setCancelled(event.isCancelled());
+ this.worldObj.getServer().getPluginManager().callEvent(paintingEvent);
+ }
+
+ if (isDead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled()))
+ {
+ return;
+ }
+
+ // CraftBukkit end
this.setDead();
this.onBroken((Entity)null);
}
@@ -233,6 +273,39 @@
{
if (!this.isDead && !this.worldObj.isRemote)
{
+ // CraftBukkit start
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
+ PaintingBreakEvent paintingEvent = null;
+
+ if (p_70097_1_.getEntity() != null)
+ {
+ event = new org.bukkit.event.hanging.HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), p_70097_1_.getEntity() == null ? null : p_70097_1_.getEntity().getBukkitEntity());
+
+ if (this instanceof EntityPainting)
+ {
+ // Fire old painting event until it can be removed
+ paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), p_70097_1_.getEntity() == null ? null : p_70097_1_.getEntity().getBukkitEntity());
+ }
+ }
+ else if (p_70097_1_.isExplosion())
+ {
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
+ }
+
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (paintingEvent != null)
+ {
+ paintingEvent.setCancelled(event.isCancelled());
+ this.worldObj.getServer().getPluginManager().callEvent(paintingEvent);
+ }
+
+ if (this.isDead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled()))
+ {
+ return true;
+ }
+
+ // CraftBukkit end
this.setDead();
this.setBeenAttacked();
this.onBroken(p_70097_1_.getEntity());
@@ -246,6 +319,22 @@
{
if (!this.worldObj.isRemote && !this.isDead && p_70091_1_ * p_70091_1_ + p_70091_3_ * p_70091_3_ + p_70091_5_ * p_70091_5_ > 0.0D)
{
+ if (this.isDead)
+ {
+ return; // CraftBukkit
+ }
+
+ // CraftBukkit start
+ // TODO - Does this need its own cause? Seems to only be triggered by pistons
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (this.isDead || event.isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
this.setDead();
this.onBroken((Entity)null);
}

View File

@ -0,0 +1,74 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityLeashKnot.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLeashKnot.java
@@ -11,6 +11,12 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
+ // CraftBukkit start
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.network.play.server.S1BPacketEntityAttach;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class EntityLeashKnot extends EntityHanging
{
private static final String __OBFID = "CL_00001548";
@@ -84,6 +90,14 @@
if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == p_130002_1_)
{
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityliving, this, p_130002_1_).isCancelled())
+ {
+ ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, entityliving, entityliving.getLeashedToEntity()));
+ continue;
+ }
+
+ // CraftBukkit end
entityliving.setLeashedToEntity(this, true);
flag = true;
}
@@ -93,9 +107,12 @@
if (!this.worldObj.isRemote && !flag)
{
- this.setDead();
+ // CraftBukkit start - Move below
+ //this.setDead();
+ boolean die = true;
- if (p_130002_1_.capabilities.isCreativeMode)
+ // CraftBukkit end
+ if (true || p_130002_1_.capabilities.isCreativeMode) // CraftBukkit - Process for non-creative as well
{
d0 = 7.0D;
list = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + d0, this.posZ + d0));
@@ -110,11 +127,27 @@
if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == this)
{
- entityliving.clearLeashed(true, false);
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityliving, p_130002_1_).isCancelled())
+ {
+ die = false;
+ continue;
+ }
+
+ entityliving.clearLeashed(true, !p_130002_1_.capabilities.isCreativeMode); // false -> survival mode boolean
+ // CraftBukkit end
}
}
}
}
+
+ // CraftBukkit start
+ if (die)
+ {
+ this.setDead();
+ }
+
+ // CraftBukkit end
}
return true;

View File

@ -0,0 +1,162 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java
@@ -38,6 +38,13 @@
import cpw.mods.fml.common.eventhandler.Event.Result;
import net.minecraftforge.event.ForgeEventFactory;
+// CraftBukkit start
+import net.minecraft.entity.player.EntityPlayerMP;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityUnleashEvent;
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
+// CraftBukkit end
+
public abstract class EntityLiving extends EntityLivingBase
{
public int livingSoundTime;
@@ -52,9 +59,9 @@
private EntityLivingBase attackTarget;
private EntitySenses senses;
private ItemStack[] equipment = new ItemStack[5];
- protected float[] equipmentDropChances = new float[5];
- private boolean canPickUpLoot;
- private boolean persistenceRequired;
+ public float[] equipmentDropChances = new float[5]; // CraftBukkit - protected -> public
+ public boolean canPickUpLoot; // CraftBukkit - private -> public
+ public boolean persistenceRequired; // CraftBukkit - private -> public
protected float defaultPitch;
private Entity currentTarget;
protected int numTicksToChaseTarget;
@@ -311,9 +318,23 @@
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
{
super.readEntityFromNBT(p_70037_1_);
- this.setCanPickUpLoot(p_70037_1_.getBoolean("CanPickUpLoot"));
- this.persistenceRequired = p_70037_1_.getBoolean("PersistenceRequired");
+ // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
+ boolean data = p_70037_1_.getBoolean("CanPickUpLoot");
+ if (isLevelAtLeast(p_70037_1_, 1) || data)
+ {
+ this.canPickUpLoot = data;
+ }
+
+ data = p_70037_1_.getBoolean("PersistenceRequired");
+
+ if (isLevelAtLeast(p_70037_1_, 1) || data)
+ {
+ this.persistenceRequired = data;
+ }
+
+ // CraftBukkit end
+
if (p_70037_1_.hasKey("CustomName", 8) && p_70037_1_.getString("CustomName").length() > 0)
{
this.setCustomNameTag(p_70037_1_.getString("CustomName"));
@@ -521,15 +542,36 @@
this.entityAge = 0;
}
}
+ // Cauldron start - Force despawn of entity if a player isn't near
+ else if (this.worldObj.cauldronConfig.entityDespawnImmediate && this.canDespawn())
+ {
+ this.despawn("No Player : Immediate");
+ }
+ // Cauldron end
}
}
+ // Cauldron start
+ private void despawn(String reason) {
+ this.setDead();
+ net.minecraftforge.cauldron.CauldronHooks.logEntityDespawn(this, reason);
+ }
+ // Cauldron end
+
protected void updateAITasks()
{
++this.entityAge;
this.worldObj.theProfiler.startSection("checkDespawn");
this.despawnEntity();
this.worldObj.theProfiler.endSection();
+
+ // Spigot Start
+ if (this.fromMobSpawner)
+ {
+ return;
+ }
+
+ // Spigot End
this.worldObj.theProfiler.startSection("sensing");
this.senses.clearSensingCache();
this.worldObj.theProfiler.endSection();
@@ -1005,6 +1047,14 @@
{
if (this.getLeashed() && this.getLeashedToEntity() == p_130002_1_)
{
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, p_130002_1_).isCancelled())
+ {
+ ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this, this.getLeashedToEntity()));
+ return false;
+ }
+
+ // CraftBukkit end
this.clearLeashed(true, !p_130002_1_.capabilities.isCreativeMode);
return true;
}
@@ -1016,6 +1066,14 @@
{
if (!(this instanceof EntityTameable) || !((EntityTameable)this).isTamed())
{
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, p_130002_1_, p_130002_1_).isCancelled())
+ {
+ ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this, this.getLeashedToEntity()));
+ return false;
+ }
+
+ // CraftBukkit end
this.setLeashedToEntity(p_130002_1_, true);
--itemstack.stackSize;
return true;
@@ -1023,6 +1081,14 @@
if (((EntityTameable)this).func_152114_e(p_130002_1_))
{
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, p_130002_1_, p_130002_1_).isCancelled())
+ {
+ ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this, this.getLeashedToEntity()));
+ return false;
+ }
+
+ // CraftBukkit end
this.setLeashedToEntity(p_130002_1_, true);
--itemstack.stackSize;
return true;
@@ -1049,6 +1115,7 @@
{
if (this.leashedToEntity == null || this.leashedToEntity.isDead)
{
+ this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
this.clearLeashed(true, true);
}
}
@@ -1136,10 +1203,16 @@
}
else
{
+ this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.clearLeashed(false, true);
}
}
this.field_110170_bx = null;
}
+
+ public boolean canDespawn_CB()
+ {
+ return this.canDespawn();
+ }
}

View File

@ -0,0 +1,657 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java
@@ -50,14 +50,28 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
+// CraftBukkit start
+import net.minecraft.nbt.NBTTagInt;
+import net.minecraft.network.play.server.S28PacketEffect;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
+import org.bukkit.event.entity.EntityRegainHealthEvent;
+// CraftBukkit end
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // Cauldron
+
+import com.google.common.base.Function;
+
public abstract class EntityLivingBase extends Entity
{
private static final UUID sprintingSpeedBoostModifierUUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
private static final AttributeModifier sprintingSpeedBoostModifier = (new AttributeModifier(sprintingSpeedBoostModifierUUID, "Sprinting speed boost", 0.30000001192092896D, 2)).setSaved(false);
private BaseAttributeMap attributeMap;
- private final CombatTracker _combatTracker = new CombatTracker(this);
- private final HashMap activePotionsMap = new HashMap();
+ public CombatTracker _combatTracker = new CombatTracker(this); // CraftBukkit - private -> public, remove final
+ public final HashMap activePotionsMap = new HashMap(); // CraftBukkit - protected -> public
private final ItemStack[] previousEquipment = new ItemStack[5];
public boolean isSwingInProgress;
public int swingProgressInt;
@@ -83,7 +97,7 @@
public float rotationYawHead;
public float prevRotationYawHead;
public float jumpMovementFactor = 0.02F;
- protected EntityPlayer attackingPlayer;
+ public EntityPlayer attackingPlayer; // CraftBukkit - protected -> public
protected int recentlyHit;
protected boolean dead;
protected int entityAge;
@@ -93,7 +107,7 @@
protected float field_70763_ax;
protected float field_70741_aB;
protected int scoreValue;
- protected float lastDamage;
+ public float lastDamage; // CraftBukkit - protected -> public
protected boolean isJumping;
public float moveStrafing;
public float moveForward;
@@ -104,21 +118,26 @@
protected double newPosZ;
protected double newRotationYaw;
protected double newRotationPitch;
- private boolean potionsNeedUpdate = true;
- private EntityLivingBase entityLivingToAttack;
+ public boolean potionsNeedUpdate = true; // CraftBukkit - private -> public
+ public EntityLivingBase entityLivingToAttack; // CraftBukkit - private -> public
private int revengeTimer;
private EntityLivingBase lastAttacker;
private int lastAttackerTime;
private float landMovementFactor;
private int jumpTicks;
private float field_110151_bq;
+ // CraftBukkit start
+ public int expToDrop;
+ public int maxAirTicks = 300;
+ // CraftBukkit end
private static final String __OBFID = "CL_00001549";
public EntityLivingBase(World p_i1594_1_)
{
super(p_i1594_1_);
this.applyEntityAttributes();
- this.setHealth(this.getMaxHealth());
+ // CraftBukkit - this.setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
+ this.dataWatcher.updateObject(6, (float) this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue());
this.preventEntitySpawning = true;
this.field_70770_ap = (float)(Math.random() + 1.0D) * 0.01F;
this.setPosition(this.posX, this.posY, this.posZ);
@@ -173,7 +192,18 @@
}
else if (!this.worldObj.isRemote && this.fallDistance > 3.0F)
{
- this.worldObj.playAuxSFX(2006, i, j, k, MathHelper.ceiling_float_int(this.fallDistance - 3.0F));
+ // CraftBukkit start - supply player as argument in particles for visibility API to work
+ if (this instanceof EntityPlayerMP)
+ {
+ this.worldObj.playAuxSFXAtEntity((EntityPlayer) this, 2006, i, j, k, MathHelper.ceiling_float_int(this.fallDistance - 3.0F));
+ ((EntityPlayerMP) this).playerNetServerHandler.sendPacket(new S28PacketEffect(2006, i, j, k, MathHelper
+ .ceiling_float_int(this.fallDistance - 3.0F), false));
+ }
+ else
+ {
+ this.worldObj.playAuxSFX(2006, i, j, k, MathHelper.ceiling_float_int(this.fallDistance - 3.0F));
+ }
+ // CraftBukkit end
}
block.onFallenUpon(this.worldObj, i, j, k, this, this.fallDistance);
@@ -234,7 +264,12 @@
}
else
{
- this.setAir(300);
+ // CraftBukkit start - Only set if needed to work around a DataWatcher inefficiency
+ if (this.getAir() != 300)
+ {
+ this.setAir(maxAirTicks);
+ }
+ // CraftBukkit end
}
if (this.isEntityAlive() && this.isWet())
@@ -299,6 +334,22 @@
this.worldObj.theProfiler.endSection();
}
+ // CraftBukkit start
+ public int getExpReward()
+ {
+ int exp = this.getExperiencePoints(this.attackingPlayer);
+
+ if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG())
+ {
+ return exp;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ // CraftBukkit end
+
public boolean isChild()
{
return false;
@@ -308,22 +359,21 @@
{
++this.deathTime;
- if (this.deathTime == 20)
+ if (this.deathTime >= 20 && !this.isDead) // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
{
int i;
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
+ i = this.expToDrop;
- if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
+ while (i > 0)
{
- i = this.getExperiencePoints(this.attackingPlayer);
-
- while (i > 0)
- {
- int j = EntityXPOrb.getXPSplit(i);
- i -= j;
- this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
- }
+ int j = EntityXPOrb.getXPSplit(i);
+ i -= j;
+ this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
}
+ this.expToDrop = 0;
+ // CraftBukkit end
this.setDead();
for (i = 0; i < 20; ++i)
@@ -485,6 +535,22 @@
}
}
+ // CraftBukkit start
+ if (p_70037_1_.hasKey("Bukkit.MaxHealth"))
+ {
+ NBTBase nbtbase = p_70037_1_.getTag("Bukkit.MaxHealth");
+
+ if (nbtbase.getId() == 5)
+ {
+ this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((double) ((NBTTagFloat) nbtbase).func_150291_c());
+ }
+ else if (nbtbase.getId() == 3)
+ {
+ this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((double) ((NBTTagInt) nbtbase).func_150287_d());
+ }
+ }
+ // CraftBukkit end
+
if (p_70037_1_.hasKey("HealF", 99))
{
this.setHealth(p_70037_1_.getFloat("HealF"));
@@ -614,12 +680,14 @@
public boolean isPotionActive(int p_82165_1_)
{
- return this.activePotionsMap.containsKey(Integer.valueOf(p_82165_1_));
+ // CraftBukkit - Add size check for efficiency
+ return this.activePotionsMap.size() != 0 && this.activePotionsMap.containsKey(Integer.valueOf(p_82165_1_));
}
public boolean isPotionActive(Potion p_70644_1_)
{
- return this.activePotionsMap.containsKey(Integer.valueOf(p_70644_1_.id));
+ // CraftBukkit - Add size check for efficiency
+ return this.activePotionsMap.size() != 0 && this.activePotionsMap.containsKey(Integer.valueOf(p_70644_1_.id));
}
public PotionEffect getActivePotionEffect(Potion p_70660_1_)
@@ -710,25 +778,66 @@
}
}
+ // CraftBukkit start - Delegate so we can handle providing a reason for health being regained
public void heal(float p_70691_1_)
{
+ heal(p_70691_1_, EntityRegainHealthEvent.RegainReason.CUSTOM);
+ }
+
+ public void heal(float p_70691_1_, EntityRegainHealthEvent.RegainReason regainReason)
+ {
p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_);
if (p_70691_1_ <= 0) return;
float f1 = this.getHealth();
if (f1 > 0.0F)
{
- this.setHealth(f1 + p_70691_1_);
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), p_70691_1_, regainReason);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled())
+ {
+ this.setHealth((float) (this.getHealth() + event.getAmount()));
+ }
}
}
public final float getHealth()
{
+ // CraftBukkit start - Use unscaled health
+ if (this instanceof EntityPlayerMP)
+ {
+ return (float) ((EntityPlayerMP) this).getBukkitEntity().getHealth();
+ }
+ // CraftBukkit end
return this.dataWatcher.getWatchableObjectFloat(6);
}
public void setHealth(float p_70606_1_)
{
+ // CraftBukkit start - Handle scaled health
+ if (this instanceof EntityPlayerMP)
+ {
+ org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayerMP) this).getBukkitEntity();
+
+ // Squeeze
+ if (p_70606_1_ < 0.0F)
+ {
+ player.setRealHealth(0.0D);
+ }
+ else if (p_70606_1_ > player.getMaxHealth())
+ {
+ player.setRealHealth(player.getMaxHealth());
+ }
+ else
+ {
+ player.setRealHealth(p_70606_1_);
+ }
+
+ this.dataWatcher.updateObject(6, Float.valueOf(player.getScaledHealth()));
+ return;
+ }
+ // CraftBukkit end
this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(p_70606_1_, 0.0F, this.getMaxHealth())));
}
@@ -757,7 +866,8 @@
}
else
{
- if ((p_70097_1_ == DamageSource.anvil || p_70097_1_ == DamageSource.fallingBlock) && this.getEquipmentInSlot(4) != null)
+ // CraftBukkit - Moved into damageEntity_CB(DamageSource, float)
+ if (false && (p_70097_1_ == DamageSource.anvil || p_70097_1_ == DamageSource.fallingBlock) && this.getEquipmentInSlot(4) != null)
{
this.getEquipmentInSlot(4).damageItem((int)(p_70097_2_ * 4.0F + this.rand.nextFloat() * p_70097_2_ * 2.0F), this);
p_70097_2_ *= 0.75F;
@@ -773,16 +883,27 @@
return false;
}
- this.damageEntity(p_70097_1_, p_70097_2_ - this.lastDamage);
+ // CraftBukkit start
+ if (!this.damageEntity_CB(p_70097_1_, p_70097_2_ - this.lastDamage))
+ {
+ return false;
+ }
+ // CraftBukkit end
this.lastDamage = p_70097_2_;
flag = false;
}
else
{
+ // CraftBukkit start
+ float previousHealth = this.getHealth();
+ if (!this.damageEntity_CB(p_70097_1_, p_70097_2_))
+ {
+ return false;
+ }
this.lastDamage = p_70097_2_;
- this.prevHealth = this.getHealth();
+ this.prevHealth = previousHealth;
this.hurtResistantTime = this.maxHurtResistantTime;
- this.damageEntity(p_70097_1_, p_70097_2_);
+ // CraftBukkit end
this.hurtTime = this.maxHurtTime = 10;
}
@@ -938,6 +1059,22 @@
if (!ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, recentlyHit > 0, j))
{
+ // Cauldron start - capture drops for plugins then fire event
+ if (this.capturedDrops.size() > 0)
+ {
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+ for (EntityItem item : capturedDrops)
+ {
+ loot.add(CraftItemStack.asCraftMirror(item.getEntityItem()));
+ }
+ CraftEventFactory.callEntityDeathEvent(this, loot);
+ }
+ else
+ {
+ CraftEventFactory.callEntityDeathEvent(this);
+ }
+ // Cauldron end
+
for (EntityItem item : capturedDrops)
{
worldObj.spawnEntityInWorld(item);
@@ -1010,8 +1147,17 @@
if (i > 0)
{
+ // CraftBukkit start
+ if (!this.attackEntityFrom(DamageSource.fall, (float) i))
+ {
+ return;
+ }
+ }
+ // CraftBukkit end
+ if (i > 0)
+ {
this.playSound(this.func_146067_o(i), 1.0F, 1.0F);
- this.attackEntityFrom(DamageSource.fall, (float)i);
+ // this.attackEntityFrom(DamageSource.fall, (float)i); // CraftBukkit - moved up
int j = MathHelper.floor_double(this.posX);
int k = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset);
int l = MathHelper.floor_double(this.posZ);
@@ -1065,7 +1211,7 @@
{
int i = 25 - this.getTotalArmorValue();
float f1 = p_70655_2_ * (float)i;
- this.damageArmor(p_70655_2_);
+ // this.damageArmor(p_70655_2_); // CraftBukkit - Moved into damageEntity_CB(DamageSource, float)
p_70655_2_ = f1 / 25.0F;
}
@@ -1089,7 +1235,8 @@
int j;
float f1;
- if (this.isPotionActive(Potion.resistance) && p_70672_1_ != DamageSource.outOfWorld)
+ // CraftBukkit - Moved to damageEntity_CB(DamageSource, float)
+ if (false && this.isPotionActive(Potion.resistance) && p_70672_1_ != DamageSource.outOfWorld)
{
i = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5;
j = 25 - i;
@@ -1122,26 +1269,156 @@
}
}
+ // Cauldron start - vanilla compatibility
protected void damageEntity(DamageSource p_70665_1_, float p_70665_2_)
{
+ this.damageEntity_CB(p_70665_1_, p_70665_2_);
+ }
+
+ // Cauldron end
+
+ // CraftBukkit start
+ protected boolean damageEntity_CB(final DamageSource damagesource, float f)
+ { // void -> boolean, add final
if (!this.isEntityInvulnerable())
{
- p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
- if (p_70665_2_ <= 0) return;
- p_70665_2_ = this.applyArmorCalculations(p_70665_1_, p_70665_2_);
- p_70665_2_ = this.applyPotionDamageCalculations(p_70665_1_, p_70665_2_);
- float f1 = p_70665_2_;
- p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F);
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - p_70665_2_));
+ final boolean human = this instanceof EntityPlayer;
+ float originalDamage = f;
+ // Cauldron start - apply forge damage hook
+ f = ForgeHooks.onLivingHurt(this, damagesource, f);
+ if (f <= 0) return false;
+ // Cauldron end
+ Function<Double, Double> hardHat = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f)
+ {
+ if ((damagesource == DamageSource.anvil || damagesource == DamageSource.fallingBlock)
+ && EntityLivingBase.this.getEquipmentInSlot(4) != null)
+ {
+ return -(f - (f * 0.75F));
+ }
+ return -0.0;
+ }
+ };
- if (p_70665_2_ != 0.0F)
+ float hardHatModifier = hardHat.apply((double) f).floatValue();
+ f += hardHatModifier;
+
+ Function<Double, Double> blocking = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f)
+ {
+ if (human)
+ {
+ if (!damagesource.isUnblockable() && ((EntityPlayer) EntityLivingBase.this).isBlocking() && f > 0.0F)
+ {
+ return -(f - ((1.0F + f) * 0.5F));
+ }
+ }
+ return -0.0;
+ }
+ };
+ float blockingModifier = blocking.apply((double) f).floatValue();
+ f += blockingModifier;
+
+ Function<Double, Double> armor = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f)
+ {
+ // Cauldron start - apply forge armor hook
+ if (human)
+ {
+ return -(f - ArmorProperties.ApplyArmor(EntityLivingBase.this, ((EntityPlayer) EntityLivingBase.this).inventory.armorInventory,
+ damagesource, f.floatValue()));
+ }
+ // Cauldron end
+ return -(f - EntityLivingBase.this.applyArmorCalculations(damagesource, f.floatValue()));
+ }
+ };
+ float armorModifier = armor.apply((double) f).floatValue();
+ f += armorModifier;
+
+ Function<Double, Double> resistance = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f)
+ {
+ if (!damagesource.isDamageAbsolute() && EntityLivingBase.this.isPotionActive(Potion.resistance) && damagesource != DamageSource.outOfWorld)
+ {
+ int i = (EntityLivingBase.this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5;
+ int j = 25 - i;
+ float f1 = f.floatValue() * (float) j;
+ return -(f - (f1 / 25.0F));
+ }
+ return -0.0;
+ }
+ };
+ float resistanceModifier = resistance.apply((double) f).floatValue();
+ f += resistanceModifier;
+
+ Function<Double, Double> magic = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f)
+ {
+ return -(f - EntityLivingBase.this.applyPotionDamageCalculations(damagesource, f.floatValue()));
+ }
+ };
+ float magicModifier = magic.apply((double) f).floatValue();
+ f += magicModifier;
+
+ Function<Double, Double> absorption = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f)
+ {
+ return -(Math.max(f - Math.max(f - EntityLivingBase.this.getAbsorptionAmount(), 0.0F), 0.0F));
+ }
+ };
+ float absorptionModifier = absorption.apply((double) f).floatValue();
+
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier,
+ armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
+ if (event.isCancelled())
{
+ return false;
+ }
+
+ f = (float) event.getFinalDamage();
+
+ // Apply damage to helmet
+ if ((damagesource == DamageSource.anvil || damagesource == DamageSource.fallingBlock) && this.getEquipmentInSlot(4) != null)
+ {
+ this.getEquipmentInSlot(4).damageItem((int) (event.getDamage() * 4.0F + this.rand.nextFloat() * event.getDamage() * 2.0F), this);
+ }
+
+ // Apply damage to armor
+ if (!damagesource.isUnblockable())
+ {
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
+ this.damageArmor(armorDamage);
+ }
+
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
+ this.setAbsorptionAmount(Math.max(this.getAbsorptionAmount() - absorptionModifier, 0.0F));
+ if (f != 0.0F)
+ {
+ if (human)
+ {
+ ((EntityPlayer) this).addExhaustion(damagesource.getHungerDamage());
+ }
+ // CraftBukkit end
float f2 = this.getHealth();
- this.setHealth(f2 - p_70665_2_);
- this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
- this.setAbsorptionAmount(this.getAbsorptionAmount() - p_70665_2_);
+ this.setHealth(f2 - f);
+ this.func_110142_aN().func_94547_a(damagesource, f2, f);
+ // CraftBukkit start
+ if (human)
+ {
+ return true;
+ }
+ // CraftBukkit end
+ this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
}
+ return true; // CraftBukkit
}
+ return false; // CraftBukkit
}
public CombatTracker func_110142_aN()
@@ -1558,6 +1835,7 @@
public void onUpdate()
{
if (ForgeHooks.onLivingUpdate(this)) return;
+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
super.onUpdate();
if (!this.worldObj.isRemote)
@@ -1608,7 +1886,9 @@
}
}
+ SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
this.onLivingUpdate();
+ SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
double d0 = this.posX - this.prevPosX;
double d1 = this.posZ - this.prevPosZ;
float f = (float)(d0 * d0 + d1 * d1);
@@ -1621,7 +1901,8 @@
{
f3 = 1.0F;
f2 = (float)Math.sqrt((double)f) * 3.0F;
- f1 = (float)Math.atan2(d1, d0) * 180.0F / (float)Math.PI - 90.0F;
+ // CraftBukkit - Math -> TrigMath
+ f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / (float)Math.PI - 90.0F;
}
if (this.swingProgress > 0.0F)
@@ -1682,6 +1963,7 @@
this.worldObj.theProfiler.endSection();
this.field_70764_aw += f2;
+ SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
}
protected float func_110146_f(float p_110146_1_, float p_110146_2_)
@@ -1757,6 +2039,7 @@
this.motionZ = 0.0D;
}
+ SpigotTimings.timerEntityAI.startTiming(); // Spigot
this.worldObj.theProfiler.startSection("ai");
if (this.isMovementBlocked())
@@ -1783,6 +2066,7 @@
}
}
+ SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.worldObj.theProfiler.endSection();
this.worldObj.theProfiler.startSection("jump");
@@ -1811,13 +2095,17 @@
this.moveStrafing *= 0.98F;
this.moveForward *= 0.98F;
this.randomYawVelocity *= 0.9F;
+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
this.moveEntityWithHeading(this.moveStrafing, this.moveForward);
+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.worldObj.theProfiler.endSection();
this.worldObj.theProfiler.startSection("push");
if (!this.worldObj.isRemote)
{
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.collideWithNearbyEntities();
+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
}
this.worldObj.theProfiler.endSection();
@@ -1829,17 +2117,36 @@
{
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- if (list != null && !list.isEmpty())
+ if (this.canBeCollidedWith() && list != null && !list.isEmpty()) // Spigot: Add this.canBeCollidedWith() condition
{
+ numCollisions -= worldObj.getSpigotConfig().maxCollisionsPerEntity; // Spigot // Cauldron
+
for (int i = 0; i < list.size(); ++i)
{
- Entity entity = (Entity)list.get(i);
+ if (numCollisions > worldObj.getSpigotConfig().maxCollisionsPerEntity) // Cauldron
+ {
+ break; // Spigot
+ }
+ Entity entity = (Entity) list.get(i);
+
+ // TODO better check now?
+ // CraftBukkit start - Only handle mob (non-player) collisions
+ // every other tick
+ if (entity instanceof EntityLivingBase && !(this instanceof EntityPlayerMP) && this.ticksExisted % 2 == 0)
+ {
+ continue;
+ }
+ // CraftBukkit end
+
if (entity.canBePushed())
{
+ entity.numCollisions++; // Spigot
+ numCollisions++; // Spigot
this.collideWithEntity(entity);
}
}
+ numCollisions = 0; // Spigot
}
}

View File

@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java
@@ -16,33 +16,9 @@
public class EntityMinecartCommandBlock extends EntityMinecart
{
- private final CommandBlockLogic field_145824_a = new CommandBlockLogic()
- {
- private static final String __OBFID = "CL_00001673";
- public void func_145756_e()
- {
- EntityMinecartCommandBlock.this.getDataWatcher().updateObject(23, this.func_145753_i());
- EntityMinecartCommandBlock.this.getDataWatcher().updateObject(24, IChatComponent.Serializer.func_150696_a(this.func_145749_h()));
- }
- @SideOnly(Side.CLIENT)
- public int func_145751_f()
- {
- return 1;
- }
- @SideOnly(Side.CLIENT)
- public void func_145757_a(ByteBuf p_145757_1_)
- {
- p_145757_1_.writeInt(EntityMinecartCommandBlock.this.getEntityId());
- }
- public ChunkCoordinates getPlayerCoordinates()
- {
- return new ChunkCoordinates(MathHelper.floor_double(EntityMinecartCommandBlock.this.posX), MathHelper.floor_double(EntityMinecartCommandBlock.this.posY + 0.5D), MathHelper.floor_double(EntityMinecartCommandBlock.this.posZ));
- }
- public World getEntityWorld()
- {
- return EntityMinecartCommandBlock.this.worldObj;
- }
- };
+ private final EntityMinecartCommandBlockListener field_145824_a_CB= new EntityMinecartCommandBlockListener(this); // CraftBukkit
+ private final CommandBlockLogic field_145824_a = field_145824_a_CB; // Cauldron
+
private int field_145823_b = 0;
private static final String __OBFID = "CL_00001672";

View File

@ -0,0 +1,27 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java
@@ -38,6 +38,7 @@
import net.minecraft.world.chunk.Chunk;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import net.minecraft.server.MinecraftServer; // Spigot
import cpw.mods.fml.common.registry.EntityRegistry;
@@ -46,7 +47,7 @@
private static final Logger logger = LogManager.getLogger();
private final WorldServer theWorld;
private Set trackedEntities = new HashSet();
- private IntHashMap trackedEntityIDs = new IntHashMap();
+ public IntHashMap trackedEntityIDs = new IntHashMap(); // CraftBukkit - private -> public
private int entityViewDistance;
private static final String __OBFID = "CL_00001431";
@@ -184,6 +185,7 @@
public void addEntityToTracker(Entity p_72785_1_, int p_72785_2_, final int p_72785_3_, boolean p_72785_4_)
{
+ p_72785_2_ = org.spigotmc.TrackingRange.getEntityTrackingRange(p_72785_1_, p_72785_2_); // Spigot
if (p_72785_2_ > this.entityViewDistance)
{
p_72785_2_ = this.entityViewDistance;

View File

@ -0,0 +1,216 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java
@@ -56,9 +56,15 @@
import net.minecraft.world.storage.MapData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import net.minecraft.server.MinecraftServer; // Spigot
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
+// CraftBukkit start
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerVelocityEvent;
+// CraftBukkit end
+
public class EntityTrackerEntry
{
private static final Logger logger = LogManager.getLogger();
@@ -131,15 +137,15 @@
this.func_151259_a(new S1BPacketEntityAttach(0, this.myEntity, this.myEntity.ridingEntity));
}
- if (this.myEntity instanceof EntityItemFrame && this.ticks % 10 == 0)
+ if (this.myEntity instanceof EntityItemFrame /*&& this.ticks % 10 == 0*/) // CraftBukkit - Moved below, should always enter this block
{
EntityItemFrame entityitemframe = (EntityItemFrame)this.myEntity;
ItemStack itemstack = entityitemframe.getDisplayedItem();
- if (itemstack != null && itemstack.getItem() instanceof ItemMap)
+ if (this.ticks % 10 == 0 && itemstack != null && itemstack.getItem() instanceof ItemMap) // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks
{
MapData mapdata = Items.filled_map.getMapData(itemstack, this.myEntity.worldObj);
- Iterator iterator = p_73122_1_.iterator();
+ Iterator iterator = this.trackingPlayers.iterator(); // CraftBukkit
while (iterator.hasNext())
{
@@ -177,6 +183,22 @@
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.ticks % 60 == 0;
boolean flag1 = Math.abs(l - this.lastYaw) >= 4 || Math.abs(i1 - this.lastPitch) >= 4;
+ // CraftBukkit start - Code moved from below
+ if (flag)
+ {
+ this.lastScaledXPosition = i;
+ this.lastScaledYPosition = j;
+ this.lastScaledZPosition = k;
+ }
+
+ if (flag1)
+ {
+ this.lastYaw = l;
+ this.lastPitch = i1;
+ }
+
+ // CraftBukkit end
+
if (this.ticks > 0 || this.myEntity instanceof EntityArrow)
{
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity)
@@ -197,7 +219,15 @@
else
{
this.ticksSinceLastForcedTeleport = 0;
- object = new S18PacketEntityTeleport(this.myEntity.getEntityId(), i, j, k, (byte)l, (byte)i1);
+
+ // CraftBukkit start - Refresh list of who can see a player before sending teleport packet
+ if (this.myEntity instanceof EntityPlayerMP)
+ {
+ this.sendEventsToPlayers(new java.util.ArrayList(this.trackingPlayers));
+ }
+
+ // CraftBukkit end
+ object = new S18PacketEntityTeleport(this.myEntity.getEntityId(), i, j, k, (byte) l, (byte) i1);
}
}
@@ -224,7 +254,7 @@
}
this.sendMetadataToAllAssociatedPlayers();
-
+ /* CraftBukkit start - Code moved up
if (flag)
{
this.lastScaledXPosition = i;
@@ -237,7 +267,7 @@
this.lastYaw = l;
this.lastPitch = i1;
}
-
+ // CraftBukkit end */
this.ridingEntity = false;
}
else
@@ -275,7 +305,32 @@
if (this.myEntity.velocityChanged)
{
- this.func_151261_b(new S12PacketEntityVelocity(this.myEntity));
+ // CraftBukkit start - Create PlayerVelocity event
+ boolean cancelled = false;
+
+ if (this.myEntity instanceof EntityPlayerMP)
+ {
+ Player player = (Player) this.myEntity.getBukkitEntity();
+ org.bukkit.util.Vector velocity = player.getVelocity();
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity);
+ this.myEntity.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ cancelled = true;
+ }
+ else if (!velocity.equals(event.getVelocity()))
+ {
+ player.setVelocity(velocity);
+ }
+ }
+
+ if (!cancelled)
+ {
+ this.func_151261_b((Packet)(new S12PacketEntityVelocity(this.myEntity)));
+ }
+
+ // CraftBukkit end
this.myEntity.velocityChanged = false;
}
}
@@ -296,6 +351,13 @@
if (!set.isEmpty())
{
+ // CraftBukkit start - Send scaled max health
+ if (this.myEntity instanceof EntityPlayerMP)
+ {
+ ((EntityPlayerMP) this.myEntity).getBukkitEntity().injectScaledMaxHealth(set, false);
+ }
+
+ // CraftBukkit end
this.func_151261_b(new S20PacketEntityProperties(this.myEntity.getEntityId(), set));
}
@@ -353,6 +415,19 @@
if (d0 >= (double)(-this.blocksDistanceThreshold) && d0 <= (double)this.blocksDistanceThreshold && d1 >= (double)(-this.blocksDistanceThreshold) && d1 <= (double)this.blocksDistanceThreshold)
{
+ // CraftBukkit start
+ if (this.myEntity instanceof EntityPlayerMP)
+ {
+ Player player = ((EntityPlayerMP) this.myEntity).getBukkitEntity();
+
+ if (!p_73117_1_.getBukkitEntity().canSee(player))
+ {
+ return;
+ }
+ }
+ // CraftBukkit end
+
+ p_73117_1_.destroyedItemsNetCache.remove(Integer.valueOf(this.myEntity.getEntityId()));
if (!this.trackingPlayers.contains(p_73117_1_) && (this.isPlayerWatchingThisChunk(p_73117_1_) || this.myEntity.forceSpawn))
{
this.trackingPlayers.add(p_73117_1_);
@@ -369,6 +444,13 @@
ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap();
Collection collection = serversideattributemap.getWatchedAttributes();
+ // CraftBukkit start - If sending own attributes send scaled health instead of current maximum health
+ if (this.myEntity.getEntityId() == p_73117_1_.getEntityId())
+ {
+ ((EntityPlayerMP) this.myEntity).getBukkitEntity().injectScaledMaxHealth(collection, false);
+ }
+
+ // CraftBukkit end
if (!collection.isEmpty())
{
p_73117_1_.playerNetServerHandler.sendPacket(new S20PacketEntityProperties(this.myEntity.getEntityId(), collection));
@@ -397,6 +479,14 @@
p_73117_1_.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this.myEntity, this.myEntity.ridingEntity));
}
+ // CraftBukkit start
+ if (this.myEntity.riddenByEntity != null)
+ {
+ p_73117_1_.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this.myEntity.riddenByEntity, this.myEntity));
+ }
+
+ // CraftBukkit end
+
if (this.myEntity instanceof EntityLiving && ((EntityLiving)this.myEntity).getLeashedToEntity() != null)
{
p_73117_1_.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this.myEntity, ((EntityLiving)this.myEntity).getLeashedToEntity()));
@@ -425,6 +515,11 @@
}
}
+ // CraftBukkit start - Fix for nonsensical head yaw
+ this.lastHeadMotion = MathHelper.floor_float(this.myEntity.getRotationYawHead() * 256.0F / 360.0F); // tracker.ao() should be getHeadRotation
+ this.func_151259_a(new S19PacketEntityHeadLook(this.myEntity, (byte) lastHeadMotion));
+ // CraftBukkit end
+
if (this.myEntity instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)this.myEntity;
@@ -465,7 +560,10 @@
{
if (this.myEntity.isDead)
{
- logger.warn("Fetching addPacket for removed entity");
+ // CraftBukkit start - Remove useless error spam, just return
+ // logger.warn("Fetching addPacket for removed entity");
+ return null;
+ // CraftBukkit end
}
Packet pkt = FMLNetworkHandler.getEntitySpawningPacket(this.myEntity);

View File

@ -0,0 +1,25 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIArrowAttack.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIArrowAttack.java
@@ -5,6 +5,11 @@
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.util.MathHelper;
+// CraftBukkit start
+import net.minecraft.entity.Entity;
+import org.bukkit.event.entity.EntityTargetEvent;
+// CraftBukkit end
+
public class EntityAIArrowAttack extends EntityAIBase
{
private final EntityLiving entityHost;
@@ -67,6 +72,10 @@
public void resetTask()
{
+ // CraftBukkit start
+ EntityTargetEvent.TargetReason reason = this.attackTarget.isEntityAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent((Entity) rangedAttackEntityHost, null, reason);
+ // CraftBukkit end
this.attackTarget = null;
this.field_75318_f = 0;
this.rangedAttackTime = -1;

View File

@ -0,0 +1,30 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java
@@ -7,6 +7,11 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+// CraftBukkit start
+import net.minecraft.entity.Entity;
+import org.bukkit.event.entity.EntityTargetEvent;
+// CraftBukkit end
+
public class EntityAIAttackOnCollide extends EntityAIBase
{
World worldObj;
@@ -73,6 +78,15 @@
public boolean continueExecuting()
{
EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();
+ // CraftBukkit start
+ EntityTargetEvent.TargetReason reason = this.attacker.getAttackTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
+
+ if (this.attacker.getAttackTarget() == null || (this.attacker.getAttackTarget() != null && !this.attacker.getAttackTarget().isEntityAlive()))
+ {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(attacker, null, reason);
+ }
+
+ // CraftBukkit end
return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistance(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ))));
}

View File

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java
@@ -58,6 +58,14 @@
if (this.breakingTime == 240 && this.theEntity.worldObj.difficultySetting == EnumDifficulty.HARD)
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.theEntity, this.entityPosX, this.entityPosY, this.entityPosZ).isCancelled())
+ {
+ this.updateTask();
+ return;
+ }
+
+ // CraftBukkit end
this.theEntity.worldObj.setBlockToAir(this.entityPosX, this.entityPosY, this.entityPosZ);
this.theEntity.worldObj.playAuxSFX(1012, this.entityPosX, this.entityPosY, this.entityPosZ, 0);
this.theEntity.worldObj.playAuxSFX(2001, this.entityPosX, this.entityPosY, this.entityPosZ, Block.getIdFromBlock(this.field_151504_e));

View File

@ -0,0 +1,34 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java
@@ -6,6 +6,11 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.Material;
+// CraftBukkit end
+
public class EntityAIEatGrass extends EntityAIBase
{
private EntityLiving field_151500_b;
@@ -69,7 +74,8 @@
if (this.field_151501_c.getBlock(i, j, k) == Blocks.tallgrass)
{
- if (this.field_151501_c.getGameRules().getGameRuleBooleanValue("mobGriefing"))
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.field_151500_b, this.field_151500_b.worldObj.getWorld().getBlockAt(i, j, k), Material.AIR, !this.field_151501_c.getGameRules().getGameRuleBooleanValue("mobGriefing")).isCancelled())
{
this.field_151501_c.func_147480_a(i, j, k, false);
}
@@ -78,7 +84,8 @@
}
else if (this.field_151501_c.getBlock(i, j - 1, k) == Blocks.grass)
{
- if (this.field_151501_c.getGameRules().getGameRuleBooleanValue("mobGriefing"))
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.field_151500_b, this.field_151500_b.worldObj.getWorld().getBlockAt(i, j - 1, k), Material.DIRT, !this.field_151501_c.getGameRules().getGameRuleBooleanValue("mobGriefing")).isCancelled())
{
this.field_151501_c.playAuxSFX(2001, i, j - 1, k, Block.getIdFromBlock(Blocks.grass));
this.field_151501_c.setBlock(i, j - 1, k, Blocks.dirt, 0, 2);

View File

@ -0,0 +1,42 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIMate.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIMate.java
@@ -4,6 +4,7 @@
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityAgeable;
+import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityCow;
@@ -12,6 +13,8 @@
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
+import net.minecraft.entity.passive.EntityTameable; // CraftBukkit
+
public class EntityAIMate extends EntityAIBase
{
private EntityAnimal theAnimal;
@@ -93,6 +96,13 @@
if (entityageable != null)
{
+ // CraftBukkit start - set persistence for tame animals
+ if (entityageable instanceof EntityTameable && ((EntityTameable) entityageable).isTamed())
+ {
+ ((EntityLiving)entityageable).persistenceRequired = true; // Cauldron - fix illegal access error. SS bug?
+ }
+
+ // CraftBukkit end
EntityPlayer entityplayer = this.theAnimal.func_146083_cb();
if (entityplayer == null && this.targetMate.func_146083_cb() != null)
@@ -116,7 +126,7 @@
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
- this.theWorld.spawnEntityInWorld(entityageable);
+ this.theWorld.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)

View File

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIPanic.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIPanic.java
@@ -3,6 +3,8 @@
import net.minecraft.entity.EntityCreature;
import net.minecraft.util.Vec3;
+import net.minecraft.entity.EntityLivingBase; // CraftBukkit
+
public class EntityAIPanic extends EntityAIBase
{
private EntityCreature theEntityCreature;
@@ -50,6 +52,14 @@
public boolean continueExecuting()
{
+ // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
+ if ((this.theEntityCreature.ticksExisted - this.theEntityCreature.func_142015_aE()) > 100)
+ {
+ this.theEntityCreature.setRevengeTarget((EntityLivingBase) null);
+ return false;
+ }
+
+ // CraftBukkit end
return !this.theEntityCreature.getNavigator().noPath();
}
}

View File

@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java
@@ -64,7 +64,8 @@
int i = this.horseHost.getTemper();
int j = this.horseHost.getMaxTemper();
- if (j > 0 && this.horseHost.getRNG().nextInt(j) < i)
+ // CraftBukkit
+ if (j > 0 && this.horseHost.getRNG().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horseHost, (EntityPlayer) this.horseHost.riddenByEntity).isCancelled() && this.horseHost.riddenByEntity instanceof EntityPlayer)
{
this.horseHost.setTamedBy((EntityPlayer)this.horseHost.riddenByEntity);
this.horseHost.worldObj.setEntityState(this.horseHost, (byte)7);
@@ -74,8 +75,20 @@
this.horseHost.increaseTemper(5);
}
- this.horseHost.riddenByEntity.mountEntity((Entity)null);
- this.horseHost.riddenByEntity = null;
+ // CraftBukkit start - Handle dismounting to account for VehicleExitEvent being fired.
+ if (this.horseHost.riddenByEntity != null)
+ {
+ this.horseHost.riddenByEntity.mountEntity((Entity) null);
+
+ // If the entity still has a passenger, then a plugin cancelled the event.
+ if (this.horseHost.riddenByEntity != null)
+ {
+ return;
+ }
+ }
+
+ // this.entity.passenger = null;
+ // CraftBukkit end
this.horseHost.makeHorseRearWithSound();
this.horseHost.worldObj.setEntityState(this.horseHost, (byte)6);
}

Some files were not shown because too many files have changed in this diff Show More