put 1.7.10 in main folder
No files matched your search
@@ -18,3 +18,4 @@ build
|
||||
# other
|
||||
eclipse
|
||||
run
|
||||
*.bat
|
||||
@@ -1,22 +0,0 @@
|
||||
# eclipse
|
||||
bin
|
||||
*.launch
|
||||
.settings
|
||||
.metadata
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# idea
|
||||
out
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
|
||||
# other
|
||||
eclipse
|
||||
run
|
||||
@@ -1,65 +0,0 @@
|
||||
Minecraft Forge: Credits/Thank You
|
||||
|
||||
Forge is a set of tools and modifications to the Minecraft base game code to assist
|
||||
mod developers in creating new and exciting content. It has been in development for
|
||||
several years now, but I would like to take this time thank a few people who have
|
||||
helped it along it's way.
|
||||
|
||||
First, the people who originally created the Forge projects way back in Minecraft
|
||||
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
|
||||
of me taking over the project, who knows what Minecraft modding would be today.
|
||||
|
||||
Secondly, someone who has worked with me, and developed some of the core features
|
||||
that allow modding to he as functional, and as simple as it is, cpw. For developing
|
||||
FML, which stabelized the client and server modding ecosystem. As well as the base
|
||||
loading system that allows us to modify Minecraft's code as elegently as possible.
|
||||
|
||||
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
|
||||
sane as well as guiding the community into creating better additions to Forge.
|
||||
|
||||
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
|
||||
I am a part}. For creating some of the core tools needed to make Minecraft modding
|
||||
both possible, and as stable as can be.
|
||||
On that note, here is some specific information of the MCP data we use:
|
||||
* Minecraft Coder Pack (MCP) *
|
||||
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
|
||||
download components of MCP and distribute MCP data files. This permission is not
|
||||
transitive and others wishing to redistribute the Minecraft Forge source independently
|
||||
should seek permission of MCP or remove the MCP data files and request their users
|
||||
to download MCP separately.
|
||||
|
||||
And lastly, the countless community members who have spent time submitting bug reports,
|
||||
pull requests, and just helping out the community in general. Thank you.
|
||||
|
||||
--LexManos
|
||||
|
||||
=========================================================================
|
||||
|
||||
This is Forge Mod Loader.
|
||||
|
||||
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
|
||||
|
||||
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
|
||||
and minecraft clients.
|
||||
|
||||
The code is authored by cpw.
|
||||
|
||||
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
|
||||
http://www.minecraftforum.net/topic/75440-
|
||||
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
|
||||
|
||||
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
|
||||
http://www.minecraftforge.net/
|
||||
|
||||
Additionally, it contains an implementation of topological sort based on that
|
||||
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
|
||||
|
||||
It also contains code from the Maven project for performing versioned dependency
|
||||
resolution. http://maven.apache.org/
|
||||
|
||||
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
|
||||
with credit to it's authors.
|
||||
|
||||
Forge Mod Loader downloads components from the Minecraft Coder Pack
|
||||
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
IBXM is copyright (c) 2007, Martin Cameron, and is licensed under the BSD License.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
Neither the name of mumart nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
SoundSystem CodecIBXM Class License:
|
||||
|
||||
You are free to use this class for any purpose, commercial or otherwise.
|
||||
You may modify this class or source code, and distribute it any way you
|
||||
like, provided the following conditions are met:
|
||||
|
||||
1) You may not falsely claim to be the author of this class or any
|
||||
unmodified portion of it.
|
||||
2) You may not copyright this class or a modified version of it and then
|
||||
sue me for copyright infringement.
|
||||
3) If you modify the source code, you must clearly document the changes
|
||||
made before redistributing the modified source code, so other users know
|
||||
it is not the original code.
|
||||
4) You are not required to give me credit for this class in any derived
|
||||
work, but if you do, you must also mention my website:
|
||||
http://www.paulscode.com
|
||||
5) I the author will not be responsible for any damages (physical,
|
||||
financial, or otherwise) caused by the use if this class or any
|
||||
portion of it.
|
||||
6) I the author do not guarantee, warrant, or make any representations,
|
||||
either expressed or implied, regarding the use of this class or any
|
||||
portion of it.
|
||||
|
||||
Author: Paul Lamb
|
||||
http://www.paulscode.com
|
||||
|
||||
|
||||
This software is based on or using the IBXM library available from
|
||||
http://www.geocities.com/sunet2000/
|
||||
|
||||
|
||||
IBXM is copyright (c) 2007, Martin Cameron, and is licensed under the BSD License.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
Neither the name of mumart nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,526 +0,0 @@
|
||||
Unless noted below, Minecraft Forge, Forge Mod Loader, and all
|
||||
parts herein are licensed under the terms of the LGPL 2.1 found
|
||||
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and
|
||||
copied below.
|
||||
|
||||
Homepage: http://MinecraftForge.net/
|
||||
http://github.com/MinecraftForge/MinecraftForge
|
||||
|
||||
|
||||
A note on authorship:
|
||||
All source artifacts are property of their original author, with
|
||||
the exclusion of the contents of the patches directory and others
|
||||
copied from it from time to time. Authorship of the contents of
|
||||
the patches directory is retained by the Minecraft Forge project.
|
||||
This is because the patches are partially machine generated
|
||||
artifacts, and are changed heavily due to the way forge works.
|
||||
Individual attribution within them is impossible.
|
||||
|
||||
Consent:
|
||||
All contributions to Forge must consent to the release of any
|
||||
patch content to the Forge project.
|
||||
|
||||
A note on infectivity:
|
||||
The LGPL is chosen specifically so that projects may depend on Forge
|
||||
features without being infected with its license. That is the
|
||||
purpose of the LGPL. Mods and others using this code via ordinary
|
||||
Java mechanics for referencing libraries are specifically not bound
|
||||
by Forge's license for the Mod code.
|
||||
|
||||
|
||||
=== MCP Data ===
|
||||
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
|
||||
from them. The license to MCP data is not transitive - distribution of this data by
|
||||
third parties requires independent licensing from the MCP team. This data is not
|
||||
redistributable without permission from the MCP team.
|
||||
|
||||
=== Sharing ===
|
||||
I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of
|
||||
the minecraft modding community. All contributions to these parts should be licensed under the same additional grant.
|
||||
|
||||
-- Runtime patcher --
|
||||
License is granted to redistribute the runtime patcher code (src/main/java/net/minecraftforge/fml/common/patcher
|
||||
and subdirectories) under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||
|
||||
-- ASM transformers --
|
||||
License is granted to redistribute the ASM transformer code (src/main/java/net/minecraftforge/common/asm/ and subdirectories)
|
||||
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||
|
||||
=========================================================================
|
||||
This software includes portions from the Apache Maven project at
|
||||
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
||||
included based on guidelines at
|
||||
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
||||
with notices intact. The only change is a non-functional change of package name.
|
||||
|
||||
This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating
|
||||
binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/
|
||||
authored by genman, heikok, pivot.
|
||||
The only changes are to replace some Trove collection types with standard Java collections, and repackaged.
|
||||
|
||||
This software contains potions of Paulscodee IBXM library, a BSD liceensed library for
|
||||
loading and playing IBXM formated auto. No modifications havee beeen made. The associated
|
||||
licenses can be found along side this one, or at
|
||||
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/LICENSE-Paulscode%20IBXM%20Library.txt
|
||||
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/LICENSE-Paulscode%20SoundSystem%20CodecIBXM.txt
|
||||
=========================================================================
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -1,62 +0,0 @@
|
||||
-------------------------------------------
|
||||
Source installation information for modders
|
||||
-------------------------------------------
|
||||
This code follows the Minecraft Forge installation methodology. It will apply
|
||||
some small patches to the vanilla MCP source code, giving you and it access
|
||||
to some of the data and functions you need to build a successful mod.
|
||||
|
||||
Note also that the patches are built against "unrenamed" MCP source code (aka
|
||||
srgnames) - this means that you will not be able to read them directly against
|
||||
normal code.
|
||||
|
||||
Source pack installation information:
|
||||
|
||||
Standalone source installation
|
||||
==============================
|
||||
|
||||
See the Forge Documentation online for more detailed instructions:
|
||||
http://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||
|
||||
Step 1: Open your command-line and browse to the folder where you extracted the zip file.
|
||||
|
||||
Step 2: Once you have a command window up in the folder that the downloaded material was placed, type:
|
||||
|
||||
Windows: "gradlew setupDecompWorkspace"
|
||||
Linux/Mac OS: "./gradlew setupDecompWorkspace"
|
||||
|
||||
Step 3: After all that finished, you're left with a choice.
|
||||
For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux)
|
||||
|
||||
If you prefer to use IntelliJ, steps are a little different.
|
||||
1. Open IDEA, and import project.
|
||||
2. Select your build.gradle file and have it import.
|
||||
3. Once it's finished you must close IntelliJ and run the following command:
|
||||
|
||||
"gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux)
|
||||
|
||||
Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project)
|
||||
|
||||
If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again.
|
||||
|
||||
Should it still not work,
|
||||
Refer to #ForgeGradle on EsperNet for more information about the gradle environment.
|
||||
|
||||
Tip:
|
||||
If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following:
|
||||
"setupDevWorkspace": Will patch, deobfuscate, and gather required assets to run minecraft, but will not generate human readable source code.
|
||||
"setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work.
|
||||
|
||||
Tip:
|
||||
When using Decomp workspace, the Minecraft source code is NOT added to your workspace in a editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes and usually can be accessed under the 'referenced libraries' section of your IDE.
|
||||
|
||||
Forge source installation
|
||||
=========================
|
||||
MinecraftForge ships with this code and installs it as part of the forge
|
||||
installation process, no further action is required on your part.
|
||||
|
||||
LexManos' Install Video
|
||||
=======================
|
||||
https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be
|
||||
|
||||
For more details update more often refer to the Forge Forums:
|
||||
http://www.minecraftforge.net/forum/index.php/topic,14048.0.html
|
||||
@@ -1,77 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
|
||||
|
||||
version = "1.0"
|
||||
group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "modid"
|
||||
|
||||
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.5.2768"
|
||||
runDir = "run"
|
||||
|
||||
// the mappings can be changed at any time, and must be in the following format.
|
||||
// snapshot_YYYYMMDD snapshot are built nightly.
|
||||
// stable_# stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings = "snapshot_20171003"
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// you may put jars on which you depend on in ./libs
|
||||
// or you may define them like so..
|
||||
//compile "some.group:artifact:version:classifier"
|
||||
//compile "some.group:artifact:version"
|
||||
|
||||
// real examples
|
||||
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
||||
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
||||
|
||||
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
|
||||
// except that these dependencies get remapped to your current MCP mappings
|
||||
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// for more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
}
|
||||
|
||||
processResources {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
// replace version and mcversion
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
}
|
||||
|
||||
// copy everything else except the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
Changelog:
|
||||
Build 2768:
|
||||
LexManos: Bump version number for RB.
|
||||
|
||||
Build 2767:
|
||||
LexManos:
|
||||
Change biome spawn list entries to use factory method where possible
|
||||
(#5075)
|
||||
LexManos: Prevent some texture loading errors from crashing the game (#5121)
|
||||
LexManos: Patch PotionHelper to use registry delegates (#5142)
|
||||
LexManos: Add a notification event for handling game rule changes (#5152)
|
||||
|
||||
Build 2766:
|
||||
LexManos:
|
||||
Change universal bucket support to use fluid names instead of instances
|
||||
(#5031)
|
||||
|
||||
Build 2765:
|
||||
LexManos: Fix NPE on clientside entities constructed with null world (#5170)
|
||||
|
||||
Build 2764:
|
||||
tterrag: Fix patches from #5160 running on the client and causing stutter
|
||||
|
||||
Build 2763:
|
||||
LexManos:
|
||||
Class transformer optimizations (#5159)
|
||||
* Filter packages for deobf transformation
|
||||
* Only serialize transformed class with TerminalTransformer if bytecode
|
||||
changed
|
||||
|
||||
Build 2762:
|
||||
github: Update github stale so issues can be Assigned
|
||||
|
||||
Build 2761:
|
||||
LexManos:
|
||||
Fix MC-136995 - Chunk loading and unloading issue with entities placed
|
||||
in exact positions. (#5160)
|
||||
Scatter gun patches to improve entity tracking and position tracking.
|
||||
Provided by Aikar through the Paper project, this commit of patches
|
||||
combines the following patches:
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0306-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0315-Always-process-chunk-registration-after-moving.patch
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0335-Ensure-chunks-are-always-loaded-on-hard-position-set.patch
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch
|
||||
|
||||
Build 2760:
|
||||
LexManos: Fix --mods and --modListFile arguments not making it past LaunchWrapper.
|
||||
|
||||
Build 2759:
|
||||
LexManos: Remove BlamingTransformer (#5115)
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
@@ -1,6 +0,0 @@
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
||||
@@ -1,90 +0,0 @@
|
||||
@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%\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
|
||||
@@ -1,45 +0,0 @@
|
||||
package pulxes.ab;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import pulxes.ab.common.core.AdvancedBotanyTab;
|
||||
import pulxes.ab.common.core.proxy.CommonProxy;
|
||||
|
||||
@Mod(modid = AdvancedBotany.MODID, name="Advanced Botany", version = AdvancedBotany.VERSION, dependencies = "required-after:botania", guiFactory = "pulxes.ab.client.core.proxy.GuiFactory", acceptedMinecraftVersions = "[1.12.2]")
|
||||
public class AdvancedBotany {
|
||||
|
||||
public static final String MODID = "advanced_botany";
|
||||
public static final String VERSION = "2.0.0";
|
||||
|
||||
public static final CreativeTabs tabAB = new AdvancedBotanyTab();
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(MODID);
|
||||
|
||||
@Mod.Instance(MODID)
|
||||
public static AdvancedBotany instance;
|
||||
|
||||
@SidedProxy(serverSide = "pulxes.ab.common.core.proxy.CommonProxy", clientSide = "pulxes.ab.client.core.proxy.ClientProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package pulxes.ab.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import pulxes.ab.api.recipe.RecipeAncientAlphirine;
|
||||
import pulxes.ab.api.recipe.RecipeNidavellirForge;
|
||||
|
||||
public class AdvancedBotanyAPI {
|
||||
|
||||
public static List<RecipeAncientAlphirine> alphirineRecipes = new ArrayList<RecipeAncientAlphirine>();
|
||||
public static List<RecipeNidavellirForge> forgeRecipes = new ArrayList<RecipeNidavellirForge>();
|
||||
|
||||
public static final Item.ToolMaterial MITHRILL_TOOL_MATERIAL = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 4.0F, 24);
|
||||
|
||||
public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, Object input, int chance) {
|
||||
RecipeAncientAlphirine recipe = new RecipeAncientAlphirine(output, input, chance);
|
||||
alphirineRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public static RecipeNidavellirForge registerForgeRecipe(ItemStack output, Object input1, Object input2, Object input3, int mana, int color) {
|
||||
RecipeNidavellirForge recipe = new RecipeNidavellirForge(output, mana, color, input1, input2, input3);
|
||||
forgeRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package pulxes.ab.api;
|
||||
|
||||
public abstract class EffectRender {
|
||||
|
||||
public int tick;
|
||||
|
||||
public EffectRender(int tick) {
|
||||
this.tick = tick;
|
||||
}
|
||||
|
||||
public abstract void doEffect();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package pulxes.ab.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
|
||||
public interface IRankItem extends IManaItem {
|
||||
|
||||
public int getLevel(ItemStack stack);
|
||||
|
||||
public int[] getLevels();
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package pulxes.ab.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class RecipeAncientAlphirine {
|
||||
|
||||
private ItemStack output;
|
||||
private Object input;
|
||||
private int chance;
|
||||
|
||||
public RecipeAncientAlphirine(ItemStack output, Object input, int chance) {
|
||||
this.output = output;
|
||||
if(input instanceof String || input instanceof ItemStack)
|
||||
this.input = input;
|
||||
else
|
||||
throw new IllegalArgumentException("Invalid input");
|
||||
this.input = input;
|
||||
if(chance > 100)
|
||||
chance = 100;
|
||||
else if(chance <= 0)
|
||||
chance = 1;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
if(stack.isEmpty())
|
||||
return false;
|
||||
if(input instanceof String) {
|
||||
boolean found = false;
|
||||
for(ItemStack oreStack : OreDictionary.getOres((String)input, false)) {
|
||||
if(OreDictionary.itemMatches(oreStack, stack, false)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
} else if(input instanceof ItemStack) {
|
||||
ItemStack inputCopy = ((ItemStack)input).copy();
|
||||
if(inputCopy.getItemDamage() == 32767)
|
||||
inputCopy.setItemDamage(stack.getItemDamage());
|
||||
return stack.getItem() == inputCopy.getItem() && stack.getItemDamage() == inputCopy.getItemDamage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public Object getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package pulxes.ab.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class RecipeNidavellirForge extends RecipePetals {
|
||||
|
||||
private int color;
|
||||
private int mana;
|
||||
|
||||
public RecipeNidavellirForge(ItemStack output, int mana, int color, Object... inputs) {
|
||||
super(output, inputs);
|
||||
this.mana = mana;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public boolean matches(IItemHandler inv) {
|
||||
List<Object> inputsMissing = new ArrayList(getInputs());
|
||||
for(int i = 1; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack.isEmpty())
|
||||
break;
|
||||
int stackIndex = -1, oredictIndex = -1;
|
||||
for(int j = 0; j < inputsMissing.size(); j++) {
|
||||
Object input = inputsMissing.get(j);
|
||||
if(input instanceof String) {
|
||||
boolean found = false;
|
||||
for(ItemStack ostack : OreDictionary.getOres((String)input, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
oredictIndex = j;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
break;
|
||||
} else if(input instanceof ItemStack && compareStacks((ItemStack)input, stack)) {
|
||||
stackIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(stackIndex != -1)
|
||||
inputsMissing.remove(stackIndex);
|
||||
else if(oredictIndex != -1)
|
||||
inputsMissing.remove(oredictIndex);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return inputsMissing.isEmpty();
|
||||
}
|
||||
|
||||
private boolean compareStacks(ItemStack recipe, ItemStack supplied) {
|
||||
return (recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage() && ItemNBTHelper.matchTag(recipe.getTagCompound(), supplied.getTagCompound()));
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public int getManaUsage() {
|
||||
return this.mana;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import pulxes.ab.api.EffectRender;
|
||||
|
||||
public class ClientEffectHandler {
|
||||
|
||||
public static List<EffectRender> effectRendersList = new ArrayList<EffectRender>();
|
||||
|
||||
public static void addEffectRender(EffectRender effectRender) {
|
||||
effectRendersList.add(effectRender);
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
if(!effectRendersList.isEmpty())
|
||||
for(int i = 0; i < effectRendersList.size(); i++) {
|
||||
EffectRender effectRender = effectRendersList.get(i);
|
||||
if(effectRender.tick <= 0) {
|
||||
effectRendersList.remove(i);
|
||||
continue;
|
||||
}
|
||||
effectRender.doEffect();
|
||||
effectRender.tick--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.client.core.handler.PlayerItemUsingSound.ClientSoundHandler;
|
||||
|
||||
public class ClientTickHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void clientTickEnd(TickEvent.ClientTickEvent event) {
|
||||
if(event.phase == TickEvent.Phase.END) {
|
||||
ClientSoundHandler.tick();
|
||||
ClientEffectHandler.tick();
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderTooltip() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.item.equipment.ItemBlackHoleBox;
|
||||
import vazkii.botania.common.item.ItemCraftingHalo;
|
||||
|
||||
@EventBusSubscriber(value = {Side.CLIENT}, modid = AdvancedBotany.MODID)
|
||||
public class HUDHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
ItemStack main = mc.player.getHeldItemMainhand();
|
||||
ItemStack offhand = mc.player.getHeldItemOffhand();
|
||||
if(event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
|
||||
boolean hasCraftingHalo = (mc.player.getHeldItemMainhand().getItem() instanceof ItemCraftingHalo) || (mc.player.getHeldItemOffhand().getItem() instanceof ItemCraftingHalo);
|
||||
if(!hasCraftingHalo) {
|
||||
if(!main.isEmpty() && main.getItem() instanceof ItemBlackHoleBox) {
|
||||
profiler.startSection("blackHoleBox_main");
|
||||
ItemBlackHoleBox.renderHUD(event.getResolution(), mc.player, main);
|
||||
profiler.endSection();
|
||||
} else if(!offhand.isEmpty() && offhand.getItem() instanceof ItemBlackHoleBox) {
|
||||
profiler.startSection("blackHoleBox_off");
|
||||
ItemBlackHoleBox.renderHUD(event.getResolution(), mc.player, offhand);
|
||||
profiler.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
|
||||
public class IconMiscHandler {
|
||||
|
||||
public static final IconMiscHandler INSTANCE = new IconMiscHandler();
|
||||
|
||||
public TextureAtlasSprite alphirinePortal;
|
||||
public TextureAtlasSprite elvenSpark;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
this.alphirinePortal = IconHelper.forName(evt.getMap(), "alphirine_portal", "blocks");
|
||||
this.elvenSpark = IconHelper.forName(evt.getMap(), "elven_spark", "items");
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PlayerItemUsingSound {
|
||||
|
||||
public EntityPlayer player;
|
||||
public ISound sound;
|
||||
public int maxTick = 0;
|
||||
public int tick = 0;
|
||||
public boolean isDeadingSound = false;
|
||||
public boolean hasCheckUse;
|
||||
|
||||
public PlayerItemUsingSound(EntityPlayer player, ISound sound, int maxTick, boolean hasCheckUse) {
|
||||
this.player = player;
|
||||
this.sound = sound;
|
||||
this.maxTick = maxTick;
|
||||
this.hasCheckUse = hasCheckUse;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class ClientSoundHandler {
|
||||
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
public static List<PlayerItemUsingSound> soundsList = new ArrayList<PlayerItemUsingSound>();
|
||||
|
||||
public static void playSound(EntityPlayer player, SoundEvent soundIn, SoundCategory category, float volume, float pitch, int maxTick, boolean hasCheckUse) {
|
||||
if(!soundsList.isEmpty())
|
||||
for(int i = 0; i < soundsList.size(); i++) {
|
||||
PlayerItemUsingSound playerSound = soundsList.get(i);
|
||||
if(playerSound.player.isEntityEqual(player)) {
|
||||
if(playerSound.maxTick != 0 && playerSound.maxTick <= playerSound.tick && !playerSound.isDeadingSound) {
|
||||
playerSound.isDeadingSound = true;
|
||||
setSound(player, soundIn, category, volume, pitch, maxTick, hasCheckUse);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} else
|
||||
setSound(player, soundIn, category, volume, pitch, maxTick, hasCheckUse);
|
||||
}
|
||||
else
|
||||
setSound(player, soundIn, category, volume, pitch, maxTick, hasCheckUse);
|
||||
}
|
||||
|
||||
public static void playSound(EntityPlayer player, SoundEvent soundIn, SoundCategory category, float volume, float pitch, int maxTick) {
|
||||
playSound(player, soundIn, category, volume, pitch, maxTick, true);
|
||||
}
|
||||
|
||||
public static void playSound(EntityPlayer player, SoundEvent soundIn, SoundCategory category, float volume, float pitch) {
|
||||
playSound(player, soundIn, category, volume, pitch, 0);
|
||||
}
|
||||
|
||||
protected static void setSound(EntityPlayer player, SoundEvent soundIn, SoundCategory category, float volume, float pitch, int maxTick, boolean hasCheckUse) {
|
||||
PositionedSoundRecord posSound = new PositionedSoundRecord(soundIn, category, volume, pitch, (float)player.posX, (float)player.posY, (float)player.posZ);
|
||||
soundsList.add(new PlayerItemUsingSound(player, posSound, maxTick, hasCheckUse));
|
||||
mc.getSoundHandler().playSound(posSound);
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
if(!soundsList.isEmpty()) {
|
||||
for(int i = 0; i < soundsList.size(); i++) {
|
||||
PlayerItemUsingSound playerSound = soundsList.get(i);
|
||||
playerSound.tick++;
|
||||
if(!mc.getSoundHandler().isSoundPlaying(playerSound.sound)) {
|
||||
soundsList.remove(playerSound);
|
||||
continue;
|
||||
} else if(playerSound.hasCheckUse && !isUseItem(playerSound.player)) {
|
||||
if(mc.getSoundHandler().isSoundPlaying(playerSound.sound))
|
||||
mc.getSoundHandler().stopSound(playerSound.sound);
|
||||
soundsList.remove(playerSound);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isUseItem(EntityPlayer player) {
|
||||
return player.isHandActive() && !player.getActiveItemStack().isEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.item.Item;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
import pulxes.ab.common.lib.register.ItemListAB;
|
||||
|
||||
public class RenderColorHandler {
|
||||
|
||||
public static void init() {
|
||||
ItemColors items = Minecraft.getMinecraft().getItemColors();
|
||||
items.registerItemColorHandler((s, t) -> (t == 1) ? Color.HSBtoRGB(0.836F, 1.0F - ((float)ItemSpaceBlade.getRechargeTick(s) / (float)ItemSpaceBlade.MAX_RECHARGE_TICK), 1.0F) : -1, new Item[] { ItemListAB.itemSpaceBlade } );
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.api.IRankItem;
|
||||
|
||||
@EventBusSubscriber(value = {Side.CLIENT}, modid = AdvancedBotany.MODID)
|
||||
public class TooltipDisplayHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
|
||||
if(evt.getStack().isEmpty())
|
||||
return;
|
||||
ItemStack stack = evt.getStack();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int width = evt.getWidth();
|
||||
int height = 3;
|
||||
int tooltipX = evt.getX();
|
||||
int tooltipY = evt.getY() - 4;
|
||||
FontRenderer font = evt.getFontRenderer();
|
||||
if(stack.getItem() instanceof IRankItem)
|
||||
drawRankDisplay(stack, tooltipX, tooltipY, width, height, font);
|
||||
}
|
||||
|
||||
private static void drawRankDisplay(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
|
||||
IRankItem item = (IRankItem)stack.getItem();
|
||||
int level = item.getLevel(stack);
|
||||
int max = item.getLevels()[Math.min(item.getLevels().length - 1, level + 1)];
|
||||
boolean ss = (level >= item.getLevels().length - 1);
|
||||
int curr = item.getMana(stack);
|
||||
float percent = (level == 0) ? 0.0F : (curr / max);
|
||||
int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int)(width * percent));
|
||||
float huePer = (width == 0) ? 0.0F : (1.0F / width);
|
||||
float hueOff = (vazkii.botania.client.core.handler.ClientTickHandler.ticksInGame + vazkii.botania.client.core.handler.ClientTickHandler.partialTicks) * 0.01F;
|
||||
GlStateManager.disableDepth();
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, -16777216);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1.0F, 1.0F));
|
||||
Gui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, -11184811);
|
||||
String rank = I18n.format("botania.rank" + level, new Object[0]).replaceAll("&", "\u00A7");
|
||||
GL11.glPushAttrib(64);
|
||||
GlStateManager.disableLighting();
|
||||
font.drawStringWithShadow(rank, mouseX, (mouseY - 12), 16777215);
|
||||
if(!ss) {
|
||||
rank = I18n.format("botania.rank" + (level + 1), new Object[0]).replaceAll("&", "\u00A7");
|
||||
font.drawStringWithShadow(rank, (mouseX + width - font.getStringWidth(rank)), (mouseY - 12), 16777215);
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package pulxes.ab.client.core.helper;
|
||||
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import vazkii.botania.client.core.proxy.ClientProxy;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
public class ClientHelper {
|
||||
|
||||
public static void registerCustomItemblock(Block b, String path) {
|
||||
registerCustomItemblock(b, 1, i -> path);
|
||||
}
|
||||
|
||||
public static void registerCustomItemblock(Block b, int maxExclusive, IntFunction<String> metaToPath) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (int i = 0; i < maxExclusive; i++)
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(AdvancedBotany.MODID + ":itemblock/" + (String)metaToPath.apply(i), "inventory"));
|
||||
}
|
||||
|
||||
public static void setLightmapTextureCoords() {
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
}
|
||||
|
||||
public static void renderIcon(TextureAtlasSprite icon, int light) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
float f4 = 1.0F;
|
||||
float f5 = 0.5F;
|
||||
float f6 = 0.25F;
|
||||
tessellator.getBuffer().begin(7, ClientProxy.POSITION_TEX_LMAP);
|
||||
tessellator.getBuffer().pos((0.0F - f5), (0.0F - f6), 0.0D).tex(f, f3).lightmap(light, light).endVertex();
|
||||
tessellator.getBuffer().pos((f4 - f5), (0.0F - f6), 0.0D).tex(f1, f3).lightmap(light, light).endVertex();
|
||||
tessellator.getBuffer().pos((f4 - f5), (f4 - f6), 0.0D).tex(f1, f2).lightmap(light, light).endVertex();
|
||||
tessellator.getBuffer().pos((0.0F - f5), (f4 - f6), 0.0D).tex(f, f2).lightmap(light, light).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static Vector3 setRotation(float angel, float vX, float vY, float vZ, Vector3 v3) {
|
||||
Vector3 rVec = new Vector3(vX, vY, vZ);
|
||||
Vector3 rVec1 = new Vector3(v3.x, v3.y, v3.z).normalize();
|
||||
double rAngel = Math.toRadians(angel) * 0.5f;
|
||||
double sin = Math.sin(rAngel);
|
||||
double x = rVec.x * sin;
|
||||
double y = rVec.y * sin;
|
||||
double z = rVec.z * sin;
|
||||
rAngel = Math.cos(rAngel);
|
||||
double d = -x * rVec1.x - y * rVec1.y - z * rVec1.z;
|
||||
double d1 = rAngel * rVec1.x + y * rVec1.z - z * rVec1.y;
|
||||
double d2 = rAngel * rVec1.y - x * rVec1.z + z * rVec1.x;
|
||||
double d3 = rAngel * rVec1.z + x * rVec1.y - y * rVec1.x;
|
||||
double finX = d1 * rAngel - d * x - d2 * z + d3 * y;
|
||||
double finY = d2 * rAngel - d * y + d1 * z - d3 * x;
|
||||
double finZ = d3 * rAngel - d * z - d1 * y + d2 * x;
|
||||
return new Vector3(finX, finY, finZ);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package pulxes.ab.client.core.proxy;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import pulxes.ab.client.core.handler.ClientTickHandler;
|
||||
import pulxes.ab.client.core.handler.IconMiscHandler;
|
||||
import pulxes.ab.client.core.handler.RenderColorHandler;
|
||||
import pulxes.ab.client.render.tile.RenderTileNidavellirForge;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.core.proxy.CommonProxy;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
MinecraftForge.EVENT_BUS.register(IconMiscHandler.INSTANCE);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileNidavellirForge.class, new RenderTileNidavellirForge());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAlphirinePortal.class, pulxes.ab.client.render.entity.RenderEntityAlphirinePortal::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityElvenSpark.class, pulxes.ab.client.render.entity.RenderEntityElvenSpark::new);
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
FMLCommonHandler.instance().bus().register(new ClientTickHandler());
|
||||
RenderColorHandler.init();
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package pulxes.ab.client.core.proxy;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
import pulxes.ab.client.gui.GuiAdvBotanyConfig;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
public boolean hasConfigGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public GuiScreen createConfigGui(GuiScreen parentScreen) {
|
||||
return new GuiAdvBotanyConfig(parentScreen);
|
||||
}
|
||||
|
||||
public Set<IModGuiFactory.RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package pulxes.ab.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.core.handler.AdvBotanyConfigHandler;
|
||||
|
||||
public class GuiAdvBotanyConfig extends GuiConfig {
|
||||
|
||||
public GuiAdvBotanyConfig(GuiScreen gui) {
|
||||
super(gui, (new ConfigElement(AdvBotanyConfigHandler.config.getCategory("general"))).getChildElements(), AdvancedBotany.MODID, false, false, GuiConfig.getAbridgedConfigPath(AdvBotanyConfigHandler.config.toString()));
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package pulxes.ab.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelNidavellirForge extends ModelBase {
|
||||
|
||||
private final ModelRenderer bottomAnvil;
|
||||
private final ModelRenderer topAnvil;
|
||||
|
||||
public ModelNidavellirForge() {
|
||||
textureWidth = 48;
|
||||
textureHeight = 48;
|
||||
|
||||
bottomAnvil = new ModelRenderer(this);
|
||||
bottomAnvil.setRotationPoint(0.0F, 24.0F, 0.0F);
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 26, -3.0F, -1.0F, -4.0F, 6, 1, 1, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 31, -5.0F, -1.0F, -3.0F, 12, 1, 6, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 17, -2.0F, -3.0F, -2.0F, 4, 1, 4, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 8, -4.0F, -2.0F, -3.0F, 8, 1, 6, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 23, -3.0F, -1.0F, 3.0F, 6, 1, 1, 0.0F));
|
||||
|
||||
topAnvil = new ModelRenderer(this);
|
||||
topAnvil.setRotationPoint(0.0F, 26.0F, 0.0F);
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 23, -6.5F, -11.0F, -3.0F, 12, 2, 6, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 38, -5.5F, -12.0F, -4.0F, 13, 2, 8, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 15, -5.5F, -9.0F, -3.0F, 9, 2, 6, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 17, 0, -4.5F, -11.0F, 2.5F, 7, 3, 1, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 0, -4.5F, -11.0F, -3.5F, 7, 3, 1, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 30, 12, -2.5F, -7.0F, -2.0F, 5, 1, 4, 0.0F));
|
||||
}
|
||||
|
||||
public void renderBottom() {
|
||||
bottomAnvil.render(0.0625f);
|
||||
}
|
||||
|
||||
public void renderTop() {
|
||||
topAnvil.render(0.0625f);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package pulxes.ab.client.render.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import pulxes.ab.client.core.handler.IconMiscHandler;
|
||||
import pulxes.ab.client.core.helper.ClientHelper;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
|
||||
public class RenderEntityAlphirinePortal extends Render<EntityAlphirinePortal> {
|
||||
|
||||
public RenderEntityAlphirinePortal(RenderManager renderManager) {
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
public void doRender(@Nonnull EntityAlphirinePortal entity, double x, double y, double z, float fl1, float par9) {
|
||||
double worldTime = (entity.world == null) ? 0.0D : (ClientTickHandler.ticksInGame + fl1);
|
||||
if(entity != null)
|
||||
worldTime += (new Random(((int)entity.posX ^ (int)entity.posY ^ (int)entity.posZ))).nextInt(360);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
float lbx = OpenGlHelper.lastBrightnessX;
|
||||
float lby = OpenGlHelper.lastBrightnessY;
|
||||
float burn = Math.min(1.0f, entity.ticksExisted * 0.0461f);
|
||||
float scale = Math.max(0.0f, (float)(burn + (Math.sin(worldTime / 4.2f) / 10.0f))) / 3.14f;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(x, y, z);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
GlStateManager.rotate(180.0f - this.renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
|
||||
GlStateManager.rotate(-this.renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
|
||||
GlStateManager.disableCull();
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
ClientHelper.setLightmapTextureCoords();
|
||||
ClientHelper.renderIcon(IconMiscHandler.INSTANCE.alphirinePortal, 220);
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lbx, lby);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityAlphirinePortal entity) {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package pulxes.ab.client.render.entity;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import pulxes.ab.client.core.handler.IconMiscHandler;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.render.entity.RenderSparkBase;
|
||||
|
||||
public class RenderEntityElvenSpark extends RenderSparkBase<EntityElvenSpark> {
|
||||
|
||||
public RenderEntityElvenSpark(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getBaseIcon(EntityElvenSpark entity) {
|
||||
return IconMiscHandler.INSTANCE.elvenSpark;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getSpinningIcon(EntityElvenSpark entity) {
|
||||
int upgrade = entity.getUpgrade().ordinal() - 1;
|
||||
return (upgrade >= 0 && upgrade < MiscellaneousIcons.INSTANCE.sparkUpgradeIcons.length) ? MiscellaneousIcons.INSTANCE.sparkUpgradeIcons[upgrade] : null;
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package pulxes.ab.client.render.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.entity.RenderEntityItem;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.client.model.ModelNidavellirForge;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.lib.register.BlockListAB;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
|
||||
public class RenderTileNidavellirForge extends TileEntitySpecialRenderer<TileNidavellirForge> {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation(AdvancedBotany.MODID + ":textures/model/nidavellir_forge.png");
|
||||
private static final ModelNidavellirForge MODEL = new ModelNidavellirForge();
|
||||
private static final float[] ROTATIONS = new float[] { 180.0F, 0.0F, 90.0F, 270.0F };
|
||||
private List<EntityItem> entityList = null;
|
||||
private RenderEntityItem itemRenderer = null;
|
||||
|
||||
public void render(@Nullable TileNidavellirForge forge, double x, double y, double z, float pticks, int digProgress, float unused) {
|
||||
if(forge != null && (!forge.getWorld().isBlockLoaded(forge.getPos(), false) || forge.getWorld().getBlockState(forge.getPos()).getBlock() != BlockListAB.nidavellirForge))
|
||||
return;
|
||||
|
||||
int meta = 0;
|
||||
double worldTime = 0.0D;
|
||||
float indetY = 0.0f;
|
||||
|
||||
if(forge != null && forge.getWorld() != null) {
|
||||
meta = forge.getBlockMetadata();
|
||||
worldTime = ClientTickHandler.ticksInGame + pticks + (new Random((forge.getPos().getX() ^ forge.getPos().getY() ^ forge.getPos().getZ()))).nextInt(360);
|
||||
indetY = (float)(Math.sin(worldTime / 18.0D) / 24.0D);
|
||||
if(entityList == null) {
|
||||
List<EntityItem> list = new ArrayList();
|
||||
for(int i = 0; i < forge.getSizeInventory(); i++)
|
||||
list.add(new EntityItem(forge.getWorld()));
|
||||
entityList = list;
|
||||
}
|
||||
if(itemRenderer == null) {
|
||||
itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) {
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
(Minecraft.getMinecraft()).renderEngine.bindTexture(TEXTURE);
|
||||
GlStateManager.translate(x, y, z);
|
||||
GlStateManager.translate(0.5f, 1.5f, 0.5f);
|
||||
GlStateManager.rotate(180.0f, 1.0f, 0.0f, 1.0f);
|
||||
GlStateManager.rotate(ROTATIONS[Math.max(Math.min(ROTATIONS.length - 1, meta - 2), 0)], 0.0F, 1.0F, 0.0F);
|
||||
MODEL.renderBottom();
|
||||
GlStateManager.translate(0.0f, indetY, 0.0f);
|
||||
MODEL.renderTop();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(forge != null && forge.getWorld() != null) {
|
||||
int items = 0;
|
||||
for(int i = 1; i < forge.getSizeInventory() && !forge.getItemHandler().getStackInSlot(i).isEmpty(); i++)
|
||||
items++;
|
||||
float[] angles = new float[forge.getSizeInventory() - 1];
|
||||
float anglePer = 360.0F / items;
|
||||
float totalAngle = 0.0F;
|
||||
for(int i = 0; i < angles.length; i++)
|
||||
angles[i] = totalAngle += anglePer;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(x + 0.5F, y + 0.75F, z + 0.5F);
|
||||
GlStateManager.scale(0.4F, 0.4F, 0.4F);
|
||||
|
||||
if(entityList != null) {
|
||||
|
||||
ItemStack resultStack = forge.getItemHandler().getStackInSlot(0);
|
||||
if(!resultStack.isEmpty()) {
|
||||
|
||||
entityList.get(0).setItem(resultStack);
|
||||
entityList.get(0).hoverStart = 0;
|
||||
|
||||
float yPos = MathHelper.sin((ClientTickHandler.ticksInGame + pticks) / 8.0F) * 0.05F + 0.1F;
|
||||
float angelRotate = ((ClientTickHandler.ticksInGame + pticks) / 20.0F) * 57.295776F;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.scale(1.5F, 1.5F, 1.5F);
|
||||
GlStateManager.translate(0.0f, yPos - indetY, 0.0f);
|
||||
GlStateManager.rotate(angelRotate, 0.0f, 1.0f, 0.0f);
|
||||
itemRenderer.doRender(entityList.get(0), 0.0D, 0.0D, 0.0D, 1.0F, 0.0f);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
for(int i = 1; i < entityList.size(); i++) {
|
||||
ItemStack slotStack = forge.getItemHandler().getStackInSlot(i);
|
||||
|
||||
if(slotStack.isEmpty())
|
||||
continue;
|
||||
|
||||
entityList.get(i).setItem(slotStack);
|
||||
entityList.get(i).hoverStart = 0;
|
||||
|
||||
float yPos = MathHelper.sin((ClientTickHandler.ticksInGame + pticks + i * 7) / 8.0F) * 0.05F + 0.1F;
|
||||
float angelRotate = ((ClientTickHandler.ticksInGame + pticks + i * 7) / 20.0F) * 57.295776F;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.rotate(angles[i - 1], 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(1.35F, 0.0F, 0.25F);
|
||||
GlStateManager.translate(0.0f, yPos, 0.0f);
|
||||
GlStateManager.rotate(angelRotate, 0.0f, 1.0f, 0.0f);
|
||||
itemRenderer.doRender(entityList.get(i), 0.0D, 0.0D, 0.0D, 1.0F, 0.0f);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package pulxes.ab.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
|
||||
public class BlockMod extends Block implements IModelRegister {
|
||||
|
||||
public BlockMod(Material material, String name) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(new ResourceLocation(AdvancedBotany.MODID, name));
|
||||
if(registerInCreative())
|
||||
this.setCreativeTab(AdvancedBotany.tabAB);
|
||||
}
|
||||
|
||||
protected boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
if(Item.getItemFromBlock(this) != Items.AIR)
|
||||
ModelHandler.registerBlockToState(this, 0, getDefaultState());
|
||||
}
|
||||
|
||||
public boolean eventReceived(IBlockState state, World world, BlockPos pos, int id, int param) {
|
||||
super.eventReceived(state, world, pos, id, param);
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
return (tileentity != null && tileentity.receiveClientEvent(id, param));
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
package pulxes.ab.common.block;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import pulxes.ab.client.core.helper.ClientHelper;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.lib.LibBlockNames;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
public class BlockNidavellirForge extends BlockMod {
|
||||
|
||||
private static final AxisAlignedBB[] AABB;
|
||||
|
||||
static {
|
||||
double d = 0.1875F;
|
||||
double d1 = 0.0625F;
|
||||
AABB = new AxisAlignedBB[4];
|
||||
AABB[0] = new AxisAlignedBB(d, 0.0D, 0.0D, 1.0D - d, 0.75D, 1.0D - d1);
|
||||
AABB[1] = new AxisAlignedBB(d, 0.0D, d1, 1.0D - d, 0.75D, 1.0D);
|
||||
AABB[2] = new AxisAlignedBB(0.0D, 0.0D, d, 1.0D - d1, 0.75D, 1.0D - d);
|
||||
AABB[3] = new AxisAlignedBB(d1, 0.0D, d, 1.0D, 0.75D, 1.0D - d);
|
||||
}
|
||||
|
||||
public BlockNidavellirForge() {
|
||||
super(Material.ROCK, LibBlockNames.NIDAVELLIR_FORGE);
|
||||
this.setHardness(3.0F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] { BotaniaStateProps.CARDINALS });
|
||||
}
|
||||
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return (state.getValue(BotaniaStateProps.CARDINALS)).getIndex();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
int meta = Math.max(0, Math.min(state.getBlock().getMetaFromState(state) - 2, AABB.length - 1));
|
||||
return AABB[meta];
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if(meta < 2 || meta > 5)
|
||||
meta = 2;
|
||||
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, placer.getHorizontalFacing()), 2);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
TileNidavellirForge forge = (TileNidavellirForge)world.getTileEntity(pos);
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(player.isSneaking()) {
|
||||
if(!forge.getItemHandler().getStackInSlot(0).isEmpty()) {
|
||||
ItemStack copy = forge.getItemHandler().getStackInSlot(0).copy();
|
||||
ItemHandlerHelper.giveItemToPlayer(player, copy);
|
||||
forge.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
|
||||
player.world.updateComparatorOutputLevel(forge.getPos(), null);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(forge);
|
||||
return true;
|
||||
}
|
||||
InventoryHelper.withdrawFromInventory(forge, player);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(forge);
|
||||
return true;
|
||||
} else {
|
||||
if(!stack.isEmpty())
|
||||
return forge.addItem(player, stack, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory)world.getTileEntity(pos);
|
||||
InventoryHelper.dropInventory(inv, world, state, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||
return new TileNidavellirForge();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(new IProperty[] { (IProperty)BotaniaStateProps.CARDINALS }).build());
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileNidavellirForge.class);
|
||||
ClientHelper.registerCustomItemblock(this, LibBlockNames.NIDAVELLIR_FORGE);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package pulxes.ab.common.block.subtile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import vazkii.botania.api.subtile.signature.SubTileSignature;
|
||||
|
||||
public class ABSubTileSignature implements SubTileSignature {
|
||||
|
||||
private final String name;
|
||||
|
||||
public ABSubTileSignature(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getUnlocalizedNameForStack(ItemStack stack) {
|
||||
return unlocalizedName("");
|
||||
}
|
||||
|
||||
public String getUnlocalizedLoreTextForStack(ItemStack stack) {
|
||||
return unlocalizedName(".reference");
|
||||
}
|
||||
|
||||
private String unlocalizedName(String end) {
|
||||
return "tile.ab:flower." + this.name + end;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
Class<? extends SubTileEntity> clazz = BotaniaAPI.getSubTileMapping(this.name);
|
||||
if(clazz == null)
|
||||
return "uwotm8";
|
||||
if(SubTileGenerating.class.isAssignableFrom(clazz))
|
||||
return "botania.flowerType.generating";
|
||||
if(SubTileFunctional.class.isAssignableFrom(clazz))
|
||||
return "botania.flowerType.functional";
|
||||
return "botania.flowerType.misc";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addTooltip(ItemStack stack, World world, List<String> tooltip) {
|
||||
tooltip.add(TextFormatting.BLUE + I18n.format(getType(), new Object[0]));
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package pulxes.ab.common.block.subtile;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.recipe.RecipeAncientAlphirine;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import pulxes.ab.common.lib.register.lexicon.LexiconListAB;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockModSlab;
|
||||
|
||||
public class SubTileAncientAlphirine extends SubTileFunctional {
|
||||
|
||||
private static final int MANA_REQUARE = 2500;
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.supertile.getPos().add(-1, -1, -1), this.supertile.getPos().add(2, 1, 2)));
|
||||
if(ticksExisted % 10 == 0 && mana >= MANA_REQUARE) {
|
||||
label666: for(EntityItem item : items) {
|
||||
if(item.isDead || !(item.getItem().getCount() >= 1))
|
||||
continue;
|
||||
else if(item.getItem().getItem() == ModItems.lexicon && !((ItemLexicon)item.getItem().getItem()).isKnowledgeUnlocked(item.getItem(), LexiconListAB.KNOWLEDGE_FORGOTTEN)) {
|
||||
ItemStack unlockedForgottenLexicon = item.getItem().copy();
|
||||
((ItemLexicon)item.getItem().getItem()).unlockKnowledge(unlockedForgottenLexicon, LexiconListAB.KNOWLEDGE_FORGOTTEN);
|
||||
doAlphirineCraft(item, -1, unlockedForgottenLexicon);
|
||||
break label666;
|
||||
}
|
||||
for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
|
||||
if(recipe.matches(item.getItem())) {
|
||||
doAlphirineCraft(item, recipe.getChance(), recipe.getOutput().copy());
|
||||
break label666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doAlphirineCraft(EntityItem item, int chance, ItemStack result) {
|
||||
if(!supertile.getWorld().isRemote) {
|
||||
if(chance == -1 || supertile.getWorld().rand.nextInt(110) <= chance) {
|
||||
spawnPortal(supertile.getWorld(), result, supertile.getPos().getX() + 0.5f, supertile.getPos().getY(), supertile.getPos().getZ() + 0.5f);
|
||||
mana -= MANA_REQUARE;
|
||||
} else
|
||||
mana -= MANA_REQUARE / 10;
|
||||
item.getItem().shrink(1);
|
||||
sync();
|
||||
} else {
|
||||
float m = 0.0375F;
|
||||
for(int i = 0; i < 16; i++) {
|
||||
float mx = (float)(Math.random() - 0.5D) * m;
|
||||
float my = (float)(Math.random() - 0.5D) * m;
|
||||
float mz = (float)(Math.random() - 0.5D) * m;
|
||||
Color color = new Color(Color.HSBtoRGB(0.1583F, (float)Math.random() * 0.5F + 0.5F, 1.0f));
|
||||
Botania.proxy.wispFX(item.posX, item.posY + 0.5f, item.posZ, (float)(color.getRed() / 255.0f), (float)(color.getGreen() / 255.0f), (float)(color.getBlue() / 255.0f), (float)(0.1f + (Math.random() * 0.12f)), mx, my, mz, 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnPortal(World world, ItemStack stack, float posX, float posY, float posZ) {
|
||||
EntityAlphirinePortal portal = new EntityAlphirinePortal(world);
|
||||
float itemX = (float)(posX + (Math.random() * 2.0f - 1.0f));
|
||||
float itemY = (float)(posY + 1.2f + (Math.random() - 0.5f));
|
||||
float itemZ = (float)(posZ + (Math.random() * 2.0f - 1.0f));
|
||||
portal.setPosition(itemX, itemY, itemZ);
|
||||
portal.setItemStack(stack);
|
||||
world.spawnEntity(portal);
|
||||
}
|
||||
|
||||
public int getMaxMana() {
|
||||
return 80000;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0xd0bf58;
|
||||
}
|
||||
}
|
||||
@@ -1,261 +0,0 @@
|
||||
package pulxes.ab.common.block.tile;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.recipe.RecipeNidavellirForge;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
import vazkii.botania.api.mana.spark.ISparkEntity;
|
||||
import vazkii.botania.api.mana.spark.SparkHelper;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class TileNidavellirForge extends TileSimpleInventory implements ITickable, ISparkAttachable {
|
||||
|
||||
private int wasMana;
|
||||
private int mana;
|
||||
public int manaToGet;
|
||||
private RecipeNidavellirForge currentRecipe;
|
||||
private int recipeID;
|
||||
public boolean requestUpdate;
|
||||
|
||||
public void update() {
|
||||
if(!world.isRemote)
|
||||
updateServer();
|
||||
else
|
||||
doParticle(pos.getX(), pos.getY(), pos.getZ(), (float)mana / (float)manaToGet, recipeID);
|
||||
ISparkEntity spark = getAttachedSpark();
|
||||
if(spark != null) {
|
||||
List<ISparkEntity> sparkEntities = SparkHelper.getSparksAround(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D);
|
||||
for (ISparkEntity otherSpark : sparkEntities) {
|
||||
if(spark == otherSpark)
|
||||
continue;
|
||||
if(otherSpark.getAttachedTile() != null && otherSpark.getAttachedTile() instanceof vazkii.botania.api.mana.IManaPool)
|
||||
otherSpark.registerTransfer(spark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateServer() {
|
||||
wasMana = mana;
|
||||
|
||||
if(requestUpdate)
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
boolean hasUpdate = false;
|
||||
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
|
||||
for(EntityItem item : items)
|
||||
if(!item.isDead && !item.getItem().isEmpty()) {
|
||||
ItemStack stack = item.getItem();
|
||||
hasUpdate = addItem(null, stack, true);
|
||||
}
|
||||
|
||||
int wasManaToGet = manaToGet;
|
||||
boolean hasCraft = false;
|
||||
int recipeID = 0;
|
||||
|
||||
for(RecipeNidavellirForge recipe : AdvancedBotanyAPI.forgeRecipes) {
|
||||
if(recipe.matches(itemHandler)) {
|
||||
this.recipeID = recipeID;
|
||||
if(mana > 0 && isFull()) {
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
recieveMana(-recipe.getManaUsage());
|
||||
manaToGet = 0;
|
||||
for(int i = 1; i < getSizeInventory(); i++)
|
||||
itemHandler.getStackInSlot(i).shrink(1);
|
||||
if(itemHandler.getStackInSlot(0).isEmpty())
|
||||
itemHandler.setStackInSlot(0, output);
|
||||
else
|
||||
itemHandler.getStackInSlot(0).grow(1);
|
||||
hasUpdate = true;
|
||||
// worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:terrasteelCraft", 1.0F, 2.0F);
|
||||
break;
|
||||
} else {
|
||||
if(itemHandler.getStackInSlot(0).isEmpty() || (isItemEqual(recipe.getOutput(), itemHandler.getStackInSlot(0)) && itemHandler.getStackInSlot(0).getCount() < itemHandler.getStackInSlot(0).getMaxStackSize())) {
|
||||
manaToGet = recipe.getManaUsage();
|
||||
currentRecipe = recipe;
|
||||
hasCraft = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
recipeID++;
|
||||
}
|
||||
|
||||
if(!hasCraft) {
|
||||
currentRecipe = null;
|
||||
mana = 0;
|
||||
manaToGet = 0;
|
||||
}
|
||||
|
||||
if(world.getTotalWorldTime() % 20 == 0 && wasMana > 0 && mana != wasMana)
|
||||
hasUpdate = true;
|
||||
|
||||
if(manaToGet != wasManaToGet)
|
||||
hasUpdate = true;
|
||||
|
||||
requestUpdate = hasUpdate;
|
||||
}
|
||||
|
||||
public static void doParticle(int posX, int posY, int posZ, float craftProcess, int recipeID) {
|
||||
if(craftProcess > 0.0f) {
|
||||
float size = 0.4f;
|
||||
double tickIncrement = 360.0D / 3;
|
||||
double wticks = tickIncrement;
|
||||
|
||||
double radius = (1.0f - craftProcess) * 0.525f;
|
||||
float rotate = 82.0f + (craftProcess * 360.0f);
|
||||
double gravitation = Math.cos(1.0f - craftProcess) * 0.4f;
|
||||
|
||||
int color = 0x24cce0;
|
||||
if(recipeID > 0 && !AdvancedBotanyAPI.forgeRecipes.isEmpty())
|
||||
color = AdvancedBotanyAPI.forgeRecipes.get(Math.min(AdvancedBotanyAPI.forgeRecipes.size(), recipeID)).getColor();
|
||||
float hsb[] = Color.RGBtoHSB(color & 255, color >> 8 & 255, color >> 16 & 255, null);
|
||||
int color1 = Color.HSBtoRGB(hsb[0], hsb[1], craftProcess);
|
||||
float[] colorsfx = { (color1 & 255) / 255.0f, (color1 >> 8 & 255) / 255.0f, (color1 >> 16 & 255) / 255.0f };
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
double x = posX + Math.sin((rotate + wticks) * Math.PI / 180.0D) * radius + 0.5D;
|
||||
double y = posY + 0.7D + gravitation;
|
||||
double z = posZ + Math.cos((rotate + wticks) * Math.PI / 180.0D) * radius + 0.5D;
|
||||
|
||||
wticks += tickIncrement;
|
||||
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.425F * size, 0.0f, 0.27F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.05F + 0.01F * size, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, 0.9F);
|
||||
|
||||
if(craftProcess == 1.0F)
|
||||
for(int j = 0; j < 12; j++)
|
||||
Botania.proxy.wispFX(posX + 0.5D, posY + 1.1D, posZ + 0.5D, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.15F + 0.15F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, 0.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addItem(@Nullable EntityPlayer player, ItemStack stack, boolean isDrop) {
|
||||
if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon)
|
||||
return false;
|
||||
for(int i = 1; i < getSizeInventory(); i++) {
|
||||
if(itemHandler.getStackInSlot(i).isEmpty()) {
|
||||
requestUpdate = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
int countToAdd = isDrop ? Math.min(Math.min(stackToAdd.getMaxStackSize(), stackToAdd.getCount()), itemHandler.getSlotLimit(i)) : 1;
|
||||
stackToAdd.setCount(countToAdd);
|
||||
itemHandler.setStackInSlot(i, stackToAdd);
|
||||
if(player == null || !player.capabilities.isCreativeMode)
|
||||
stack.shrink(countToAdd);
|
||||
break;
|
||||
} else {
|
||||
ItemStack slotStack = itemHandler.getStackInSlot(i);
|
||||
if(isItemEqual(slotStack, stack)) {
|
||||
int availableCount = slotStack.getMaxStackSize() - slotStack.getCount();
|
||||
if(availableCount > 0) {
|
||||
requestUpdate = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
int countToAdd = isDrop ? Math.min(availableCount, stackToAdd.getCount()) : 1;
|
||||
slotStack.grow(countToAdd);
|
||||
if(player == null || !player.capabilities.isCreativeMode)
|
||||
stack.shrink(countToAdd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isItemEqual(ItemStack stack, ItemStack stack1) {
|
||||
return stack.isItemEqual(stack1) && ItemStack.areItemStackTagsEqual(stack, stack1);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbtt) {
|
||||
NBTTagCompound ret = super.writeToNBT(nbtt);
|
||||
nbtt.setBoolean("requestUpdate", requestUpdate);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtt) {
|
||||
super.readFromNBT(nbtt);
|
||||
this.requestUpdate = nbtt.getBoolean("requestUpdate");
|
||||
}
|
||||
|
||||
public void writePacketNBT(NBTTagCompound nbtt) {
|
||||
super.writePacketNBT(nbtt);
|
||||
nbtt.setInteger("mana", mana);
|
||||
nbtt.setInteger("manaToGet", manaToGet);
|
||||
nbtt.setInteger("recipeID", currentRecipe == null ? -1 : recipeID);
|
||||
}
|
||||
|
||||
public void readPacketNBT(NBTTagCompound nbtt) {
|
||||
super.readPacketNBT(nbtt);
|
||||
this.mana = nbtt.getInteger("mana");
|
||||
this.manaToGet = nbtt.getInteger("manaToGet");
|
||||
int recipeID = nbtt.getInteger("recipeID");
|
||||
if(recipeID == -1)
|
||||
this.currentRecipe = null;
|
||||
else
|
||||
this.currentRecipe = AdvancedBotanyAPI.forgeRecipes.get(recipeID);
|
||||
}
|
||||
|
||||
public int getSizeInventory() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int getCurrentMana() {
|
||||
return mana;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return mana >= manaToGet;
|
||||
}
|
||||
|
||||
public void recieveMana(int mana) {
|
||||
this.mana = Math.min(this.mana + mana, manaToGet);
|
||||
}
|
||||
|
||||
public boolean canRecieveManaFromBursts() {
|
||||
return !this.isFull();
|
||||
}
|
||||
|
||||
public boolean canAttachSpark(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void attachSpark(ISparkEntity entity) {}
|
||||
|
||||
public ISparkEntity getAttachedSpark() {
|
||||
List<Entity> sparks = this.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.pos.up(), this.pos.up().add(1, 1, 1)), Predicates.instanceOf(ISparkEntity.class));
|
||||
if(sparks.size() == 1) {
|
||||
Entity e = sparks.get(0);
|
||||
return (ISparkEntity)e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean areIncomingTranfersDone() {
|
||||
return isFull();
|
||||
}
|
||||
|
||||
public int getAvailableSpaceForMana() {
|
||||
return Math.max(0, manaToGet - getCurrentMana());
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package pulxes.ab.common.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
public class AdvancedBotanyTab extends CreativeTabs {
|
||||
|
||||
public AdvancedBotanyTab() {
|
||||
super(AdvancedBotany.MODID);
|
||||
setNoTitle();
|
||||
setBackgroundImageName("ab.png");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(Items.SHEARS);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package pulxes.ab.common.core.handler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
public class AdvBotanyConfigHandler {
|
||||
|
||||
public static Configuration config;
|
||||
public static boolean useManaChargerAnimation = true;
|
||||
public static int maxContainerMana = 64000000;
|
||||
public static double protectionFactorNebula = 1.0f;
|
||||
public static double damageFactorSpaceSword = 1.0f;
|
||||
public static int nebulaWandCooldownTick = 18;
|
||||
public static String[] lockWorldNameNebulaRod = new String[] {};
|
||||
public static int limitXZCoords = 30000000;
|
||||
|
||||
public static void loadConfig(File configFile) {
|
||||
config = new Configuration(configFile);
|
||||
config.load();
|
||||
load();
|
||||
FMLCommonHandler.instance().bus().register(new ChangeListener());
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
String desc = "Maximum mana capacity for Mana Container (Diluted Mana Container will receive an eighth of the set value)";
|
||||
maxContainerMana = loadPropInt("Mana Container capacity", desc, maxContainerMana);
|
||||
desc = "Activating the charging animation for the Mana Charger";
|
||||
useManaChargerAnimation = loadPropBool("Mana Charger lighting", desc, useManaChargerAnimation);
|
||||
desc = "Protection factor for nebula armour";
|
||||
protectionFactorNebula = loadPropDouble("Nebula Armor Protection Factor", desc, protectionFactorNebula);
|
||||
desc = "Damage factor for Space Blade";
|
||||
damageFactorSpaceSword = loadPropDouble("Space Sword Damage Factor", desc, damageFactorSpaceSword);
|
||||
desc = "The number of ticks needed to restore 1 unit of the Rod of Nebula strength.";
|
||||
nebulaWandCooldownTick = loadPropInt("Rod of Nebula Cooldown", desc, nebulaWandCooldownTick);
|
||||
// desc = "Maximum amount of mana held in a mana spreader";
|
||||
// spreaderMaxMana = loadPropInt("Spreader Max Mana", desc, spreaderMaxMana);
|
||||
// desc = "Amount of Mana in a Mana Burst";
|
||||
// spreaderBurstMana = loadPropInt("Spreader Burst Mana", desc, spreaderBurstMana);
|
||||
// desc = "To block a creature, type it's class name";
|
||||
// lockEntityListToHorn = loadPropString("Blocked creatures for double drop", desc, lockEntityListToHorn);
|
||||
desc = "Enter the name of the World you want to add to the blacklist";
|
||||
lockWorldNameNebulaRod = loadPropString("Locking Worlds for Teleportation with Nebula Rod", desc, lockWorldNameNebulaRod);
|
||||
desc = "Limitation on X Z coordinates for teleportation, do not increase the default value";
|
||||
limitXZCoords = loadPropInt("Restriction on X Z coordinates for Rod of Nebula", desc, limitXZCoords);
|
||||
if(config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void loadPostInit() {
|
||||
if(config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static String[] loadPropString(String propName, String desc, String[] default_) {
|
||||
Property prop = config.get("general", propName, default_);
|
||||
prop.setComment(desc);
|
||||
return prop.getStringList();
|
||||
}
|
||||
|
||||
public static boolean loadPropBool(String propName, String desc, boolean default_) {
|
||||
Property prop = config.get("general", propName, default_);
|
||||
prop.setComment(desc);
|
||||
return prop.getBoolean(default_);
|
||||
}
|
||||
|
||||
public static int loadPropInt(String propName, String desc, int default_) {
|
||||
Property prop = config.get("general", propName, default_);
|
||||
prop.setComment(desc);
|
||||
return prop.getInt(default_);
|
||||
}
|
||||
|
||||
public static double loadPropDouble(String propName, String desc, double default_) {
|
||||
Property prop = config.get("general", propName, default_);
|
||||
prop.setComment(desc);
|
||||
return prop.getDouble(default_);
|
||||
}
|
||||
|
||||
public static class ChangeListener {
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
|
||||
if(eventArgs.getModID().equals(AdvancedBotany.MODID))
|
||||
AdvBotanyConfigHandler.load();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package pulxes.ab.common.core.handler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.core.network.S00PacketSpaceBladeDash;
|
||||
import pulxes.ab.common.core.network.C00PacketSpaceBladeBurst;
|
||||
|
||||
public class NetworkHandler {
|
||||
|
||||
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(AdvancedBotany.MODID);
|
||||
|
||||
public static void registerPackets() {
|
||||
int id = 0;
|
||||
NETWORK.registerMessage(S00PacketSpaceBladeDash.class, S00PacketSpaceBladeDash.class, id++, Side.CLIENT);
|
||||
NETWORK.registerMessage(C00PacketSpaceBladeBurst.class, C00PacketSpaceBladeBurst.class, id++, Side.SERVER);
|
||||
}
|
||||
|
||||
public static void sendPacketToSpaceDash(EntityPlayerMP playerMP) {
|
||||
NETWORK.sendTo(new S00PacketSpaceBladeDash(), playerMP);
|
||||
}
|
||||
|
||||
public static void sendPacketToSpaceBurst() {
|
||||
NETWORK.sendToServer(new C00PacketSpaceBladeBurst());
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package pulxes.ab.common.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
|
||||
public class C00PacketSpaceBladeBurst implements IMessage, IMessageHandler<C00PacketSpaceBladeBurst, IMessage> {
|
||||
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
public IMessage onMessage(C00PacketSpaceBladeBurst message, MessageContext ctx) {
|
||||
EntityPlayerMP player = (ctx.getServerHandler()).player;
|
||||
player.mcServer.addScheduledTask(() -> ItemSpaceBlade.spaceBurstAttack(player));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package pulxes.ab.common.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
|
||||
public class S00PacketSpaceBladeDash implements IMessage, IMessageHandler<S00PacketSpaceBladeDash, IMessage> {
|
||||
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(S00PacketSpaceBladeDash message, MessageContext ctx) {
|
||||
ItemSpaceBlade.playerSpaceDash(Minecraft.getMinecraft().player);
|
||||
ItemSpaceBlade.doParticleDash();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package pulxes.ab.common.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
|
||||
public class S01PacketNidavellirForgeCraft implements IMessage, IMessageHandler<S01PacketNidavellirForgeCraft, IMessage> {
|
||||
|
||||
private int posX;
|
||||
private int posY;
|
||||
private int posZ;
|
||||
|
||||
private int recipeID;
|
||||
private float craftProcess;
|
||||
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(S01PacketNidavellirForgeCraft message, MessageContext ctx) {
|
||||
ItemSpaceBlade.playerSpaceDash(Minecraft.getMinecraft().player);
|
||||
ItemSpaceBlade.doParticleDash();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package pulxes.ab.common.core.proxy;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import pulxes.ab.client.core.handler.RenderColorHandler;
|
||||
import pulxes.ab.common.core.handler.AdvBotanyConfigHandler;
|
||||
import pulxes.ab.common.core.handler.NetworkHandler;
|
||||
import pulxes.ab.common.lib.register.EntityListAB;
|
||||
import pulxes.ab.common.lib.register.FlowerListAB;
|
||||
import pulxes.ab.common.lib.register.ItemListAB;
|
||||
import pulxes.ab.common.lib.register.RecipeListAB;
|
||||
import pulxes.ab.common.lib.register.lexicon.LexiconListAB;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
EntityListAB.init();
|
||||
FlowerListAB.init();
|
||||
AdvBotanyConfigHandler.loadConfig(event.getSuggestedConfigurationFile());
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
NetworkHandler.registerPackets();
|
||||
RecipeListAB.init();
|
||||
LexiconListAB.init();
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
AdvBotanyConfigHandler.loadPostInit();
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package pulxes.ab.common.entity;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
public class EntityAlphirinePortal extends Entity {
|
||||
|
||||
private static final DataParameter<ItemStack> ITEM = EntityDataManager.createKey(EntityProjectileSpaceBurst.class, DataSerializers.ITEM_STACK);
|
||||
private static final ItemStack DEFAULT_STACK = new ItemStack(Items.AIR);
|
||||
|
||||
public EntityAlphirinePortal(World world) {
|
||||
super(world);
|
||||
setSize(1.0F, 1.0F);
|
||||
isImmuneToFire = true;
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
this.dataManager.register(ITEM, DEFAULT_STACK);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if(ticksExisted >= 40) {
|
||||
if(getItemStack() == DEFAULT_STACK)
|
||||
setDead();
|
||||
else if(!world.isRemote) {
|
||||
EntityItem itemResult = new EntityItem(world, posX, posY, posZ, getItemStack());
|
||||
world.spawnEntity(itemResult);
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return this.dataManager.get(ITEM);
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack stack) {
|
||||
this.dataManager.set(ITEM, stack);
|
||||
}
|
||||
|
||||
protected void readEntityFromNBT(NBTTagCompound nbtt) {
|
||||
ticksExisted = nbtt.getInteger("ticksExisted");
|
||||
ItemStack portalLoot = getItemStack().copy();
|
||||
portalLoot.writeToNBT(nbtt);
|
||||
}
|
||||
|
||||
protected void writeEntityToNBT(NBTTagCompound nbtt) {
|
||||
nbtt.setInteger("ticksExisted", ticksExisted);
|
||||
setItemStack(new ItemStack(nbtt));
|
||||
}
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
package pulxes.ab.common.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import pulxes.ab.common.lib.register.ItemListAB;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
import vazkii.botania.api.mana.spark.ISparkEntity;
|
||||
import vazkii.botania.api.mana.spark.SparkHelper;
|
||||
import vazkii.botania.api.mana.spark.SparkUpgradeType;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
public class EntityElvenSpark extends Entity implements ISparkEntity {
|
||||
|
||||
private static final int TRANSFER_RATE = 24_000;
|
||||
private static final String TAG_UPGRADE = "upgrade";
|
||||
private static final String TAG_INVIS = "invis";
|
||||
private static final DataParameter<Integer> UPGRADE = EntityDataManager.createKey(EntityElvenSpark.class, DataSerializers.VARINT);
|
||||
|
||||
private final Set<ISparkEntity> transfers = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
|
||||
private int removeTransferants = 2;
|
||||
|
||||
public EntityElvenSpark(World world) {
|
||||
super(world);
|
||||
isImmuneToFire = true;
|
||||
setSize(0.1F, 0.5F);
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
dataManager.register(UPGRADE, 0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getPickedResult(RayTraceResult target) {
|
||||
return new ItemStack(ItemListAB.itemElvenSpark);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if(world.isRemote)
|
||||
return;
|
||||
ISparkAttachable tile = getAttachedTile();
|
||||
if(tile == null) {
|
||||
dropAndKill();
|
||||
return;
|
||||
}
|
||||
SparkUpgradeType upgrade = getUpgrade();
|
||||
List<ISparkEntity> allSparks = null;
|
||||
if(upgrade == SparkUpgradeType.DOMINANT || upgrade == SparkUpgradeType.RECESSIVE)
|
||||
allSparks = SparkHelper.getSparksAround(world, posX, posY + (height / 2.0), posZ);
|
||||
Collection<ISparkEntity> transfers = getTransfers();
|
||||
switch(upgrade) {
|
||||
case DISPERSIVE : {
|
||||
List<EntityPlayer> players = SparkHelper.getEntitiesAround(EntityPlayer.class, world, posX, posY + (height / 2.0), posZ);
|
||||
Map<EntityPlayer, TObjectIntHashMap<ItemStack>> receivingPlayers = new HashMap<>();
|
||||
ItemStack input = new ItemStack(ItemListAB.itemElvenSpark);
|
||||
for(EntityPlayer player : players) {
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
stacks.addAll(player.inventory.mainInventory);
|
||||
stacks.addAll(player.inventory.armorInventory);
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
for (int i = 0; i < baubles.getSlots(); i++)
|
||||
stacks.add(baubles.getStackInSlot(i));
|
||||
for(ItemStack stack : stacks) {
|
||||
if(stack.isEmpty() || !(stack.getItem() instanceof IManaItem))
|
||||
continue;
|
||||
IManaItem manaItem = (IManaItem) stack.getItem();
|
||||
if(manaItem.canReceiveManaFromItem(stack, input)) {
|
||||
TObjectIntHashMap<ItemStack> receivingStacks;
|
||||
boolean add = false;
|
||||
if(!receivingPlayers.containsKey(player)) {
|
||||
add = true;
|
||||
receivingStacks = new TObjectIntHashMap<>();
|
||||
} else receivingStacks = receivingPlayers.get(player);
|
||||
int recv = Math.min(getAttachedTile().getCurrentMana(), Math.min(TRANSFER_RATE, manaItem.getMaxMana(stack) - manaItem.getMana(stack)));
|
||||
if(recv > 0) {
|
||||
receivingStacks.put(stack, recv);
|
||||
if(add)
|
||||
receivingPlayers.put(player, receivingStacks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!receivingPlayers.isEmpty()) {
|
||||
List<EntityPlayer> keys = new ArrayList<>(receivingPlayers.keySet());
|
||||
Collections.shuffle(keys);
|
||||
EntityPlayer player = keys.iterator().next();
|
||||
TObjectIntHashMap<ItemStack> items = receivingPlayers.get(player);
|
||||
ItemStack stack = items.keySet().iterator().next();
|
||||
int cost = items.get(stack);
|
||||
int manaToPut = Math.min(getAttachedTile().getCurrentMana(), cost);
|
||||
((IManaItem) stack.getItem()).addMana(stack, manaToPut);
|
||||
getAttachedTile().recieveMana(-manaToPut);
|
||||
particlesTowards(player);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOMINANT : {
|
||||
List<ISparkEntity> validSparks = new ArrayList<>();
|
||||
for(ISparkEntity spark : allSparks) {
|
||||
if(spark == this)
|
||||
continue;
|
||||
SparkUpgradeType upgrade_ = spark.getUpgrade();
|
||||
if(upgrade_ == SparkUpgradeType.NONE && spark.getAttachedTile() instanceof IManaPool)
|
||||
validSparks.add(spark);
|
||||
}
|
||||
if(validSparks.size() > 0)
|
||||
validSparks.get(world.rand.nextInt(validSparks.size())).registerTransfer(this);
|
||||
break;
|
||||
}
|
||||
case RECESSIVE : {
|
||||
for(ISparkEntity spark : allSparks) {
|
||||
if(spark == this)
|
||||
continue;
|
||||
SparkUpgradeType upgrade_ = spark.getUpgrade();
|
||||
if(upgrade_ != SparkUpgradeType.DOMINANT && upgrade_ != SparkUpgradeType.RECESSIVE && upgrade_ != SparkUpgradeType.ISOLATED)
|
||||
transfers.add(spark);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NONE:
|
||||
default: break;
|
||||
}
|
||||
if(!transfers.isEmpty()) {
|
||||
int manaTotal = Math.min(TRANSFER_RATE * transfers.size(), tile.getCurrentMana());
|
||||
int manaForEach = manaTotal / transfers.size();
|
||||
int manaSpent = 0;
|
||||
if(manaForEach > transfers.size()) {
|
||||
for(ISparkEntity spark : transfers) {
|
||||
if(spark.getAttachedTile() == null || spark.getAttachedTile().isFull() || spark.areIncomingTransfersDone()) {
|
||||
manaTotal -= manaForEach;
|
||||
continue;
|
||||
}
|
||||
ISparkAttachable attached = spark.getAttachedTile();
|
||||
int spend = Math.min(attached.getAvailableSpaceForMana(), manaForEach);
|
||||
attached.recieveMana(spend);
|
||||
manaSpent += spend;
|
||||
particlesTowards((Entity) spark);
|
||||
}
|
||||
tile.recieveMana(-manaSpent);
|
||||
}
|
||||
}
|
||||
if(removeTransferants > 0)
|
||||
removeTransferants--;
|
||||
filterTransfers();
|
||||
}
|
||||
|
||||
private void particlesTowards(Entity e) {
|
||||
PacketHandler.sendToNearby(world, this, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.SPARK_MANA_FLOW, posX, posY, posZ, getEntityId(), e.getEntityId()));
|
||||
}
|
||||
|
||||
public static void particleBeam(EntityPlayer player, Entity e1, Entity e2) {
|
||||
if(e1 != null && e2 != null && !e1.world.isRemote) {
|
||||
PacketHandler.sendTo((EntityPlayerMP) player, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.SPARK_NET_INDICATOR, e1.posX, e1.posY, e1.posZ, e1.getEntityId(), e2.getEntityId()));
|
||||
}
|
||||
}
|
||||
|
||||
private void dropAndKill() {
|
||||
SparkUpgradeType upgrade = getUpgrade();
|
||||
entityDropItem(new ItemStack(ItemListAB.itemElvenSpark), 0F);
|
||||
if(upgrade != SparkUpgradeType.NONE)
|
||||
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade.ordinal() - 1), 0F);
|
||||
setDead();
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(!isDead && !stack.isEmpty()) {
|
||||
if(world.isRemote) {
|
||||
boolean valid = stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.sparkUpgrade || stack.getItem() == ModItems.phantomInk;
|
||||
if(valid)
|
||||
player.swingArm(hand);
|
||||
return valid;
|
||||
}
|
||||
SparkUpgradeType upgrade = getUpgrade();
|
||||
if(stack.getItem() == ModItems.twigWand) {
|
||||
if(player.isSneaking()) {
|
||||
if(upgrade != SparkUpgradeType.NONE) {
|
||||
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade.ordinal() - 1), 0F);
|
||||
setUpgrade(SparkUpgradeType.NONE);
|
||||
transfers.clear();
|
||||
removeTransferants = 2;
|
||||
} else dropAndKill();
|
||||
return true;
|
||||
} else {
|
||||
for(ISparkEntity spark : SparkHelper.getSparksAround(world, posX, posY + (height / 2.0), posZ))
|
||||
particleBeam(player, this, (Entity) spark);
|
||||
return true;
|
||||
}
|
||||
} else if(stack.getItem() == ModItems.sparkUpgrade && upgrade == SparkUpgradeType.NONE) {
|
||||
int newUpgrade = stack.getItemDamage() + 1;
|
||||
setUpgrade(SparkUpgradeType.values()[newUpgrade]);
|
||||
stack.shrink(1);
|
||||
return true;
|
||||
} else if (stack.getItem() == ModItems.phantomInk) {
|
||||
setInvisible(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void readEntityFromNBT(@Nonnull NBTTagCompound cmp) {
|
||||
setUpgrade(SparkUpgradeType.values()[cmp.getInteger(TAG_UPGRADE)]);
|
||||
setInvisible(cmp.getInteger(TAG_INVIS) == 1);
|
||||
}
|
||||
|
||||
protected void writeEntityToNBT(@Nonnull NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_UPGRADE, getUpgrade().ordinal());
|
||||
cmp.setInteger(TAG_INVIS, isInvisible() ? 1 : 0);
|
||||
}
|
||||
|
||||
public ISparkAttachable getAttachedTile() {
|
||||
int x = MathHelper.floor(posX);
|
||||
int y = MathHelper.floor(posY) - 1;
|
||||
int z = MathHelper.floor(posZ);
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
if(tile != null && tile instanceof ISparkAttachable)
|
||||
return (ISparkAttachable) tile;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void filterTransfers() {
|
||||
Iterator<ISparkEntity> iter = transfers.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ISparkEntity spark = iter.next();
|
||||
SparkUpgradeType upgr = getUpgrade();
|
||||
SparkUpgradeType supgr = spark.getUpgrade();
|
||||
ISparkAttachable atile = spark.getAttachedTile();
|
||||
if(!(spark != this
|
||||
&& !spark.areIncomingTransfersDone()
|
||||
&& atile != null && !atile.isFull()
|
||||
&& (upgr == SparkUpgradeType.NONE && supgr == SparkUpgradeType.DOMINANT || upgr == SparkUpgradeType.RECESSIVE && (supgr == SparkUpgradeType.NONE || supgr == SparkUpgradeType.DISPERSIVE) || !(atile instanceof IManaPool))))
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<ISparkEntity> getTransfers() {
|
||||
filterTransfers();
|
||||
return transfers;
|
||||
}
|
||||
|
||||
private boolean hasTransfer(ISparkEntity entity) {
|
||||
return transfers.contains(entity);
|
||||
}
|
||||
|
||||
public void registerTransfer(ISparkEntity entity) {
|
||||
if(hasTransfer(entity))
|
||||
return;
|
||||
transfers.add(entity);
|
||||
}
|
||||
|
||||
public SparkUpgradeType getUpgrade() {
|
||||
return SparkUpgradeType.values()[dataManager.get(UPGRADE)];
|
||||
}
|
||||
|
||||
public void setUpgrade(SparkUpgradeType upgrade) {
|
||||
dataManager.set(UPGRADE, upgrade.ordinal());
|
||||
}
|
||||
|
||||
public boolean areIncomingTransfersDone() {
|
||||
ISparkAttachable tile = getAttachedTile();
|
||||
if(tile instanceof IManaPool)
|
||||
return removeTransferants > 0;
|
||||
return tile != null && tile.areIncomingTranfersDone();
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package pulxes.ab.common.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
public class EntityProjectileSpaceBurst extends EntityThrowable {
|
||||
|
||||
private static final DataParameter<Float> DAMAGE = EntityDataManager.createKey(EntityProjectileSpaceBurst.class, DataSerializers.FLOAT);
|
||||
private static final DataParameter<String> ATTACKER_NAME = EntityDataManager.createKey(EntityProjectileSpaceBurst.class, DataSerializers.STRING);
|
||||
|
||||
public EntityProjectileSpaceBurst(World world) {
|
||||
super(world);
|
||||
setSize(0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public EntityProjectileSpaceBurst(EntityLivingBase thrower) {
|
||||
super(thrower.world, thrower);
|
||||
setSize(0.0F, 0.0F);
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataManager.register(DAMAGE, Float.valueOf(0.0f));
|
||||
this.dataManager.register(ATTACKER_NAME, "");
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
updateState();
|
||||
if(ticksExisted < 20) {
|
||||
this.motionX *= 1.115f;
|
||||
this.motionY *= 1.115f;
|
||||
this.motionZ *= 1.115f;
|
||||
} else if(ticksExisted > 160)
|
||||
setDead();
|
||||
if(world.isRemote) {
|
||||
for(int i = 0; i < 12; i++) {
|
||||
float r = world.rand.nextBoolean() ? (225.0f / 255.0f) : (101.0f / 255.0f);
|
||||
float g = world.rand.nextBoolean() ? (67.0f / 255.0f) : (209.0f / 255.0f);
|
||||
float b = world.rand.nextBoolean() ? (240.0f / 255.0f) : (225.0f / 255.0f);
|
||||
Botania.proxy.sparkleFX(posX + ((Math.random() - 0.5D)) * 0.25f, posY + ((Math.random() - 0.5D) * 0.25f), (posZ + (Math.random() - 0.5D) * 0.25f), r + (float)(Math.random() / 4 - 0.125D), g + (float)(Math.random() / 4 - 0.125D), b + (float)(Math.random() / 4 - 0.125D), 1.6F * (float)(Math.random() - 0.5D), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState() {
|
||||
String attacker = getAttacker();
|
||||
AxisAlignedBB axis = (new AxisAlignedBB(posX, posY, posZ, lastTickPosX, lastTickPosY, lastTickPosZ)).grow(1.0D);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, axis);
|
||||
for(EntityLivingBase living : entities) {
|
||||
if(living instanceof EntityPlayer && (((EntityPlayer)living).getName().equals(attacker) || (FMLCommonHandler.instance().getMinecraftServerInstance() != null && !FMLCommonHandler.instance().getMinecraftServerInstance().isPVPEnabled())))
|
||||
continue;
|
||||
if(living.hurtTime == 0) {
|
||||
float damage = getDamage();
|
||||
if(!world.isRemote) {
|
||||
EntityPlayer player = living.world.getPlayerEntityByName(attacker);
|
||||
living.attackEntityFrom((player == null) ? DamageSource.MAGIC : DamageSource.causePlayerDamage(player), damage);
|
||||
setDead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onImpact(@Nonnull RayTraceResult result) {
|
||||
if(result.getBlockPos() != null) {
|
||||
IBlockState state = world.getBlockState(result.getBlockPos());
|
||||
if(state != null) {
|
||||
if(state.getBlock() instanceof net.minecraft.block.BlockBush || state.getBlock() instanceof net.minecraft.block.BlockLeaves)
|
||||
return;
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readEntityFromNBT(NBTTagCompound nbtt) {
|
||||
super.readEntityFromNBT(nbtt);
|
||||
ticksExisted = nbtt.getInteger("ticksExisted");
|
||||
setDamage(nbtt.getInteger("burtDamage"));
|
||||
setAttacker(nbtt.getString("attackerName"));
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbtt) {
|
||||
super.writeEntityToNBT(nbtt);
|
||||
nbtt.setInteger("ticksExisted", ticksExisted);
|
||||
nbtt.setFloat("burtDamage", getDamage());
|
||||
nbtt.setString("attackerName", getAttacker());
|
||||
}
|
||||
|
||||
protected float getGravityVelocity() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public String getAttacker() {
|
||||
return this.dataManager.get(ATTACKER_NAME);
|
||||
}
|
||||
|
||||
public void setAttacker(String str) {
|
||||
this.dataManager.set(ATTACKER_NAME, str);
|
||||
}
|
||||
|
||||
public float getDamage() {
|
||||
return this.dataManager.get(DAMAGE);
|
||||
}
|
||||
|
||||
public void setDamage(float damage) {
|
||||
this.dataManager.set(DAMAGE, damage);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package pulxes.ab.common.item;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.IManaGivingItem;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
|
||||
public class ItemElvenSpark extends ItemMod implements IManaGivingItem {
|
||||
|
||||
public ItemElvenSpark() {
|
||||
super(LibItemNames.ELVEN_SPARK);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float xv, float yv, float zv) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof ISparkAttachable) {
|
||||
ISparkAttachable attach = (ISparkAttachable)tile;
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(attach.canAttachSpark(stack) && attach.getAttachedSpark() == null) {
|
||||
if(!world.isRemote) {
|
||||
stack.shrink(1);
|
||||
EntityElvenSpark spark = new EntityElvenSpark(world);
|
||||
spark.setPosition(pos.getX() + 0.5D, pos.getY() + 1.5D, pos.getZ() + 0.5D);
|
||||
world.spawnEntity(spark);
|
||||
attach.attachSpark(spark);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package pulxes.ab.common.item;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
|
||||
public class ItemMod extends Item implements IModelRegister {
|
||||
|
||||
public ItemMod(String name) {
|
||||
this.setCreativeTab(AdvancedBotany.tabAB);
|
||||
this.setRegistryName(new ResourceLocation(AdvancedBotany.MODID, name));
|
||||
this.setUnlocalizedName(name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack stack) {
|
||||
return super.getUnlocalizedNameInefficiently(stack).replaceAll("item\\.", "item." + AdvancedBotany.MODID + ":");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package pulxes.ab.common.item;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import vazkii.botania.api.recipe.IFlowerComponent;
|
||||
|
||||
public class ItemResource extends ItemMod implements IFlowerComponent {
|
||||
|
||||
public ItemResource() {
|
||||
super("resourse");
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack stack) {
|
||||
return stack.getItemDamage() == 2;
|
||||
}
|
||||
|
||||
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> stacks) {
|
||||
if(isInCreativeTab(tab))
|
||||
for(int i = 0; i < LibItemNames.RESOURCE_NAMES.length; i++)
|
||||
stacks.add(new ItemStack(this, 1, i));
|
||||
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "item." + LibItemNames.RESOURCE_NAMES[Math.min(LibItemNames.RESOURCE_NAMES.length, stack.getItemDamage())];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
for(int i = 0; i < LibItemNames.RESOURCE_NAMES.length; i++)
|
||||
ModelLoader.setCustomModelResourceLocation(this, i, new ModelResourceLocation(AdvancedBotany.MODID + ":" + LibItemNames.RESOURCE_NAMES[i], "inventory"));
|
||||
}
|
||||
|
||||
public int getParticleColor(ItemStack stack) {
|
||||
return 10158080;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
if(player.getHeldItem(hand).getItemDamage() != 3)
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
player.setActiveHand(hand);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack onItemUseFinish(@Nonnull ItemStack stack, World world, EntityLivingBase living) {
|
||||
if(stack.getItemDamage() != 3)
|
||||
return super.onItemUseFinish(stack, world, living);
|
||||
else if(!(living instanceof EntityPlayer))
|
||||
return super.onItemUseFinish(stack, world, living);
|
||||
else if(!world.isRemote)
|
||||
living.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 120, 3));
|
||||
EntityPlayer player = (EntityPlayer)living;
|
||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(Items.GLASS_BOTTLE));
|
||||
stack.shrink(1);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return stack.getItemDamage() != 3 ? super.getMaxItemUseDuration(stack) : 24;
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return stack.getItemDamage() != 3 ? super.getItemUseAction(stack) : EnumAction.DRINK;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package pulxes.ab.common.item.block;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
public class ItemBlockMod extends ItemBlock {
|
||||
|
||||
public ItemBlockMod(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack par1ItemStack) {
|
||||
return getUnlocalizedNameInefficiently_(par1ItemStack).replaceAll("tile.", "tile." + AdvancedBotany.MODID + ":");
|
||||
}
|
||||
|
||||
public String getUnlocalizedNameInefficiently_(ItemStack stack) {
|
||||
return super.getUnlocalizedNameInefficiently(stack);
|
||||
}
|
||||
}
|
||||
@@ -1,394 +0,0 @@
|
||||
package pulxes.ab.common.item.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.item.ItemMod;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import vazkii.botania.api.item.IBlockProvider;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ItemBlackHoleTalisman;
|
||||
import vazkii.botania.common.item.ItemCraftingHalo;
|
||||
|
||||
public class ItemBlackHoleBox extends ItemMod implements IBlockProvider {
|
||||
|
||||
public static final ResourceLocation GLOW_TEXTURE = new ResourceLocation(AdvancedBotany.MODID + ":textures/misc/glow.png");
|
||||
private static final int MAX_SEGMENTS = 12;
|
||||
|
||||
public ItemBlackHoleBox() {
|
||||
super(LibItemNames.BLACK_HOLE_BOX);
|
||||
this.setMaxStackSize(1);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public void onUpdate(@Nonnull ItemStack stack, World world, @Nonnull Entity entity, int pos, boolean equipped) {
|
||||
if(!(entity instanceof EntityLivingBase))
|
||||
return;
|
||||
EntityLivingBase living = (EntityLivingBase)entity;
|
||||
boolean eqLastTick = wasEquipped(stack);
|
||||
if(!equipped && living.getHeldItemOffhand() == stack)
|
||||
equipped = true;
|
||||
if(!equipped && eqLastTick)
|
||||
setEquipped(stack, equipped);
|
||||
if(!eqLastTick && equipped) {
|
||||
setEquipped(stack, equipped);
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
float shift = (segAngles / 2);
|
||||
setRotationBase(stack, getCheckingAngle((EntityLivingBase)entity) - shift);
|
||||
}
|
||||
if(!world.isRemote && entity.ticksExisted % 10 == 0) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHalo = getItemForSlot(stack, i).copy();
|
||||
if(!blackHalo.isEmpty()) {
|
||||
((ItemBlackHoleTalisman)blackHalo.getItem()).onUpdate(blackHalo, world, entity, pos, equipped);
|
||||
setItemSlot(stack, blackHalo, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
int segment = getSegmentLookedAt(stack, player);
|
||||
if(!getItemForSlot(stack, segment).isEmpty()) {
|
||||
ItemStack blackHole = getItemForSlot(stack, segment).copy();
|
||||
if(player.isSneaking()) {
|
||||
ItemHandlerHelper.giveItemToPlayer(player, blackHole);
|
||||
setItemSlot(stack, ItemStack.EMPTY, segment);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
} else {
|
||||
int dmg = blackHole.getItemDamage();
|
||||
blackHole.setItemDamage((dmg ^ 0xFFFFFFFF) & 0x1);
|
||||
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 0.3F, 0.1F);
|
||||
setItemSlot(stack, blackHole, segment);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack hotBarStack = player.inventory.getStackInSlot(i);
|
||||
if(!hotBarStack.isEmpty() && hotBarStack.getItem() instanceof ItemBlackHoleTalisman) {
|
||||
Block block = ((ItemBlackHoleTalisman)hotBarStack.getItem()).getBlock(hotBarStack);
|
||||
if(block != null && Item.getItemFromBlock(block) != Items.AIR) {
|
||||
setItemSlot(stack, hotBarStack, segment);
|
||||
hotBarStack.shrink(1);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack box = player.getHeldItem(hand);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) {
|
||||
if(!world.isRemote) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman blackHoleItem = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block bBlock = blackHoleItem.getBlock(blackHole);
|
||||
int bmeta = blackHoleItem.getBlockMeta(blackHole);
|
||||
IItemHandler inv = (IItemHandler)tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
|
||||
ItemStack toAdd = new ItemStack(bBlock, 1, bmeta);
|
||||
toAdd.setCount(blackHoleItem.remove(blackHole, toAdd.getMaxStackSize()));
|
||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inv, toAdd, false);
|
||||
if(!remainder.isEmpty())
|
||||
ItemNBTHelper.setInt(blackHole, "blockCount", blackHoleItem.getBlockCount(blackHole) + remainder.getCount());
|
||||
setItemSlot(box, blackHole, i);
|
||||
}
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack box, World world, List<String> list, ITooltipFlag flags) {
|
||||
if(GuiScreen.isShiftKeyDown()) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block block = talisman.getBlock(blackHole);
|
||||
int count = talisman.getBlockCount(blackHole);
|
||||
String active = "" + (blackHole.getItemDamage() == 1 ? TextFormatting.GREEN : TextFormatting.RED);
|
||||
list.add(active + count + TextFormatting.RESET + " " + I18n.format((new ItemStack(block, 1, talisman.getBlockMeta(blackHole))).getUnlocalizedName() + ".name", new Object[0]));
|
||||
}
|
||||
} else
|
||||
list.add(I18n.format("botaniamisc.shiftinfo", new Object[0]).replaceAll("&", "\u00A7"));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
EntityPlayerSP entityPlayerSP = (Minecraft.getMinecraft()).player;
|
||||
ItemStack stack = PlayerHelper.getFirstHeldItemClass((EntityPlayer)entityPlayerSP, ItemBlackHoleBox.class);
|
||||
boolean hasCraftingHalo = (entityPlayerSP.getHeldItemMainhand().getItem() instanceof ItemCraftingHalo) || (entityPlayerSP.getHeldItemOffhand().getItem() instanceof ItemCraftingHalo);
|
||||
if(!stack.isEmpty() && !hasCraftingHalo)
|
||||
render(stack, (EntityPlayer)entityPlayerSP, event.getPartialTicks());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render(ItemStack stack, EntityPlayer player, float partialTicks) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
|
||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
|
||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
float alpha = ((float)Math.sin(((ClientTickHandler.ticksInGame + partialTicks) * 0.2F)) * 0.5F + 0.5F) * 0.4F + 0.3F;
|
||||
double posX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
|
||||
double posY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
|
||||
double posZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;
|
||||
GlStateManager.translate(posX - renderPosX, posY - renderPosY + player.getDefaultEyeHeight(), posZ - renderPosZ);
|
||||
float base = getRotationBase(stack);
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
float shift = base - (segAngles / 2);
|
||||
float u = 1.0F;
|
||||
float v = 0.25F;
|
||||
float s = 3.2F;
|
||||
float m = 0.8F;
|
||||
float y = v * s * 2.0F;
|
||||
float y0 = 0.0F;
|
||||
int segmentLookedAt = getSegmentLookedAt(stack, (EntityLivingBase)player);
|
||||
for(int seg = 0; seg < MAX_SEGMENTS; seg++) {
|
||||
boolean inside = false;
|
||||
float rotationAngle = (seg + 0.5F) * segAngles + shift;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(s * m, -0.75F, 0.0F);
|
||||
if(segmentLookedAt == seg)
|
||||
inside = true;
|
||||
ItemStack slotStack = getItemForSlot(stack, seg);
|
||||
if(!slotStack.isEmpty()) {
|
||||
ItemBlackHoleTalisman blackHole = (ItemBlackHoleTalisman)slotStack.getItem();
|
||||
ItemStack renderStack = new ItemStack(blackHole.getBlock(slotStack));
|
||||
int meta = 0;
|
||||
if(renderStack.getItem().getHasSubtypes())
|
||||
meta = blackHole.getBlockMeta(slotStack);
|
||||
renderStack.setItemDamage(meta);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
float scale = 0.75F;
|
||||
double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks + seg * 2.75f;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(0.0F, 0.4F + Math.sin(worldTime / 8.0D) / 20.0D, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(renderStack, ItemCameraTransforms.TransformType.GUI);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
float a = alpha;
|
||||
if(inside) {
|
||||
a += 0.3F;
|
||||
y0 = -y;
|
||||
}
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
if(seg % 2 == 0)
|
||||
GlStateManager.color(0.6F, 0.6F, 0.6F, a);
|
||||
else
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, a);
|
||||
GlStateManager.disableCull();
|
||||
mc.renderEngine.bindTexture(GLOW_TEXTURE);
|
||||
tess.getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
for(int i = 0; i < segAngles; i++) {
|
||||
float ang = (i + seg * segAngles) + shift;
|
||||
double xp = Math.cos(ang * Math.PI / 180.0D) * s;
|
||||
double zp = Math.sin(ang * Math.PI / 180.0D) * s;
|
||||
tess.getBuffer().pos(xp * m, y, zp * m).tex(u, v).endVertex();
|
||||
tess.getBuffer().pos(xp, y0, zp).tex(u, 0.0D).endVertex();
|
||||
xp = Math.cos((ang + 1.0F) * Math.PI / 180.0D) * s;
|
||||
zp = Math.sin((ang + 1.0F) * Math.PI / 180.0D) * s;
|
||||
tess.getBuffer().pos(xp, y0, zp).tex(0.0D, 0.0D).endVertex();
|
||||
tess.getBuffer().pos(xp * m, y, zp * m).tex(0.0D, v).endVertex();
|
||||
}
|
||||
y0 = 0.0F;
|
||||
tess.draw();
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack box) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int slot = getSegmentLookedAt(box, player);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
ItemStack blackHole = getItemForSlot(box, slot);
|
||||
if(!blackHole.isEmpty()) {
|
||||
String name = blackHole.getDisplayName();
|
||||
String count = "" + ((ItemBlackHoleTalisman)blackHole.getItem()).getBlockCount(blackHole);
|
||||
int l = mc.fontRenderer.getStringWidth(name);
|
||||
int x = resolution.getScaledWidth() / 2 - l / 2;
|
||||
int y = resolution.getScaledHeight() / 2 - 65;
|
||||
Gui.drawRect(x - 6, y - 6, x + l + 6, y + 43, 570425344);
|
||||
Gui.drawRect(x - 4, y - 4, x + l + 4, y + 41, 570425344);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(blackHole, resolution.getScaledWidth() / 2 - 8, resolution.getScaledHeight() / 2 - 52);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
mc.fontRenderer.drawStringWithShadow(name, x, y, 16777215);
|
||||
mc.fontRenderer.drawStringWithShadow(count, resolution.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(count) / 2, y + 32, 16777215);
|
||||
}
|
||||
}
|
||||
|
||||
public void setItemSlot(ItemStack box, ItemStack stack, int slot) {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
if(!stack.isEmpty())
|
||||
stack.copy().writeToNBT(cmp);
|
||||
ItemNBTHelper.setCompound(box, "blackHoleSlot" + slot, cmp);
|
||||
}
|
||||
|
||||
public static ItemStack getItemForSlot(ItemStack box, int slot) {
|
||||
if(slot >= MAX_SEGMENTS)
|
||||
return ItemStack.EMPTY;
|
||||
NBTTagCompound cmp = ItemNBTHelper.getCompound(box, "blackHoleSlot" + slot, true);
|
||||
if(cmp != null)
|
||||
return new ItemStack(cmp);
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private static int getSegmentLookedAt(ItemStack stack, EntityLivingBase player) {
|
||||
getRotationBase(stack);
|
||||
float yaw = getCheckingAngle(player, getRotationBase(stack));
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
for (int seg = 0; seg < MAX_SEGMENTS; seg++) {
|
||||
float calcAngle = seg * segAngles;
|
||||
if (yaw >= calcAngle && yaw < calcAngle + segAngles)
|
||||
return seg;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void setRotationBase(ItemStack stack, float rotation) {
|
||||
ItemNBTHelper.setFloat(stack, "rotationBase", rotation);
|
||||
}
|
||||
|
||||
public static float getRotationBase(ItemStack stack) {
|
||||
return ItemNBTHelper.getFloat(stack, "rotationBase", 0.0F);
|
||||
}
|
||||
|
||||
private static float getCheckingAngle(EntityLivingBase player, float base) {
|
||||
float yaw = MathHelper.wrapDegrees(player.rotationYaw) + 90.0F;
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
float shift = (segAngles / 2);
|
||||
if (yaw < 0.0F)
|
||||
yaw = 180.0F + 180.0F + yaw;
|
||||
yaw -= 360.0F - base;
|
||||
float angle = 360.0F - yaw + shift;
|
||||
if (angle < 0.0F)
|
||||
angle = 360.0F + angle;
|
||||
return angle;
|
||||
}
|
||||
|
||||
private static float getCheckingAngle(EntityLivingBase player) {
|
||||
return getCheckingAngle(player, 0.0F);
|
||||
}
|
||||
|
||||
public static void setEquipped(ItemStack stack, boolean equipped) {
|
||||
ItemNBTHelper.setBoolean(stack, "equipped", equipped);
|
||||
}
|
||||
|
||||
public static boolean wasEquipped(ItemStack stack) {
|
||||
return ItemNBTHelper.getBoolean(stack, "equipped", false);
|
||||
}
|
||||
|
||||
public int getBlockCount(EntityPlayer player, ItemStack requestor, ItemStack box, Block block, int meta) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block stored = talisman.getBlock(blackHole);
|
||||
int storedMeta = talisman.getBlockMeta(blackHole);
|
||||
if(stored == block && storedMeta == meta)
|
||||
return talisman.getBlockCount(blackHole);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean provideBlock(EntityPlayer player, ItemStack requestor, ItemStack box, Block block, int meta, boolean doit) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block stored = talisman.getBlock(blackHole);
|
||||
int storedMeta = talisman.getBlockMeta(blackHole);
|
||||
if(stored == block && storedMeta == meta) {
|
||||
int count = talisman.getBlockCount(blackHole);
|
||||
if(count > 0) {
|
||||
if(doit) {
|
||||
talisman.remove(blackHole, 1);
|
||||
setItemSlot(box, blackHole, i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package pulxes.ab.common.item.equipment;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import pulxes.ab.client.core.handler.PlayerItemUsingSound.ClientSoundHandler;
|
||||
import pulxes.ab.client.core.helper.ClientHelper;
|
||||
import pulxes.ab.common.core.handler.AdvBotanyConfigHandler;
|
||||
import pulxes.ab.common.item.ItemMod;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import pulxes.ab.common.lib.register.SoundListAB;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
public class ItemNebulaRod extends ItemMod implements IManaUsingItem {
|
||||
|
||||
public ItemNebulaRod() {
|
||||
super(LibItemNames.NEBULA_ROD);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
this.setMaxDamage(100);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public void onUpdate(@Nonnull ItemStack stack, World world, @Nonnull Entity player, int par4, boolean par5) {
|
||||
if(!world.isRemote && player instanceof EntityPlayer && player.ticksExisted % 120 == 0 && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer)player, 140, true))
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
if(player.getHeldItem(hand).getItemDamage() == 0 && checkWorld(world.provider.getDimensionType().getName())) {
|
||||
player.setActiveHand(hand);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
} else
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
public void onUsingTick(ItemStack stack, EntityLivingBase living, int time) {
|
||||
if(!(living instanceof EntityPlayer))
|
||||
return;
|
||||
EntityPlayer p = (EntityPlayer)living;
|
||||
time = this.getMaxItemUseDuration(stack) - time;
|
||||
if(time > 110 && !p.isSneaking()) {
|
||||
if(!p.world.isRemote) {
|
||||
BlockPos blockPos = getTopBlock(p.world, p);
|
||||
if(blockPos == null) {
|
||||
p.stopActiveHand();
|
||||
p.sendMessage((new TextComponentTranslation("ab.nebulaRod.notTeleporting", new Object[] {})).setStyle((new Style()).setColor(TextFormatting.DARK_PURPLE)));
|
||||
return;
|
||||
}
|
||||
EnderTeleportEvent event = new EnderTeleportEvent((EntityPlayerMP)p, blockPos.getX() + 0.5D, blockPos.getY() + 0.5D, blockPos.getZ() + 0.5D, 0.0F);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if(event.isCanceled()) {
|
||||
p.stopActiveHand();
|
||||
p.sendMessage((new TextComponentTranslation("abmisc.nebulaRod.notTeleportingEvent", new Object[] {})).setStyle((new Style()).setColor(TextFormatting.DARK_PURPLE)));
|
||||
return;
|
||||
}
|
||||
((EntityPlayerMP)p).connection.setPlayerLocation(blockPos.getX() + 0.5D, blockPos.getY() + 0.5D, blockPos.getZ() + 0.5D, p.rotationYaw, p.rotationPitch);
|
||||
p.world.playSound(null, p.posX, p.posY, p.posZ, SoundListAB.nebulaRod, SoundCategory.PLAYERS, 1.2F, 1.2F);
|
||||
}
|
||||
if(!p.capabilities.isCreativeMode)
|
||||
stack.setItemDamage(100);
|
||||
p.stopActiveHand();
|
||||
}
|
||||
spawnPortalParticle(p.world, p, time, p.world.rand.nextBoolean() ? 0x931fec : 0x4b1682);
|
||||
}
|
||||
|
||||
public void spawnPortalParticle(World world, EntityPlayer p, int time, int color) {
|
||||
if(world.isRemote) {
|
||||
ClientSoundHandler.playSound(p, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.PLAYERS, 1.2F, 1.0F, 40);
|
||||
boolean isFinish = time > 80;
|
||||
int ticks = Math.min(100, time);
|
||||
int totalSpiritCount = (int)Math.max(3, ticks / 100.0f * 18);
|
||||
double tickIncrement = 360.0D / totalSpiritCount;
|
||||
int speed = 8;
|
||||
double wticks = (ticks * speed) - tickIncrement;
|
||||
double r = Math.sin((ticks) / 100.0D) * Math.max(0.75f, 1.4D * ticks / 100.0f);
|
||||
Vec3d look = p.getLookVec();
|
||||
float yawOffset = 1.62f - (p.isSneaking() ? 0.1f : 0.0f);
|
||||
Vector3 l = new Vector3(look.x, look.y + yawOffset, look.z);
|
||||
Vector3 player = Vector3.fromEntity(p);
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
float size = Math.max(0.215f, ticks / 100.0f);
|
||||
Vector3 v3 = new Vector3(Math.sin(wticks * Math.PI / 180.0D) / 1.825f * r, Math.cos(wticks * Math.PI / 180.0D) * r, 0.8f);
|
||||
v3 = ClientHelper.setRotation(p.rotationPitch, 1.0f, 0.0f, 0.0f, v3);
|
||||
v3 = ClientHelper.setRotation(-p.rotationYaw, 0.0f, 1.0f, 0.0f, v3);
|
||||
v3 = v3.add(l.multiply(1.0f)).add(player);
|
||||
wticks += tickIncrement;
|
||||
float hsb[] = Color.RGBtoHSB(color & 255, color >> 8 & 255, color >> 16 & 255, null);
|
||||
int color1 = Color.HSBtoRGB(hsb[0], hsb[1], ticks / 100.0f);
|
||||
float[] colorsfx = { (color1 & 255) / 255.0f, (color1 >> 8 & 255) / 255.0f, (color1 >> 16 & 255) / 255.0f };
|
||||
float motionSpeed = 0.25f * Math.min(1.0f, (time - 80) / 30.0f);
|
||||
Botania.proxy.wispFX(v3.x, v3.y, v3.z, colorsfx[0], colorsfx[1], colorsfx[2], 0.3F * size, isFinish ? (float)(look.x * -1) * motionSpeed : 0.0f, isFinish ? (float)(look.y * -1) * motionSpeed : 0.0f, isFinish ? (float)(look.z * -1) * motionSpeed : 0.0f, 0.3F);
|
||||
Botania.proxy.wispFX(v3.x, v3.y, v3.z, colorsfx[0], colorsfx[1], colorsfx[2], (float)(Math.random() * 0.1F + 0.05F) * size, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, 0.4F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BlockPos getTopBlock(World world, EntityPlayer player) {
|
||||
Vec3d vec3 = player.getLook(1.0F).normalize();
|
||||
int limitXZ = AdvBotanyConfigHandler.limitXZCoords;
|
||||
for(int nextPos = 256; nextPos > 0 && nextPos > 8; nextPos--) {
|
||||
int nPosX = MathHelper.floor(player.posX + vec3.x * nextPos);
|
||||
int nPosZ = MathHelper.floor(player.posZ + vec3.z * nextPos);
|
||||
nPosX = Math.min(Math.max(nPosX, -(limitXZ - 1)), limitXZ - 1);
|
||||
nPosZ = Math.min(Math.max(nPosZ, -(limitXZ - 1)), limitXZ - 1);
|
||||
Chunk chunk = world.getChunkFromChunkCoords(nPosX, nPosZ);
|
||||
for(int k = chunk.getTopFilledSegment() + 15; k > 0; --k) {
|
||||
IBlockState state = world.getBlockState(new BlockPos(nPosX, k, nPosZ));
|
||||
boolean hasTopAir = world.isAirBlock(new BlockPos(nPosX, k + 1, nPosZ)) && world.isAirBlock(new BlockPos(nPosX, k + 2, nPosZ));
|
||||
if(state.getMaterial() != Material.AIR && state.getBlock() != Blocks.BEDROCK && hasTopAir)
|
||||
return new BlockPos(nPosX, k + 1, nPosZ);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return EnumAction.BOW;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
private boolean checkWorld(String name) {
|
||||
for(String str : AdvBotanyConfigHandler.lockWorldNameNebulaRod)
|
||||
if(str.equals(name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean usesMana(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
package pulxes.ab.common.item.equipment;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.EffectRender;
|
||||
import pulxes.ab.api.IRankItem;
|
||||
import pulxes.ab.client.core.handler.ClientEffectHandler;
|
||||
import pulxes.ab.common.core.handler.AdvBotanyConfigHandler;
|
||||
import pulxes.ab.common.core.handler.NetworkHandler;
|
||||
import pulxes.ab.common.entity.EntityProjectileSpaceBurst;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import pulxes.ab.common.lib.register.ItemListAB;
|
||||
import pulxes.ab.common.lib.register.SoundListAB;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class ItemSpaceBlade extends ItemSword implements IModelRegister, IRankItem, IManaUsingItem {
|
||||
|
||||
public static final int[] RANK_LEVELS = new int[] { 0, 10000, 1000000, 10000000, 100000000, 1000000000 };
|
||||
private static final int[] CREATIVE_MANA = new int[] { 9999, 999999, 9999999, 99999999, 999999999, 2147483646 };
|
||||
public static final int MAX_RECHARGE_TICK = 36;
|
||||
|
||||
public ItemSpaceBlade() {
|
||||
super(AdvancedBotanyAPI.MITHRILL_TOOL_MATERIAL);
|
||||
this.setCreativeTab(AdvancedBotany.tabAB);
|
||||
this.setRegistryName(new ResourceLocation(AdvancedBotany.MODID, LibItemNames.SPACE_BLADE));
|
||||
this.setUnlocalizedName(LibItemNames.SPACE_BLADE);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
this.addPropertyOverride(new ResourceLocation(AdvancedBotany.MODID, "enabled"), (stack, world, entity) -> isEnabledMode(stack) ? 1.0F : 0.0F);
|
||||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, @Nonnull EntityLivingBase attacker) {
|
||||
if(!attacker.world.isRemote && entity != null && attacker instanceof EntityPlayer) {
|
||||
if(getLevel(stack) >= 3 && isEnabledMode(stack)) {
|
||||
float size = getLevel(stack) >= 4 ? (getLevel(stack) >= 5 ? 3.5f : 2.5f) : 1.5f;
|
||||
AxisAlignedBB axis = (new AxisAlignedBB(entity.posX - size, entity.posY - 1.7F, entity.posZ - size, entity.posX + size, entity.posY + 1.7F, entity.posZ + size));
|
||||
List<EntityLivingBase> entities = entity.world.getEntitiesWithinAABB(EntityLivingBase.class, axis);
|
||||
for(EntityLivingBase living : entities) {
|
||||
if(living instanceof EntityPlayer && (((EntityPlayer)living).getName().equals(attacker.getName()) || (FMLCommonHandler.instance().getMinecraftServerInstance() != null && !FMLCommonHandler.instance().getMinecraftServerInstance().isPVPEnabled())))
|
||||
continue;
|
||||
else if(living.hurtTime == 0) {
|
||||
float damage = getSwordDamage(stack);
|
||||
living.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)attacker), damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.hitEntity(stack, entity, attacker);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public void onUpdate(@Nonnull ItemStack stack, World world, @Nonnull Entity entity, int par4, boolean par5) {
|
||||
if(entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
int rechargeTick = getRechargeTick(stack);
|
||||
if(!world.isRemote) {
|
||||
if(rechargeTick > 0)
|
||||
setRechargeTick(stack, --rechargeTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
if(!world.isRemote) {
|
||||
if(!player.isSneaking()) {
|
||||
if(getRechargeTick(player.getHeldItem(hand)) == 0)
|
||||
startPlayerDash((EntityPlayerMP)player, player.getHeldItem(hand));
|
||||
else if(!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() == ItemListAB.itemSpaceBlade && getRechargeTick(player.getHeldItemOffhand()) == 0)
|
||||
startPlayerDash((EntityPlayerMP)player, player.getHeldItemOffhand());
|
||||
} else {
|
||||
ItemNBTHelper.setBoolean(player.getHeldItem(hand), "isEnabledMode", !this.isEnabledMode(player.getHeldItem(hand)));
|
||||
}
|
||||
}
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
}
|
||||
|
||||
private void startPlayerDash(EntityPlayerMP player, ItemStack stack) {
|
||||
NetworkHandler.sendPacketToSpaceDash(player);
|
||||
playerSpaceDash(player);
|
||||
setRechargeTick(stack, MAX_RECHARGE_TICK);
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundListAB.bladeSpace, SoundCategory.PLAYERS, 2.3F, 1.2F);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void leftClick(PlayerInteractEvent.LeftClickEmpty evt) {
|
||||
if(!evt.getItemStack().isEmpty() && evt.getItemStack().getItem() == ItemListAB.itemSpaceBlade && ItemSpaceBlade.getLevel_(evt.getItemStack()) >= 1)
|
||||
NetworkHandler.sendPacketToSpaceBurst();
|
||||
}
|
||||
|
||||
public int getEntityLifespan(ItemStack itemStack, World world) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag flags) {
|
||||
String rank = I18n.format("botania.rank" + getLevel(stack), new Object[0]);
|
||||
String rankFormat = I18n.format("botaniamisc.toolRank", new Object[] { rank });
|
||||
list.add(rankFormat.replaceAll("&", "\u00A7"));
|
||||
if(getMana(stack) == Integer.MAX_VALUE)
|
||||
list.add(TextFormatting.DARK_AQUA + I18n.format("abmisc.spaceBlade.maximumMana", new Object[0]));
|
||||
if(GuiScreen.isShiftKeyDown()) {
|
||||
int level = getLevel(stack);
|
||||
list.add((level >= 1 ? TextFormatting.GREEN : "") + I18n.format("abmisc.spaceBlade.bladeInfo.0", new Object[0]));
|
||||
list.add((level >= 2 ? TextFormatting.GREEN : "") + I18n.format("abmisc.spaceBlade.bladeInfo.1", new Object[0]));
|
||||
list.add((level >= 3 ? TextFormatting.GREEN : "") + I18n.format("abmisc.spaceBlade.bladeInfo.LEVEL".replaceAll("LEVEL", Integer.toString(level < 3 ? 2 : level - 1)), new Object[0]));
|
||||
} else
|
||||
list.add(I18n.format("botaniamisc.shiftinfo", new Object[0]).replaceAll("&", "\u00A7"));
|
||||
}
|
||||
|
||||
public static boolean spaceBurstAttack(EntityPlayer player) {
|
||||
if(!player.world.isRemote && !player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() == ItemListAB.itemSpaceBlade && player.getCooledAttackStrength(0.0F) == 1.0F && ManaItemHandler.requestManaExactForTool(player.getHeldItemMainhand(), player, 120, true)) {
|
||||
EntityProjectileSpaceBurst spaceBurst = new EntityProjectileSpaceBurst(player);
|
||||
spaceBurst.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
spaceBurst.motionX *= 0.27f;
|
||||
spaceBurst.motionY *= 0.27f;
|
||||
spaceBurst.motionZ *= 0.27f;
|
||||
spaceBurst.setAttacker(player.getName());
|
||||
spaceBurst.setDamage(ItemSpaceBlade.getSwordDamage(player.getHeldItemMainhand()));
|
||||
player.world.spawnEntity(spaceBurst);
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundListAB.bladeSpace, SoundCategory.PLAYERS, 0.5F, 3.6F);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void doParticleDash() {
|
||||
EffectRender effectRender = new EffectRender(7) {
|
||||
public void doEffect() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
for(int i = 0; i < 16; i++) {
|
||||
float r = mc.world.rand.nextBoolean() ? (225.0f / 255.0f) : (101.0f / 255.0f);
|
||||
float g = mc.world.rand.nextBoolean() ? (67.0f / 255.0f) : (209.0f / 255.0f);
|
||||
float b = mc.world.rand.nextBoolean() ? (240.0f / 255.0f) : (225.0f / 255.0f);
|
||||
Botania.proxy.sparkleFX(mc.player.posX + (Math.random() - 0.5D), mc.player.posY + ((Math.random() - 0.5D) * 2) + 1.0f, mc.player.posZ + (Math.random() - 0.5D), r + (float)(Math.random() / 4 - 0.125D), g + (float)(Math.random() / 4 - 0.125D), b + (float)(Math.random() / 4 - 0.125D), 1.8F * (float)(Math.random() - 0.5D), 4);
|
||||
}
|
||||
}
|
||||
};
|
||||
ClientEffectHandler.addEffectRender(effectRender);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static void playerSpaceDash(@Nonnull EntityPlayer player) {
|
||||
Vec3d vec3 = player.getLook(1.0F).normalize();
|
||||
player.motionX += vec3.x * 3.25f;
|
||||
player.motionY += (vec3.y / 1.6f);
|
||||
player.motionZ += vec3.z * 3.25f;
|
||||
}
|
||||
|
||||
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> stacks) {
|
||||
if(isInCreativeTab(tab))
|
||||
for(int mana : CREATIVE_MANA) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
setMana(stack, mana);
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
private static float getSwordDamage(ItemStack stack) {
|
||||
int level = ItemSpaceBlade.getLevel_(stack);
|
||||
return (float)Math.round((3.0F + AdvancedBotanyAPI.MITHRILL_TOOL_MATERIAL.getAttackDamage() + (level * level / 1.5f)) * AdvBotanyConfigHandler.damageFactorSpaceSword);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = getItemAttributeModifiers(equipmentSlot);
|
||||
multimap.clear();
|
||||
if(equipmentSlot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double)getSwordDamage(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -1.5000000953674316D, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack stack) {
|
||||
return super.getUnlocalizedNameInefficiently(stack).replaceAll("item\\.", "item." + AdvancedBotany.MODID + ":");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
public static void setRechargeTick(ItemStack stack, int value) {
|
||||
ItemNBTHelper.setInt(stack, "rechargeTick", value);
|
||||
}
|
||||
|
||||
public static int getRechargeTick(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, "rechargeTick", 0);
|
||||
}
|
||||
|
||||
private boolean isEnabledMode(ItemStack stack) {
|
||||
return ItemNBTHelper.getBoolean(stack, "isEnabledMode", false);
|
||||
}
|
||||
|
||||
private void changeEnableMode(ItemStack stack) {
|
||||
ItemNBTHelper.setBoolean(stack, "isEnabledMode", !isEnabledMode(stack));
|
||||
}
|
||||
|
||||
public int[] getLevels() {
|
||||
return ItemSpaceBlade.RANK_LEVELS;
|
||||
}
|
||||
|
||||
public int getLevel(ItemStack stack) {
|
||||
int mana = getMana_(stack);
|
||||
for(int i = ItemSpaceBlade.RANK_LEVELS.length - 1; i > 0; i--)
|
||||
if(mana >= ItemSpaceBlade.RANK_LEVELS[i])
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getLevel_(ItemStack stack) {
|
||||
int mana = getMana_(stack);
|
||||
for(int i = ItemSpaceBlade.RANK_LEVELS.length - 1; i > 0; i--)
|
||||
if(mana >= ItemSpaceBlade.RANK_LEVELS[i])
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getMana_(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, "mana", 0);
|
||||
}
|
||||
|
||||
public static void setMana(ItemStack stack, int mana) {
|
||||
ItemNBTHelper.setInt(stack, "mana", mana);
|
||||
}
|
||||
|
||||
public void addMana(ItemStack stack, int mana) {
|
||||
setMana(stack, Math.min(getMana(stack) + mana, 2147483647));
|
||||
}
|
||||
|
||||
public boolean canExportManaToItem(ItemStack stack, ItemStack stack1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canExportManaToPool(ItemStack stack, TileEntity tile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) {
|
||||
return !(otherStack.getItem() instanceof vazkii.botania.api.mana.IManaGivingItem);
|
||||
}
|
||||
|
||||
public boolean canReceiveManaFromPool(ItemStack stack, TileEntity tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getMana(ItemStack stack) {
|
||||
return getMana_(stack);
|
||||
}
|
||||
|
||||
public int getMaxMana(ItemStack stack) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public boolean isNoExport(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean usesMana(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return getRechargeTick(stack) != 0;
|
||||
}
|
||||
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
return (float)getRechargeTick(stack) / (float)MAX_RECHARGE_TICK;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package pulxes.ab.common.lib;
|
||||
|
||||
public class LibBlockNames {
|
||||
|
||||
public static final String NIDAVELLIR_FORGE = "nidavellir_forge";
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package pulxes.ab.common.lib;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
public class LibEntityNames {
|
||||
|
||||
public static final ResourceLocation SPACE_BURST_REGISTRY = makeName("space_burst");
|
||||
public static final ResourceLocation ALPHIRINE_PORTAL_REGISTRY = makeName("alphirine_portal");
|
||||
public static final ResourceLocation ELVEN_SPARK_REGISTRY = makeName("elven_spark");
|
||||
|
||||
private static ResourceLocation makeName(String str) {
|
||||
return new ResourceLocation(AdvancedBotany.MODID, str);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package pulxes.ab.common.lib;
|
||||
|
||||
public class LibItemNames {
|
||||
|
||||
public static final String NEBULA_ROD = "nebula_rod";
|
||||
|
||||
public static final String SPACE_BLADE = "space_blade";
|
||||
|
||||
public static final String BLACK_HOLE_BOX = "black_hole_box";
|
||||
|
||||
public static final String ELVEN_SPARK = "elven_spark";
|
||||
|
||||
public static final String[] RESOURCE_NAMES = new String[] {
|
||||
"mithrill", "mithrill_nugget", "mana_nether_star", "air_forgotten_lands", "nature_gift",
|
||||
"nebula_fragment", "piece_nebula"
|
||||
};
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.block.BlockNidavellirForge;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.item.block.ItemBlockMod;
|
||||
import pulxes.ab.common.lib.LibBlockNames;
|
||||
|
||||
@EventBusSubscriber(modid = AdvancedBotany.MODID)
|
||||
public class BlockListAB {
|
||||
|
||||
public static final Block nidavellirForge = new BlockNidavellirForge();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> evt) {
|
||||
IForgeRegistry<Block> r = evt.getRegistry();
|
||||
r.register(nidavellirForge);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItemBlocks(RegistryEvent.Register<Item> evt) {
|
||||
IForgeRegistry<Item> r = evt.getRegistry();
|
||||
r.register((new ItemBlockMod(nidavellirForge)).setRegistryName(nidavellirForge.getRegistryName()));
|
||||
initTileEntities();
|
||||
}
|
||||
|
||||
private static void initTileEntities() {
|
||||
registerTile(TileNidavellirForge.class, LibBlockNames.NIDAVELLIR_FORGE);
|
||||
}
|
||||
|
||||
private static void registerTile(Class<? extends TileEntity> clazz, String key) {
|
||||
GameRegistry.registerTileEntity(clazz, AdvancedBotany.MODID + ":" + key);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
import pulxes.ab.common.entity.EntityProjectileSpaceBurst;
|
||||
import pulxes.ab.common.lib.LibEntityNames;
|
||||
|
||||
public class EntityListAB {
|
||||
|
||||
public static void init() {
|
||||
int id = 0;
|
||||
EntityRegistry.registerModEntity(LibEntityNames.SPACE_BURST_REGISTRY, EntityProjectileSpaceBurst.class, AdvancedBotany.MODID + ":spaceBurst", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(LibEntityNames.ALPHIRINE_PORTAL_REGISTRY, EntityAlphirinePortal.class, AdvancedBotany.MODID + ":alphirinePortal", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(LibEntityNames.ELVEN_SPARK_REGISTRY, EntityElvenSpark.class, AdvancedBotany.MODID + ":elvenSpark", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import pulxes.ab.common.block.subtile.SubTileAncientAlphirine;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.signature.BasicSignature;
|
||||
|
||||
public class FlowerListAB {
|
||||
|
||||
public static final String ANCIENT_ALPHIRINE = "ancient_alphirine";
|
||||
|
||||
public static void init() {
|
||||
registerFlower(SubTileAncientAlphirine.class, ANCIENT_ALPHIRINE);
|
||||
}
|
||||
|
||||
static void registerFlower(Class <? extends SubTileEntity> subTile, String name) {
|
||||
BotaniaAPI.registerSubTile(name, subTile);
|
||||
BotaniaAPI.registerSubTileSignature(subTile, new BasicSignature(name));
|
||||
BotaniaAPI.addSubTileToCreativeMenu(name);
|
||||
BotaniaAPIClient.registerSubtileModel(subTile, new ModelResourceLocation("botania:" + name));
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.item.*;
|
||||
import pulxes.ab.common.item.equipment.*;
|
||||
|
||||
@EventBusSubscriber(modid = AdvancedBotany.MODID)
|
||||
public class ItemListAB {
|
||||
|
||||
public static final Item itemResource = new ItemResource();
|
||||
public static final Item itemNebulaRod = new ItemNebulaRod();
|
||||
public static final Item itemSpaceBlade = new ItemSpaceBlade();
|
||||
public static final Item itemBlackHoleBox = new ItemBlackHoleBox();
|
||||
public static final Item itemElvenSpark = new ItemElvenSpark();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> evt) {
|
||||
IForgeRegistry<Item> r = evt.getRegistry();
|
||||
r.register(itemResource);
|
||||
r.register(itemNebulaRod);
|
||||
r.register(itemSpaceBlade);
|
||||
r.register(itemBlackHoleBox);
|
||||
r.register(itemElvenSpark);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.recipe.RecipeAncientAlphirine;
|
||||
import pulxes.ab.api.recipe.RecipeNidavellirForge;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class RecipeListAB {
|
||||
|
||||
public static RecipeAncientAlphirine forgottenLandRecipe;
|
||||
|
||||
public static RecipeNidavellirForge mithrillRecipe;
|
||||
public static RecipeNidavellirForge terrasteelRecipe;
|
||||
public static RecipeNidavellirForge manaStarRecipe;
|
||||
public static RecipeNidavellirForge nebulaRecipe;
|
||||
|
||||
public static void init() {
|
||||
forgottenLandRecipe = AdvancedBotanyAPI.registerAlphirineRecipe(new ItemStack(ItemListAB.itemResource, 1, 3), new ItemStack(ModItems.manaResource, 1, 15), 75);
|
||||
|
||||
mithrillRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ItemListAB.itemResource, 1, 0), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModBlocks.storage, 1, 0), new ItemStack(ModItems.manaResource, 1, 18), 2500000, 0x25d6b7);
|
||||
terrasteelRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ModItems.manaResource, 1, 4), new ItemStack(ModItems.manaResource, 1, 2), new ItemStack(ModItems.manaResource, 1, 0), new ItemStack(ModItems.manaResource, 1, 1), 500000, 0x29de20);
|
||||
manaStarRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ItemListAB.itemResource, 1, 2), new ItemStack(ModItems.manaResource, 1, 23), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(Items.NETHER_STAR), 250000, 0x6bc9ec);
|
||||
nebulaRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ItemListAB.itemResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 8), new ItemStack(ModBlocks.storage, 1, 4), new ItemStack(ItemListAB.itemResource, 1, 1), 25000000, 0x8d16e0);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
@EventBusSubscriber(modid = AdvancedBotany.MODID)
|
||||
public class SoundListAB {
|
||||
|
||||
public static final SoundEvent nebulaRod = makeSoundEvent("nebularod");
|
||||
public static final SoundEvent bladeSpace = makeSoundEvent("bladespace");
|
||||
|
||||
private static SoundEvent makeSoundEvent(String name) {
|
||||
ResourceLocation loc = new ResourceLocation(AdvancedBotany.MODID, name);
|
||||
return (new SoundEvent(loc)).setRegistryName(loc);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerSounds(RegistryEvent.Register<SoundEvent> evt) {
|
||||
IForgeRegistry<SoundEvent> r = evt.getRegistry();
|
||||
r.register(nebulaRod);
|
||||
r.register(bladeSpace);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package pulxes.ab.common.lib.register.lexicon;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import pulxes.ab.common.lib.register.FlowerListAB;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lexicon.BLexiconCategory;
|
||||
import vazkii.botania.common.lexicon.BasicLexiconEntry;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
|
||||
public class LexiconListAB {
|
||||
|
||||
public static final LexiconCategory CATEGORY_FORGOTTEN;
|
||||
public static final KnowledgeType KNOWLEDGE_FORGOTTEN;
|
||||
|
||||
public static LexiconEntry ancientAlphirine;
|
||||
|
||||
public static void init() {
|
||||
ancientAlphirine = new BasicLexiconEntry("ancientAlphirine", CATEGORY_FORGOTTEN);
|
||||
ancientAlphirine.setPriority().setKnowledgeType(BotaniaAPI.elvenKnowledge).setLexiconPages(new LexiconPage[] { new PageText("0") }).setIcon(ItemBlockSpecialFlower.ofType(FlowerListAB.ANCIENT_ALPHIRINE));
|
||||
}
|
||||
|
||||
static {
|
||||
BotaniaAPI.addCategory(CATEGORY_FORGOTTEN = new BLexiconCategory("forgotten", 5));
|
||||
KNOWLEDGE_FORGOTTEN = BotaniaAPI.registerKnowledgeType("forgotten", TextFormatting.BLUE, false);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "botania:dummy",
|
||||
"textures": {
|
||||
"particle": "botania:blocks/storage0"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}]
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/air_forgotten_lands"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/black_hole_box"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "botania:items/elven_spark"
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"parent": "builtin/entity",
|
||||
"display": {
|
||||
"gui": {
|
||||
"rotation": [ 30, 225, 0 ],
|
||||
"translation": [ -0.25, 2.0, 0],
|
||||
"scale":[ 0.825, 0.825, 0.825 ]
|
||||
},
|
||||
"ground": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 3, 0],
|
||||
"scale":[ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [ 0, 90, 0 ],
|
||||
"translation": [ 0.825, 2.75, 0],
|
||||
"scale":[ 0.825, 0.825, 0.825 ]
|
||||
},
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"translation": [ 0.0, 2.5, 1.5],
|
||||
"scale": [ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"translation": [ 0, 2.5, 0 ],
|
||||
"scale": [ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 225, 0 ],
|
||||
"translation": [ 0, 2.5, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/mana_nether_star"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/mithrill"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/mithrill_nugget"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/nature_gift"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/nebula_fragment"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/nebula_rod"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/piece_nebula"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "advanced_botany:items/space_blade",
|
||||
"layer1": "advanced_botany:items/space_blade_overlay"
|
||||
},
|
||||
"overrides": [{
|
||||
"predicate": {
|
||||
"advanced_botany:enabled": 1
|
||||
},
|
||||
"model": "advanced_botany:item/space_blade_enabled"
|
||||
}]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "advanced_botany:items/space_blade_enabled",
|
||||
"layer1": "advanced_botany:items/space_blade_overlay"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"boardcube": { "sounds":["advanced_botany:boardcube"], "subtitle": "ab.subtitle.boardcube" },
|
||||
"nebulablaze": { "sounds":["advanced_botany:nebulablaze"], "subtitle": "ab.subtitle.nebulablaze" },
|
||||
"bladespace": { "sounds":["advanced_botany:bladespace"], "subtitle": "ab.subtitle.bladespace" },
|
||||
"nebularod": { "sounds":["advanced_botany:nebularod"], "subtitle": "ab.subtitle.nebularod" },
|
||||
"hornplentyusing": { "sounds":["advanced_botany:hornplentyusing"], "subtitle": "ab.subtitle.hornplentyusing" },
|
||||
"freyrslingshot": { "sounds":["advanced_botany:freyrslingshot"], "subtitle": "ab.subtitle.freyrslingshot" },
|
||||
"lokicubearmor": { "sounds":["advanced_botany:lokicubearmor"], "subtitle": "ab.subtitle.lokicubearmor" }
|
||||
}
|
||||
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |